+ * New --disable-dynamic configure option for non-ELF systems.
[adns] / configure.in
CommitLineData
11b35193 1# configure.in - input to autoconf
2#
d942707d 3# This file is
4# Copyright (C) 1997-1999 Ian Jackson <ian@davenant.greenend.org.uk>
11b35193 5#
d942707d 6# It is part of adns, which is
3d5cde09 7# Copyright (C) 1997-2000 Ian Jackson <ian@davenant.greenend.org.uk>
d942707d 8# Copyright (C) 1999 Tony Finch <dot@dotat.at>
9#
11b35193 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
24AC_INIT(src/adns.h)
25AC_CONFIG_HEADER(src/config.h)
48337073 26
27AC_MSG_CHECKING(whether you requested dynamic linking)
28AC_SUBST(ENABLE_DYNAMIC)
29AC_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
11b35193 49AC_PROG_CC
04e7fb4d 50AC_PROG_CPP
9579019a 51AC_PROG_RANLIB
8b5269f2 52
620c146d 53AC_CHECK_FUNCS(poll)
8b5269f2 54ADNS_C_GETFUNC(socket,socket)
55ADNS_C_GETFUNC(inet_ntoa,nsl)
56
9a09fa18 57PROGS_IF_TSEARCH=adnsresfilter
58AC_SUBST(PROGS_HAVE_TSEARCH)
59AC_CHECK_FUNC(tsearch,[
60 PROGS_HAVE_TSEARCH=$PROGS_IF_TSEARCH
61],[
62 PROGS_HAVE_TSEARCH='';
63 AC_MSG_WARN([tsearch missing - not building client program(s) $PROGS_IF_TSEARCH])
64])
65
04e7fb4d 66AC_MSG_CHECKING(for INADDR_LOOPBACK)
67AC_CACHE_VAL(adns_cv_decl_inaddrloopback,[
68 AC_TRY_COMPILE([
69#include <sys/socket.h>
70#include <netinet/in.h>
71#include <arpa/inet.h>
72 ],[
73 INADDR_LOOPBACK;
74 ],
75 adns_cv_decl_inaddrloopback=yes,
76 adns_cv_decl_inaddrloopback=no)])
77if test "$adns_cv_decl_inaddrloopback" = yes; then
78 AC_MSG_RESULT(found)
79else
80 AC_MSG_RESULT([not in standard headers, urgh...])
81 AC_CHECK_HEADER(rpc/types.h,[
82 AC_DEFINE(HAVEUSE_RPCTYPES_H)
83 ],[
84 AC_MSG_ERROR([cannot find INADDR_LOOPBACK or rpc/types.h])
85 ])
86fi
87
8b5269f2 88ADNS_C_GETFUNC(inet_aton,resolv,[
89 LIBS="-lresolv $LIBS";
90 AC_MSG_WARN([inet_aton is in libresolv, urgh. Must use -lresolv.])
91])
92
11b35193 93ADNS_C_GCCATTRIB
94
95AC_SUBST(WARNS)
96
97if test "${GCC-no}" = yes; then
98 WARNS="-Wall -Wmissing-prototypes -Wwrite-strings -Wstrict-prototypes -Wcast-qual -Wpointer-arith"
99else
100 WARNS=
101fi
102
103AC_SUBST(SHLIBCC)
104AC_SUBST(MKSHLIB_1)
105AC_SUBST(MKSHLIB_2)
106AC_SUBST(MKSHLIB_3)
9310ea4d 107
108AC_SUBST(SHLIBFORLINK)
11b35193 109AC_SUBST(SHLIBFILE)
110AC_SUBST(SHLIBSONAME)
111
9310ea4d 112SHLIBFORLINK='libadns.so'
113SHLIBSONAME='$(SHLIBFORLINK).$(MAJOR)'
114SHLIBFILE='$(SHLIBSONAME).$(MINOR)'
11b35193 115
696e536a 116SHLIBCC='$(CC) $(CFLAGS) -fpic'
117MKSHLIB_1='$(CC) $(LDFLAGS) -shared -Wl,-soname=$(SHLIBSONAME) -o'
118MKSHLIB_2=''
119MKSHLIB_3='-lc'
120
9579019a 121AC_OUTPUT(
122 settings.make Makefile
123 src/Makefile client/Makefile dynamic/Makefile regress/Makefile
124)