Author: Alex Badea <vampire@p16.pub.ro>
[ircu2.10.12-pk.git] / adns / configure.in
1 # configure.in - input to autoconf
2 #  
3 #  This file is
4 #    Copyright (C) 1997-2000 Ian Jackson <ian@davenant.greenend.org.uk>
5 #
6 #  It is part of adns, which is
7 #    Copyright (C) 1997-2000 Ian Jackson <ian@davenant.greenend.org.uk>
8 #    Copyright (C) 1999-2000 Tony Finch <dot@dotat.at>
9 #  
10 #  This program is free software; you can redistribute it and/or modify
11 #  it under the terms of the GNU General Public License as published by
12 #  the Free Software Foundation; either version 2, or (at your option)
13 #  any later version.
14 #  
15 #  This program is distributed in the hope that it will be useful,
16 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
17 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 #  GNU General Public License for more details.
19 #  
20 #  You should have received a copy of the GNU General Public License
21 #  along with this program; if not, write to the Free Software Foundation,
22 #  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
23
24 AC_INIT(src/adns.h)
25 AC_CONFIG_HEADER(src/config.h)
26
27 dnl DPKG_CACHED_TRY_COMPILE(<description>,<cachevar>,<include>,<program>,<ifyes>,<ifno>)
28 define(DPKG_CACHED_TRY_COMPILE,[
29  AC_MSG_CHECKING($1)
30  AC_CACHE_VAL($2,[
31   AC_TRY_COMPILE([$3],[$4],[$2=yes],[$2=no])
32  ])
33  if test "x$$2" = xyes; then
34   true
35   $5
36  else
37   true
38   $6
39  fi
40 ])
41
42 AC_PROG_CC
43 AC_PROG_CPP
44 AC_PROG_RANLIB
45 AC_PROG_INSTALL
46
47 AC_CHECK_FUNCS(poll)
48 ADNS_C_GETFUNC(socket,socket)
49 ADNS_C_GETFUNC(inet_ntoa,nsl)
50
51 AC_MSG_CHECKING(for INADDR_LOOPBACK)
52 AC_CACHE_VAL(adns_cv_decl_inaddrloopback,[
53  AC_TRY_COMPILE([
54 #include <sys/socket.h>
55 #include <netinet/in.h>
56 #include <arpa/inet.h>
57  ],[
58   INADDR_LOOPBACK;
59  ],
60  adns_cv_decl_inaddrloopback=yes,
61  adns_cv_decl_inaddrloopback=no)])
62 if test "$adns_cv_decl_inaddrloopback" = yes; then
63  AC_MSG_RESULT(found)
64 else
65  AC_MSG_RESULT([not in standard headers, urgh...])
66  AC_CHECK_HEADER(rpc/types.h,[
67   AC_DEFINE(HAVEUSE_RPCTYPES_H)
68  ],[
69   AC_MSG_ERROR([cannot find INADDR_LOOPBACK or rpc/types.h])
70  ])
71 fi
72
73 ADNS_C_GETFUNC(inet_aton,resolv,[
74  LIBS="-lresolv $LIBS";
75  AC_MSG_WARN([inet_aton is in libresolv, urgh.  Must use -lresolv.])
76 ])
77
78 DPKG_CACHED_TRY_COMPILE(inlines,dpkg_cv_c_inline,,
79  [} inline int foo (int x) {],
80  AC_MSG_RESULT(yes)
81  AC_DEFINE(HAVE_INLINE),
82  AC_MSG_RESULT(no))
83
84 ADNS_C_GCCATTRIB
85 AC_CHECK_HEADERS(sys/select.h)
86
87 AC_SUBST(WARNS)
88
89 if test "${GCC-no}" = yes; then
90         WARNS="-Wall -Wmissing-prototypes -Wwrite-strings -Wstrict-prototypes -Wcast-qual -Wpointer-arith"
91 else
92         WARNS=
93 fi
94
95 AC_OUTPUT(
96         settings.make Makefile src/Makefile
97 )