Import Upstream version 1.8.5
[hcoop/debian/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(
12 [AC_LANG_PROGRAM(
13 [[
14 #include <stdlib.h>
15 #include <stdio.h>
16 #include <sys/types.h>
17 #include <sys/socket.h>
18 #include <netinet/in.h>
19 #include <arpa/inet.h>
20 #include <arpa/nameser.h>
21 #include <arpa/nameser_compat.h>
22 #include <resolv.h>
23 ]],
24 [[static int i; i = 0;]])],
25 [AC_MSG_RESULT(yes)
26 AC_DEFINE(HAVE_ARPA_NAMESER_COMPAT_H, 1,
27 [define if arpa/nameser_compat.h exists])],
28 [AC_MSG_RESULT(no)])
29
30 openafs_save_libs="$LIBS"
31 AC_MSG_CHECKING([for res_search])
32 AC_FUNC_RES_SEARCH
33
34 if test "$ac_cv_func_res_search" = no; then
35 for lib in dns nsl resolv; do
36 if test "$ac_cv_func_res_search" != yes; then
37 LIBS="-l$lib $LIBS"
38 AC_FUNC_RES_SEARCH
39 LIBS="$openafs_save_libs"
40 fi
41 done
42 if test "$ac_cv_func_res_search" = yes; then
43 LIB_AFSDB="-l$lib"
44 AC_DEFINE(HAVE_RES_SEARCH, 1, [])
45 AC_MSG_RESULT([yes, in lib$lib])
46 else
47 AC_MSG_RESULT(no)
48 fi
49 else
50 AC_DEFINE(HAVE_RES_SEARCH, 1, [])
51 AC_MSG_RESULT(yes)
52 fi
53
54 fi
55 XLIBS="$LIB_AFSDB $XLIBS"
56 ])