chiark / gitweb /
+ -- Ian Jackson <ian@davenant.greenend.org.uk> Wed, 9 Aug 2000 16:59:28 +0100
[adns.git] / 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 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 AC_MSG_CHECKING(whether you requested dynamic linking)
28 AC_SUBST(ENABLE_DYNAMIC)
29 AC_ARG_ENABLE(dynamic,
30 [  --disable-dynamic       use static linking
31   --enable-dynamic[=elf]  create and use ELF dynamic library (default)],
32 [       case "$enableval" in
33         elf|yes)
34                 ENABLE_DYNAMIC=elf
35                 AC_MSG_RESULT([yes (ELF)])
36                 ;;
37         no)     ENABLE_DYNAMIC=no
38                 AC_MSG_RESULT(no)
39                 ;;
40         *)      AC_MSG_ERROR(
41 ["invalid value $enableval for --enable-dynamic, try yes or elf"])
42                 ;;
43         esac
44 ],[
45                 ENABLE_DYNAMIC=yes
46                 AC_MSG_RESULT([yes, by default])
47 ])
48
49 AC_PROG_CC
50 AC_PROG_CPP
51 AC_PROG_RANLIB
52 AC_PROG_INSTALL
53
54 AC_CHECK_FUNCS(poll)
55 ADNS_C_GETFUNC(socket,socket)
56 ADNS_C_GETFUNC(inet_ntoa,nsl)
57
58 PROGS_IF_TSEARCH=adnsresfilter
59 AC_SUBST(PROGS_HAVE_TSEARCH)
60 AC_CHECK_FUNC(tsearch,[
61  PROGS_HAVE_TSEARCH=$PROGS_IF_TSEARCH
62 ],[
63  PROGS_HAVE_TSEARCH='';
64  AC_MSG_WARN([tsearch missing - not building client program(s) $PROGS_IF_TSEARCH])
65 ])
66
67 AC_MSG_CHECKING(for INADDR_LOOPBACK)
68 AC_CACHE_VAL(adns_cv_decl_inaddrloopback,[
69  AC_TRY_COMPILE([
70 #include <sys/socket.h>
71 #include <netinet/in.h>
72 #include <arpa/inet.h>
73  ],[
74   INADDR_LOOPBACK;
75  ],
76  adns_cv_decl_inaddrloopback=yes,
77  adns_cv_decl_inaddrloopback=no)])
78 if test "$adns_cv_decl_inaddrloopback" = yes; then
79  AC_MSG_RESULT(found)
80 else
81  AC_MSG_RESULT([not in standard headers, urgh...])
82  AC_CHECK_HEADER(rpc/types.h,[
83   AC_DEFINE(HAVEUSE_RPCTYPES_H)
84  ],[
85   AC_MSG_ERROR([cannot find INADDR_LOOPBACK or rpc/types.h])
86  ])
87 fi
88
89 ADNS_C_GETFUNC(inet_aton,resolv,[
90  LIBS="-lresolv $LIBS";
91  AC_MSG_WARN([inet_aton is in libresolv, urgh.  Must use -lresolv.])
92 ])
93
94 ADNS_C_GCCATTRIB
95
96 AC_SUBST(WARNS)
97
98 if test "${GCC-no}" = yes; then
99         WARNS="-Wall -Wmissing-prototypes -Wwrite-strings -Wstrict-prototypes -Wcast-qual -Wpointer-arith"
100 else
101         WARNS=
102 fi
103
104 AC_SUBST(SHLIBCC)
105 AC_SUBST(MKSHLIB_1)
106 AC_SUBST(MKSHLIB_2)
107 AC_SUBST(MKSHLIB_3)
108
109 AC_SUBST(SHLIBFORLINK)
110 AC_SUBST(SHLIBFILE)
111 AC_SUBST(SHLIBSONAME)
112
113 SHLIBFORLINK='libadns.so'
114 SHLIBSONAME='$(SHLIBFORLINK).$(MAJOR)'
115 SHLIBFILE='$(SHLIBSONAME).$(MINOR)'
116
117 SHLIBCC='$(CC) $(CFLAGS) -fpic'
118 MKSHLIB_1='$(CC) $(LDFLAGS) -shared -Wl,-soname=$(SHLIBSONAME) -o'
119 MKSHLIB_2=''
120 MKSHLIB_3='-lc'
121
122 AC_OUTPUT(
123         settings.make Makefile
124         src/Makefile client/Makefile dynamic/Makefile regress/Makefile
125 )