configure.in 20.3 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Copyright (C) 1998, 1999, 2000  Internet Software Consortium.
# 
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
# 
# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
# ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
# CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.

16
AC_REVISION($Revision: 1.102 $)
17

Bob Halley's avatar
Bob Halley committed
18
AC_PREREQ(2.13)
Bob Halley's avatar
Bob Halley committed
19
20
21
22
23
24

AC_INIT(lib/dns/name.c)
AC_CONFIG_HEADER(config.h)

AC_CANONICAL_HOST

25
26
27
28
29
30
31
32
33
34
35
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_PROG_INSTALL

STD_CINCLUDES=""
STD_CDEFINES=""
STD_CWARNINGS=""
AC_SUBST(STD_CINCLUDES)
AC_SUBST(STD_CDEFINES)
AC_SUBST(STD_CWARNINGS)

David Lawrence's avatar
David Lawrence committed
36
37
38
39
40
AC_PATH_PROG(AR, ar)
ARFLAGS="cruv"
AC_SUBST(AR)
AC_SUBST(ARFLAGS)

41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#
# Special processing of paths depending on whether --prefix,
# --sysconfdir or --localstatedir arguments were given.  What's
# desired is some compatability with the way previous versions
# of BIND built; they defaulted to /usr/local for most parts of
# the installation, but named.boot/named.conf was in /etc
# and named.pid was in /var/run.
#
# So ... if none of --prefix, --sysconfdir or --localstatedir are
# specified, set things up that way.  If --prefix is given, use
# it for sysconfdir and localstatedir the way configure normally
# would.  To change the prefix for everything but leave named.conf
# in /etc or named.pid in /var/run, then do this the usual configure way:
# ./configure --prefix=/somewhere --sysconfdir=/etc
# ./configure --prefix=/somewhere --localstatedir=/var
#
# To put named.conf and named.pid in /usr/local with everything else,
# set the prefix explicitly to /usr/local even though that's the default:
# ./configure --prefix=/usr/local
#
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
case "$prefix" in
        NONE)
                case "$sysconfdir" in
                        '${prefix}/etc')
                                sysconfdir=/etc
                                ;;
                esac
                case "$localstatedir" in
                        '${prefix}/var')
                                localstatedir=/var
                                ;;
                esac
                ;;
esac

76
77
78
79
80
81
82
83
#
# Make sure INSTALL uses an absolute path, else it will be wrong in all
# Makefiles, since they use make/rules.in and INSTALL will be adjusted by
# configure based on the location of the file where it is substituted.
# Since in BIND9 INSTALL is only substituted into make/rules.in, an immediate
# subdirectory of install-sh, This relative path will be wrong for all
# directories more than one level down from install-sh.
#
84
85
86
87
case "$INSTALL" in
	/*)
                ;;
        *)
88
89
90
                #
                # Not all systems have dirname.
                #
91
92
93
94
95
96
97
98
99
100
101
                changequote({, })
                ac_dir="`echo $INSTALL | sed 's%/[^/]*$%%'`"
                changequote([, ])

                ac_prog="`echo $INSTALL | sed 's%.*/%%'`"
                test "$ac_dir" = "$ac_prog" && ac_dir=.
                test -d "$ac_dir" && ac_dir="`(cd \"$ac_dir\" && pwd)`"
                INSTALL="$ac_dir/$ac_prog"
                ;;
esac

102
103
104
105
106
107
108
109
#
# On these hosts, we really want to use cc, not gcc, even if it is
# found.  The gcc that these systems have will not correctly handle
# pthreads.
#
# However, if the user sets $CC to be something, let that override
# our change.
#
110
111
112
113
114
115
if test "X$CC" = "X" ; then
	case "$host" in
		*-dec-osf*)
			CC="cc"
			;;
		*-sun-solaris*)
116
117
118
119
120
121
                        # Use Sun's cc if it is available, but watch
                        # out for /usr/ucb/cc; it will never be the right
                        # compiler to use.
                        #
                        # If setting CC here fails, the AC_PROG_CC done
                        # below might still find gcc.
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
			IFS="${IFS=	}"; ac_save_ifs="$IFS"; IFS=":"
			for ac_dir in $PATH; do
				test -z "$ac_dir" && ac_dir=.
				case "$ac_dir" in
				/usr/ucb)
					# exclude
					;;
				*)
					if test -f "$ac_dir/cc"; then
						CC="$ac_dir/cc"
						break
					fi
					;;
				esac
			done
			IFS="$ac_save_ifs"
138
139
140
141
142
143
144
145
146
147
			;;
		*-hp-hpux*)
			CC="cc"
			;;
		mips-sgi-irix*)
			CC="cc"
			;;
	esac
