/[pcre]/code/trunk/configure.ac
ViewVC logotype

Diff of /code/trunk/configure.ac

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 96 by nigel, Fri Mar 2 13:10:43 2007 UTC revision 912 by ph10, Sun Feb 12 16:53:39 2012 UTC
# Line 1  Line 1 
1  dnl Process this file with autoconf to produce a configure script.  dnl Process this file with autoconf to produce a configure script.
2    
3  dnl This configure.in file has been hacked around quite a lot as a result of  dnl NOTE FOR MAINTAINERS: Do not use minor version numbers 08 or 09 because
4  dnl patches that various people have sent to me (PH). Sometimes the information  dnl the leading zeros may cause them to be treated as invalid octal constants
5  dnl I get is contradictory. I've tried to put in comments that explain things,  dnl if a PCRE user writes code that uses PCRE_MINOR as a number. There is now
6  dnl but in some cases the information is second-hand and I have no way of  dnl a check further down that throws an error if 08 or 09 are used.
7  dnl verifying it. I am not an autoconf or libtool expert!  
8    dnl The PCRE_PRERELEASE feature is for identifying release candidates. It might
9    dnl be defined as -RC2, for example. For real releases, it should be empty.
10    
11    m4_define(pcre_major, [8])
12    m4_define(pcre_minor, [31])
13    m4_define(pcre_prerelease, [-RC1])
14    m4_define(pcre_date, [2012-02-012])
15    
16    # NOTE: The CMakeLists.txt file searches for the above variables in the first
17    # 50 lines of this file. Please update that if the variables above are moved.
18    
19    # Libtool shared library interface versions (current:revision:age)
20    m4_define(libpcre_version, [1:0:0])
21    m4_define(libpcre16_version, [0:0:0])
22    m4_define(libpcreposix_version, [0:0:0])
23    m4_define(libpcrecpp_version, [0:0:0])
24    
25  dnl This is required at the start; the name is the name of a file  AC_PREREQ(2.57)
26  dnl it should be seeing, to verify it is in the same directory.  AC_INIT(PCRE, pcre_major.pcre_minor[]pcre_prerelease, , pcre)
27    AC_CONFIG_SRCDIR([pcre.h.in])
28    AM_INIT_AUTOMAKE([dist-bzip2 dist-zip])
29    m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
30    AC_CONFIG_HEADERS(config.h)
31    
32    # This was added at the suggestion of libtoolize (03-Jan-10)
33    AC_CONFIG_MACRO_DIR([m4])
34    
35    # The default CFLAGS and CXXFLAGS in Autoconf are "-g -O2" for gcc and just
36    # "-g" for any other compiler. There doesn't seem to be a standard way of
37    # getting rid of the -g (which I don't think is needed for a production
38    # library). This fudge seems to achieve the necessary. First, we remember the
39    # externally set values of CFLAGS and CXXFLAGS. Then call the AC_PROG_CC and
40    # AC_PROG_CXX macros to find the compilers - if CFLAGS and CXXFLAGS are not
41    # set, they will be set to Autoconf's defaults. Afterwards, if the original
42    # values were not set, remove the -g from the Autoconf defaults.
43    # (PH 02-May-07)
44    
45  AC_INIT(dftables.c)  remember_set_CFLAGS="$CFLAGS"
46  AC_CONFIG_SRCDIR([pcre.h])  remember_set_CXXFLAGS="$CXXFLAGS"
47    
48  dnl A safety precaution  AC_PROG_CC
49    AC_PROG_CXX
50    
51  AC_PREREQ(2.57)  if test "x$remember_set_CFLAGS" = "x"
52    then
53      if test "$CFLAGS" = "-g -O2"
54      then
55        CFLAGS="-O2"
56      elif test "$CFLAGS" = "-g"
57      then
58        CFLAGS=""
59      fi
60    fi
61    
62  dnl Arrange to build config.h from config.h.in.  if test "x$remember_set_CXXFLAGS" = "x"
63  dnl Manual says this macro should come right after AC_INIT.  then
64  AC_CONFIG_HEADER(config.h)    if test "$CXXFLAGS" = "-g -O2"
65      then
66        CXXFLAGS="-O2"
67      elif test "$CXXFLAGS" = "-g"
68      then
69        CXXFLAGS=""
70      fi
71    fi
72    
73    # AC_PROG_CXX will return "g++" even if no c++ compiler is installed.
74    # Check for that case, and just disable c++ code if g++ doesn't run.
75    AC_LANG_PUSH(C++)
76    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],, CXX=""; CXXCP=""; CXXFLAGS="")
77    AC_LANG_POP
78    
79  dnl Default values for miscellaneous macros  # Check for a 64-bit integer type
80    AC_TYPE_INT64_T
81    
82  POSIX_MALLOC_THRESHOLD=-DPOSIX_MALLOC_THRESHOLD=10  AC_PROG_INSTALL
83    AC_LIBTOOL_WIN32_DLL
84    LT_INIT
85    AC_PROG_LN_S
86    
87  dnl Provide versioning information for libtool shared libraries that  PCRE_MAJOR="pcre_major"
88  dnl are built by default on Unix systems.  PCRE_MINOR="pcre_minor"
89    PCRE_PRERELEASE="pcre_prerelease"
90    PCRE_DATE="pcre_date"
91    
92  PCRE_LIB_VERSION=0:1:0  if test "$PCRE_MINOR" = "08" -o "$PCRE_MINOR" = "09"
93  PCRE_POSIXLIB_VERSION=0:0:0  then
94  PCRE_CPPLIB_VERSION=0:0:0    echo "***"
95      echo "*** Minor version number $PCRE_MINOR must not be used. ***"
96      echo "*** Use only 01 to 07 or 10 onwards, to avoid octal issues. ***"
97      echo "***"
98      exit 1
99    fi
100    
101  dnl Find the PCRE version from the pcre.h file. The PCRE_VERSION variable is  AC_SUBST(PCRE_MAJOR)
102  dnl substituted in pcre-config.in.  AC_SUBST(PCRE_MINOR)
103    AC_SUBST(PCRE_PRERELEASE)
104    AC_SUBST(PCRE_DATE)
105    
106  PCRE_MAJOR=`grep '#define PCRE_MAJOR' ${srcdir}/pcre.h | cut -c 29-`  # Set a more sensible default value for $(htmldir).
107  PCRE_MINOR=`grep '#define PCRE_MINOR' ${srcdir}/pcre.h | cut -c 29-`  if test "x$htmldir" = 'x${docdir}'
108  PCRE_PRERELEASE=`grep '#define PCRE_PRERELEASE' ${srcdir}/pcre.h | cut -c 29-`  then
109  PCRE_VERSION=${PCRE_MAJOR}.${PCRE_MINOR}${PCRE_PRERELEASE}    htmldir='${docdir}/html'
110    fi
111    
112  dnl Handle --disable-cpp  # Handle --disable-pcre8 (enabled by default)
113    AC_ARG_ENABLE(pcre8,
114                  AS_HELP_STRING([--disable-pcre8],
115                                 [disable 8 bit character support]),
116                  , enable_pcre8=unset)
117    AC_SUBST(enable_pcre8)
118    
119    # Handle --enable-pcre16 (disabled by default)
120    AC_ARG_ENABLE(pcre16,
121                  AS_HELP_STRING([--enable-pcre16],
122                                 [enable 16 bit character support]),
123                  , enable_pcre16=unset)
124    AC_SUBST(enable_pcre16)
125    
126    # Handle --disable-cpp. The substitution of enable_cpp is needed for use in
127    # pcre-config.
128  AC_ARG_ENABLE(cpp,  AC_ARG_ENABLE(cpp,
129  [  --disable-cpp           disable C++ support],                AS_HELP_STRING([--disable-cpp],
130  want_cpp="$enableval", want_cpp=yes)                               [disable C++ support]),
131                  , enable_cpp=unset)
132  dnl Checks for programs.  AC_SUBST(enable_cpp)
133    
134  AC_PROG_CC  # Handle --enable-jit (disabled by default)
135    AC_ARG_ENABLE(jit,
136                  AS_HELP_STRING([--enable-jit],
137                                 [enable Just-In-Time compiling support]),
138                  , enable_jit=no)
139    
140    # Handle --disable-pcregrep-jit (enabled by default)
141    AC_ARG_ENABLE(pcregrep-jit,
142                  AS_HELP_STRING([--disable-pcregrep-jit],
143                                 [disable JIT support in pcregrep]),
144                  , enable_pcregrep_jit=yes)
145    
146    # Handle --enable-rebuild-chartables
147    AC_ARG_ENABLE(rebuild-chartables,
148                  AS_HELP_STRING([--enable-rebuild-chartables],
149                                 [rebuild character tables in current locale]),
150                  , enable_rebuild_chartables=no)
151    
152  dnl Test for C++ for the C++ wrapper libpcrecpp. It seems, however, that  # Handle --enable-utf8 (disabled by default)
153  dnl AC_PROC_CXX will set $CXX to "g++" when no C++ compiler is installed, even  AC_ARG_ENABLE(utf8,
154  dnl though that is completely bogus. (This may happen only on certain systems                AS_HELP_STRING([--enable-utf8],
155  dnl with certain versions of autoconf, of course.) An attempt to include this                               [another name for --enable-utf. Kept only for compatibility reasons]),
156  dnl test inside a check for want_cpp was criticized by a libtool expert, who                , enable_utf8=unset)
157  dnl tells me that it isn't allowed.  
158    # Handle --enable-utf (disabled by default)
159    AC_ARG_ENABLE(utf,
160                  AS_HELP_STRING([--enable-utf],
161                                 [enable UTF-8/16 support (incompatible with --enable-ebcdic)]),
162                  , enable_utf=unset)
163    
164  AC_PROG_CXX  # Handle --enable-unicode-properties
165    AC_ARG_ENABLE(unicode-properties,
166                  AS_HELP_STRING([--enable-unicode-properties],
167                                 [enable Unicode properties support (implies --enable-utf)]),
168                  , enable_unicode_properties=no)
169    
170    # Handle --enable-newline=NL
171    dnl AC_ARG_ENABLE(newline,
172    dnl               AS_HELP_STRING([--enable-newline=NL],
173    dnl                              [use NL as newline (lf, cr, crlf, anycrlf, any; default=lf)]),
174    dnl               , enable_newline=lf)
175    
176  dnl The icc compiler has the same options as gcc, so let the rest of the  # Separate newline options
177  dnl configure script think it has gcc when setting up dnl options etc.  ac_pcre_newline=lf
178  dnl This is a nasty hack which no longer seems necessary with the update  AC_ARG_ENABLE(newline-is-cr,
179  dnl to the latest libtool files, so I have commented it out.                AS_HELP_STRING([--enable-newline-is-cr],
180  dnl                               [use CR as newline character]),
181  dnl if test "$CC" = "icc" ; then GCC=yes ; fi                ac_pcre_newline=cr)
182    AC_ARG_ENABLE(newline-is-lf,
183                  AS_HELP_STRING([--enable-newline-is-lf],
184                                 [use LF as newline character (default)]),
185                  ac_pcre_newline=lf)
186    AC_ARG_ENABLE(newline-is-crlf,
187                  AS_HELP_STRING([--enable-newline-is-crlf],
188                                 [use CRLF as newline sequence]),
189                  ac_pcre_newline=crlf)
190    AC_ARG_ENABLE(newline-is-anycrlf,
191                  AS_HELP_STRING([--enable-newline-is-anycrlf],
192                                 [use CR, LF, or CRLF as newline sequence]),
193                  ac_pcre_newline=anycrlf)
194    AC_ARG_ENABLE(newline-is-any,
195                  AS_HELP_STRING([--enable-newline-is-any],
196                                 [use any valid Unicode newline sequence]),
197                  ac_pcre_newline=any)
198    enable_newline="$ac_pcre_newline"
199    
200    # Handle --enable-bsr-anycrlf
201    AC_ARG_ENABLE(bsr-anycrlf,
202                  AS_HELP_STRING([--enable-bsr-anycrlf],
203                                 [\R matches only CR, LF, CRLF by default]),
204                  , enable_bsr_anycrlf=no)
205    
206  AC_PROG_INSTALL  # Handle --enable-ebcdic
207  AC_LIBTOOL_WIN32_DLL  AC_ARG_ENABLE(ebcdic,
208  AC_PROG_LIBTOOL                AS_HELP_STRING([--enable-ebcdic],
209                                 [assume EBCDIC coding rather than ASCII; incompatible with --enable-utf; use only in (uncommon) EBCDIC environments; it implies --enable-rebuild-chartables]),
210                  , enable_ebcdic=no)
211    
212  dnl We need to find a compiler for compiling a program to run on the local host  # Handle --disable-stack-for-recursion
213  dnl while building. It needs to be different from CC when cross-compiling.  AC_ARG_ENABLE(stack-for-recursion,
214  dnl There is a macro called AC_PROG_CC_FOR_BUILD in the GNU archive for                AS_HELP_STRING([--disable-stack-for-recursion],
215  dnl figuring this out automatically. Unfortunately, it does not work with the                               [don't use stack recursion when matching]),
216  dnl latest versions of autoconf. So for the moment, we just default to the                , enable_stack_for_recursion=yes)
217  dnl same values as the "main" compiler. People who are cross-compiling will  
218  dnl just have to adjust the Makefile by hand or set these values when they  # Handle --enable-pcregrep-libz
219  dnl run "configure".  AC_ARG_ENABLE(pcregrep-libz,
220                  AS_HELP_STRING([--enable-pcregrep-libz],
221  CC_FOR_BUILD=${CC_FOR_BUILD:-'$(CC)'}                               [link pcregrep with libz to handle .gz files]),
222  CXX_FOR_BUILD=${CXX_FOR_BUILD:-'$(CXX)'}                , enable_pcregrep_libz=no)
223  CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD:-'$(CFLAGS)'}  
224  CPPFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD:-'$(CPPFLAGS)'}  # Handle --enable-pcregrep-libbz2
225  CXXFLAGS_FOR_BUILD=${CXXFLAGS_FOR_BUILD:-'$(CXXFLAGS)'}  AC_ARG_ENABLE(pcregrep-libbz2,
226  BUILD_EXEEXT=${BUILD_EXEEXT:-'$(EXEEXT)'}                AS_HELP_STRING([--enable-pcregrep-libbz2],
227  BUILD_OBJEXT=${BUILD_OBJEXT:-'$(OBJEXT)'}                               [link pcregrep with libbz2 to handle .bz2 files]),
228                  , enable_pcregrep_libbz2=no)
229    
230    # Handle --with-pcregrep-bufsize=N
231    AC_ARG_WITH(pcregrep-bufsize,
232                  AS_HELP_STRING([--with-pcregrep-bufsize=N],
233                                 [pcregrep buffer size (default=20480)]),
234                  , with_pcregrep_bufsize=20480)
235    
236    # Handle --enable-pcretest-libreadline
237    AC_ARG_ENABLE(pcretest-libreadline,
238                  AS_HELP_STRING([--enable-pcretest-libreadline],
239                                 [link pcretest with libreadline]),
240                  , enable_pcretest_libreadline=no)
241    
242  dnl Checks for header files.  # Handle --with-posix-malloc-threshold=NBYTES
243    AC_ARG_WITH(posix-malloc-threshold,
244                AS_HELP_STRING([--with-posix-malloc-threshold=NBYTES],
245                               [threshold for POSIX malloc usage (default=10)]),
246                , with_posix_malloc_threshold=10)
247    
248  AC_HEADER_STDC  # Handle --with-link-size=N
249  AC_CHECK_HEADERS(limits.h)  AC_ARG_WITH(link-size,
250                AS_HELP_STRING([--with-link-size=N],
251                               [internal link size (2, 3, or 4 allowed; default=2)]),
252                , with_link_size=2)
253    
254  dnl The files below are C++ header files. One person told me (PH) that  # Handle --with-match-limit=N
255  dnl AC_LANG_CPLUSPLUS unsets CXX if it was explicitly set to something which  AC_ARG_WITH(match-limit,
256  dnl doesn't work. However, this doesn't always seem to be the case.              AS_HELP_STRING([--with-match-limit=N],
257                               [default limit on internal looping (default=10000000)]),
258                , with_match_limit=10000000)
259    
260    # Handle --with-match-limit_recursion=N
261    #
262    # Note: In config.h, the default is to define MATCH_LIMIT_RECURSION
263    # symbolically as MATCH_LIMIT, which in turn is defined to be some numeric
264    # value (e.g. 10000000). MATCH_LIMIT_RECURSION can otherwise be set to some
265    # different numeric value (or even the same numeric value as MATCH_LIMIT,
266    # though no longer defined in terms of the latter).
267    #
268    AC_ARG_WITH(match-limit-recursion,
269                AS_HELP_STRING([--with-match-limit-recursion=N],
270                               [default limit on internal recursion (default=MATCH_LIMIT)]),
271                , with_match_limit_recursion=MATCH_LIMIT)
272    
273  if test "x$want_cpp" = "xyes" -a -n "$CXX"  # Copy enable_utf8 value to enable_utf for compatibility reasons
274    if test "x$enable_utf8" != "xunset"
275  then  then
276  AC_LANG_SAVE    if test "x$enable_utf" != "xunset"
277  AC_LANG_CPLUSPLUS    then
278        AC_MSG_ERROR([--enable/disable-utf8 is kept only for compatibility reasons and its value is copied to --enable/disable-utf. Newer code must use --enable/disable-utf alone.])
279  dnl We could be more clever here, given we're doing AC_SUBST with this    fi
280  dnl (eg set a var to be the name of the include file we want).  But we're not    enable_utf=$enable_utf8
 dnl so it's easy to change back to 'regular' autoconf vars if we needed to.  
 AC_CHECK_HEADERS(string, [pcre_have_cpp_headers="1"],  
                          [pcre_have_cpp_headers="0"])  
 AC_CHECK_HEADERS(bits/type_traits.h, [pcre_have_bits_type_traits="1"],  
                                      [pcre_have_bits_type_traits="0"])  
 AC_CHECK_HEADERS(type_traits.h, [pcre_have_type_traits="1"],  
                                 [pcre_have_type_traits="0"])  
 dnl Using AC_SUBST eliminates the need to include config.h in a public .h file  
 AC_SUBST(pcre_have_bits_type_traits)  
 AC_SUBST(pcre_have_type_traits)  
 AC_LANG_RESTORE  
