From: Ian Jackson Date: Sun, 28 Dec 2014 16:34:10 +0000 (+0000) Subject: Build system: Use -lresolv only if inet_aton is not found otherwise. X-Git-Tag: v0.4.0_beta2~6 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=secnet.git;a=commitdiff_plain;h=695904f2c095fff219d59d6caf1695e32aec3430;hp=6f821c7078f3a08a9892708b7b5f3476fe4c503b Build system: Use -lresolv only if inet_aton is not found otherwise. Signed-off-by: Ian Jackson --- diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..a963db9 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,28 @@ +# aclocal.m4 - package-specific macros for autoconf + +dnl This file is part of secnet. +dnl See README for full list of copyright holders. +dnl +dnl secnet is free software; you can redistribute it and/or modify it +dnl under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version d of the License, or +dnl (at your option) any later version. +dnl +dnl secnet is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl version 3 along with secnet; if not, see +dnl https://www.gnu.org/licenses/gpl.html. + +dnl This next macro came from adns.git, +dnl (d8fa191ed7774818862febd6ade774cb7e149ab9). +define(ADNS_C_GETFUNC,[ + AC_CHECK_FUNC([$1],,[ + AC_CHECK_LIB([$2],[$1],[$3],[ + AC_MSG_ERROR([cannot find library function $1]) + ]) + ]) +]) diff --git a/config.h.in b/config.h.in index 13034ba..5acb7fa 100644 --- a/config.h.in +++ b/config.h.in @@ -29,9 +29,6 @@ /* Define to 1 if you have the `nsl' library (-lnsl). */ #undef HAVE_LIBNSL -/* Define to 1 if you have the `resolv' library (-lresolv). */ -#undef HAVE_LIBRESOLV - /* Define to 1 if you have the `socket' library (-lsocket). */ #undef HAVE_LIBSOCKET diff --git a/configure b/configure index a025190..fdb6c4a 100755 --- a/configure +++ b/configure @@ -1863,52 +1863,6 @@ fi } # ac_fn_c_try_link -# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES -# --------------------------------------------- -# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR -# accordingly. -ac_fn_c_check_decl () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - as_decl_name=`echo $2|sed 's/ *(.*//'` - as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 -$as_echo_n "checking whether $as_decl_name is declared... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -#ifndef $as_decl_name -#ifdef __cplusplus - (void) $as_decl_use; -#else - (void) $as_decl_name; -#endif -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_decl - # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly @@ -1975,6 +1929,52 @@ $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func + +# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES +# --------------------------------------------- +# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR +# accordingly. +ac_fn_c_check_decl () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + as_decl_name=`echo $2|sed 's/ *(.*//'` + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +$as_echo_n "checking whether $as_decl_name is declared... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_decl cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -4612,7 +4612,13 @@ _ACEOF fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_aton in -lresolv" >&5 + + ac_fn_c_check_func "$LINENO" "inet_aton" "ac_cv_func_inet_aton" +if test "x$ac_cv_func_inet_aton" = xyes; then : + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_aton in -lresolv" >&5 $as_echo_n "checking for inet_aton in -lresolv... " >&6; } if ${ac_cv_lib_resolv_inet_aton+:} false; then : $as_echo_n "(cached) " >&6 @@ -4649,14 +4655,21 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_inet_aton" >&5 $as_echo "$ac_cv_lib_resolv_inet_aton" >&6; } if test "x$ac_cv_lib_resolv_inet_aton" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBRESOLV 1 -_ACEOF - LIBS="-lresolv $LIBS" + LIBS="-lresolv $LIBS"; + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: inet_aton is in libresolv, urgh. Must use -lresolv." >&5 +$as_echo "$as_me: WARNING: inet_aton is in libresolv, urgh. Must use -lresolv." >&2;} + +else + + as_fn_error $? "cannot find library function inet_aton" "$LINENO" 5 + +fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for adns_init in -ladns" >&5 $as_echo_n "checking for adns_init in -ladns... " >&6; } if ${ac_cv_lib_adns_adns_init+:} false; then : diff --git a/configure.in b/configure.in index 190aa94..57c2076 100644 --- a/configure.in +++ b/configure.in @@ -83,7 +83,10 @@ if test "$ac_cv_lib_fl_yywrap" != yes; then fi AC_CHECK_LIB(nsl,inet_ntoa) AC_CHECK_LIB(socket,socket) -AC_CHECK_LIB(resolv,inet_aton) +ADNS_C_GETFUNC(inet_aton,resolv,[ + LIBS="-lresolv $LIBS"; + AC_MSG_WARN([inet_aton is in libresolv, urgh. Must use -lresolv.]) +]) AC_CHECK_LIB(adns,adns_init) REQUIRE_HEADER([adns.h]) diff --git a/debian/changelog b/debian/changelog index 6e54785..b28c657 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,7 @@ secnet (0.4.0~beta2~) unstable; urgency=low * Do not install ipaddrset.py and secnet.8 executable. * Fix check for . * debian/rules: Support dpkg-buildflags. + * Build system: Use -lresolv only if inet_aton is not found otherwise. Copyright updates: * Update to GPLv3. Add missing copyright notices and credits.