fi

148
149
150
151
152
#
# NetBSD has two alternative pthreads implementations.  Make the 
# user choose one by saying --with-mit-pthreads or --with-ptl2
# if necessary.
#
153
154
155
156
157
158
case "$host" in
  *-netbsd*)
	CC="gcc"
	AC_MSG_CHECKING(which thread library to use)

	AC_ARG_WITH(mit-pthreads, 
159
	    [  --with-mit-pthreads	use the mit-pthreads thread library],
160
161
162
	    use_mit_pthreads="$withval", use_mit_pthreads="no")
	
	AC_ARG_WITH(ptl2,
163
	    [  --with-ptl2		use the ptl2 thread library],
164
165
	    use_ptl2="$withval", use_ptl2="no")

166
167
        : ${LOCALBASE:=/usr/pkg}

168
169
170
        # If user did not choose a thread library explicitly,
        # try to choose one automatically.  This will work when
	# exactly one library is installed.
171
172
173

	case "$use_mit_pthreads+$use_ptl2" in
		no+no)
174
			if test -d $LOCALBASE/pthreads
175
176
177
			then
				use_mit_pthreads="yes"
			fi
178
			if test -d $LOCALBASE/PTL
179
180
181
182
183
184
185
186
187
			then
				use_ptl2="yes"
			fi
			;;
        esac

	case "$use_mit_pthreads+$use_ptl2" in
		yes+no)
			AC_MSG_RESULT(mit-pthreads)
188
			pkg="$LOCALBASE/pthreads"
189
190
191
			lib1="-L$pkg/lib -Wl,-R$pkg/lib"
			lib2="-lpthread -lm -lgcc -lpthread"
			LIBS="$lib1 $lib2 $LIBS"
Mark Andrews's avatar
Mark Andrews committed
192
			CPPFLAGS="-I$pkg/include $CPPFLAGS"
193
194
195
196
			STD_CINCLUDES="-I$pkg/include"
			;;
		no+yes)
			AC_MSG_RESULT(PTL2)
197
198
#			pkg="$LOCALBASE/PTL"
#			LIBS="-L$LOCALBASE/lib -lPTL $LIBS"
199
#			STD_CINCLUDES="-nostdinc -idirafter $pkg/include"
200
			CC=ptlgcc
201
202
203
204
205
206
207
208
209
210
211
212
213
214
			;;
		*)
			AC_MSG_ERROR([no thread library.

Please choose a thread library using one of 

   configure --with-mit-pthreads
   configure --with-ptl2
])
			;;
		esac
		;;
esac

Bob Halley's avatar
Bob Halley committed
215
AC_PROG_CC
James Brister's avatar
James Brister committed
216
AC_PROG_YACC
Bob Halley's avatar
Bob Halley committed
217
218

AC_HEADER_STDC
219
AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h sys/sockio.h netinet6/in6.h)
Bob Halley's avatar
Bob Halley committed
220

221
222
223
#
# HAVE_NETINET6_IN6_H needs to go in platform.h.
#
224
225
226
case "$ac_cv_header_netinet6_in6_h" in
yes)
	ISC_PLATFORM_HAVENETINET6IN6H="#define ISC_PLATFORM_HAVENETINET6IN6H 1"
227
	LWRES_PLATFORM_HAVENETINET6IN6H="#define LWRES_PLATFORM_HAVENETINET6IN6H 1"
228
229
230
	;;
no)
	ISC_PLATFORM_HAVENETINET6IN6H="#undef ISC_PLATFORM_HAVENETINET6IN6H"
231
	LWRES_PLATFORM_HAVENETINET6IN6H="#undef LWRES_PLATFORM_HAVENETINET6IN6H"
232
233
234
	;;
esac
AC_SUBST(ISC_PLATFORM_HAVENETINET6IN6H)
235
AC_SUBST(LWRES_PLATFORM_HAVENETINET6IN6H)
236

Bob Halley's avatar
Bob Halley committed
237
238
239
240
241
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_HEADER_TIME

Bob Halley's avatar
Bob Halley committed
242
243
AC_CHECK_LIB(pthread, pthread_create,,
             AC_CHECK_LIB(pthread, __pthread_create)
Bob Halley's avatar
Bob Halley committed
244
             AC_CHECK_LIB(pthread, __pthread_create_system)
Bob Halley's avatar
Bob Halley committed
245
)
246

