From 11d9d041cf4420b02b7f18cece6478888e386b2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Wed, 22 Sep 2004 12:13:58 +0000 Subject: [PATCH] Clean up and comment config.mk. Centralize more stuff. Bitch if POSIX threads libraries are not available. Add crypto support if the crypto libraries are available. Build dnssec-{keygen,signzone} if crypto is available. Submitted by: (in part) dougb@ --- lib/bind/bind/Makefile | 4 +- lib/bind/bind9/Makefile | 4 +- lib/bind/config.mk | 67 +++++++++++++++++++++---------- lib/bind/dns/Makefile | 4 +- lib/bind/isc/Makefile | 4 +- lib/bind/isccc/Makefile | 4 +- lib/bind/isccfg/Makefile | 4 +- lib/bind/lwres/Makefile | 4 +- usr.bin/dig/Makefile | 4 +- usr.bin/host/Makefile | 4 +- usr.bin/nslookup/Makefile | 4 +- usr.bin/nsupdate/Makefile | 4 +- usr.sbin/Makefile | 7 +++- usr.sbin/dnssec-keygen/Makefile | 21 ++++++++++ usr.sbin/dnssec-signzone/Makefile | 21 ++++++++++ usr.sbin/named-checkconf/Makefile | 4 +- usr.sbin/named-checkzone/Makefile | 4 +- usr.sbin/named/Makefile | 4 +- usr.sbin/rndc-confgen/Makefile | 4 +- usr.sbin/rndc/Makefile | 4 +- 20 files changed, 125 insertions(+), 55 deletions(-) create mode 100644 usr.sbin/dnssec-keygen/Makefile create mode 100644 usr.sbin/dnssec-signzone/Makefile diff --git a/lib/bind/bind/Makefile b/lib/bind/bind/Makefile index d636bccd9ab8..2297e2feee85 100644 --- a/lib/bind/bind/Makefile +++ b/lib/bind/bind/Makefile @@ -60,8 +60,8 @@ SRCS+= herror.c res_comp.c res_data.c \ CFLAGS+= -I${SRCDIR}/port/freebsd/include -I${SRCDIR}/include CFLAGS+= -I${.CURDIR} -I${.CURDIR}/.. -DPADD= ${LIBPTHREAD} -LDADD= -lpthread +DPADD= ${PTHREAD_DPADD} +LDADD= ${PTHREAD_LDADD} #INCS= ${SRCDIR}/include/isc/assertions.h \ # ${SRCDIR}/include/isc/ctl.h \ diff --git a/lib/bind/bind9/Makefile b/lib/bind/bind9/Makefile index be2149812c61..73fc1f18ca88 100644 --- a/lib/bind/bind9/Makefile +++ b/lib/bind/bind9/Makefile @@ -13,8 +13,8 @@ SRCS= check.c getaddresses.c version.c CFLAGS+= -I${SRCDIR}/include -I${.CURDIR} -I${.CURDIR}/.. -DPADD= ${LIBPTHREAD} -LDADD= -lpthread +DPADD= ${PTHREAD_DPADD} +LDADD= ${PTHREAD_LDADD} INCS= ${SRCDIR}/include/bind9/check.h \ ${SRCDIR}/include/bind9/getaddresses.h \ diff --git a/lib/bind/config.mk b/lib/bind/config.mk index 9e09254dd0f7..e950d7d27958 100644 --- a/lib/bind/config.mk +++ b/lib/bind/config.mk @@ -1,54 +1,79 @@ # $FreeBSD$ +# BIND version number CFLAGS+= -DVERSION='"9.3.0rc4"' +CFLAGS+= -DHAVE_CONFIG_H + +# Get version numbers (for libraries) .if defined(SRCDIR) && exists(${SRCDIR}/api) .include "${SRCDIR}/api" -.endif - -.if defined(LIB_BIND_DIR) && exists(${LIB_BIND_DIR}/config.h) -CFLAGS+= -I${LIB_BIND_DIR} -.endif - -.if defined(LIBINTERFACE) CFLAGS+= -DLIBINTERFACE=${LIBINTERFACE} SHLIB_MAJOR= ${LIBINTERFACE} -.endif - -.if defined(LIBREVISION) CFLAGS+= -DLIBREVISION=${LIBREVISION} SHLIB_MINOR= ${LIBINTERFACE} -.endif - -.if defined(LIBAGE) CFLAGS+= -DLIBAGE=${LIBAGE} .endif -CFLAGS+= -DHAVE_CONFIG_H - # GSSAPI support is incomplete in 9.3.0rc4 #.if !defined(NO_KERBEROS) #CFLAGS+= -DGSSAPI #.endif +# Enable IPv6 support if available .if !defined(NOINET6) CFLAGS+= -DWANT_IPV6 .endif -.if ${MACHINE_ARCH} == powerpc || ${MACHINE_ARCH} == sparc64 +# Enable crypto if available +.if !defined(NOCRYPT) +CFLAGS+= -DOPENSSL +.endif + +# Enable MD5 - BIND has its own implementation +CFLAGS+= -DUSE_MD5 + +# Endianness +.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "sparc64" CFLAGS+= -DWORDS_BIGENDIAN .endif +# Default file locations LOCALSTATEDIR= /var/run -SYSCONFDIR= /etc - +SYSCONFDIR= /etc/namedb CFLAGS+= -DNS_LOCALSTATEDIR='"${LOCALSTATEDIR}"' CFLAGS+= -DNS_SYSCONFDIR='"${SYSCONFDIR}"' CFLAGS+= -DNAMED_CONFFILE='"${SYSCONFDIR}/named.conf"' CFLAGS+= -DRNDC_CONFFILE='"${SYSCONFDIR}/rndc.conf"' CFLAGS+= -DRNDC_KEYFILE='"${SYSCONFDIR}/rndc.key"' +# Add correct include path for config.h +.if defined(LIB_BIND_DIR) && exists(${LIB_BIND_DIR}/config.h) +CFLAGS+= -I${LIB_BIND_DIR} +.endif + +# Link against BIND libraries BIND_DPADD= ${LIBBIND9} ${LIBDNS} ${LIBISCCC} ${LIBISCCFG} \ - ${LIBISC} ${LIBLWRES} ${LIBCRYPTO} ${LIBPTHREAD} -BIND_LDADD= -lbind9 -ldns -lisccc -lisccfg -lisc -llwres \ - -lcrypto -lpthread + ${LIBISC} ${LIBLWRES} +BIND_LDADD= -lbind9 -ldns -lisccc -lisccfg -lisc -llwres + +# Link against crypto library +.if !defined(NOCRYPT) +CRYPTO_DPADD+= ${LIBCRYPTO} +CRYPTO_LDADD+= -lcrypto +.endif + +# Link against POSIX threads library +.if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "sparc64" +.if defined(NOLIBC_R) +.error "BIND requires libc_r - define NO_BIND, or undefine NOLIBC_R" +.endif +PTHREAD_DPADD+= ${LIBC_R} +PTHREAD_LDADD+= -lc_r +.else +.if defined(NOLIBPTHREAD) +.error "BIND requires libpthread - define NO_BIND, or undefine NOLIBPTHREAD" +.endif +PTHREAD_DPADD+= ${LIBPTHREAD} +PTHREAD_LDADD+= -lpthread +.endif diff --git a/lib/bind/dns/Makefile b/lib/bind/dns/Makefile index f8cc4acaba49..3a3d05655930 100644 --- a/lib/bind/dns/Makefile +++ b/lib/bind/dns/Makefile @@ -36,8 +36,8 @@ SRCS+= acl.c adb.c byaddr.c \ CFLAGS+= -I${SRCDIR}/sec/dst/include -I${SRCDIR}/include -I${SRCDIR} CFLAGS+= -I${.CURDIR} -I${.CURDIR}/.. -DPADD= ${LIBPTHREAD} -LDADD= -lpthread +DPADD= ${CRYPTO_DPADD} ${PTHREAD_DPADD} +LDADD= ${CRYPTO_LDADD} ${PTHREAD_LDADD} DNSINCS= ${SRCDIR}/include/dns/acl.h \ ${SRCDIR}/include/dns/adb.h \ diff --git a/lib/bind/isc/Makefile b/lib/bind/isc/Makefile index 437ba095d5ed..6fc1a1f487ef 100644 --- a/lib/bind/isc/Makefile +++ b/lib/bind/isc/Makefile @@ -37,8 +37,8 @@ SRCS+= inet_pton.c \ CFLAGS+= -I${SRCDIR}/unix/include -I${SRCDIR}/pthreads/include CFLAGS+= -I${SRCDIR}/include -I${.CURDIR} -I${.CURDIR}/.. -DPADD= ${LIBPTHREAD} -LDADD= -lpthread +DPADD= ${PTHREAD_DPADD} +LDADD= ${PTHREAD_LDADD} INCS= ${SRCDIR}/include/isc/app.h \ ${SRCDIR}/include/isc/assertions.h \ diff --git a/lib/bind/isccc/Makefile b/lib/bind/isccc/Makefile index 6b316c360a0c..9d3d1fe3a31d 100644 --- a/lib/bind/isccc/Makefile +++ b/lib/bind/isccc/Makefile @@ -15,8 +15,8 @@ SRCS= alist.c base64.c cc.c ccmsg.c \ CFLAGS+= -I${SRCDIR}/include -I${.CURDIR} -I${.CURDIR}/.. -DPADD= ${LIBPTHREAD} -LDADD= -lpthread +DPADD= ${PTHREAD_DPADD} +LDADD= ${PTHREAD_LDADD} INCS= ${SRCDIR}/include/isccc/alist.h \ ${SRCDIR}/include/isccc/base64.h \ diff --git a/lib/bind/isccfg/Makefile b/lib/bind/isccfg/Makefile index 1f77ffcaba44..b37a70000fb5 100644 --- a/lib/bind/isccfg/Makefile +++ b/lib/bind/isccfg/Makefile @@ -13,8 +13,8 @@ SRCS= log.c namedconf.c parser.c version.c CFLAGS+= -I${SRCDIR}/include -I${.CURDIR} -I${.CURDIR}/.. -DPADD= ${LIBPTHREAD} -LDADD= -lpthread +DPADD= ${PTHREAD_DPADD} +LDADD= ${PTHREAD_LDADD} INCS= ${SRCDIR}/include/isccfg/cfg.h \ ${SRCDIR}/include/isccfg/grammar.h \ diff --git a/lib/bind/lwres/Makefile b/lib/bind/lwres/Makefile index 4a2b6ee37d01..c8594c65e0b5 100644 --- a/lib/bind/lwres/Makefile +++ b/lib/bind/lwres/Makefile @@ -18,8 +18,8 @@ SRCS+= context.c gai_strerror.c getaddrinfo.c gethost.c \ CFLAGS+= -I${SRCDIR}/unix/include -I${SRCDIR}/include CFLAGS+= -I${.CURDIR} -I${.CURDIR}/.. -DPADD= ${LIBPTHREAD} -LDADD= -lpthread +DPADD= ${PTHREAD_DPADD} +LDADD= ${PTHREAD_LDADD} INCS= ${SRCDIR}/include/lwres/context.h \ ${SRCDIR}/include/lwres/int.h \ diff --git a/usr.bin/dig/Makefile b/usr.bin/dig/Makefile index 3e45ca566db7..0d5b4ca7d1ce 100644 --- a/usr.bin/dig/Makefile +++ b/usr.bin/dig/Makefile @@ -13,8 +13,8 @@ SRCS+= dig.c dighost.c CFLAGS+= -I${SRCDIR}/include -DPADD+= ${BIND_DPADD} -LDADD+= ${BIND_LDADD} +DPADD+= ${BIND_DPADD} ${CRYPTO_DPADD} ${PTHREAD_DPADD} +LDADD+= ${BIND_LDADD} ${CRYPTO_LDADD} ${PTHREAD_LDADD} MAN= dig.1 diff --git a/usr.bin/host/Makefile b/usr.bin/host/Makefile index b4d07ad96455..e3a034d66bcd 100644 --- a/usr.bin/host/Makefile +++ b/usr.bin/host/Makefile @@ -13,8 +13,8 @@ SRCS+= dighost.c host.c CFLAGS+= -I${SRCDIR}/include -DPADD+= ${BIND_DPADD} -LDADD+= ${BIND_LDADD} +DPADD+= ${BIND_DPADD} ${CRYPTO_DPADD} ${PTHREAD_DPADD} +LDADD+= ${BIND_LDADD} ${CRYPTO_LDADD} ${PTHREAD_LDADD} MAN= host.1 diff --git a/usr.bin/nslookup/Makefile b/usr.bin/nslookup/Makefile index a7bf65ef8a16..e59c71459d9b 100644 --- a/usr.bin/nslookup/Makefile +++ b/usr.bin/nslookup/Makefile @@ -13,8 +13,8 @@ SRCS+= dighost.c nslookup.c CFLAGS+= -I${SRCDIR}/include -DPADD+= ${BIND_DPADD} -LDADD+= ${BIND_LDADD} +DPADD+= ${BIND_DPADD} ${CRYPTO_DPADD} ${PTHREAD_DPADD} +LDADD+= ${BIND_LDADD} ${CRYPTO_LDADD} ${PTHREAD_LDADD} MAN= nslookup.1 diff --git a/usr.bin/nsupdate/Makefile b/usr.bin/nsupdate/Makefile index 9073c12c2f58..8612a0d20464 100644 --- a/usr.bin/nsupdate/Makefile +++ b/usr.bin/nsupdate/Makefile @@ -13,8 +13,8 @@ SRCS+= nsupdate.c CFLAGS+= -I${SRCDIR}/include -DPADD+= ${BIND_DPADD} -LDADD+= ${BIND_LDADD} +DPADD+= ${BIND_DPADD} ${CRYPTO_DPADD} ${PTHREAD_DPADD} +LDADD+= ${BIND_LDADD} ${CRYPTO_LDADD} ${PTHREAD_LDADD} MAN= nsupdate.8 diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile index 8f14162a2567..bcc25b8c66d0 100644 --- a/usr.sbin/Makefile +++ b/usr.sbin/Makefile @@ -195,9 +195,12 @@ _atm= atm #_bsnmpd= bsnmpd .endif +.if !defined(NO_BIND) && !defined(NOCRYPT) +_dnssec-keygen= dnssec-keygen +_dnssec-signzone= dnssec-signzone +.endif + .if !defined(NO_BIND) -#_dnssec-keygen= dnssec-keygen -#_dnssec-signzone= dnssec-signzone _named= named _named.reload= named.reload _named-checkconf= named-checkconf diff --git a/usr.sbin/dnssec-keygen/Makefile b/usr.sbin/dnssec-keygen/Makefile new file mode 100644 index 000000000000..0c357dfc0a85 --- /dev/null +++ b/usr.sbin/dnssec-keygen/Makefile @@ -0,0 +1,21 @@ +# $FreeBSD$ + +BIND_DIR= ${.CURDIR}/../../contrib/bind9 +LIB_BIND_DIR= ${.CURDIR}/../../lib/bind +SRCDIR= ${BIND_DIR}/bin/dnssec + +.include "${LIB_BIND_DIR}/config.mk" + +PROG= dnssec-keygen + +.PATH: ${SRCDIR} +SRCS+= dnssec-keygen.c dnssectool.c + +CFLAGS+= -I${SRCDIR}/unix/include -I${SRCDIR}/include + +DPADD+= ${BIND_DPADD} ${CRYPTO_DPADD} ${PTHREAD_DPADD} +LDADD+= ${BIND_LDADD} ${CRYPTO_LDADD} ${PTHREAD_LDADD} + +MAN= dnssec-keygen.8 + +.include diff --git a/usr.sbin/dnssec-signzone/Makefile b/usr.sbin/dnssec-signzone/Makefile new file mode 100644 index 000000000000..c8dd6a946759 --- /dev/null +++ b/usr.sbin/dnssec-signzone/Makefile @@ -0,0 +1,21 @@ +# $FreeBSD$ + +BIND_DIR= ${.CURDIR}/../../contrib/bind9 +LIB_BIND_DIR= ${.CURDIR}/../../lib/bind +SRCDIR= ${BIND_DIR}/bin/dnssec + +.include "${LIB_BIND_DIR}/config.mk" + +PROG= dnssec-signzone + +.PATH: ${SRCDIR} +SRCS+= dnssec-signzone.c dnssectool.c + +CFLAGS+= -I${SRCDIR}/unix/include -I${SRCDIR}/include + +DPADD+= ${BIND_DPADD} ${CRYPTO_DPADD} ${PTHREAD_DPADD} +LDADD+= ${BIND_LDADD} ${CRYPTO_LDADD} ${PTHREAD_LDADD} + +MAN= dnssec-signzone.8 + +.include diff --git a/usr.sbin/named-checkconf/Makefile b/usr.sbin/named-checkconf/Makefile index 957915942c80..a478ba038284 100644 --- a/usr.sbin/named-checkconf/Makefile +++ b/usr.sbin/named-checkconf/Makefile @@ -13,8 +13,8 @@ SRCS+= named-checkconf.c check-tool.c CFLAGS+= -I${LIB_BIND_DIR} -DPADD+= ${BIND_DPADD} -LDADD+= ${BIND_LDADD} +DPADD+= ${BIND_DPADD} ${CRYPTO_DPADD} ${PTHREAD_DPADD} +LDADD+= ${BIND_LDADD} ${CRYPTO_LDADD} ${PTHREAD_LDADD} MAN= named-checkconf.8 diff --git a/usr.sbin/named-checkzone/Makefile b/usr.sbin/named-checkzone/Makefile index abde0cc83723..0531457aa62f 100644 --- a/usr.sbin/named-checkzone/Makefile +++ b/usr.sbin/named-checkzone/Makefile @@ -13,8 +13,8 @@ SRCS+= named-checkzone.c check-tool.c CFLAGS+= -I${LIB_BIND_DIR} -DPADD+= ${BIND_DPADD} -LDADD+= ${BIND_LDADD} +DPADD+= ${BIND_DPADD} ${CRYPTO_DPADD} ${PTHREAD_DPADD} +LDADD+= ${BIND_LDADD} ${CRYPTO_LDADD} ${PTHREAD_LDADD} MAN= named-checkzone.8 diff --git a/usr.sbin/named/Makefile b/usr.sbin/named/Makefile index 9976151206d1..12c7c8f8787f 100644 --- a/usr.sbin/named/Makefile +++ b/usr.sbin/named/Makefile @@ -23,8 +23,8 @@ SRCS+= aclconf.c builtin.c client.c config.c control.c \ CFLAGS+= -I${SRCDIR}/unix/include -I${SRCDIR}/include -I${LIB_BIND_DIR} -DPADD+= ${BIND_DPADD} -LDADD+= ${BIND_LDADD} +DPADD+= ${BIND_DPADD} ${CRYPTO_DPADD} ${PTHREAD_DPADD} +LDADD+= ${BIND_LDADD} ${CRYPTO_LDADD} ${PTHREAD_LDADD} MAN= named.8 lwresd.8 named.conf.5 diff --git a/usr.sbin/rndc-confgen/Makefile b/usr.sbin/rndc-confgen/Makefile index ae91ecf2ac36..e69cb46b908d 100644 --- a/usr.sbin/rndc-confgen/Makefile +++ b/usr.sbin/rndc-confgen/Makefile @@ -16,8 +16,8 @@ SRCS+= rndc-confgen.c util.c CFLAGS+= -I${SRCDIR}/unix/include -I${SRCDIR}/include -I${LIB_BIND_DIR} -DPADD+= ${BIND_DPADD} -LDADD+= ${BIND_LDADD} +DPADD+= ${BIND_DPADD} ${CRYPTO_DPADD} ${PTHREAD_DPADD} +LDADD+= ${BIND_LDADD} ${CRYPTO_LDADD} ${PTHREAD_LDADD} MAN= rndc-confgen.8 diff --git a/usr.sbin/rndc/Makefile b/usr.sbin/rndc/Makefile index b4e801b3c5b1..0fd49c15f1a0 100644 --- a/usr.sbin/rndc/Makefile +++ b/usr.sbin/rndc/Makefile @@ -16,8 +16,8 @@ SRCS+= rndc.c util.c CFLAGS+= -I${SRCDIR}/unix/include -I${SRCDIR}/include -I${LIB_BIND_DIR} -DPADD+= ${BIND_DPADD} -LDADD+= ${BIND_LDADD} +DPADD+= ${BIND_DPADD} ${CRYPTO_DPADD} ${PTHREAD_DPADD} +LDADD+= ${BIND_LDADD} ${CRYPTO_LDADD} ${PTHREAD_LDADD} MAN= rndc.8 rndc.conf.5