autoconf: autoupdate macros
[openafs.git] / src / cf / library.m4
1 AC_DEFUN([OPENAFS_LIBRARY_CHECKS],[
2 if test "x${MKAFS_OSTYPE}" = "xIRIX"; then
3         echo Skipping library tests because they confuse Irix.
4 else
5   AC_SEARCH_LIBS([socket], [socket inet])
6   AC_SEARCH_LIBS([connect], [nsl])
7   AC_SEARCH_LIBS([gethostbyname], [dns nsl resolv])
8
9   dnl darwin wants it, aix hates it
10   AC_MSG_CHECKING(for the useability of arpa/nameser_compat.h)
11   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12   #include <stdlib.h>
13   #include <stdio.h>
14   #include <sys/types.h>
15   #include <sys/socket.h>
16   #include <netinet/in.h>
17   #include <arpa/inet.h>
18   #include <arpa/nameser.h>
19   #include <arpa/nameser_compat.h>
20   #include <resolv.h>
21   ]], [[static int i; i = 0;]])],[AC_MSG_RESULT(yes)
22    AC_DEFINE(HAVE_ARPA_NAMESER_COMPAT_H, 1, [define if arpa/nameser_compat.h exists])],[AC_MSG_RESULT(no)
23    ])
24
25   openafs_save_libs="$LIBS"
26   AC_MSG_CHECKING([for res_search])
27   AC_FUNC_RES_SEARCH
28
29   if test "$ac_cv_func_res_search" = no; then
30       for lib in dns nsl resolv; do
31         if test "$ac_cv_func_res_search" != yes; then
32           LIBS="-l$lib $LIBS"
33           AC_FUNC_RES_SEARCH
34           LIBS="$openafs_save_libs"
35         fi
36       done
37       if test "$ac_cv_func_res_search" = yes; then
38         LIB_AFSDB="-l$lib"
39         AC_DEFINE(HAVE_RES_SEARCH, 1, [])
40         AC_MSG_RESULT([yes, in lib$lib])
41       else
42         AC_MSG_RESULT(no)
43       fi
44   else
45     AC_DEFINE(HAVE_RES_SEARCH, 1, [])
46     AC_MSG_RESULT(yes)
47   fi
48
49 fi
50 XLIBS="$LIB_AFSDB $XLIBS"
51 ])