247
248
249
#
# We'd like to use sigwait() too
#
250
AC_CHECK_LIB(c, sigwait,
251
	     AC_DEFINE(HAVE_SIGWAIT),
252
253
254
255
             AC_CHECK_LIB(pthread, sigwait,
			  AC_DEFINE(HAVE_SIGWAIT),
			  AC_CHECK_LIB(pthread, _Psigwait,
				       AC_DEFINE(HAVE_SIGWAIT),))
256
257
)

258
259
260
#
# Additional OS-specific searching for sigwait.
#
Bob Halley's avatar
Bob Halley committed
261
262
263
264
265
266
case "$host" in
	*-freebsd*)
		AC_CHECK_LIB(c_r, sigwait, AC_DEFINE(HAVE_SIGWAIT),)
		;;
esac

267
268
269
#
# Make sure we get the right sigwait() semantics...
#
270
271
272
273
274
275
case "$host" in
	*-sun-solaris*)
		AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
		;;
esac

276
277
278
#
# NLS
#
Bob Halley's avatar
Bob Halley committed
279
280
AC_CHECK_FUNC(catgets, AC_DEFINE(HAVE_CATGETS),)

281
282
283
284
285
#
# BSDI 3.1 through 4.0.1 needs pthread_init() to be called before certain
# pthreads calls.  LinuxThreads requires some changes to the way we deal with
# signals.
#
286
case "$host" in
287
	*-bsdi3.1*|*-bsdi4.0*)
288
289
		AC_DEFINE(NEED_PTHREAD_INIT)
		;;
Bob Halley's avatar
Bob Halley committed
290
291
292
	*-linux*)
		AC_DEFINE(HAVE_LINUXTHREADS)
		;;
293
294
esac

295
296
297
298
299
300
301
302
303
304
#
# -lxnet buys us one big porting headache...  standards, gotta love 'em.
#
# AC_CHECK_LIB(xnet, socket, ,
#    AC_CHECK_LIB(socket, socket)
#    AC_CHECK_LIB(nsl, inet_ntoa)
# )
#
# Use this for now, instead:
#
305
306
307
308
309
310
311
312
case "$host" in
	mips-sgi-irix*)
		;;
	*)
		AC_CHECK_LIB(socket, socket)
		AC_CHECK_LIB(nsl, inet_ntoa)
		;;
esac
Michael Graff's avatar
Michael Graff committed
313

Bob Halley's avatar
Bob Halley committed
314
315
MKDEPCC="$CC"
MKDEPCFLAGS="-M"
Bob Halley's avatar
Bob Halley committed
316
if test "X$GCC" = "Xyes"; then
317
	STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes"
318
	case "$host" in
319
320
321
322
		*-freebsd*)
			CC="$CC -pthread"
			STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
			;;
323
324
325
		*-openbsd*)
			CC="$CC -pthread"
			;;
326
327
328
329
		*-sun-solaris*)
			LIBS="$LIBS -lthread"
			;;
	esac
Bob Halley's avatar
Bob Halley committed
330
331
else
	case "$host" in
Bob Halley's avatar
Bob Halley committed
332
		*-dec-osf*)
333
			CC="$CC -std -pthread"
Bob Halley's avatar
Bob Halley committed
334
			MKDEPCC="$CC"
Bob Halley's avatar
Bob Halley committed
335
			;;
336
337
		*-sun-solaris*)
			CC="$CC -mt"
Bob Halley's avatar
Bob Halley committed
338
339
			MKDEPCC="$CC"
			MKDEPCFLAGS="-xM"
340
			;;
Bob Halley's avatar
Bob Halley committed
341
		*-hp-hpux*)
Bob Halley's avatar
Bob Halley committed
342
			CC="$CC -Ae -z +w1"
Bob Halley's avatar
Bob Halley committed
343
			MKDEPPROG='cc -Ae -E -Wp,-M >/dev/null 2>>$TMP'
Bob Halley's avatar
Bob Halley committed
344
			;;
Bob Halley's avatar
Bob Halley committed
345
346
	esac
fi
Bob Halley's avatar
Bob Halley committed
347
348
349
AC_SUBST(MKDEPCC)
AC_SUBST(MKDEPCFLAGS)
AC_SUBST(MKDEPPROG)
350

351
352
353
#
# Networking specifics.
#
Bob Halley's avatar
Bob Halley committed
354
case "$host" in
355
	*-dec-osf*)
356
		# Turn on 4.4BSD style sa_len support.
357
		AC_DEFINE(_SOCKADDR_LEN)
358
		;;
Bob Halley's avatar
Bob Halley committed
359
esac
Bob Halley's avatar
Bob Halley committed
360

