chiark / gitweb /
Build system: Use -lresolv only if inet_aton is not found otherwise.
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 28 Dec 2014 16:34:10 +0000 (16:34 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 28 Dec 2014 16:50:36 +0000 (16:50 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
aclocal.m4 [new file with mode: 0644]
config.h.in
configure
configure.in
debian/changelog

diff --git a/aclocal.m4 b/aclocal.m4
new file mode 100644 (file)
index 0000000..a963db9
--- /dev/null
@@ -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])
+  ])
+ ])
+])
index 13034ba4249902b339e3a15b3a0f2da584802bd7..5acb7fac3e06672d0805154c7264c158e514c7a4 100644 (file)
@@ -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
 
index a025190978b3cc32b3618bd5d544a838244485fd..fdb6c4a63987c6dcb4601b98bb84969599759368 100755 (executable)
--- 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 :
index 190aa942d7da028d37887f5584b3bfc23e5e8ab4..57c20763206d9e8e06745f266b4738d7c01d0198 100644 (file)
@@ -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])
 
index 6e5478508092285ca7a553f6d375947543d45b7a..b28c6573c2e51d096031f4171934b8dc15040463 100644 (file)
@@ -9,6 +9,7 @@ secnet (0.4.0~beta2~) unstable; urgency=low
   * Do not install ipaddrset.py and secnet.8 executable.
   * Fix check for <linux/if_tun.h>.
   * 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.