From 4c80189d9747e21e5cd62bc38d9349e0584d8c50 Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Wed, 1 Aug 2007 20:27:46 +0000 Subject: [PATCH] Improve the libnl checks, also checking for the required types --- configure | 165 +++++++++++++++++++++++++++++++++++++++++++++++++-- configure.ac | 35 +++++++++-- 2 files changed, 192 insertions(+), 8 deletions(-) diff --git a/configure b/configure index e4939b2..e83040e 100755 --- a/configure +++ b/configure @@ -27660,16 +27660,16 @@ fi ensc_have_libnl=yes -LIBNL_ROOT=`echo ../libnl*/` +LIBNL_ROOT=`readlink -f ../libnl*/` if test -d "$LIBNL_ROOT"; then - CFLAGS="$CFLAGS -isystem $LIBNL_ROOT/include" - LDFLAGS="$LDFLAGS -L$LIBNL_ROOT/lib" + CFLAGS="$CFLAGS -I ${LIBNL_ROOT}/include" + LDFLAGS="$LDFLAGS -L${LIBNL_ROOT}/lib" fi if test x"$ensc_have_libnl" = xyes; then -for ac_header in netlink/netlink.h netlink/route/addr.h +for ac_header in asm/types.h stdint.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then @@ -27818,6 +27818,163 @@ else ensc_have_libnl=no fi +done + + for b in 8 16 32 64; do + for s in s u; do + ensc_libnl_stdint_type= + if test x"$s" = xu; then + ensc_libnl_stdint_type=u + fi + ensc_libnl_stdint_type="${ensc_libnl_stdint_type}int${b}_t" + as_ac_Type=`echo "ac_cv_type___${s}${b}" | $as_tr_sh` +echo "$as_me:$LINENO: checking for __${s}${b}" >&5 +echo $ECHO_N "checking for __${s}${b}... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Type+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#ifdef HAVE_ASM_TYPES_H +# include +#endif + + +int +main () +{ +if ((__${s}${b} *) 0) + return 0; +if (sizeof (__${s}${b})) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Type=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Type=no" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Type'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Type'}'`" >&6 +if test `eval echo '${'$as_ac_Type'}'` = yes; then + +cat >>confdefs.h <<_ACEOF +#define `echo "HAVE___${s}${b}" | $as_tr_cpp` 1 +_ACEOF + + : +else + +cat >>confdefs.h <<_ACEOF +#define __${s}${b} $ensc_libnl_stdint_type +_ACEOF + +fi + + done + done +fi + +if test x"$ensc_have_libnl" = xyes; then + + +for ac_header in netlink/netlink.h netlink/route/addr.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#ifdef HAVE_ASM_TYPES_H +# include +#endif + + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + : +else + ensc_have_libnl=no +fi + done fi diff --git a/configure.ac b/configure.ac index 56e7bc0..cfcd569 100644 --- a/configure.ac +++ b/configure.ac @@ -342,15 +342,42 @@ dnl {check for libnl dnl ensc_have_libnl=yes -LIBNL_ROOT=`echo ../libnl*/` +LIBNL_ROOT=`readlink -f ../libnl*/` if test -d "$LIBNL_ROOT"; then - CFLAGS="$CFLAGS -isystem $LIBNL_ROOT/include" - LDFLAGS="$LDFLAGS -L$LIBNL_ROOT/lib" + CFLAGS="$CFLAGS -I ${LIBNL_ROOT}/include" + LDFLAGS="$LDFLAGS -L${LIBNL_ROOT}/lib" fi if test x"$ensc_have_libnl" = xyes; then - AC_CHECK_HEADERS([netlink/netlink.h netlink/route/addr.h], [ : ], + AC_CHECK_HEADERS([asm/types.h stdint.h], [ : ], [ ensc_have_libnl=no ]) + for b in 8 16 32 64; do + for s in s u; do + ensc_libnl_stdint_type= + if test x"$s" = xu; then + ensc_libnl_stdint_type=u + fi + ensc_libnl_stdint_type="${ensc_libnl_stdint_type}int${b}_t" + AC_CHECK_TYPES([__${s}${b}], [ : ], + [AC_DEFINE_UNQUOTED([__${s}${b}], + [$ensc_libnl_stdint_type], + [__${s}${b} type])], + [AC_INCLUDES_DEFAULT() +#ifdef HAVE_ASM_TYPES_H +# include +#endif] + ) + done + done +fi + +if test x"$ensc_have_libnl" = xyes; then + AC_CHECK_HEADERS([netlink/netlink.h netlink/route/addr.h], [ : ], + [ ensc_have_libnl=no ], [AC_INCLUDES_DEFAULT() +#ifdef HAVE_ASM_TYPES_H +# include +#endif] + ) fi if test x"$ensc_have_libnl" = xyes; then -- 2.43.0