361
362
363
#
# Look for a 4.4BSD-style sa_len member in struct sockaddr.
#
364
AC_MSG_CHECKING(for sa_len in struct sockaddr)
365
366
367
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>],
368
[struct sockaddr sa; sa.sa_len = 0; return (0);],
369
	[AC_MSG_RESULT(yes)
370
371
	ISC_PLATFORM_HAVESALEN="#define ISC_PLATFORM_HAVESALEN 1"
	LWRES_PLATFORM_HAVESALEN="#define LWRES_PLATFORM_HAVESALEN 1"],
372
	[AC_MSG_RESULT(no)
373
374
	ISC_PLATFORM_HAVESALEN="#undef ISC_PLATFORM_HAVESALEN"
	LWRES_PLATFORM_HAVESALEN="#undef LWRES_PLATFORM_HAVESALEN"])
375
AC_SUBST(ISC_PLATFORM_HAVESALEN)
376
AC_SUBST(LWRES_PLATFORM_HAVESALEN)
377

378
379
380
#
# Look for a 4.4BSD or 4.3BSD struct msghdr
#
381
382
383
384
385
386
AC_MSG_CHECKING(for struct msghdr flavor)
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>],
[struct msghdr msg; msg.msg_flags = 0; return (0);],
	[AC_MSG_RESULT(4.4BSD)
387
	ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD44MSGHDR 1"],
388
	[AC_MSG_RESULT(4.3BSD)
389
390
	ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD43MSGHDR 1"])
AC_SUBST(ISC_PLATFORM_MSGHDRFLAVOR)
391

392
393
394
#
# Look for in_port_t.
#
395
396
AC_MSG_CHECKING(for type in_port_t)
AC_TRY_COMPILE([
397
#include <sys/types.h>
398
399
400
#include <netinet/in.h>],
[in_port_t port = 25; return (0);],
	[AC_MSG_RESULT(yes)
401
	ISC_PLATFORM_NEEDPORTT="#undef ISC_PLATFORM_NEEDPORTT"],
402
        [AC_MSG_RESULT(no)
403
404
	ISC_PLATFORM_NEEDPORTT="#define ISC_PLATFORM_NEEDPORTT 1"])
AC_SUBST(ISC_PLATFORM_NEEDPORTT)
405

406
407
408
#
# Check for addrinfo
#
Mark Andrews's avatar
Mark Andrews committed
409
410
411
412
413
414
415
416
AC_MSG_CHECKING(for struct addrinfo)
AC_TRY_COMPILE([
#include <netdb.h>],
[struct addrinfo a; return (0);],
	[AC_MSG_RESULT(yes)
	ISC_LWRES_NEEDADDRINFO="#undef ISC_LWRES_NEEDADDRINFO"],
	[AC_MSG_RESULT(no)
	ISC_LWRES_NEEDADDRINFO="#define ISC_LWRES_NEEDADDRINFO 1"])
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
AC_SUBST(ISC_LWRES_NEEDADDRINFO)

AC_MSG_CHECKING(for int sethostent)
AC_TRY_COMPILE([
#include <netdb.h>],
[int i = sethostent(0); return(0);],
	[AC_MSG_RESULT(yes)
	ISC_LWRES_SETHOSTENTINT="#define ISC_LWRES_SETHOSTENTINT 1"],
	[AC_MSG_RESULT(no)
	ISC_LWRES_SETHOSTENTINT="#undef ISC_LWRES_SETHOSTENTINT"])
AC_SUBST(ISC_LWRES_SETHOSTENTINT)

AC_MSG_CHECKING(for int endhostent)
AC_TRY_COMPILE([
#include <netdb.h>],
Mark Andrews's avatar
Mark Andrews committed
432
[int i = endhostent(); return(0);],
433
434
435
436
437
438
	[AC_MSG_RESULT(yes)
	ISC_LWRES_ENDHOSTENTINT="#define ISC_LWRES_ENDHOSTENTINT 1"],
	[AC_MSG_RESULT(no)
	ISC_LWRES_ENDHOSTENTINT="#undef ISC_LWRES_ENDHOSTENTINT"])
AC_SUBST(ISC_LWRES_ENDHOSTENTINT)

439
440
441
442
443
444
445
446
447
448
449
AC_MSG_CHECKING(for getnetbyaddr(in_addr_t, ...))
AC_TRY_COMPILE([
#include <netdb.h>
struct netent *getnetbyaddr(in_addr_t, int);],
[],
	[AC_MSG_RESULT(yes)
	ISC_LWRES_GETNETBYADDRINADDR="#define ISC_LWRES_GETNETBYADDRINADDR 1"],
	[AC_MSG_RESULT(no)
	ISC_LWRES_GETNETBYADDRINADDR="#undef ISC_LWRES_GETNETBYADDRINADDR"])
AC_SUBST(ISC_LWRES_GETNETBYADDRINADDR)

450
451
452
453
454
455
456
457
AC_MSG_CHECKING(for int setnetent)
AC_TRY_COMPILE([
#include <netdb.h>],
[int i = setnetent(0); return(0);],
	[AC_MSG_RESULT(yes)
	ISC_LWRES_SETNETENTINT="#define ISC_LWRES_SETNETENTINT 1"],
	[AC_MSG_RESULT(no)
	ISC_LWRES_SETNETENTINT="#undef ISC_LWRES_SETNETENTINT"])
458
459
AC_SUBST(ISC_LWRES_SETNETENTINT)

Mark Andrews's avatar
Mark Andrews committed
460
461
462
463
464
465
466
467
AC_MSG_CHECKING(for int endnetent)
AC_TRY_COMPILE([
#include <netdb.h>],
[int i = endnetent(); return(0);],
	[AC_MSG_RESULT(yes)
	ISC_LWRES_ENDNETENTINT="#define ISC_LWRES_ENDNETENTINT 1"],
	[AC_MSG_RESULT(no)
	ISC_LWRES_ENDNETENTINT="#undef ISC_LWRES_ENDNETENTINT"])
468
AC_SUBST(ISC_LWRES_ENDNETENTINT)
Mark Andrews's avatar
Mark Andrews committed
469

Mark Andrews's avatar
Mark Andrews committed
470
AC_MSG_CHECKING(for gethostbyadd(const void *, size_t, ...))
471
472
AC_TRY_COMPILE([
#include <netdb.h>
Mark Andrews's avatar
Mark Andrews committed
473
struct hostent *gethostbyaddr(const void *, size_t, int);],
474
475
476
477
478
[return(0);],
	[AC_MSG_RESULT(yes)
	ISC_LWRES_GETHOSTBYADDRVOID="#define ISC_LWRES_GETHOSTBYADDRVOID 1"],
	[AC_MSG_RESULT(no)
	ISC_LWRES_GETHOSTBYADDRVOID="#undef ISC_LWRES_GETHOSTBYADDRVOID"])
479
480
AC_SUBST(ISC_LWRES_GETHOSTBYADDRVOID)

Mark Andrews's avatar
Mark Andrews committed
481
482
483
484
485
486
487
488
489
490
AC_MSG_CHECKING(for h_errno in netdb.h)
AC_TRY_COMPILE([
#include <netdb.h>],
[h_errno = 1; return(0);],
	[AC_MSG_RESULT(yes)
	ISC_LWRES_NEEDHERRNO="#undef ISC_LWRES_NEEDHERRNO"],
	[AC_MSG_RESULT(no)
	ISC_LWRES_NEEDHERRNO="#define ISC_LWRES_NEEDHERRNO 1"])
AC_SUBST(ISC_LWRES_NEEDHERRNO)

Mark Andrews's avatar
Mark Andrews committed
491
492
493
494
495
496
497
498
499
500
501
502
503
AC_CHECK_FUNC(getipnodebyname,
        [ISC_LWRES_GETIPNODEPROTO="#undef ISC_LWRES_GETIPNODEPROTO"],
        [ISC_LWRES_GETIPNODEPROTO="#define ISC_LWRES_GETIPNODEPROTO 1"])
AC_CHECK_FUNC(getnameinfo,
        [ISC_LWRES_GETNAMEINFOPROTO="#undef ISC_LWRES_GETNAMEINFOPROTO"],
        [ISC_LWRES_GETNAMEINFOPROTO="#define ISC_LWRES_GETNAMEINFOPROTO 1"])
AC_CHECK_FUNC(getaddrinfo,
        [ISC_LWRES_GETADDRINFOPROTO="#undef ISC_LWRES_GETADDRINFOPROTO"],
        [ISC_LWRES_GETADDRINFOPROTO="#define ISC_LWRES_GETADDRINFOPROTO 1"])
AC_SUBST(ISC_LWRES_GETIPNODEPROTO)
AC_SUBST(ISC_LWRES_GETADDRINFOPROTO)
AC_SUBST(ISC_LWRES_GETNAMEINFOPROTO)

504
505
506
#
# Look for a sysctl call to get the list of network interfaces.
#
507
508
509
510
511
512
513
514
515
516
517
518
519
AC_MSG_CHECKING(for interface list sysctl)
AC_EGREP_CPP(found_rt_iflist, [
#include <sys/param.h>
#include <sys/sysctl.h>
#include <sys/socket.h>
#ifdef NET_RT_IFLIST
found_rt_iflist
#endif
],
	[AC_MSG_RESULT(yes)
	 AC_DEFINE(HAVE_IFLIST_SYSCTL)],
	[AC_MSG_RESULT(no)])

520
521
522
#
# GNU libtool support
#
Bob Halley's avatar
Bob Halley committed
523
AC_ARG_WITH(libtool,
524
	    [  --with-libtool	use GNU libtool],
Bob Halley's avatar
Bob Halley committed
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
	    use_libtool="$withval", use_libtool="no")

case $use_libtool in
	yes)
		AM_PROG_LIBTOOL
		O=lo
		A=la
		;;
	*)
		O=o
		A=a
		LIBTOOL=
		AC_SUBST(LIBTOOL)
		;;
esac
540
541
542
543
544

# File name extension for static archive files, for those few places
# where they are treated differently from dynamic ones.
SA=a

Bob Halley's avatar
Bob Halley committed
545
546
AC_SUBST(O)
AC_SUBST(A)
547
AC_SUBST(SA)
Bob Halley's avatar
Bob Halley committed
548

549
550
551
#
# IPv6
#
552
553
554
AC_ARG_ENABLE(ipv6,
	[  --enable-ipv6		use IPv6 [default=autodetect]])

555
556
557
558
#
# We do the IPv6 compilation checking after libtool so that we can put
# the right suffix on the files.
#
559
560
561
562
case "$enable_ipv6" in
	yes|''|autodetect)
		AC_MSG_CHECKING(for IPv6 structures)
		AC_TRY_COMPILE([
563
564
565
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>],
566
567
568
569
570
571
572
573
574
575
576
577
578
		[struct sockaddr_in6 sin6; return (0);],
			[AC_MSG_RESULT(yes)
			 found_ipv6=yes],
			[AC_MSG_RESULT(no)
			 found_ipv6=no])
		;;
	no)
		found_ipv6=no
		;;
esac

case "$found_ipv6" in
	yes)
579
580
		ISC_PLATFORM_HAVEIPV6="#define ISC_PLATFORM_HAVEIPV6 1"
		LWRES_PLATFORM_HAVEIPV6="#define LWRES_PLATFORM_HAVEIPV6 1"
581
582
583
		;;
	no)
		ISC_PLATFORM_HAVEIPV6="#undef ISC_PLATFORM_HAVEIPV6"
584
		LWRES_PLATFORM_HAVEIPV6="#undef LWRES_PLATFORM_HAVEIPV6"
585
586
587
588
589
590
591
		ISC_IPV6_H="ipv6.h"
		ISC_IPV6_O="ipv6.$O"
		ISC_ISCIPV6_O="unix/ipv6.$O"
		ISC_IPV6_C="ipv6.c"
		;;
esac

592
AC_SUBST(ISC_PLATFORM_HAVEIPV6)
593
AC_SUBST(LWRES_PLATFORM_HAVEIPV6)
594
595
596
597
598
AC_SUBST(ISC_IPV6_H)
AC_SUBST(ISC_IPV6_O)
AC_SUBST(ISC_ISCIPV6_O)
AC_SUBST(ISC_IPV6_C)

599
600
601
#
# IPv6 support provided via Kame
#
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
AC_MSG_CHECKING(for Kame IPv6 support)
AC_ARG_WITH(kame,
	[  --with-kame[=PATH]	use Kame IPv6 [default path /usr/local/v6]],
	use_kame="$withval", use_kame="no")

case "$use_kame" in
	no)
		;;
	yes)
		kame_path=/usr/local/v6
		;;
	*)
		kame_path="$use_kame"
		;;
