Browse code

don't link with nsl if not needed (bb#754)

git-svn: trunk@3522

Tomasz Kojm authored on 2008/01/22 19:49:50
Showing 3 changed files
... ...
@@ -1,3 +1,7 @@
1
+Tue Jan 22 11:28:20 CET 2008 (tk)
2
+---------------------------------
3
+  * configure: don't link with nsl if not needed (bb#754)
4
+
1 5
 Tue Jan 22 11:20:12 CET 2008 (tk)
2 6
 ---------------------------------
3 7
   * shared/misc.c, clamd, clamscan, freshclam: respect custom dbdir settings
... ...
@@ -11234,13 +11234,12 @@ if test $ac_cv_lib_socket_bind = yes; then
11234 11234
   LIBS="$LIBS -lsocket"; CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lsocket"; FRESHCLAM_LIBS="$FRESHCLAM_LIBS -lsocket"; CLAMD_LIBS="$CLAMD_LIBS -lsocket"
11235 11235
 fi
11236 11236
 
11237
-{ echo "$as_me:$LINENO: checking for gethostent in -lnsl" >&5
11238
-echo $ECHO_N "checking for gethostent in -lnsl... $ECHO_C" >&6; }
11239
-if test "${ac_cv_lib_nsl_gethostent+set}" = set; then
11237
+{ echo "$as_me:$LINENO: checking for library containing gethostent" >&5
11238
+echo $ECHO_N "checking for library containing gethostent... $ECHO_C" >&6; }
11239
+if test "${ac_cv_search_gethostent+set}" = set; then
11240 11240
   echo $ECHO_N "(cached) $ECHO_C" >&6
11241 11241
 else
11242
-  ac_check_lib_save_LIBS=$LIBS
11243
-LIBS="-lnsl  $LIBS"
11242
+  ac_func_search_save_LIBS=$LIBS
11244 11243
 cat >conftest.$ac_ext <<_ACEOF
11245 11244
 /* confdefs.h.  */
11246 11245
 _ACEOF
... ...
@@ -11263,7 +11262,14 @@ return gethostent ();
11263 11263
   return 0;
11264 11264
 }
11265 11265
 _ACEOF
11266
-rm -f conftest.$ac_objext conftest$ac_exeext
11266
+for ac_lib in '' nsl; do
11267
+  if test -z "$ac_lib"; then
11268
+    ac_res="none required"
11269
+  else
11270
+    ac_res=-l$ac_lib
11271
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
11272
+  fi
11273
+  rm -f conftest.$ac_objext conftest$ac_exeext
11267 11274
 if { (ac_try="$ac_link"
11268 11275
 case "(($ac_try" in
11269 11276
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
... ...
@@ -11281,22 +11287,34 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
11281 11281
 	 test ! -s conftest.err
11282 11282
        } && test -s conftest$ac_exeext &&
11283 11283
        $as_test_x conftest$ac_exeext; then
11284
-  ac_cv_lib_nsl_gethostent=yes
11284
+  ac_cv_search_gethostent=$ac_res
11285 11285
 else
11286 11286
   echo "$as_me: failed program was:" >&5
11287 11287
 sed 's/^/| /' conftest.$ac_ext >&5
11288 11288
 
11289
-	ac_cv_lib_nsl_gethostent=no
11289
+
11290 11290
 fi
11291 11291
 
11292 11292
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
11293
-      conftest$ac_exeext conftest.$ac_ext
11294
-LIBS=$ac_check_lib_save_LIBS
11293
+      conftest$ac_exeext
11294
+  if test "${ac_cv_search_gethostent+set}" = set; then
11295
+  break
11296
+fi
11297
+done
11298
+if test "${ac_cv_search_gethostent+set}" = set; then
11299
+  :
11300
+else
11301
+  ac_cv_search_gethostent=no
11302
+fi
11303
+rm conftest.$ac_ext
11304
+LIBS=$ac_func_search_save_LIBS
11295 11305
 fi
11296
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostent" >&5
11297
-echo "${ECHO_T}$ac_cv_lib_nsl_gethostent" >&6; }
11298
-if test $ac_cv_lib_nsl_gethostent = yes; then
11299
-  LIBS="$LIBS -lnsl"; CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lnsl"; FRESHCLAM_LIBS="$FRESHCLAM_LIBS -lnsl"; CLAMD_LIBS="$CLAMD_LIBS -lnsl"
11306
+{ echo "$as_me:$LINENO: result: $ac_cv_search_gethostent" >&5
11307
+echo "${ECHO_T}$ac_cv_search_gethostent" >&6; }
11308
+ac_res=$ac_cv_search_gethostent
11309
+if test "$ac_res" != no; then
11310
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
11311
+  (LIBS="$LIBS -lnsl"; CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lnsl"; FRESHCLAM_LIBS="$FRESHCLAM_LIBS -lnsl"; CLAMD_LIBS="$CLAMD_LIBS -lnsl")
11300 11312
 fi
11301 11313
 
11302 11314
 
... ...
@@ -211,7 +211,7 @@ if test "$enable_experimental" = "yes"; then
211 211
 fi
212 212
 
213 213
 AC_CHECK_LIB(socket, bind, [LIBS="$LIBS -lsocket"; CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lsocket"; FRESHCLAM_LIBS="$FRESHCLAM_LIBS -lsocket"; CLAMD_LIBS="$CLAMD_LIBS -lsocket"])
214
-AC_CHECK_LIB(nsl, gethostent, [LIBS="$LIBS -lnsl"; CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lnsl"; FRESHCLAM_LIBS="$FRESHCLAM_LIBS -lnsl"; CLAMD_LIBS="$CLAMD_LIBS -lnsl"])
214
+AC_SEARCH_LIBS([gethostent],[nsl], [(LIBS="$LIBS -lnsl"; CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lnsl"; FRESHCLAM_LIBS="$FRESHCLAM_LIBS -lnsl"; CLAMD_LIBS="$CLAMD_LIBS -lnsl")])
215 215
 
216 216
 dnl we need to try to link with iconv, otherwise there could be a 
217 217
 dnl mismatch between a 32-bit and 64-bit lib. Detect this at configure time.