281  fi  fi
282    
283  dnl From the above, we now have enough info to know if C++ is fully installed  # Set the default value for pcre8
284  if test "x$want_cpp" = "xyes" -a -n "$CXX" -a "$pcre_have_cpp_headers" = 1; then  if test "x$enable_pcre8" = "xunset"
285    MAYBE_CPP_TARGETS='$(CPP_TARGETS)'  then
286    HAVE_CPP=    enable_pcre8=yes
 else  
   MAYBE_CPP_TARGETS=  
   HAVE_CPP="#"  
287  fi  fi
 AC_SUBST(MAYBE_CPP_TARGETS)  
 AC_SUBST(HAVE_CPP)  
   
 dnl Checks for typedefs, structures, and compiler characteristics.  
   
 AC_C_CONST  
 AC_TYPE_SIZE_T  
288    
289  AC_CHECK_TYPES([long long], [pcre_have_long_long="1"], [pcre_have_long_long="0"])  # Set the default value for pcre16
290  AC_CHECK_TYPES([unsigned long long], [pcre_have_ulong_long="1"], [pcre_have_ulong_long="0"])  if test "x$enable_pcre16" = "xunset"
291  AC_SUBST(pcre_have_long_long)  then
292  AC_SUBST(pcre_have_ulong_long)    enable_pcre16=no
   
 dnl Checks for library functions.  
   
 AC_CHECK_FUNCS(bcopy memmove strerror strtoq strtoll)  
   
 dnl Handle --enable-utf8  
   
 AC_ARG_ENABLE(utf8,  
 [  --enable-utf8           enable UTF8 support],  
 if test "$enableval" = "yes"; then  
   UTF8=-DSUPPORT_UTF8  
293  fi  fi
 )  
   
 dnl Handle --enable-unicode-properties  
