zrhoffman / rpms / 389-ds-base

Forked from rpms/389-ds-base 3 years ago
Clone
Blob Blame History Raw
From fffbb3d39a2ea12a2b3a72c729e76c1e69a19d8f Mon Sep 17 00:00:00 2001
From: Mark Reynolds <mreynolds@redhat.com>
Date: Mon, 27 Mar 2017 14:33:17 -0400
Subject: [PATCH] Ticket 49177 - rpm would not create valid pkgconfig files

    Bug Description:  pkgconfig from the rpm was not valid.

    Fix Description:  Resolve an issue in the way we handle the file
    substiution to resolve this issue.

    https://pagure.io/389-ds-base/issue/49177
---
 Makefile.am                | 10 ++--------
 configure.ac               |  3 +++
 m4/mozldap.m4              |  4 ++++
 m4/openldap.m4             |  4 ++++
 src/pkgconfig/dirsrv.pc.in |  4 ++++
 5 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 4a4b2d3..982dd28 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -110,14 +110,12 @@ if OPENLDAP
 # shared lib _fini for one will stomp on the other, and the program will crash
 LDAPSDK_LINK_NOTHR = @openldap_lib@ -lldap@ol_libver@ @ldap_lib_ldif@ -llber@ol_libver@
 LDAPSDK_LINK = @openldap_lib@ -lldap_r@ol_libver@ @ldap_lib_ldif@ -llber@ol_libver@
-ldaplib = openldap
-ldaplib_defs = -DUSE_OPENLDAP
 else
 LDAPSDK_LINK = @ldapsdk_lib@ -lssldap60 -lprldap60 -lldap60 -lldif60
 LDAPSDK_LINK_NOTHR = $(LDAPSDK_LINK)
-ldaplib = mozldap
-ldaplib_defs =
 endif
+ldaplib = @ldaplib@
+ldaplib_defs = @ldaplib_defs@
 
 DB_LINK = @db_lib@ -ldb-@db_libver@
 SASL_LINK = @sasl_lib@ -lsasl2
@@ -2237,10 +2235,6 @@ else
 	$(fixupcmd) $^ | sed -n -e 's/@preamble@//' -e '/^#/{p;d;}' -e '/^$$/{p;d;}' -e 's/^\([^=]*\)\(=.*\)$$/\1\2 ; export \1/ ; p' > $@
 endif
 
-%/$(PACKAGE_NAME).pc: %/dirsrv.pc.in
-	if [ ! -d $(dir $@) ] ; then mkdir -p $(dir $@) ; fi
-	$(fixupcmd) $^ > $@
-
 %/$(PACKAGE_NAME)-snmp: %/ldap-agent-initscript.in
 	if [ ! -d $(dir $@) ] ; then mkdir -p $(dir $@) ; fi
 	$(fixupcmd) $^ > $@
diff --git a/configure.ac b/configure.ac
index 4e3e9fb..3f2aa75 100644
--- a/configure.ac
+++ b/configure.ac
@@ -785,6 +785,8 @@ AC_SUBST(openldap_inc)
 AC_SUBST(openldap_lib)
 AC_SUBST(openldap_libdir)
 AC_SUBST(openldap_bindir)
+AC_SUBST(ldaplib)
+AC_SUBST(ldaplib_defs)
 AC_SUBST(ldaptool_bindir)
 AC_SUBST(ldaptool_opts)
 AC_SUBST(plainldif_opts)
@@ -853,6 +855,7 @@ if test "$GCC" != yes ; then
 fi
 
 # Build our pkgconfig files
+# This currently conflicts with %.in: rule in Makefile.am, which should be removed eventually.
 AC_CONFIG_FILES([src/pkgconfig/dirsrv.pc src/pkgconfig/nunc-stans.pc src/pkgconfig/libsds.pc])
 
 AC_CONFIG_FILES([Makefile rpm/389-ds-base.spec  ])
diff --git a/m4/mozldap.m4 b/m4/mozldap.m4
index 4352151..8084ed8 100644
--- a/m4/mozldap.m4
+++ b/m4/mozldap.m4
@@ -15,6 +15,8 @@ AC_ARG_WITH(ldapsdk, AS_HELP_STRING([--with-ldapsdk@<:@=PATH@:>@],[Mozilla LDAP
   if test "$withval" = yes
   then
     AC_MSG_RESULT(yes)
+    ldaplib="mozldap"
+    ldaplib_defs=""
   elif test "$withval" = no
   then
     AC_MSG_RESULT(no)
@@ -22,6 +24,8 @@ AC_ARG_WITH(ldapsdk, AS_HELP_STRING([--with-ldapsdk@<:@=PATH@:>@],[Mozilla LDAP
   then
     AC_MSG_RESULT([using $withval])
     LDAPSDKDIR=$withval
+    ldaplib="mozldap"
+    ldaplib_defs=""
     ldapsdk_inc="-I$LDAPSDKDIR/include"
     ldapsdk_lib="-L$LDAPSDKDIR/lib"
     ldapsdk_libdir="$LDAPSDKDIR/lib"
diff --git a/m4/openldap.m4 b/m4/openldap.m4
index 417bf43..f45637c 100644
--- a/m4/openldap.m4
+++ b/m4/openldap.m4
@@ -15,6 +15,8 @@ AC_ARG_WITH(openldap, AS_HELP_STRING([--with-openldap@<:@=PATH@:>@],[Use OpenLDA
   if test "$withval" = yes
   then
     AC_MSG_RESULT([using system OpenLDAP])
+    ldaplib="openldap"
+    ldaplib_defs="-DUSE_OPENLDAP"
   elif test "$withval" = no
   then
     AC_MSG_RESULT(no)
@@ -22,6 +24,8 @@ AC_ARG_WITH(openldap, AS_HELP_STRING([--with-openldap@<:@=PATH@:>@],[Use OpenLDA
   then
     AC_MSG_RESULT([using $withval])
     OPENLDAPDIR=$withval
+    ldaplib="openldap"
+    ldaplib_defs="-DUSE_OPENLDAP"
     openldap_incdir="$OPENLDAPDIR/include"
     openldap_inc="-I$openldap_incdir"
     openldap_lib="-L$OPENLDAPDIR/lib"
diff --git a/src/pkgconfig/dirsrv.pc.in b/src/pkgconfig/dirsrv.pc.in
index 4140031..df433cf 100644
--- a/src/pkgconfig/dirsrv.pc.in
+++ b/src/pkgconfig/dirsrv.pc.in
@@ -1,3 +1,7 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
 ldaplib=@ldaplib@
 
 Name: dirsrv
-- 
2.9.3