esac

case "$use_kame" in
	no)
620
		AC_MSG_RESULT(no)
621
622
623
624
		;;
	*)
		if test -f $kame_path/lib/libinet6.a; then
			AC_MSG_RESULT($kame_path/lib/libinet6.a)
625
			LIBS="-L$kame_path/lib -linet6 $LIBS"
626
627
628
629
630
631
632
633
634
635
636
637
		else
			AC_MSG_ERROR([$kame_path/lib/libinet6.a not found.

Please choose the proper path with the following command:

    configure --with-kame=PATH
])
		fi
		;;
esac


638
639
640
641
642
#
# Check for network functions that are often missing.  We do this
# after the libtool checking, so we can put the right suffix on
# the files.
#
643
AC_CHECK_FUNC(inet_ntop,
644
	      [ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"],
Bob Halley's avatar
Bob Halley committed
645
	      [ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_ntop.$O"
Bob Halley's avatar
Bob Halley committed
646
	       ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_ntop.c"
647
	       ISC_PLATFORM_NEEDNTOP="#define ISC_PLATFORM_NEEDNTOP 1"]
Bob Halley's avatar
Bob Halley committed
648
)
649
AC_CHECK_FUNC(inet_pton,
650
	      [ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"],
Bob Halley's avatar
Bob Halley committed
651
	      [ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O"
Bob Halley's avatar
Bob Halley committed
652
	       ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_pton.c"
653
	       ISC_PLATFORM_NEEDPTON="#define ISC_PLATFORM_NEEDPTON 1"]
Bob Halley's avatar
Bob Halley committed
654
)
655
AC_CHECK_FUNC(inet_aton,
656
	      [ISC_PLATFORM_NEEDATON="#undef ISC_PLATFORM_NEEDATON"],
Bob Halley's avatar
Bob Halley committed
657
	      [ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_aton.$O"
Bob Halley's avatar
Bob Halley committed
658
	       ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_aton.c"
659
	       ISC_PLATFORM_NEEDATON="#define ISC_PLATFORM_NEEDATON 1"]
Bob Halley's avatar
Bob Halley committed
660
)
Mark Andrews's avatar
Mark Andrews committed
661
662
663
664
665
AC_CHECK_FUNC(strsep,
	[ISC_PLATFORM_NEEDSTRSEP="#undef ISC_PLATFORM_NEEDSTRSEP"],
	[ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS strsep.$O"
	 ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS strsep.c"
	 ISC_PLATFORM_NEEDSTRSEP="#define ISC_PLATFORM_NEEDSTRSEP 1"])
Mark Andrews's avatar
Mark Andrews committed
666
AC_CHECK_FUNC(vsnprintf,
667
	[ISC_PLATFORM_NEEDVSNPRINTF="#undef ISC_PLATFORM_NEEDVSNPRINTF"],
Mark Andrews's avatar
Mark Andrews committed
668
669
	[ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS print.$O"
	 ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS print.c"
670
671
672
673
	 ISC_PLATFORM_NEEDVSNPRINTF="#define ISC_PLATFORM_NEEDVSNPRINTF 1"])
AC_SUBST(ISC_PLATFORM_NEEDNTOP)
AC_SUBST(ISC_PLATFORM_NEEDPTON)
AC_SUBST(ISC_PLATFORM_NEEDATON)
Mark Andrews's avatar
Mark Andrews committed
674
AC_SUBST(ISC_PLATFORM_NEEDSTRSEP)
675
AC_SUBST(ISC_PLATFORM_NEEDVSNPRINTF)
Bob Halley's avatar
Bob Halley committed
676
677
AC_SUBST(ISC_EXTRA_OBJS)
AC_SUBST(ISC_EXTRA_SRCS)
678
679
680
681
682
683
684
685
686
AC_MSG_CHECKING(for sizeof(long long int) == sizeof(long int))
AC_TRY_RUN([main() { exit(!(sizeof(long long int) == sizeof(long int))); }],
	[AC_MSG_RESULT(yes)
	ISC_PLATFORM_LONGLONGEQUALLONG="#define ISC_PLATFORM_LONGLONGEQUALLONG 1"],
	[AC_MSG_RESULT(no)
	ISC_PLATFORM_LONGLONGEQUALLONG="#undef ISC_PLATFORM_LONGLONGEQUALLONG"],
	[AC_MSG_RESULT(default yes)
	ISC_PLATFORM_LONGLONGEQUALLONG="#define ISC_PLATFORM_LONGLONGEQUALLONG 1"])
AC_SUBST(ISC_PLATFORM_LONGLONGEQUALLONG)
687

688
689
690
#
# Security Stuff
#
691
692
693
694
AC_CHECK_FUNC(chroot, AC_DEFINE(HAVE_CHROOT))
AC_CHECK_HEADERS(linux/capability.h)


695
696
697
#
# Substitutions
#
698
699
700
AC_SUBST(BIND9_TOP_BUILDDIR)
BIND9_TOP_BUILDDIR=`pwd`

701
702
AC_SUBST(BIND9_ISC_BUILDINCLUDE)
AC_SUBST(BIND9_DNS_BUILDINCLUDE)
703
AC_SUBST(BIND9_OMAPI_BUILDINCLUDE)
Michael Graff's avatar
Michael Graff committed
704
AC_SUBST(BIND9_LWRES_BUILDINCLUDE)
705
706
707
if test "X$srcdir" != "X"; then
	BIND9_ISC_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isc/include"
	BIND9_DNS_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/dns/include"
708
	BIND9_OMAPI_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/omapi/include"
Michael Graff's avatar
Michael Graff committed
709
	BIND9_LWRES_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/lwres/include"
710
711
712
else
	BIND9_ISC_BUILDINCLUDE=""
	BIND9_DNS_BUILDINCLUDE=""
713
	BIND9_OMAPI_BUILDINCLUDE=""
Michael Graff's avatar
Michael Graff committed
714
	BIND9_LWRES_BUILDINCLUDE=""
715
716
717
718
719
fi

AC_SUBST_FILE(BIND9_INCLUDES)
BIND9_INCLUDES=$BIND9_TOP_BUILDDIR/make/includes

Bob Halley's avatar
Bob Halley committed
720
AC_SUBST_FILE(BIND9_MAKE_RULES)
721
BIND9_MAKE_RULES=$BIND9_TOP_BUILDDIR/make/rules
Bob Halley's avatar
Bob Halley committed
722
723
724
725

AC_SUBST_FILE(BIND9_VERSION)
BIND9_VERSION=$srcdir/version

Bob Halley's avatar
Bob Halley committed
726
727
728
729
730
731
AC_SUBST_FILE(LIBISC_API)
LIBISC_API=$srcdir/lib/isc/api

AC_SUBST_FILE(LIBDNS_API)
LIBDNS_API=$srcdir/lib/dns/api

Michael Graff's avatar
Michael Graff committed
732
733
734
AC_SUBST_FILE(LIBLWRES_API)
LIBLWRES_API=$srcdir/lib/lwres/api

David Lawrence's avatar
David Lawrence committed
735
736
737
AC_SUBST_FILE(LIBOMAPI_API)
LIBOMAPI_API=$srcdir/lib/omapi/api

Bob Halley's avatar
Bob Halley committed
738
AC_OUTPUT(
739
	make/rules
740
	make/includes
Bob Halley's avatar
Bob Halley committed
741
	Makefile
742
	make/Makefile
Bob Halley's avatar
Bob Halley committed
743
	make/mkdep
Bob Halley's avatar
Bob Halley committed
744
745
746
747
	lib/Makefile
	lib/isc/Makefile
	lib/isc/include/Makefile
	lib/isc/include/isc/Makefile
748
	lib/isc/include/isc/platform.h
Bob Halley's avatar
Bob Halley committed
749
750
751
	lib/isc/unix/Makefile
	lib/isc/unix/include/Makefile
	lib/isc/unix/include/isc/Makefile
Bob Halley's avatar
Bob Halley committed
752
	lib/isc/nls/Makefile
Bob Halley's avatar
Bob Halley committed
753
754
755
756
757
758
	lib/isc/pthreads/Makefile
	lib/isc/pthreads/include/Makefile
	lib/isc/pthreads/include/isc/Makefile
	lib/dns/Makefile
	lib/dns/include/Makefile
	lib/dns/include/dns/Makefile
759
760
761
762
763
764
765
766
	lib/dns/sec/Makefile
	lib/dns/sec/openssl/Makefile
	lib/dns/sec/openssl/include/Makefile
	lib/dns/sec/openssl/include/openssl/Makefile
	lib/dns/sec/dnssafe/Makefile
	lib/dns/sec/dst/Makefile
	lib/dns/sec/dst/include/Makefile
	lib/dns/sec/dst/include/dst/Makefile
767
	lib/dns/config/Makefile
Michael Graff's avatar
Michael Graff committed
768
769
770
	lib/lwres/Makefile
	lib/lwres/include/Makefile
	lib/lwres/include/lwres/Makefile
Mark Andrews's avatar
Mark Andrews committed
771
	lib/lwres/include/lwres/netdb.h
772
	lib/lwres/include/lwres/platform.h
David Lawrence's avatar
David Lawrence committed
773
774
775
	lib/omapi/Makefile
	lib/omapi/include/Makefile
	lib/omapi/include/omapi/Makefile
Bob Halley's avatar
Bob Halley committed
776
777
778
	lib/tests/Makefile
	lib/tests/include/Makefile
	lib/tests/include/tests/Makefile
Bob Halley's avatar
Bob Halley committed
779
	bin/Makefile
Michael Graff's avatar
typo    
Michael Graff committed
780
	bin/named/Makefile
Bob Halley's avatar
Bob Halley committed
781
	bin/named/unix/Makefile
782
	bin/lwresd/Makefile
783
	bin/rndc/Makefile
Bob Halley's avatar
Bob Halley committed
784
785
786
787
	bin/tests/Makefile
	bin/tests/names/Makefile
	bin/tests/master/Makefile
	bin/tests/rbt/Makefile
788
789
790
	bin/tests/db/Makefile
	bin/tests/tasks/Makefile
	bin/tests/timers/Makefile
791
	bin/tests/dst/Makefile
792
	bin/tests/mem/Makefile
793
	bin/tests/sockaddr/Makefile
Bob Halley's avatar
Bob Halley committed
794
)