294    
295  AC_ARG_ENABLE(unicode-properties,  # Make sure enable_pcre8 or enable_pcre16 was set
296  [  --enable-unicode-properties  enable Unicode properties support],  if test "x$enable_pcre8$enable_pcre16" = "xnono"
297  if test "$enableval" = "yes"; then  then
298    UCP=-DSUPPORT_UCP    AC_MSG_ERROR([Either 8 or 16 bit (or both) pcre library must be enabled])
299  fi  fi
 )  
   
 dnl Handle --enable-newline-is-cr  
300    
301  AC_ARG_ENABLE(newline-is-cr,  # Make sure that if enable_unicode_properties was set, that UTF support is enabled.
302  [  --enable-newline-is-cr  use CR as the newline character],  if test "x$enable_unicode_properties" = "xyes"
303  if test "$enableval" = "yes"; then  then
304    NEWLINE=-DNEWLINE=13    if test "x$enable_utf" = "xno"
305      then
306        AC_MSG_ERROR([support for Unicode properties requires UTF-8/16 support])
307      fi
308      enable_utf=yes
309  fi  fi
 )  
310    
311  dnl Handle --enable-newline-is-lf  # enable_utf is disabled by default.
312    if test "x$enable_utf" = "xunset"
313  AC_ARG_ENABLE(newline-is-lf,  then
314  [  --enable-newline-is-lf  use LF as the newline character],    enable_utf=no
 if test "$enableval" = "yes"; then  
   NEWLINE=-DNEWLINE=10  
315  fi  fi
 )  
