On 24.7.2014 11:00, Petr Spacek wrote:
> On 27.2.2014 15:19, Lukas Slebodnik wrote:
>> 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.
> 
> Kind NACK. It would be valuable to test if isc/errno2result.h header is
> present and throw appropriate error.
> 
> Current check with isc-config.sh only will pass if you have bind-devel package
> installed but you are missing bind-lite-devel package.
> 
> 
> I have a question: How
> +ldap_la_CFLAGS = $(BIND9_CFLAGS) -Wall -Wextra @WERROR@ -std=gnu99
> works?
> 
> Will it take user-defined CFLAGS into account? I would like to place
> user-defined flags at the end of the list so you can easily override settings
> given by autotools.
> 
> Thank you for clarification :-)
> 
> 
> I will be really happy to commit complete fix. Thank you for cleaning this
> autotools mess!

This version actually works. Previous version did not take CFLAGS from
isc-config.sh into account during libdns version check so it actually did not
work at all :-)

Please review it (and send me a modified patch if you see a problem).

Thank you for your time!

-- 
Petr^2 Spacek
From 4b17099abe2169ddb86b24e53cd2769b76f3ea2d Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lsleb...@redhat.com>
Date: Tue, 25 Feb 2014 10:46:50 +0100
Subject: [PATCH] Improve detection of BIND 9 header files and necessary
 CFLAGS.

BIND 9 header files can be stored in non-default path (/usr/include/bind9).
The isc-config.sh utility can provide necessary CFLAGS.
---
 configure.ac                 | 43 ++++++++++++++++++++++++++++++++++---------
 contrib/bind-dyndb-ldap.spec |  1 -
 2 files changed, 34 insertions(+), 10 deletions(-)

diff --git a/configure.ac b/configure.ac
index d471038ada54c07dcfc211c8a2572850e3b28205..c985908c760c974f7c02b6fa3d183e839bbeb9ad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,14 +15,6 @@ m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
 AC_PROG_CC
 AC_PROG_LIBTOOL
 
-# Checks for libraries.
-AC_CHECK_LIB([dns], [dns_name_init], [],
-	AC_MSG_ERROR([Install BIND9 development files]))
-AC_CHECK_LIB([ldap], [ldap_initialize], [],
-	AC_MSG_ERROR([Install OpenLDAP development files]))
-AC_CHECK_LIB([krb5], [krb5_cc_initialize], [],
-	AC_MSG_ERROR([Install Kerberos 5 development files]))
-
 # Checks for header files.
 AC_CHECK_HEADERS([stddef.h stdlib.h string.h strings.h])
 
@@ -47,6 +39,39 @@ AC_TRY_COMPILE([
 [CFLAGS="$SAVED_CFLAGS"
  AC_MSG_RESULT([no])])
 
+# Get CFLAGS from isc-config.sh
+AC_ARG_VAR([BIND9_CFLAGS],
+           [C compiler flags for bind9, overriding isc-config.sh])
+AC_SUBST(BIND9_CFLAGS)
+
+dnl do not override enviroment variables BIND9_CFLAGS
+if test -z "$BIND9_CFLAGS"; then
+	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]);
+		BIND9_CFLAGS=`$ISC_CONFIG --cflags dns`
+		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 variable BIND9_CFLAGS will fix this problem.
+	])
+	fi
+fi
+CFLAGS="$BIND9_CFLAGS $CFLAGS"
+
+# Checks for libraries.
+AC_CHECK_LIB([dns], [dns_name_init], [],
+	AC_MSG_ERROR([Install BIND9 development files]))
+AC_CHECK_LIB([ldap], [ldap_initialize], [],
+	AC_MSG_ERROR([Install OpenLDAP development files]))
+AC_CHECK_LIB([krb5], [krb5_cc_initialize], [],
+	AC_MSG_ERROR([Install Kerberos 5 development files]))
+
 # Check version of libdns
 AC_MSG_CHECKING([libdns version])
 AC_TRY_RUN([
@@ -62,7 +87,7 @@ int main(void) {
 [AC_MSG_ERROR([Cross compiling is not supported.])]
 )
 
-# Older autoconf (2.59, for example) doesn't define docdir
+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 572076597a7597c8495ac7a977f26578e840603e..574519982463d811c482bdaaa70839e2c15e9e12 100644
--- a/contrib/bind-dyndb-ldap.spec
+++ b/contrib/bind-dyndb-ldap.spec
@@ -28,7 +28,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}
 
-- 
2.1.0

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to