1dnl Process this file with autoconf to produce a configure script.
2AC_RELEASE("$Id: configure.in,v 1.1 2008/02/15 01:47:15 marka Exp $")
3AC_INIT(query-loc.c)
4
5dnl Checks for programs.
6AC_PROG_CC
7if test "$GCC" = "yes"; then
8	CFLAGS="${CFLAGS} -Wall"
9fi
10AC_PROG_INSTALL
11
12dnl Checks for libraries.
13AC_CHECK_LIB(resolv, res_query)
14
15dnl Checks for header files.
16AC_HEADER_STDC
17AC_CONFIG_HEADER(config.h)
18AC_CHECK_HEADER(resolv.h, , AC_MSG_ERROR("No headers for name service applications"))
19AC_CHECK_HEADER(arpa/nameser.h, , AC_MSG_ERROR("No headers for name service applications"))
20AC_CHECK_HEADER(sys/time.h, , AC_MSG_ERROR("Mandatory header missing on your system"))
21AC_CHECK_HEADER(unistd.h, , AC_MSG_ERROR("Mandatory header missing on your system"))
22
23
24dnl This one is only useful for Solaris?
25AC_MSG_CHECKING(if libnsl is mandatory)
26AC_TRY_LINK([#include <sys/types.h>
27             #include <netinet/in.h>
28             #include <arpa/nameser.h>
29             #include <resolv.h>
30             union
31             {
32                HEADER hdr;	
33                u_char buf[4096]; /* With RFC 2671, otherwise 512 is enough */
34             }
35             response;
36             char *domain;
37             int requested_type;	], 
38	[res_query(domain,
39		  C_IN,		
40		  requested_type,	
41		  (u_char *) & response,	
42		  sizeof (response)) ], dnl
43	[AC_MSG_RESULT(no)], dnl
44	[AC_MSG_RESULT(yes); LIBS="${LIBS} -lnsl"]) 
45
46dnl Check for the loc_ntoa macro/function
47AC_MSG_CHECKING(loc_ntoa)
48AC_TRY_LINK([#include <resolv.h>], dnl
49	[u_char *cp; char *result; loc_ntoa(cp, result)], dnl
50	[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_LOC_NTOA)], dnl
51	[AC_MSG_RESULT([no, using the alternative]); LOC_NTOA=loc_ntoa.o]) 
52AC_SUBST(LOC_NTOA)
53
54dnl Checks for typedefs, structures, and compiler characteristics.
55AC_C_CONST
56AC_CHECK_SIZEOF(long)
57AC_CHECK_SIZEOF(int)
58AC_CHECK_SIZEOF(short)
59AC_CHECK_SIZEOF(char)
60
61dnl Misc.
62AC_OUTPUT(Makefile)
63
64
65
66