summaryrefslogtreecommitdiffstats
path: root/Makefile.am
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2006-11-15 17:17:39 +0000
committerRich Megginson <rmeggins@redhat.com>2006-11-15 17:17:39 +0000
commita269b9cabbf0e5fc8a5ff8f8d9becba784879ba0 (patch)
treecd868c366b937992a5601aee8e1070f1654e66fc /Makefile.am
parentb45519e60e6b6461c97163780534df715dc1a2b5 (diff)
downloadds-a269b9cabbf0e5fc8a5ff8f8d9becba784879ba0.tar.gz
ds-a269b9cabbf0e5fc8a5ff8f8d9becba784879ba0.tar.xz
ds-a269b9cabbf0e5fc8a5ff8f8d9becba784879ba0.zip
Resolves: bug 215669
Bug Description: Define LIBDIR, BINDIR, etc. in Makefile Reviewed by: nkinder (Thanks!) Fix Description: The paths LIBDIR, BINDIR, et. al. are #define'd in create_instance.h to hard coded values. We should be able to set these values in configure and override the built in values. We can't simply set them via AC_DEFINE in configure.ac because we are using config.h and this would render the definition like this: #define BINDIR "${exec_prefix}/bin" instead of #define BINDIR "/usr/bin" So we instead define them in Makefile.am and add their definitions to AM_CPPFLAGS, and quote them properly to make sure the value includes the quotation marks when expanded in the C code. I tested this with both an rpmbuild and a regular developer type build. Platforms tested: RHEL4/FC5 Flag Day: no Doc impact: no
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am15
1 files changed, 14 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 5d742aa2..81cd6f70 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -9,7 +9,20 @@ PLATFORM_DEFINES = @platform_defs@
DEBUG_DEFINES = @debug_defs@
DS_DEFINES = -DBUILD_NUM=$(BUILDNUM)
DS_INCLUDES = -I$(srcdir)/ldap/include -I$(srcdir)/ldap/servers/slapd -I$(srcdir)/include -I.
-AM_CPPFLAGS = $(PLATFORM_DEFINES) $(DEBUG_DEFINES) $(DS_DEFINES) $(DS_INCLUDES)
+# these paths are dependent on the settings of prefix and exec_prefix which may be specified
+# at make time. So we cannot use AC_DEFINE in the configure.ac because that would set the
+# values prior to their being defined. Defining them here ensures that they are properly
+# expanded before use. See create_instance.h for more details. The quoting ensures that
+# the values are quoted for the shell command, and the value expands to a quoted string
+# value in the header file e.g.
+# #define LOCALSTATEDIR "/var"
+# without the quotes, it would be
+# #define LOCALSTATEDIR /var
+# which would be an error
+PATH_DEFINES = -DLOCALSTATEDIR="\"$(localstatedir)\"" -DSYSCONFDIR="\"$(sysconfdir)\"" \
+ -DLIBDIR="\"$(libdir)\"" -DBINDIR="\"$(bindir)\"" \
+ -DDATADIR="\"$(datadir)\"" -DDOCDIR="\"$(docdir)\""
+AM_CPPFLAGS = $(PLATFORM_DEFINES) $(DEBUG_DEFINES) $(DS_DEFINES) $(DS_INCLUDES) $(PATH_DEFINES)
PLUGIN_CPPFLAGS = $(AM_CPPFLAGS) @ldapsdk_inc@ @nss_inc@ @nspr_inc@
#------------------------