[Freeipa-devel] [PATCH][bind-dyndb-ldap] AUTOCONF: Improve detection of bind9 header files
Lukas Slebodnik
lslebodn at redhat.com
Thu Feb 27 14:19:38 UTC 2014
ehlo,
I did some reviews of bind-dyndb-ldap last week and it was little bit annoying
to export special CFLAGS for bind9 header files. It can be automatically
detected in configure script using utility isc-config.
Attached patch should improve this and CFLAGS needn't be exported.
LS
-------------- next part --------------
>From 118301596dadc2ef66437e7c6661c5fb84459611 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Tue, 25 Feb 2014 10:46:50 +0100
Subject: [PATCH] AUTOCONF: Improve detection of bind9 header files
bind9 header files are stored in non-default path (/usr/include/bind9)
There is an utility (isc-config) which can provides cflags.
---
configure.ac | 30 +++++++++++++++++++++++++++++-
contrib/bind-dyndb-ldap.spec | 1 -
src/Makefile.am | 3 ++-
3 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index 91739c03d9d6de2a9c07129ff0d71b024953293b..5b860f62208fae01cd3ee4cb9b585bf89416e5cf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,7 +62,35 @@ int main(void) {
[AC_MSG_ERROR([Cross compiling is not supported.])]
)
-# Older autoconf (2.59, for example) doesn't define docdir
+AC_SUBST(BIND9_CFLAGS)
+AC_SUBST(BIND9_LIBS)
+
+AC_PATH_PROG(ISC_CONFIG, [isc-config.sh])
+AC_MSG_CHECKING([for working isc-config])
+if test -x "$ISC_CONFIG"; then
+ AC_MSG_RESULT([yes]);
+
+ dnl do not override enviroment variables BIND9_CFLAGS BIND9_LIBS
+ if test -z "$BIND9_CFLAGS"; then
+ BIND9_CFLAGS=`$ISC_CONFIG --cflags dns`
+ fi
+ dnl We do not need all libraries suggested by isc-config.sh
+ dnl {-lcrypto, -lcap} are useless
+ dnl BIND9_LIBS=`$ISC_CONFIG --libs dns`
+else
+ AC_MSG_RESULT([no])
+ AC_MSG_WARN([
+Could not detect script isc-config.sh. Compilation may fail.
+Defining variables BIND9_CFLAGS BIND9_LIBS will fix this problem.
+])
+fi
+
+AC_ARG_VAR([BIND9_CFLAGS],
+ [C compiler flags for bind9, overriding isc-config.sh])
+AC_ARG_VAR([BIND9_LIBS],
+ [linker flags for bind9, overriding isc-config.sh])
+
+dnl Older autoconf (2.59, for example) doesn't define docdir
[[ ! -n "$docdir" ]] && docdir='${datadir}/doc/${PACKAGE_TARNAME}'
AC_SUBST([docdir])
diff --git a/contrib/bind-dyndb-ldap.spec b/contrib/bind-dyndb-ldap.spec
index b345b1b5cb6cad99cf2f1c4df7d9f1e2b144548d..12b8004e218a06606a242255ac87b8f2736225ac 100644
--- a/contrib/bind-dyndb-ldap.spec
+++ b/contrib/bind-dyndb-ldap.spec
@@ -27,7 +27,6 @@ off of your LDAP server.
%setup -q -n %{name}-%{VERSION}
%build
-export CFLAGS="`isc-config.sh --cflags dns` $RPM_OPT_FLAGS"
%configure
make %{?_smp_mflags}
diff --git a/src/Makefile.am b/src/Makefile.am
index 6856957f48dbe32750009ab8a32487add05d5c1c..4adf28a2dcdc09223d86c367fad492f7d64a2b13 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -43,6 +43,7 @@ ldap_la_SOURCES = \
zone_manager.c \
zone_register.c
-ldap_la_CFLAGS = -Wall -Wextra @WERROR@ -std=gnu99 -O2
+ldap_la_CFLAGS = $(BIND9_CFLAGS) -Wall -Wextra @WERROR@ -std=gnu99
+ldap_la_LIBADD = $(BIND9_LIBS)
ldap_la_LDFLAGS = -module -avoid-version -Wl,-z,relro,-z,now,-z,noexecstack
--
1.8.5.3
More information about the Freeipa-devel
mailing list