316    
317  dnl Handle --enable-newline-is-crlf  # enable_cpp copies the value of enable_pcre8 by default
318    if test "x$enable_cpp" = "xunset"
319    then
320      enable_cpp=$enable_pcre8
321    fi
322    
323  AC_ARG_ENABLE(newline-is-crlf,  # Make sure that if enable_cpp was set, that enable_pcre8 support is enabled
324  [  --enable-newline-is-crlf  use CRLF as the newline sequence],  if test "x$enable_cpp" = "xyes"
325  if test "$enableval" = "yes"; then  then
326    NEWLINE=-DNEWLINE=3338    if test "x$enable_pcre8" = "xno"
327      then
328        AC_MSG_ERROR([C++ library requires pcre library with 8 bit characters])
329      fi
330  fi  fi
 )  
331    
332  dnl Handle --enable-newline-is-any  # Make sure that if enable_ebcdic is set, rebuild_chartables is also enabled.
333    # Also check that UTF support is not requested, because PCRE cannot handle
334    # EBCDIC and UTF in the same build. To do so it would need to use different
335    # character constants depending on the mode.
336    #
337    if test "x$enable_ebcdic" = "xyes"
338    then
339      enable_rebuild_chartables=yes
340      if test "x$enable_utf" = "xyes"
341      then
342        AC_MSG_ERROR([support for EBCDIC and UTF-8/16 cannot be enabled at the same time])
343      fi
344    fi
345    
346    # Convert the newline identifier into the appropriate integer value.
347    case "$enable_newline" in
348      lf)      ac_pcre_newline_value=10   ;;
349      cr)      ac_pcre_newline_value=13   ;;
350      crlf)    ac_pcre_newline_value=3338 ;;
351      anycrlf) ac_pcre_newline_value=-2   ;;
352      any)     ac_pcre_newline_value=-1   ;;
353      *)
354      AC_MSG_ERROR([invalid argument \"$enable_newline\" to --enable-newline option])
355      ;;
356    esac
357    
358  AC_ARG_ENABLE(newline-is-any,  # Check argument to --with-link-size
359  [  --enable-newline-is-any  use any Unicode newline sequence],  case "$with_link_size" in
360  if test "$enableval" = "yes"; then    2|3|4) ;;
361    NEWLINE=-DNEWLINE=-1    *)
362  fi    AC_MSG_ERROR([invalid argument \"$with_link_size\" to --with-link-size option])
363  )    ;;
364    esac
365    
366  dnl Handle --enable-ebcdic  AH_TOP([
367    /* On Unix-like systems config.h.in is converted by "configure" into config.h.
368    Some other environments also support the use of "configure". PCRE is written in
369    Standard C, but there are a few non-standard things it can cope with, allowing
370    it to run on SunOS4 and other "close to standard" systems.
371    
372    If you are going to build PCRE "by hand" on a system without "configure" you
373    should copy the distributed config.h.generic to config.h, and then set up the
374    macro definitions the way you need them. You must then add -DHAVE_CONFIG_H to
375    all of your compile commands, so that config.h is included at the start of
376    every source.
377    
378    Alternatively, you can avoid editing by using -D on the compiler command line
379    to set the macro values. In this case, you do not have to set -DHAVE_CONFIG_H.
380    
381    PCRE uses memmove() if HAVE_MEMMOVE is set to 1; otherwise it uses bcopy() if
382    HAVE_BCOPY is set to 1. If your system has neither bcopy() nor memmove(), set
383    them both to 0; an emulation function will be used. */])
384    
385  AC_ARG_ENABLE(ebcdic,  # Checks for header files.
386  [  --enable-ebcdic         assume EBCDIC coding rather than ASCII],  AC_HEADER_STDC
387  if test "$enableval" = "yes"; then  AC_CHECK_HEADERS(limits.h sys/types.h sys/stat.h dirent.h windows.h)
   EBCDIC=-DEBCDIC=1  
 fi  
 )  
388    
389  dnl Handle --disable-stack-for-recursion  # The files below are C++ header files.
390    pcre_have_type_traits="0"
391    pcre_have_bits_type_traits="0"
392    if test "x$enable_cpp" = "xyes" -a -n "$CXX"
393    then
394    AC_LANG_PUSH(C++)
395    
396  AC_ARG_ENABLE(stack-for-recursion,  # Older versions of pcre defined pcrecpp::no_arg, but in new versions
397  [  --disable-stack-for-recursion  disable use of stack recursion when matching],  # it's called pcrecpp::RE::no_arg.  For backwards ABI compatibility,
398  if test "$enableval" = "no"; then  # we want to make one an alias for the other.  Different systems do
399    NO_RECURSE=-DNO_RECURSE  # this in different ways.  Some systems, for instance, can do it via
400    # a linker flag: -alias (for os x 10.5) or -i (for os x <=10.4).
401    OLD_LDFLAGS="$LDFLAGS"
402    for flag in "-alias,__ZN7pcrecpp2RE6no_argE,__ZN7pcrecpp6no_argE" \
403                "-i__ZN7pcrecpp6no_argE:__ZN7pcrecpp2RE6no_argE"; do
404      AC_MSG_CHECKING([for alias support in the linker])
405      LDFLAGS="$OLD_LDFLAGS -Wl,$flag"
406      # We try to run the linker with this new ld flag.  If the link fails,
407      # we give up and remove the new flag from LDFLAGS.
408      AC_LINK_IFELSE([AC_LANG_PROGRAM([namespace pcrecpp {
409                                        class RE { static int no_arg; };
410                                        int RE::no_arg;
411                                      }],
412                                     [])],
413                     [AC_MSG_RESULT([yes]);
414                      EXTRA_LIBPCRECPP_LDFLAGS="$EXTRA_LIBPCRECPP_LDFLAGS -Wl,$flag";
415                      break;],
416                     AC_MSG_RESULT([no]))
417    done
418    LDFLAGS="$OLD_LDFLAGS"
419    
420    # We could be more clever here, given we're doing AC_SUBST with this
421    # (eg set a var to be the name of the include file we want). But we're not
422    # so it's easy to change back to 'regular' autoconf vars if we needed to.
423    AC_CHECK_HEADERS(string, [pcre_have_cpp_headers="1"],
424                             [pcre_have_cpp_headers="0"])
425    AC_CHECK_HEADERS(bits/type_traits.h, [pcre_have_bits_type_traits="1"],
426                                         [pcre_have_bits_type_traits="0"])
427    AC_CHECK_HEADERS(type_traits.h, [pcre_have_type_traits="1"],
428                                    [pcre_have_type_traits="0"])
429    
430    # (This isn't c++-specific, but is only used in pcrecpp.cc, so try this
431    # in a c++ context.  This matters becuase strtoimax is C99 and may not
432    # be supported by the C++ compiler.)
433    # Figure out how to create a longlong from a string: strtoll and
434    # equiv.  It's not enough to call AC_CHECK_FUNCS: hpux has a
435    # strtoll, for instance, but it only takes 2 args instead of 3!
436    # We have to call AH_TEMPLATE since AC_DEFINE_UNQUOTED below is complex.
437    AH_TEMPLATE(HAVE_STRTOQ, [Define to 1 if you have `strtoq'.])
438    AH_TEMPLATE(HAVE_STRTOLL, [Define to 1 if you have `strtoll'.])
439    AH_TEMPLATE(HAVE__STRTOI64, [Define to 1 if you have `_strtoi64'.])
440    AH_TEMPLATE(HAVE_STRTOIMAX, [Define to 1 if you have `strtoimax'.])
441    have_strto_fn=0
442    for fn in strtoq strtoll _strtoi64 strtoimax; do
443      AC_MSG_CHECKING([for $fn])
444      if test "$fn" = strtoimax; then
445        include=stdint.h
446      else
447        include=stdlib.h
448      fi
449      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <$include>],
450                                        [char* e; return $fn("100", &e, 10)])],
451                        [AC_MSG_RESULT(yes)
452                         AC_DEFINE_UNQUOTED(HAVE_`echo $fn | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`, 1,
453                                            [Define to 1 if you have `$fn'.])
454                         have_strto_fn=1
455                         break],
456                        [AC_MSG_RESULT(no)])
457    done
458    
459    if test "$have_strto_fn" = 1; then
460      AC_CHECK_TYPES([long long],
461                     [pcre_have_long_long="1"],
462                     [pcre_have_long_long="0"])
463      AC_CHECK_TYPES([unsigned long long],
464                     [pcre_have_ulong_long="1"],
465                     [pcre_have_ulong_long="0"])
466    else
467      pcre_have_long_long="0"
468      pcre_have_ulong_long="0"
469  fi  fi
470  )  AC_SUBST(pcre_have_long_long)
471    AC_SUBST(pcre_have_ulong_long)
472    
473  dnl There doesn't seem to be a straightforward way of having parameters  AC_LANG_POP
474  dnl that set values, other than fudging the --with thing. So that's what  fi
475  dnl I've done.  # Using AC_SUBST eliminates the need to include config.h in a public .h file
476    AC_SUBST(pcre_have_type_traits)
477    AC_SUBST(pcre_have_bits_type_traits)
478    
479  dnl Handle --with-posix-malloc-threshold=n  # Conditional compilation
480    AM_CONDITIONAL(WITH_PCRE8, test "x$enable_pcre8" = "xyes")
481    AM_CONDITIONAL(WITH_PCRE16, test "x$enable_pcre16" = "xyes")
482    AM_CONDITIONAL(WITH_PCRE_CPP, test "x$enable_cpp" = "xyes")
483    AM_CONDITIONAL(WITH_REBUILD_CHARTABLES, test "x$enable_rebuild_chartables" = "xyes")
484    AM_CONDITIONAL(WITH_JIT, test "x$enable_jit" = "xyes")
485    AM_CONDITIONAL(WITH_UTF, test "x$enable_utf" = "xyes")
486    
487  AC_ARG_WITH(posix-malloc-threshold,  # Checks for typedefs, structures, and compiler characteristics.
 [  --with-posix-malloc-threshold=10  threshold for POSIX malloc usage],  
   POSIX_MALLOC_THRESHOLD=-DPOSIX_MALLOC_THRESHOLD=$withval  
 )  
488    
489  dnl Handle --with-link-size=n  AC_C_CONST
490    AC_TYPE_SIZE_T
491    
492  AC_ARG_WITH(link-size,  # Checks for library functions.
 [  --with-link-size=2    internal link size (2, 3, or 4 allowed)],  
   LINK_SIZE=-DLINK_SIZE=$withval  
 )  
493    
494  dnl Handle --with-match-limit=n  AC_CHECK_FUNCS(bcopy memmove strerror)
495    
496  AC_ARG_WITH(match-limit,  # Check for the availability of libz (aka zlib)
 [  --with-match-limit=10000000  default limit on internal looping],  
   MATCH_LIMIT=-DMATCH_LIMIT=$withval  
 )  
497    
498  dnl Handle --with-match-limit_recursion=n  AC_CHECK_HEADERS([zlib.h], [HAVE_ZLIB_H=1])
499    AC_CHECK_LIB([z], [gzopen], [HAVE_LIBZ=1])
500    
501  AC_ARG_WITH(match-limit-recursion,  # Check for the availability of libbz2. Originally we just used AC_CHECK_LIB,
502  [  --with-match-limit-recursion=10000000  default limit on internal recursion],  # as for libz. However, this had the following problem, diagnosed and fixed by
503    MATCH_LIMIT_RECURSION=-DMATCH_LIMIT_RECURSION=$withval  # a user:
504  )  #
505    #   - libbz2 uses the Pascal calling convention (WINAPI) for the functions
506    #     under Win32.
507    #   - The standard autoconf AC_CHECK_LIB fails to include "bzlib.h",
508    #     therefore missing the function definition.
509    #   - The compiler thus generates a "C" signature for the test function.
510    #   - The linker fails to find the "C" function.
511    #   - PCRE fails to configure if asked to do so against libbz2.
512    #
513    # Solution:
514    #
515    #   - Replace the AC_CHECK_LIB test with a custom test.
516    
517    AC_CHECK_HEADERS([bzlib.h], [HAVE_BZLIB_H=1])
518    # Original test
519    # AC_CHECK_LIB([bz2], [BZ2_bzopen], [HAVE_LIBBZ2=1])
520    #
521    # Custom test follows
522    
523    AC_MSG_CHECKING([for libbz2])
524    OLD_LIBS="$LIBS"
525    LIBS="$LIBS -lbz2"
526    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
527    #ifdef HAVE_BZLIB_H
528    #include <bzlib.h>
529    #endif]],
530    [[return (int)BZ2_bzopen("conftest", "rb");]])],
531    [AC_MSG_RESULT([yes]);HAVE_LIBBZ2=1; break;],
532    AC_MSG_RESULT([no]))
533    LIBS="$OLD_LIBS"
534    
535    # Check for the availabiity of libreadline
536    
537    AC_CHECK_HEADERS([readline/readline.h], [HAVE_READLINE_H=1])
538    AC_CHECK_HEADERS([readline/history.h], [HAVE_HISTORY_H=1])
539    AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lreadline"],
540      [unset ac_cv_lib_readline_readline;
541       AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-ltinfo"],
542        [unset ac_cv_lib_readline_readline;
543         AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lcurses"],
544          [unset ac_cv_lib_readline_readline;
545           AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lncurses"],
546            [unset ac_cv_lib_readline_readline;
547             AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lncursesw"],
548              [unset ac_cv_lib_readline_readline;
549               AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-ltermcap"],
550                [LIBREADLINE=""],
551                [-ltermcap])],
552              [-lncursesw])],
553            [-lncurses])],
554          [-lcurses])],
555        [-ltinfo])])
556    AC_SUBST(LIBREADLINE)
557    if test -n "$LIBREADLINE"; then
558      if test "$LIBREADLINE" != "-lreadline"; then
559        echo "-lreadline needs $LIBREADLINE"
560        LIBREADLINE="-lreadline $LIBREADLINE"
561      fi
562    fi
563    
564  dnl Unicode character property support implies UTF-8 support  # This facilitates -ansi builds under Linux
565    dnl AC_DEFINE([_GNU_SOURCE], [], [Enable GNU extensions in glibc])
566    
567  if test "$UCP" != "" ; then  PCRE_STATIC_CFLAG=""
568    UTF8=-DSUPPORT_UTF8  if test "x$enable_shared" = "xno" ; then
569      AC_DEFINE([PCRE_STATIC], [1], [
570        Define if linking statically (TODO: make nice with Libtool)])
571      PCRE_STATIC_CFLAG="-DPCRE_STATIC"
572  fi  fi
573    AC_SUBST(PCRE_STATIC_CFLAG)
574    
575    # Here is where pcre specific defines are handled
576    
577  dnl "Export" these variables  if test "$enable_pcre8" = "yes"; then
578      AC_DEFINE([SUPPORT_PCRE8], [], [
579        Define to enable the 8 bit PCRE library.])
580    fi
581    
582  AC_SUBST(BUILD_EXEEXT)  if test "$enable_pcre16" = "yes"; then
583  AC_SUBST(BUILD_OBJEXT)    AC_DEFINE([SUPPORT_PCRE16], [], [
584  AC_SUBST(CC_FOR_BUILD)      Define to enable the 16 bit PCRE library.])
585  AC_SUBST(CXX_FOR_BUILD)  fi
 AC_SUBST(CFLAGS_FOR_BUILD)  
 AC_SUBST(CXXFLAGS_FOR_BUILD)  
 AC_SUBST(CXXLDFLAGS)  
 AC_SUBST(EBCDIC)  
 AC_SUBST(HAVE_MEMMOVE)  
 AC_SUBST(HAVE_STRERROR)  
 AC_SUBST(LINK_SIZE)  
 AC_SUBST(MATCH_LIMIT)  
 AC_SUBST(MATCH_LIMIT_RECURSION)  
 AC_SUBST(NEWLINE)  
 AC_SUBST(NO_RECURSE)  
 AC_SUBST(PCRE_LIB_VERSION)  
 AC_SUBST(PCRE_POSIXLIB_VERSION)  
 AC_SUBST(PCRE_CPPLIB_VERSION)  
 AC_SUBST(PCRE_VERSION)  
 AC_SUBST(POSIX_MALLOC_THRESHOLD)  
 AC_SUBST(UCP)  
 AC_SUBST(UTF8)  
586    
587  dnl Stuff to make MinGW work better. Special treatment is no longer  if test "$enable_jit" = "yes"; then
588  dnl needed for Cygwin.    AC_DEFINE([SUPPORT_JIT], [], [
589        Define to enable support for Just-In-Time compiling.])
590    else
591      enable_pcregrep_jit="no"
592    fi
593    
594    if test "$enable_pcregrep_jit" = "yes"; then
595      AC_DEFINE([SUPPORT_PCREGREP_JIT], [], [
596        Define to enable JIT support in pcregrep.])
597    fi
598    
599    if test "$enable_utf" = "yes"; then
600      AC_DEFINE([SUPPORT_UTF], [], [
601        Define to enable support for the UTF-8/16 Unicode encoding. This
602        will work even in an EBCDIC environment, but it is incompatible
603        with the EBCDIC macro. That is, PCRE can support *either* EBCDIC
604        code *or* ASCII/UTF-8/16, but not both at once.])
605    fi
606    
607    if test "$enable_unicode_properties" = "yes"; then
608      AC_DEFINE([SUPPORT_UCP], [], [
609        Define to enable support for Unicode properties.])
610    fi
611    
612    if test "$enable_stack_for_recursion" = "no"; then
613      AC_DEFINE([NO_RECURSE], [], [
614        PCRE uses recursive function calls to handle backtracking while
615        matching. This can sometimes be a problem on systems that have
616        stacks of limited size. Define NO_RECURSE to get a version that
617        doesn't use recursion in the match() function; instead it creates
618        its own stack by steam using pcre_recurse_malloc() to obtain memory
619        from the heap. For more detail, see the comments and other stuff
620        just above the match() function. On systems that support it,
621        "configure" can be used to set this in the Makefile
622        (use --disable-stack-for-recursion).])
623    fi
624    
625    if test "$enable_pcregrep_libz" = "yes"; then
626      AC_DEFINE([SUPPORT_LIBZ], [], [
627        Define to allow pcregrep to be linked with libz, so that it is
628        able to handle .gz files.])
629    fi
630    
631    if test "$enable_pcregrep_libbz2" = "yes"; then
632      AC_DEFINE([SUPPORT_LIBBZ2], [], [
633        Define to allow pcregrep to be linked with libbz2, so that it is
634        able to handle .bz2 files.])
635    fi
636    
637    if test $with_pcregrep_bufsize -lt 8192 ; then
638      with_pcregrep_bufsize="8192"
639    fi
640    
641    AC_DEFINE_UNQUOTED([PCREGREP_BUFSIZE], [$with_pcregrep_bufsize], [
642      The value of PCREGREP_BUFSIZE determines the size of buffer used by
643      pcregrep to hold parts of the file it is searching. On systems that
644      support it, "configure" can be used to override the default, which is
645      8192. This is also the minimum value. The actual amount of memory used by
646      pcregrep is three times this number, because it allows for the buffering of
647      "before" and "after" lines.])
648    
649    if test "$enable_pcretest_libreadline" = "yes"; then
650      AC_DEFINE([SUPPORT_LIBREADLINE], [], [
651        Define to allow pcretest to be linked with libreadline.])
652    fi
653    
654    AC_DEFINE_UNQUOTED([NEWLINE], [$ac_pcre_newline_value], [
655      The value of NEWLINE determines the newline character sequence. On
656      systems that support it, "configure" can be used to override the
657      default, which is 10. The possible values are 10 (LF), 13 (CR),
658      3338 (CRLF), -1 (ANY), or -2 (ANYCRLF).])
659    
660    if test "$enable_bsr_anycrlf" = "yes"; then
661      AC_DEFINE([BSR_ANYCRLF], [], [
662        By default, the \R escape sequence matches any Unicode line ending
663        character or sequence of characters. If BSR_ANYCRLF is defined, this is
664        changed so that backslash-R matches only CR, LF, or CRLF. The build-
665        time default can be overridden by the user of PCRE at runtime. On
666        systems that support it, "configure" can be used to override the
667        default.])
668    fi
669    
670    AC_DEFINE_UNQUOTED([LINK_SIZE], [$with_link_size], [
671      The value of LINK_SIZE determines the number of bytes used to store
672      links as offsets within the compiled regex. The default is 2, which
673      allows for compiled patterns up to 64K long. This covers the vast
674      majority of cases. However, PCRE can also be compiled to use 3 or 4
675      bytes instead. This allows for longer patterns in extreme cases. On
676      systems that support it, "configure" can be used to override this default.])
677    
678    AC_DEFINE_UNQUOTED([POSIX_MALLOC_THRESHOLD], [$with_posix_malloc_threshold], [
679      When calling PCRE via the POSIX interface, additional working storage
680      is required for holding the pointers to capturing substrings because
681      PCRE requires three integers per substring, whereas the POSIX
682      interface provides only two. If the number of expected substrings is
683      small, the wrapper function uses space on the stack, because this is
684      faster than using malloc() for each call. The threshold above which
685      the stack is no longer used is defined by POSIX_MALLOC_THRESHOLD. On
686      systems that support it, "configure" can be used to override this
687      default.])
688    
689    AC_DEFINE_UNQUOTED([MATCH_LIMIT], [$with_match_limit], [
690      The value of MATCH_LIMIT determines the default number of times the
691      internal match() function can be called during a single execution of
692      pcre_exec(). There is a runtime interface for setting a different
693      limit. The limit exists in order to catch runaway regular
694      expressions that take for ever to determine that they do not match.
695      The default is set very large so that it does not accidentally catch
696      legitimate cases. On systems that support it, "configure" can be
697      used to override this default default.])
698    
699    AC_DEFINE_UNQUOTED([MATCH_LIMIT_RECURSION], [$with_match_limit_recursion], [
700      The above limit applies to all calls of match(), whether or not they
701      increase the recursion depth. In some environments it is desirable
702      to limit the depth of recursive calls of match() more strictly, in
703      order to restrict the maximum amount of stack (or heap, if
704      NO_RECURSE is defined) that is used. The value of
705      MATCH_LIMIT_RECURSION applies only to recursive calls of match(). To
706      have any useful effect, it must be less than the value of
707      MATCH_LIMIT. The default is to use the same value as MATCH_LIMIT.
708      There is a runtime method for setting a different limit. On systems
709      that support it, "configure" can be used to override the default.])
710    
711    AC_DEFINE([MAX_NAME_SIZE], [32], [
712      This limit is parameterized just in case anybody ever wants to
713      change it. Care must be taken if it is increased, because it guards
714      against integer overflow caused by enormously large patterns.])
715    
716    AC_DEFINE([MAX_NAME_COUNT], [10000], [
717      This limit is parameterized just in case anybody ever wants to
718      change it. Care must be taken if it is increased, because it guards
719      against integer overflow caused by enormously large patterns.])
720    
721    AH_VERBATIM([PCRE_EXP_DEFN], [
722    /* If you are compiling for a system other than a Unix-like system or
723       Win32, and it needs some magic to be inserted before the definition
724       of a function that is exported by the library, define this macro to
725       contain the relevant magic. If you do not define this macro, it
726       defaults to "extern" for a C compiler and "extern C" for a C++
727       compiler on non-Win32 systems. This macro apears at the start of
728       every exported function that is part of the external API. It does
729       not appear on functions that are "external" in the C sense, but
730       which are internal to the library. */
731    #undef PCRE_EXP_DEFN])
732    
733    if test "$enable_ebcdic" = "yes"; then
734      AC_DEFINE_UNQUOTED([EBCDIC], [], [
735        If you are compiling for a system that uses EBCDIC instead of ASCII
736        character codes, define this macro as 1. On systems that can use
737        "configure", this can be done via --enable-ebcdic. PCRE will then
738        assume that all input strings are in EBCDIC. If you do not define
739        this macro, PCRE will assume input strings are ASCII or UTF-8/16
740        Unicode. It is not possible to build a version of PCRE that
741        supports both EBCDIC and UTF-8/16.])
742    fi
743    
744    # Platform specific issues
745    NO_UNDEFINED=
746    EXPORT_ALL_SYMBOLS=
747  case $host_os in  case $host_os in
748  mingw* )    cygwin* | mingw* )
749      POSIX_OBJ=pcreposix.o      if test X"$enable_shared" = Xyes; then
750      POSIX_LOBJ=pcreposix.lo        NO_UNDEFINED="-no-undefined"
751      POSIX_LIB=        EXPORT_ALL_SYMBOLS="-Wl,--export-all-symbols"
752      ON_WINDOWS=      fi
     NOT_ON_WINDOWS="#"  
     WIN_PREFIX=  
     ;;  
 * )  
     ON_WINDOWS="#"  
     NOT_ON_WINDOWS=  
     POSIX_OBJ=  
     POSIX_LOBJ=  
     POSIX_LIB=libpcreposix.la  
     WIN_PREFIX=  
753      ;;      ;;
754  esac  esac
 AC_SUBST(WIN_PREFIX)  
 AC_SUBST(ON_WINDOWS)  
 AC_SUBST(NOT_ON_WINDOWS)  
 AC_SUBST(POSIX_OBJ)  
 AC_SUBST(POSIX_LOBJ)  
 AC_SUBST(POSIX_LIB)  
755    
756  if test "x$enable_shared" = "xno" ; then  # The extra LDFLAGS for each particular library
757      AC_DEFINE([PCRE_STATIC],[1],[to link statically])  # (Note: The libpcre*_version bits are m4 variables, assigned above)
758  fi  
759    EXTRA_LIBPCRE_LDFLAGS="$EXTRA_LIBPCRE_LDFLAGS \
760                           $NO_UNDEFINED -version-info libpcre_version"
761    
762    EXTRA_LIBPCRE16_LDFLAGS="$EXTRA_LIBPCRE16_LDFLAGS \
763                           $NO_UNDEFINED -version-info libpcre16_version"
764    
765    EXTRA_LIBPCREPOSIX_LDFLAGS="$EXTRA_LIBPCREPOSIX_LDFLAGS \
766                                $NO_UNDEFINED -version-info libpcreposix_version"
767    
768    EXTRA_LIBPCRECPP_LDFLAGS="$EXTRA_LIBPCRECPP_LDFLAGS \
769                              $NO_UNDEFINED -version-info libpcrecpp_version \
770                              $EXPORT_ALL_SYMBOLS"
771    
772    AC_SUBST(EXTRA_LIBPCRE_LDFLAGS)
773    AC_SUBST(EXTRA_LIBPCRE16_LDFLAGS)
774    AC_SUBST(EXTRA_LIBPCREPOSIX_LDFLAGS)
775    AC_SUBST(EXTRA_LIBPCRECPP_LDFLAGS)
776    
777    # When we run 'make distcheck', use these arguments. Turning off compiler
778    # optimization makes it run faster.
779    DISTCHECK_CONFIGURE_FLAGS="CFLAGS='' CXXFLAGS='' --enable-pcre16 --enable-jit --enable-cpp --enable-unicode-properties"
780    AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)
781    
782    # Check that, if --enable-pcregrep-libz or --enable-pcregrep-libbz2 is
783    # specified, the relevant library is available.
784    
785    if test "$enable_pcregrep_libz" = "yes"; then
786      if test "$HAVE_ZLIB_H" != "1"; then
787        echo "** Cannot --enable-pcregrep-libz because zlib.h was not found"
788        exit 1
789      fi
790      if test "$HAVE_LIBZ" != "1"; then
791        echo "** Cannot --enable-pcregrep-libz because libz was not found"
792        exit 1
793      fi
794      LIBZ="-lz"
795    fi
796    AC_SUBST(LIBZ)
797    
798    if test "$enable_pcregrep_libbz2" = "yes"; then
799      if test "$HAVE_BZLIB_H" != "1"; then
800        echo "** Cannot --enable-pcregrep-libbz2 because bzlib.h was not found"
801        exit 1
802      fi
803      if test "$HAVE_LIBBZ2" != "1"; then
804        echo "** Cannot --enable-pcregrep-libbz2 because libbz2 was not found"
805        exit 1
806      fi
807      LIBBZ2="-lbz2"
808    fi
809    AC_SUBST(LIBBZ2)
810    
811    # Similarly for --enable-pcretest-readline
812    
813    if test "$enable_pcretest_libreadline" = "yes"; then
814      if test "$HAVE_READLINE_H" != "1"; then
815        echo "** Cannot --enable-pcretest-readline because readline/readline.h was not found."
816        exit 1
817      fi
818      if test "$HAVE_HISTORY_H" != "1"; then
819        echo "** Cannot --enable-pcretest-readline because readline/history.h was not found."
820        exit 1
821      fi
822      if test -z "$LIBREADLINE"; then
823        echo "** Cannot --enable-pcretest-readline because readline library was not found."
824        exit 1
825      fi
826    fi
827    
828    # Produce these files, in addition to config.h.
829    AC_CONFIG_FILES(
830            Makefile
831            libpcre.pc
832            libpcre16.pc
833            libpcreposix.pc
834            libpcrecpp.pc
835            pcre-config
836            pcre.h
837            pcre_stringpiece.h
838            pcrecpparg.h
839    )
840    
841    # Make the generated script files executable.
842    AC_CONFIG_COMMANDS([script-chmod], [chmod a+x pcre-config])
843    
844    # Make sure that pcre_chartables.c is removed in case the method for
845    # creating it was changed by reconfiguration.
846    AC_CONFIG_COMMANDS([delete-old-chartables], [rm -f pcre_chartables.c])
847    
848    AC_OUTPUT
849    
850    # Print out a nice little message after configure is run displaying your
851    # chosen options.
852    
853    cat <<EOF
854    
855    $PACKAGE-$VERSION configuration summary:
856    
857        Install prefix .................. : ${prefix}
858        C preprocessor .................. : ${CPP}
859        C compiler ...................... : ${CC}
860        C++ preprocessor ................ : ${CXXCPP}
861        C++ compiler .................... : ${CXX}
862        Linker .......................... : ${LD}
863        C preprocessor flags ............ : ${CPPFLAGS}
864        C compiler flags ................ : ${CFLAGS}
865        C++ compiler flags .............. : ${CXXFLAGS}
866        Linker flags .................... : ${LDFLAGS}
867        Extra libraries ................. : ${LIBS}
868    
869        Build 8 bit pcre library ........ : ${enable_pcre8}
870        Build 16 bit pcre library ....... : ${enable_pcre16}
871        Build C++ library ............... : ${enable_cpp}
872        Enable JIT compiling support .... : ${enable_jit}
873        Enable UTF-8/16 support ......... : ${enable_utf}
874        Unicode properties .............. : ${enable_unicode_properties}
875        Newline char/sequence ........... : ${enable_newline}
876        \R matches only ANYCRLF ......... : ${enable_bsr_anycrlf}
877        EBCDIC coding ................... : ${enable_ebcdic}
878        Rebuild char tables ............. : ${enable_rebuild_chartables}
879        Use stack recursion ............. : ${enable_stack_for_recursion}
880        POSIX mem threshold ............. : ${with_posix_malloc_threshold}
881        Internal link size .............. : ${with_link_size}
882        Match limit ..................... : ${with_match_limit}
883        Match limit recursion ........... : ${with_match_limit_recursion}
884        Build shared libs ............... : ${enable_shared}
885        Build static libs ............... : ${enable_static}
886        Use JIT in pcregrep ............. : ${enable_pcregrep_jit}
887        Buffer size for pcregrep ........ : ${with_pcregrep_bufsize}
888        Link pcregrep with libz ......... : ${enable_pcregrep_libz}
889        Link pcregrep with libbz2 ....... : ${enable_pcregrep_libbz2}
890        Link pcretest with libreadline .. : ${enable_pcretest_libreadline}
891    
892    EOF
893    
894  dnl This must be last; it determines what files are written as well as config.h  dnl end configure.ac
 AC_OUTPUT(Makefile pcre-config:pcre-config.in libpcre.pc:libpcre.pc.in libpcrecpp.pc:libpcrecpp.pc.in pcrecpparg.h:pcrecpparg.h.in pcre_stringpiece.h:pcre_stringpiece.h.in RunGrepTest:RunGrepTest.in RunTest:RunTest.in,[chmod a+x RunTest RunGrepTest pcre-config])  

Legend:
Removed from v.96  
changed lines
  Added in v.912

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12