summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2012-12-10 13:36:29 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2012-12-10 13:36:29 +0000
commit66f89c335967360f6f1dda35f6c2a96ac81c291a (patch)
tree01f3c1d5bc5f6eb877ef19452e2da07f51ecf96a
parentdcf4232db2afc0b9479d8523fba3935645cc6dad (diff)
downloadpcre-66f89c335967360f6f1dda35f6c2a96ac81c291a.tar.gz
Ensure boolean macros are #undeffed in pcre.h.generic.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1235 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r--ChangeLog4
-rw-r--r--Makefile.am24
-rw-r--r--configure.ac32
-rw-r--r--m4/pcre_visibility.m42
4 files changed, 39 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index 511dc98..32edd41 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,10 @@ Version 8.33 xx-xxxx-201x
2. Applied patch by Daniel Richard G for quashing MSVC warnings to the
CMake config files.
+
+3. Revise the creation of config.h.generic so that all boolean macros are
+ #undefined, whereas non-boolean macros are #ifndef/#endif-ed. This makes
+ overriding via -D on the command line possible.
Version 8.32 30-November-2012
diff --git a/Makefile.am b/Makefile.am
index 37925a0..2372690 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -138,14 +138,16 @@ pcre.h.generic: pcre.h.in configure.ac
cp -p pcre.h $@
# It is more complicated for config.h.generic. We need the version that results
-# from a default configuration. We can get this by doing a configure in a
-# temporary directory. However, some trickery is needed,
-# because the source directory may already be configured. If you
-# just try running configure in a new directory, it complains. For this reason,
-# we move config.status out of the way while doing the default configuration.
-# The resulting config.h is munged by perl to put #ifdefs round any #defines
-# and to get rid of any gcc-specific visibility settings. Make sure that
-# PCRE_EXP_DEFN is unset (in case it has visibility settings).
+# from a default configuration so as to get all the default values for PCRE
+# configuration macros such as MATCH_LIMIT and NEWLINE. We can get this by
+# doing a configure in a temporary directory. However, some trickery is needed,
+# because the source directory may already be configured. If you just try
+# running configure in a new directory, it complains. For this reason, we move
+# config.status out of the way while doing the default configuration. The
+# resulting config.h is munged by perl to put #ifdefs round any #defines for
+# macros with values, and to #undef all boolean macros such as HAVE_xxx and
+# SUPPORT_xxx. We also get rid of any gcc-specific visibility settings. Make
+# sure that PCRE_EXP_DEFN is unset (in case it has visibility settings).
config.h.generic: configure.ac
rm -rf $@ _generic
mkdir _generic
@@ -158,8 +160,10 @@ config.h.generic: configure.ac
-e 'if(/PCRE_EXP_DEFN/){print"/* #undef PCRE_EXP_DEFN */\n";$$blank=0;next;}' \
-e 'if(/to make a symbol visible/){next;}' \
-e 'if(/__attribute__ \(\(visibility/){next;}' \
- -e 'if(/^#define\s(?!PACKAGE)(\w+)/){print"#ifndef $$1\n$$_#endif\n";$$blank=0;}' \
- -e 'else {if(/^\s*$$/){print unless $$blank; $$blank=1;} else{print;$$blank=0;}}' \
+ -e 'if(/LT_OBJDIR/){print"/* This is ignored unless you are using libtool. */\n";}' \
+ -e 'if(/^#define\s((?:HAVE|SUPPORT|STDC)_\w+)/){print"/* #undef $$1 */\n";$$blank=0;next;}' \
+ -e 'if(/^#define\s(?!PACKAGE|VERSION)(\w+)/){print"#ifndef $$1\n$$_#endif\n";$$blank=0;next;}' \
+ -e 'if(/^\s*$$/){print unless $$blank; $$blank=1;} else{print;$$blank=0;}' \
_generic/config.h >$@
rm -rf _generic
diff --git a/configure.ac b/configure.ac
index 9973853..2b012b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -427,20 +427,28 @@ AH_TOP([
can cope with, allowing it to run on SunOS4 and other "close to standard"
systems.
-In environments that support the facilities, config.h.in is converted by
-"configure", or config-cmake.h.in is converted by CMake, into config.h. If you
-are going to build PCRE "by hand" without using "configure" or CMake, you
-should copy the distributed config.h.generic to config.h, and then edit the
-macro definitions to be the way you need them. You must then add
--DHAVE_CONFIG_H to all of your compile commands, so that config.h is included
-at the start of every source.
+In environments that support the GNU autotools, config.h.in is converted into
+config.h by the "configure" script. In environments that use CMake,
+config-cmake.in is converted into config.h. If you are going to build PCRE "by
+hand" without using "configure" or CMake, you should copy the distributed
+config.h.generic to config.h, and edit the macro definitions to be the way you
+need them. You must then add -DHAVE_CONFIG_H to all of your compile commands,
+so that config.h is included at the start of every source.
Alternatively, you can avoid editing by using -D on the compiler command line
-to set the macro values. In this case, you do not have to set -DHAVE_CONFIG_H.
+to set the macro values. In this case, you do not have to set -DHAVE_CONFIG_H,
+but if you do, default values will be taken from config.h for non-boolean
+macros that are not defined on the command line.
-PCRE uses memmove() if HAVE_MEMMOVE is set to 1; otherwise it uses bcopy() if
-HAVE_BCOPY is set to 1. If your system has neither bcopy() nor memmove(), set
-them both to 0; an emulation function will be used. */])
+Boolean macros such as HAVE_STDLIB_H and SUPPORT_PCRE8 should either be defined
+(conventionally to 1) for TRUE, and not defined at all for FALSE. All such
+macros are listed as a commented #undef in config.h.generic. Macros such as
+MATCH_LIMIT, whose actual value is relevant, have defaults defined, but are
+surrounded by #ifndef/#endif lines so that the value can be overridden by -D.
+
+PCRE uses memmove() if HAVE_MEMMOVE is defined; otherwise it uses bcopy() if
+HAVE_BCOPY is defined. If your system has neither bcopy() nor memmove(), make
+sure both macros are undefined; an emulation function will then be used. */])
# Checks for header files.
AC_HEADER_STDC
@@ -838,7 +846,7 @@ fi
if test "$enable_valgrind" = "yes"; then
AC_DEFINE_UNQUOTED([SUPPORT_VALGRIND], [], [
- Valgrind support to find invalid memory reads.])
+ Define to any value for valgrind support to find invalid memory reads.])
fi
# Platform specific issues
diff --git a/m4/pcre_visibility.m4 b/m4/pcre_visibility.m4
index 31f5deb..30aff87 100644
--- a/m4/pcre_visibility.m4
+++ b/m4/pcre_visibility.m4
@@ -85,5 +85,5 @@ AC_DEFUN([PCRE_VISIBILITY],
AC_SUBST([VISIBILITY_CXXFLAGS])
AC_SUBST([HAVE_VISIBILITY])
AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$HAVE_VISIBILITY],
- [Define to 1 or 0, depending whether the compiler supports simple visibility declarations.])
+ [Define to 1 if the compiler supports simple visibility declarations.])
])