/[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 231 by ph10, Tue Sep 11 11:15:33 2007 UTC revision 1320 by ph10, Wed May 1 16:39:35 2013 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 NOTE FOR MAINTAINERS: Do not use major or minor version numbers with  dnl NOTE FOR MAINTAINERS: Do not use minor version numbers 08 or 09 because
4  dnl leading zeros, because they may be treated as octal constants. The  dnl the leading zeros may cause them to be treated as invalid octal constants
5  dnl PCRE_PRERELEASE feature is for identifying release candidates. It might  dnl if a PCRE user writes code that uses PCRE_MINOR as a number. There is now
6  dnl be defined as -RC2, for example. For real releases, it should be defined  dnl a check further down that throws an error if 08 or 09 are used.
 dnl empty.  
7    
8  m4_define(pcre_major, [7])  dnl The PCRE_PRERELEASE feature is for identifying release candidates. It might
9  m4_define(pcre_minor, [4])  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, [33])
13  m4_define(pcre_prerelease, [-RC1])  m4_define(pcre_prerelease, [-RC1])
14  m4_define(pcre_date, [2007-09-10])  m4_define(pcre_date, [2013-04-28])
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)  # Libtool shared library interface versions (current:revision:age)
20  m4_define(libpcre_version, [0:1:0])  m4_define(libpcre_version, [3:1:2])
21  m4_define(libpcreposix_version, [0:0:0])  m4_define(libpcre16_version, [2:1:2])
22    m4_define(libpcre32_version, [0:1:0])
23    m4_define(libpcreposix_version, [0:2:0])
24  m4_define(libpcrecpp_version, [0:0:0])  m4_define(libpcrecpp_version, [0:0:0])
25    
26  AC_PREREQ(2.57)  AC_PREREQ(2.57)
27  AC_INIT(PCRE, pcre_major.pcre_minor[]pcre_prerelease, , pcre)  AC_INIT(PCRE, pcre_major.pcre_minor[]pcre_prerelease, , pcre)
28  AC_CONFIG_SRCDIR([pcre.h.in])  AC_CONFIG_SRCDIR([pcre.h.in])
29  AM_INIT_AUTOMAKE([dist-bzip2 dist-zip])  AM_INIT_AUTOMAKE([dist-bzip2 dist-zip])
30    m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
31  AC_CONFIG_HEADERS(config.h)  AC_CONFIG_HEADERS(config.h)
32    
33    # This is a new thing required to stop a warning from automake 1.12
34    m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
35    
36    # This was added at the suggestion of libtoolize (03-Jan-10)
37    AC_CONFIG_MACRO_DIR([m4])
38    
39  # The default CFLAGS and CXXFLAGS in Autoconf are "-g -O2" for gcc and just  # The default CFLAGS and CXXFLAGS in Autoconf are "-g -O2" for gcc and just
40  # "-g" for any other compiler. There doesn't seem to be a standard way of  # "-g" for any other compiler. There doesn't seem to be a standard way of
41  # getting rid of the -g (which I don't think is needed for a production  # getting rid of the -g (which I don't think is needed for a production
# Line 37  remember_set_CXXFLAGS="$CXXFLAGS" Line 51  remember_set_CXXFLAGS="$CXXFLAGS"
51    
52  AC_PROG_CC  AC_PROG_CC
53  AC_PROG_CXX  AC_PROG_CXX
54    AM_PROG_CC_C_O
55    
56  if test "x$remember_set_CFLAGS" = "x"  if test "x$remember_set_CFLAGS" = "x"
57  then  then
# Line 60  then Line 75  then
75    fi    fi
76  fi  fi
77    
78    # AC_PROG_CXX will return "g++" even if no c++ compiler is installed.
79    # Check for that case, and just disable c++ code if g++ doesn't run.
80    AC_LANG_PUSH(C++)
81    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],, CXX=""; CXXCP=""; CXXFLAGS="")
82    AC_LANG_POP
83    
84    # Check for a 64-bit integer type
85    AC_TYPE_INT64_T
86    
87  AC_PROG_INSTALL  AC_PROG_INSTALL
88  AC_LIBTOOL_WIN32_DLL  AC_LIBTOOL_WIN32_DLL
89  AC_PROG_LIBTOOL  LT_INIT
90  AC_PROG_LN_S  AC_PROG_LN_S
91    
92    # Check for GCC visibility feature
93    
94    PCRE_VISIBILITY
95    
96    # Versioning
97    
98  PCRE_MAJOR="pcre_major"  PCRE_MAJOR="pcre_major"
99  PCRE_MINOR="pcre_minor"  PCRE_MINOR="pcre_minor"
100  PCRE_PRERELEASE="pcre_prerelease"  PCRE_PRERELEASE="pcre_prerelease"
101  PCRE_DATE="pcre_date"  PCRE_DATE="pcre_date"
102    
103    if test "$PCRE_MINOR" = "08" -o "$PCRE_MINOR" = "09"
104    then
105      echo "***"
106      echo "*** Minor version number $PCRE_MINOR must not be used. ***"
107      echo "*** Use only 01 to 07 or 10 onwards, to avoid octal issues. ***"
108      echo "***"
109      exit 1
110    fi
111    
112  AC_SUBST(PCRE_MAJOR)  AC_SUBST(PCRE_MAJOR)
113  AC_SUBST(PCRE_MINOR)  AC_SUBST(PCRE_MINOR)
114  AC_SUBST(PCRE_PRERELEASE)  AC_SUBST(PCRE_PRERELEASE)
# Line 82  then Line 120  then
120    htmldir='${docdir}/html'    htmldir='${docdir}/html'
121  fi  fi
122    
123  # Handle --disable-cpp  # Handle --disable-pcre8 (enabled by default)
124    AC_ARG_ENABLE(pcre8,
125                  AS_HELP_STRING([--disable-pcre8],
126                                 [disable 8 bit character support]),
127                  , enable_pcre8=unset)
128    AC_SUBST(enable_pcre8)
129    
130    # Handle --enable-pcre16 (disabled by default)
131    AC_ARG_ENABLE(pcre16,
132                  AS_HELP_STRING([--enable-pcre16],
133                                 [enable 16 bit character support]),
134                  , enable_pcre16=unset)
135    AC_SUBST(enable_pcre16)
136    
137    # Handle --enable-pcre32 (disabled by default)
138    AC_ARG_ENABLE(pcre32,
139                  AS_HELP_STRING([--enable-pcre32],
140                                 [enable 32 bit character support]),
141                  , enable_pcre32=unset)
142    AC_SUBST(enable_pcre32)
143    
144    # Handle --disable-cpp. The substitution of enable_cpp is needed for use in
145    # pcre-config.
146  AC_ARG_ENABLE(cpp,  AC_ARG_ENABLE(cpp,
147                AS_HELP_STRING([--disable-cpp],                AS_HELP_STRING([--disable-cpp],
148                               [disable C++ support]),                               [disable C++ support]),
149                , enable_cpp=yes)                , enable_cpp=unset)
150    AC_SUBST(enable_cpp)
151    
152    # Handle --enable-jit (disabled by default)
153    AC_ARG_ENABLE(jit,
154                  AS_HELP_STRING([--enable-jit],
155                                 [enable Just-In-Time compiling support]),
156                  , enable_jit=no)
157    
158    # Handle --disable-pcregrep-jit (enabled by default)
159    AC_ARG_ENABLE(pcregrep-jit,
160                  AS_HELP_STRING([--disable-pcregrep-jit],
161                                 [disable JIT support in pcregrep]),
162                  , enable_pcregrep_jit=yes)
163    
164  # Handle --enable-rebuild-chartables  # Handle --enable-rebuild-chartables
165  AC_ARG_ENABLE(rebuild-chartables,  AC_ARG_ENABLE(rebuild-chartables,
# Line 97  AC_ARG_ENABLE(rebuild-chartables, Line 170  AC_ARG_ENABLE(rebuild-chartables,
170  # Handle --enable-utf8 (disabled by default)  # Handle --enable-utf8 (disabled by default)
171  AC_ARG_ENABLE(utf8,  AC_ARG_ENABLE(utf8,
172                AS_HELP_STRING([--enable-utf8],                AS_HELP_STRING([--enable-utf8],
173                               [enable UTF-8 support]),                               [another name for --enable-utf. Kept only for compatibility reasons]),
174                , enable_utf8=unset)                , enable_utf8=unset)
175    
176    # Handle --enable-utf (disabled by default)
177    AC_ARG_ENABLE(utf,
178                  AS_HELP_STRING([--enable-utf],
179                                 [enable UTF-8/16/32 support (incompatible with --enable-ebcdic)]),
180                  , enable_utf=unset)
181    
182  # Handle --enable-unicode-properties  # Handle --enable-unicode-properties
183  AC_ARG_ENABLE(unicode-properties,  AC_ARG_ENABLE(unicode-properties,
184                AS_HELP_STRING([--enable-unicode-properties],                AS_HELP_STRING([--enable-unicode-properties],
185                               [enable Unicode properties support (implies --enable-utf8)]),                               [enable Unicode properties support (implies --enable-utf)]),
186                , enable_unicode_properties=no)                , enable_unicode_properties=no)
187    
188  # Handle --enable-newline=NL  # Handle newline options
 dnl AC_ARG_ENABLE(newline,  
 dnl               AS_HELP_STRING([--enable-newline=NL],  
 dnl                              [use NL as newline (lf, cr, crlf, anycrlf, any; default=lf)]),  
 dnl               , enable_newline=lf)  
   
 # Separate newline options  
189  ac_pcre_newline=lf  ac_pcre_newline=lf
190  AC_ARG_ENABLE(newline-is-cr,  AC_ARG_ENABLE(newline-is-cr,
191                AS_HELP_STRING([--enable-newline-is-cr],                AS_HELP_STRING([--enable-newline-is-cr],
# Line 145  AC_ARG_ENABLE(bsr-anycrlf, Line 218  AC_ARG_ENABLE(bsr-anycrlf,
218  # Handle --enable-ebcdic  # Handle --enable-ebcdic
219  AC_ARG_ENABLE(ebcdic,  AC_ARG_ENABLE(ebcdic,
220                AS_HELP_STRING([--enable-ebcdic],                AS_HELP_STRING([--enable-ebcdic],
221                               [assume EBCDIC coding rather than ASCII; use this only in (uncommon) EBCDIC environments; it implies --enable-rebuild-chartables]),                               [assume EBCDIC coding rather than ASCII; incompatible with --enable-utf; use only in (uncommon) EBCDIC environments; it implies --enable-rebuild-chartables]),
222                , enable_ebcdic=no)                , enable_ebcdic=no)
223    
224    # Handle --enable-ebcdic-nl25
225    AC_ARG_ENABLE(ebcdic-nl25,
226                  AS_HELP_STRING([--enable-ebcdic-nl25],
227                                 [set EBCDIC code for NL to 0x25 instead of 0x15; it implies --enable-ebcdic]),
228                  , enable_ebcdic_nl25=no)
229    
230  # Handle --disable-stack-for-recursion  # Handle --disable-stack-for-recursion
231  AC_ARG_ENABLE(stack-for-recursion,  AC_ARG_ENABLE(stack-for-recursion,
232                AS_HELP_STRING([--disable-stack-for-recursion],                AS_HELP_STRING([--disable-stack-for-recursion],
233                               [don't use stack recursion when matching]),                               [don't use stack recursion when matching]),
234                , enable_stack_for_recursion=yes)                , enable_stack_for_recursion=yes)
235    
236    # Handle --enable-pcregrep-libz
237    AC_ARG_ENABLE(pcregrep-libz,
238                  AS_HELP_STRING([--enable-pcregrep-libz],
239                                 [link pcregrep with libz to handle .gz files]),
240                  , enable_pcregrep_libz=no)
241    
242    # Handle --enable-pcregrep-libbz2
243    AC_ARG_ENABLE(pcregrep-libbz2,
244                  AS_HELP_STRING([--enable-pcregrep-libbz2],
245                                 [link pcregrep with libbz2 to handle .bz2 files]),
246                  , enable_pcregrep_libbz2=no)
247    
248    # Handle --with-pcregrep-bufsize=N
249    AC_ARG_WITH(pcregrep-bufsize,
250                  AS_HELP_STRING([--with-pcregrep-bufsize=N],
251                                 [pcregrep buffer size (default=20480)]),
252                  , with_pcregrep_bufsize=20480)
253    
254    # Handle --enable-pcretest-libedit
255    AC_ARG_ENABLE(pcretest-libedit,
256                  AS_HELP_STRING([--enable-pcretest-libedit],
257                                 [link pcretest with libedit]),
258                  , enable_pcretest_libedit=no)
259    
260    # Handle --enable-pcretest-libreadline
261    AC_ARG_ENABLE(pcretest-libreadline,
262                  AS_HELP_STRING([--enable-pcretest-libreadline],
263                                 [link pcretest with libreadline]),
264                  , enable_pcretest_libreadline=no)
265    
266  # Handle --with-posix-malloc-threshold=NBYTES  # Handle --with-posix-malloc-threshold=NBYTES
267  AC_ARG_WITH(posix-malloc-threshold,  AC_ARG_WITH(posix-malloc-threshold,
268              AS_HELP_STRING([--with-posix-malloc-threshold=NBYTES],              AS_HELP_STRING([--with-posix-malloc-threshold=NBYTES],
# Line 185  AC_ARG_WITH(match-limit-recursion, Line 294  AC_ARG_WITH(match-limit-recursion,
294                             [default limit on internal recursion (default=MATCH_LIMIT)]),                             [default limit on internal recursion (default=MATCH_LIMIT)]),
295              , with_match_limit_recursion=MATCH_LIMIT)              , with_match_limit_recursion=MATCH_LIMIT)
296    
297  # Make sure that if enable_unicode_properties was set, that UTF-8 support  # Handle --enable-valgrind
298  # is enabled.  AC_ARG_ENABLE(valgrind,
299  #                AS_HELP_STRING([--enable-valgrind],
300                                 [valgrind support]),
301                  , enable_valgrind=no)
302    
303    # Enable code coverage reports using gcov
304    AC_ARG_ENABLE(coverage,
305                  AS_HELP_STRING([--enable-coverage],
306                                 [enable code coverage reports using gcov]),
307                  , enable_coverage=no)
308    
309    # Copy enable_utf8 value to enable_utf for compatibility reasons
310    if test "x$enable_utf8" != "xunset"
311    then
312      if test "x$enable_utf" != "xunset"
313      then
314        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.])
315      fi
316      enable_utf=$enable_utf8
317    fi
318    
319    # Set the default value for pcre8
320    if test "x$enable_pcre8" = "xunset"
321    then
322      enable_pcre8=yes
323    fi
324    
325    # Set the default value for pcre16
326    if test "x$enable_pcre16" = "xunset"
327    then
328      enable_pcre16=no
329    fi
330    
331    # Set the default value for pcre32
332    if test "x$enable_pcre32" = "xunset"
333    then
334      enable_pcre32=no
335    fi
336    
337    # Make sure enable_pcre8 or enable_pcre16 was set
338    if test "x$enable_pcre8$enable_pcre16$enable_pcre32" = "xnonono"
339    then
340      AC_MSG_ERROR([At least one of 8, 16 or 32 bit pcre library must be enabled])
341    fi
342    
343    # Make sure that if enable_unicode_properties was set, that UTF support is enabled.
344  if test "x$enable_unicode_properties" = "xyes"  if test "x$enable_unicode_properties" = "xyes"
345  then  then
346    if test "x$enable_utf8" = "xno"    if test "x$enable_utf" = "xno"
347    then    then
348      AC_MSG_ERROR([support for Unicode properties requires UTF-8 support])      AC_MSG_ERROR([support for Unicode properties requires UTF-8/16/32 support])
349    fi    fi
350    enable_utf8=yes    enable_utf=yes
351  fi  fi
352    
353  if test "x$enable_utf8" = "xunset"  # enable_utf is disabled by default.
354    if test "x$enable_utf" = "xunset"
355  then  then
356    enable_utf8=no    enable_utf=no
357  fi  fi
358    
359  # Make sure that if enable_ebcdic is set, rebuild_chartables is also enabled.  # enable_cpp copies the value of enable_pcre8 by default
360  #  if test "x$enable_cpp" = "xunset"
 if test "x$enable_ebcdic" = "xyes"  
361  then  then
362    enable_rebuild_chartables=yes    enable_cpp=$enable_pcre8
363  fi  fi
364    
365  # Convert the newline identifier into the appropriate integer value.  # Make sure that if enable_cpp was set, that enable_pcre8 support is enabled
366    if test "x$enable_cpp" = "xyes"
367    then
368      if test "x$enable_pcre8" = "xno"
369      then
370        AC_MSG_ERROR([C++ library requires pcre library with 8 bit characters])
371      fi
372    fi
373    
374    # Convert the newline identifier into the appropriate integer value. The first
375    # three are ASCII values 0x0a, 0x0d, and 0x0d0a, but if EBCDIC is enabled, they
376    # are changed below.
377    
378  case "$enable_newline" in  case "$enable_newline" in
379    lf)      ac_pcre_newline_value=10   ;;    lf)      ac_pcre_newline_value=10   ;;
380    cr)      ac_pcre_newline_value=13   ;;    cr)      ac_pcre_newline_value=13   ;;
# Line 221  case "$enable_newline" in Line 386  case "$enable_newline" in
386    ;;    ;;
387  esac  esac
388    
389    # --enable-ebcdic-nl25 implies --enable-ebcdic
390    if test "x$enable_ebcdic_nl25" = "xyes"; then
391      enable_ebcdic=yes
392    fi
393    
394    # Make sure that if enable_ebcdic is set, rebuild_chartables is also enabled,
395    # and the newline value is adjusted appropriately (CR is still 13, but LF is
396    # 21 or 37). Also check that UTF support is not requested, because PCRE cannot
397    # handle EBCDIC and UTF in the same build. To do so it would need to use
398    # different character constants depending on the mode.
399    #
400    if test "x$enable_ebcdic" = "xyes"; then
401      enable_rebuild_chartables=yes
402    
403      if test "x$enable_utf" = "xyes"; then
404        AC_MSG_ERROR([support for EBCDIC and UTF-8/16/32 cannot be enabled at the same time])
405      fi
406    
407      if test "x$enable_ebcdic_nl25" = "xno"; then
408        case "$ac_pcre_newline_value" in
409          10)   ac_pcre_newline_value=21 ;;
410          3338) ac_pcre_newline_value=3349 ;;
411        esac
412      else
413        case "$ac_pcre_newline_value" in
414          10)   ac_pcre_newline_value=37 ;;
415          3338) ac_pcre_newline_value=3365 ;;
416        esac
417      fi
418    fi
419    
420  # Check argument to --with-link-size  # Check argument to --with-link-size
421  case "$with_link_size" in  case "$with_link_size" in
422    2|3|4) ;;    2|3|4) ;;
# Line 230  case "$with_link_size" in Line 426  case "$with_link_size" in
426  esac  esac
427    
428  AH_TOP([  AH_TOP([
429  /* On Unix-like systems config.h.in is converted by "configure" into config.h.  /* PCRE is written in Standard C, but there are a few non-standard things it
430  Some other environments also support the use of "configure". PCRE is written in  can cope with, allowing it to run on SunOS4 and other "close to standard"
431  Standard C, but there are a few non-standard things it can cope with, allowing  systems.
432  it to run on SunOS4 and other "close to standard" systems.  
433    In environments that support the GNU autotools, config.h.in is converted into
434  If you are going to build PCRE "by hand" on a system without "configure" you  config.h by the "configure" script. In environments that use CMake,
435  should copy the distributed config.h.generic to config.h, and then set up the  config-cmake.in is converted into config.h. If you are going to build PCRE "by
436  macros the way you need them. Alternatively, you can avoid editing by using -D  hand" without using "configure" or CMake, you should copy the distributed
437  on the compiler command line to set the macro values.  config.h.generic to config.h, and edit the macro definitions to be the way you
438    need them. You must then add -DHAVE_CONFIG_H to all of your compile commands,
439  PCRE uses memmove() if HAVE_MEMMOVE is set to 1; otherwise it uses bcopy() if  so that config.h is included at the start of every source.
440  HAVE_BCOPY is set to 1. If your system has neither bcopy() nor memmove(), set  
441  them both to 0; an emulation function will be used. */])  Alternatively, you can avoid editing by using -D on the compiler command line
442    to set the macro values. In this case, you do not have to set -DHAVE_CONFIG_H,
443    but if you do, default values will be taken from config.h for non-boolean
444    macros that are not defined on the command line.
445    
446    Boolean macros such as HAVE_STDLIB_H and SUPPORT_PCRE8 should either be defined
447    (conventionally to 1) for TRUE, and not defined at all for FALSE. All such
448    macros are listed as a commented #undef in config.h.generic. Macros such as
449    MATCH_LIMIT, whose actual value is relevant, have defaults defined, but are
450    surrounded by #ifndef/#endif lines so that the value can be overridden by -D.
451    
452    PCRE uses memmove() if HAVE_MEMMOVE is defined; otherwise it uses bcopy() if
453    HAVE_BCOPY is defined. If your system has neither bcopy() nor memmove(), make
454    sure both macros are undefined; an emulation function will then be used. */])
455    
456  # Checks for header files.  # Checks for header files.
457  AC_HEADER_STDC  AC_HEADER_STDC
# Line 251  AC_CHECK_HEADERS(limits.h sys/types.h sy Line 460  AC_CHECK_HEADERS(limits.h sys/types.h sy
460  # The files below are C++ header files.  # The files below are C++ header files.
461  pcre_have_type_traits="0"  pcre_have_type_traits="0"
462  pcre_have_bits_type_traits="0"  pcre_have_bits_type_traits="0"
463    
464    if test "x$enable_cpp" = "xyes" -a -z "$CXX"; then
465       AC_MSG_ERROR([You need a C++ compiler for C++ support.])
466    fi
467    
468  if test "x$enable_cpp" = "xyes" -a -n "$CXX"  if test "x$enable_cpp" = "xyes" -a -n "$CXX"
469  then  then
470  AC_LANG_PUSH(C++)  AC_LANG_PUSH(C++)
471    
472    # Older versions of pcre defined pcrecpp::no_arg, but in new versions
473    # it's called pcrecpp::RE::no_arg.  For backwards ABI compatibility,
474    # we want to make one an alias for the other.  Different systems do
475    # this in different ways.  Some systems, for instance, can do it via
476    # a linker flag: -alias (for os x 10.5) or -i (for os x <=10.4).
477    OLD_LDFLAGS="$LDFLAGS"
478    for flag in "-alias,__ZN7pcrecpp2RE6no_argE,__ZN7pcrecpp6no_argE" \
479                "-i__ZN7pcrecpp6no_argE:__ZN7pcrecpp2RE6no_argE"; do
480      AC_MSG_CHECKING([for alias support in the linker])
481      LDFLAGS="$OLD_LDFLAGS -Wl,$flag"
482      # We try to run the linker with this new ld flag.  If the link fails,
483      # we give up and remove the new flag from LDFLAGS.
484      AC_LINK_IFELSE([AC_LANG_PROGRAM([namespace pcrecpp {
485                                        class RE { static int no_arg; };
486                                        int RE::no_arg;
487                                      }],
488                                     [])],
489                     [AC_MSG_RESULT([yes]);
490                      EXTRA_LIBPCRECPP_LDFLAGS="$EXTRA_LIBPCRECPP_LDFLAGS -Wl,$flag";
491                      break;],
492                     AC_MSG_RESULT([no]))
493    done
494    LDFLAGS="$OLD_LDFLAGS"
495    
496  # We could be more clever here, given we're doing AC_SUBST with this  # We could be more clever here, given we're doing AC_SUBST with this
497  # (eg set a var to be the name of the include file we want). But we're not  # (eg set a var to be the name of the include file we want). But we're not
498  # so it's easy to change back to 'regular' autoconf vars if we needed to.  # so it's easy to change back to 'regular' autoconf vars if we needed to.
# Line 264  AC_CHECK_HEADERS(bits/type_traits.h, [pc Line 502  AC_CHECK_HEADERS(bits/type_traits.h, [pc
502                                       [pcre_have_bits_type_traits="0"])                                       [pcre_have_bits_type_traits="0"])
503  AC_CHECK_HEADERS(type_traits.h, [pcre_have_type_traits="1"],  AC_CHECK_HEADERS(type_traits.h, [pcre_have_type_traits="1"],
504                                  [pcre_have_type_traits="0"])                                  [pcre_have_type_traits="0"])
505    
506    # (This isn't c++-specific, but is only used in pcrecpp.cc, so try this
507    # in a c++ context.  This matters becuase strtoimax is C99 and may not
508    # be supported by the C++ compiler.)
509    # Figure out how to create a longlong from a string: strtoll and
510    # equiv.  It's not enough to call AC_CHECK_FUNCS: hpux has a
511    # strtoll, for instance, but it only takes 2 args instead of 3!
512    # We have to call AH_TEMPLATE since AC_DEFINE_UNQUOTED below is complex.
513    AH_TEMPLATE(HAVE_STRTOQ, [Define to 1 if you have `strtoq'.])
514    AH_TEMPLATE(HAVE_STRTOLL, [Define to 1 if you have `strtoll'.])
515    AH_TEMPLATE(HAVE__STRTOI64, [Define to 1 if you have `_strtoi64'.])
516    AH_TEMPLATE(HAVE_STRTOIMAX, [Define to 1 if you have `strtoimax'.])
517    have_strto_fn=0
518    for fn in strtoq strtoll _strtoi64 strtoimax; do
519      AC_MSG_CHECKING([for $fn])
520      if test "$fn" = strtoimax; then
521        include=stdint.h
522      else
523        include=stdlib.h
524      fi
525      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <$include>],
526                                        [char* e; return $fn("100", &e, 10)])],
527                        [AC_MSG_RESULT(yes)
528                         AC_DEFINE_UNQUOTED(HAVE_`echo $fn | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`, 1,
529                                            [Define to 1 if you have `$fn'.])
530                         have_strto_fn=1
531                         break],
532                        [AC_MSG_RESULT(no)])
533    done
534    
535    if test "$have_strto_fn" = 1; then
536      AC_CHECK_TYPES([long long],
537                     [pcre_have_long_long="1"],
538                     [pcre_have_long_long="0"])
539      AC_CHECK_TYPES([unsigned long long],
540                     [pcre_have_ulong_long="1"],
541                     [pcre_have_ulong_long="0"])
542    else
543      pcre_have_long_long="0"
544      pcre_have_ulong_long="0"
545    fi
546    AC_SUBST(pcre_have_long_long)
547    AC_SUBST(pcre_have_ulong_long)
548    
549  AC_LANG_POP  AC_LANG_POP
550  fi  fi
551  # Using AC_SUBST eliminates the need to include config.h in a public .h file  # Using AC_SUBST eliminates the need to include config.h in a public .h file
# Line 271  AC_SUBST(pcre_have_type_traits) Line 553  AC_SUBST(pcre_have_type_traits)
553  AC_SUBST(pcre_have_bits_type_traits)  AC_SUBST(pcre_have_bits_type_traits)
554    
555  # Conditional compilation  # Conditional compilation
556    AM_CONDITIONAL(WITH_PCRE8, test "x$enable_pcre8" = "xyes")
557    AM_CONDITIONAL(WITH_PCRE16, test "x$enable_pcre16" = "xyes")
558    AM_CONDITIONAL(WITH_PCRE32, test "x$enable_pcre32" = "xyes")
559  AM_CONDITIONAL(WITH_PCRE_CPP, test "x$enable_cpp" = "xyes")  AM_CONDITIONAL(WITH_PCRE_CPP, test "x$enable_cpp" = "xyes")
560  AM_CONDITIONAL(WITH_REBUILD_CHARTABLES, test "x$enable_rebuild_chartables" = "xyes")  AM_CONDITIONAL(WITH_REBUILD_CHARTABLES, test "x$enable_rebuild_chartables" = "xyes")
561    AM_CONDITIONAL(WITH_JIT, test "x$enable_jit" = "xyes")
562    AM_CONDITIONAL(WITH_UTF, test "x$enable_utf" = "xyes")
563    AM_CONDITIONAL(WITH_VALGRIND, test "x$enable_valgrind" = "xyes")
564    
565  # Checks for typedefs, structures, and compiler characteristics.  # Checks for typedefs, structures, and compiler characteristics.
566    
567  AC_C_CONST  AC_C_CONST
568  AC_TYPE_SIZE_T  AC_TYPE_SIZE_T
569    
 AC_CHECK_TYPES([long long],  
                [pcre_have_long_long="1"],  
                [pcre_have_long_long="0"])  
 AC_CHECK_TYPES([unsigned long long],  
                [pcre_have_ulong_long="1"],  
                [pcre_have_ulong_long="0"])  
 AC_SUBST(pcre_have_long_long)  
 AC_SUBST(pcre_have_ulong_long)  
   
570  # Checks for library functions.  # Checks for library functions.
571    
572  AC_CHECK_FUNCS(bcopy memmove strerror strtoq strtoll)  AC_CHECK_FUNCS(bcopy memmove strerror)
573    
574    # Check for the availability of libz (aka zlib)
575    
576    AC_CHECK_HEADERS([zlib.h], [HAVE_ZLIB_H=1])
577    AC_CHECK_LIB([z], [gzopen], [HAVE_LIBZ=1])
578    
579    # Check for the availability of libbz2. Originally we just used AC_CHECK_LIB,
580    # as for libz. However, this had the following problem, diagnosed and fixed by
581    # a user:
582    #
583    #   - libbz2 uses the Pascal calling convention (WINAPI) for the functions
584    #     under Win32.
585    #   - The standard autoconf AC_CHECK_LIB fails to include "bzlib.h",
586    #     therefore missing the function definition.
587    #   - The compiler thus generates a "C" signature for the test function.
588    #   - The linker fails to find the "C" function.
589    #   - PCRE fails to configure if asked to do so against libbz2.
590    #
591    # Solution:
592    #
593    #   - Replace the AC_CHECK_LIB test with a custom test.
594    
595    AC_CHECK_HEADERS([bzlib.h], [HAVE_BZLIB_H=1])
596    # Original test
597    # AC_CHECK_LIB([bz2], [BZ2_bzopen], [HAVE_LIBBZ2=1])
598    #
599    # Custom test follows
600    
601    AC_MSG_CHECKING([for libbz2])
602    OLD_LIBS="$LIBS"
603    LIBS="$LIBS -lbz2"
604    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
605    #ifdef HAVE_BZLIB_H
606    #include <bzlib.h>
607    #endif]],
608    [[return (int)BZ2_bzopen("conftest", "rb");]])],
609    [AC_MSG_RESULT([yes]);HAVE_LIBBZ2=1; break;],
610    AC_MSG_RESULT([no]))
611    LIBS="$OLD_LIBS"
612    
613    # Check for the availabiity of libreadline
614    
615    if test "$enable_pcretest_libreadline" = "yes"; then
616     AC_CHECK_HEADERS([readline/readline.h], [HAVE_READLINE_H=1])
617     AC_CHECK_HEADERS([readline/history.h], [HAVE_HISTORY_H=1])
618     AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lreadline"],
619       [unset ac_cv_lib_readline_readline;
620        AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-ltinfo"],
621         [unset ac_cv_lib_readline_readline;
622          AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lcurses"],
623           [unset ac_cv_lib_readline_readline;
624            AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lncurses"],
625             [unset ac_cv_lib_readline_readline;
626              AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lncursesw"],
627               [unset ac_cv_lib_readline_readline;
628                AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-ltermcap"],
629                 [LIBREADLINE=""],
630                 [-ltermcap])],
631               [-lncursesw])],
632             [-lncurses])],
633           [-lcurses])],
634         [-ltinfo])])
635     AC_SUBST(LIBREADLINE)
636     if test -n "$LIBREADLINE"; then
637       if test "$LIBREADLINE" != "-lreadline"; then
638         echo "-lreadline needs $LIBREADLINE"
639         LIBREADLINE="-lreadline $LIBREADLINE"
640       fi
641     fi
642    fi
643    
644    
645    # Check for the availability of libedit. Different distributions put its
646    # headers in different places. Try to cover the most common ones.
647    
648    if test "$enable_pcretest_libedit" = "yes"; then
649      AC_CHECK_HEADERS([editline/readline.h], [HAVE_EDITLINE_READLINE_H=1],
650        [AC_CHECK_HEADERS([edit/readline/readline.h], [HAVE_READLINE_READLINE_H=1],
651          [AC_CHECK_HEADERS([readline/readline.h], [HAVE_READLINE_READLINE_H=1])])])
652      AC_CHECK_LIB([edit], [readline], [LIBEDIT="-ledit"])
653    fi
654    
655  # This facilitates -ansi builds under Linux  # This facilitates -ansi builds under Linux
656  dnl AC_DEFINE([_GNU_SOURCE], [], [Enable GNU extensions in glibc])  dnl AC_DEFINE([_GNU_SOURCE], [], [Enable GNU extensions in glibc])
657    
658    PCRE_STATIC_CFLAG=""
659  if test "x$enable_shared" = "xno" ; then  if test "x$enable_shared" = "xno" ; then
660    AC_DEFINE([PCRE_STATIC], [1], [    AC_DEFINE([PCRE_STATIC], [1], [
661      Define if linking statically (TODO: make nice with Libtool)])      Define to any value if linking statically (TODO: make nice with Libtool)])
662      PCRE_STATIC_CFLAG="-DPCRE_STATIC"
663  fi  fi
664    AC_SUBST(PCRE_STATIC_CFLAG)
665    
666  # Here is where pcre specific defines are handled  # Here is where pcre specific defines are handled
667    
668  if test "$enable_utf8" = "yes"; then  if test "$enable_pcre8" = "yes"; then
669    AC_DEFINE([SUPPORT_UTF8], [], [    AC_DEFINE([SUPPORT_PCRE8], [], [
670      Define to enable support for the UTF-8 Unicode encoding.])      Define to any value to enable the 8 bit PCRE library.])
671    fi
672    
673    if test "$enable_pcre16" = "yes"; then
674      AC_DEFINE([SUPPORT_PCRE16], [], [
675        Define to any value to enable the 16 bit PCRE library.])
676    fi
677    
678    if test "$enable_pcre32" = "yes"; then
679      AC_DEFINE([SUPPORT_PCRE32], [], [
680        Define to any value to enable the 32 bit PCRE library.])
681    fi
682    
683    if test "$enable_jit" = "yes"; then
684      AX_PTHREAD([], [AC_MSG_ERROR([JIT support requires pthreads])])
685      CC="$PTHREAD_CC"
686      CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
687      LIBS="$PTHREAD_LIBS $LIBS"
688      AC_DEFINE([SUPPORT_JIT], [], [
689        Define to any value to enable support for Just-In-Time compiling.])
690    else
691      enable_pcregrep_jit="no"
692    fi
693    
694    if test "$enable_pcregrep_jit" = "yes"; then
695      AC_DEFINE([SUPPORT_PCREGREP_JIT], [], [
696        Define to any value to enable JIT support in pcregrep.])
697    fi
698    
699    if test "$enable_utf" = "yes"; then
700      AC_DEFINE([SUPPORT_UTF], [], [
701        Define to any value to enable support for the UTF-8/16/32 Unicode encoding.
702        This will work even in an EBCDIC environment, but it is incompatible
703        with the EBCDIC macro. That is, PCRE can support *either* EBCDIC
704        code *or* ASCII/UTF-8/16/32, but not both at once.])
705  fi  fi
706    
707  if test "$enable_unicode_properties" = "yes"; then  if test "$enable_unicode_properties" = "yes"; then
708    AC_DEFINE([SUPPORT_UCP], [], [    AC_DEFINE([SUPPORT_UCP], [], [
709      Define to enable support for Unicode properties])      Define to any value to enable support for Unicode properties.])
710  fi  fi
711    
712  if test "$enable_stack_for_recursion" = "no"; then  if test "$enable_stack_for_recursion" = "no"; then
713    AC_DEFINE([NO_RECURSE], [], [    AC_DEFINE([NO_RECURSE], [], [
714      PCRE uses recursive function calls to handle backtracking while      PCRE uses recursive function calls to handle backtracking while
715      matching. This can sometimes be a problem on systems that have      matching. This can sometimes be a problem on systems that have
716      stacks of limited size. Define NO_RECURSE to get a version that      stacks of limited size. Define NO_RECURSE to any value to get a
717      doesn't use recursion in the match() function; instead it creates      version that doesn't use recursion in the match() function; instead
718      its own stack by steam using pcre_recurse_malloc() to obtain memory      it creates its own stack by steam using pcre_recurse_malloc() to obtain
719      from the heap. For more detail, see the comments and other stuff      memory from the heap. For more detail, see the comments and other stuff
720      just above the match() function. On systems that support it,      just above the match() function.])
721      "configure" can be used to set this in the Makefile  fi
722      (use --disable-stack-for-recursion).])  
723    if test "$enable_pcregrep_libz" = "yes"; then
724      AC_DEFINE([SUPPORT_LIBZ], [], [
725        Define to any value to allow pcregrep to be linked with libz, so that it is
726        able to handle .gz files.])
727    fi
728    
729    if test "$enable_pcregrep_libbz2" = "yes"; then
730      AC_DEFINE([SUPPORT_LIBBZ2], [], [
731        Define to any value to allow pcregrep to be linked with libbz2, so that it
732        is able to handle .bz2 files.])
733    fi
734    
735    if test $with_pcregrep_bufsize -lt 8192 ; then
736      with_pcregrep_bufsize="8192"
737    fi
738    
739    AC_DEFINE_UNQUOTED([PCREGREP_BUFSIZE], [$with_pcregrep_bufsize], [
740      The value of PCREGREP_BUFSIZE determines the size of buffer used by pcregrep
741      to hold parts of the file it is searching. This is also the minimum value.
742      The actual amount of memory used by pcregrep is three times this number,
743      because it allows for the buffering of "before" and "after" lines.])
744    
745    if test "$enable_pcretest_libedit" = "yes"; then
746      AC_DEFINE([SUPPORT_LIBEDIT], [], [
747        Define to any value to allow pcretest to be linked with libedit.])
748      LIBREADLINE="$LIBEDIT"
749    elif test "$enable_pcretest_libreadline" = "yes"; then
750      AC_DEFINE([SUPPORT_LIBREADLINE], [], [
751        Define to any value to allow pcretest to be linked with libreadline.])
752  fi  fi
753    
754  AC_DEFINE_UNQUOTED([NEWLINE], [$ac_pcre_newline_value], [  AC_DEFINE_UNQUOTED([NEWLINE], [$ac_pcre_newline_value], [
755    The value of NEWLINE determines the newline character sequence. On    The value of NEWLINE determines the default newline character sequence. PCRE
756    systems that support it, "configure" can be used to override the    client programs can override this by selecting other values at run time. In
757    default, which is 10. The possible values are 10 (LF), 13 (CR),    ASCII environments, the value can be 10 (LF), 13 (CR), or 3338 (CRLF); in
758    3338 (CRLF), -1 (ANY), or -2 (ANYCRLF).])    EBCDIC environments the value can be 21 or 37 (LF), 13 (CR), or 3349 or 3365
759      (CRLF) because there are two alternative codepoints (0x15 and 0x25) that are
760      used as the NL line terminator that is equivalent to ASCII LF. In both ASCII
761      and EBCDIC environments the value can also be -1 (ANY), or -2 (ANYCRLF).])
762    
763  if test "$enable_bsr_anycrlf" = "yes"; then  if test "$enable_bsr_anycrlf" = "yes"; then
764    AC_DEFINE([BSR_ANYCRLF], [], [    AC_DEFINE([BSR_ANYCRLF], [], [
765      By default, the \R escape sequence matches any Unicode line ending      By default, the \R escape sequence matches any Unicode line ending
766      character or sequence of characters. If BSR_ANYCRLF is defined, this is      character or sequence of characters. If BSR_ANYCRLF is defined (to any
767      changed so that backslash-R matches only CR, LF, or CRLF. The build-      value), this is changed so that backslash-R matches only CR, LF, or CRLF.
768      time default can be overridden by the user of PCRE at runtime. On      The build-time default can be overridden by the user of PCRE at runtime.])
     systems that support it, "configure" can be used to override the  
     default.])  
769  fi  fi
770    
771  AC_DEFINE_UNQUOTED([LINK_SIZE], [$with_link_size], [  AC_DEFINE_UNQUOTED([LINK_SIZE], [$with_link_size], [
# Line 346  AC_DEFINE_UNQUOTED([LINK_SIZE], [$with_l Line 773  AC_DEFINE_UNQUOTED([LINK_SIZE], [$with_l
773    links as offsets within the compiled regex. The default is 2, which    links as offsets within the compiled regex. The default is 2, which
774    allows for compiled patterns up to 64K long. This covers the vast    allows for compiled patterns up to 64K long. This covers the vast
775    majority of cases. However, PCRE can also be compiled to use 3 or 4    majority of cases. However, PCRE can also be compiled to use 3 or 4
776    bytes instead. This allows for longer patterns in extreme cases. On    bytes instead. This allows for longer patterns in extreme cases.])
   systems that support it, "configure" can be used to override this default.])  
777    
778  AC_DEFINE_UNQUOTED([POSIX_MALLOC_THRESHOLD], [$with_posix_malloc_threshold], [  AC_DEFINE_UNQUOTED([POSIX_MALLOC_THRESHOLD], [$with_posix_malloc_threshold], [
779    When calling PCRE via the POSIX interface, additional working storage    When calling PCRE via the POSIX interface, additional working storage
# Line 356  AC_DEFINE_UNQUOTED([POSIX_MALLOC_THRESHO Line 782  AC_DEFINE_UNQUOTED([POSIX_MALLOC_THRESHO
782    interface provides only two. If the number of expected substrings is    interface provides only two. If the number of expected substrings is
783    small, the wrapper function uses space on the stack, because this is    small, the wrapper function uses space on the stack, because this is
784    faster than using malloc() for each call. The threshold above which    faster than using malloc() for each call. The threshold above which
785    the stack is no longer used is defined by POSIX_MALLOC_THRESHOLD. On    the stack is no longer used is defined by POSIX_MALLOC_THRESHOLD.])
   systems that support it, "configure" can be used to override this  
   default.])  
786    
787  AC_DEFINE_UNQUOTED([MATCH_LIMIT], [$with_match_limit], [  AC_DEFINE_UNQUOTED([MATCH_LIMIT], [$with_match_limit], [
788    The value of MATCH_LIMIT determines the default number of times the    The value of MATCH_LIMIT determines the default number of times the
# Line 367  AC_DEFINE_UNQUOTED([MATCH_LIMIT], [$with Line 791  AC_DEFINE_UNQUOTED([MATCH_LIMIT], [$with
791    limit. The limit exists in order to catch runaway regular    limit. The limit exists in order to catch runaway regular
792    expressions that take for ever to determine that they do not match.    expressions that take for ever to determine that they do not match.
793    The default is set very large so that it does not accidentally catch    The default is set very large so that it does not accidentally catch
794    legitimate cases. On systems that support it, "configure" can be    legitimate cases.])
   used to override this default default.])  
795    
796  AC_DEFINE_UNQUOTED([MATCH_LIMIT_RECURSION], [$with_match_limit_recursion], [  AC_DEFINE_UNQUOTED([MATCH_LIMIT_RECURSION], [$with_match_limit_recursion], [
797    The above limit applies to all calls of match(), whether or not they    The above limit applies to all calls of match(), whether or not they
# Line 379  AC_DEFINE_UNQUOTED([MATCH_LIMIT_RECURSIO Line 802  AC_DEFINE_UNQUOTED([MATCH_LIMIT_RECURSIO
802    MATCH_LIMIT_RECURSION applies only to recursive calls of match(). To    MATCH_LIMIT_RECURSION applies only to recursive calls of match(). To
803    have any useful effect, it must be less than the value of    have any useful effect, it must be less than the value of
804    MATCH_LIMIT. The default is to use the same value as MATCH_LIMIT.    MATCH_LIMIT. The default is to use the same value as MATCH_LIMIT.
805    There is a runtime method for setting a different limit. On systems    There is a runtime method for setting a different limit.])
   that support it, "configure" can be used to override the default.])  
806    
807  AC_DEFINE([MAX_NAME_SIZE], [32], [  AC_DEFINE([MAX_NAME_SIZE], [32], [
808    This limit is parameterized just in case anybody ever wants to    This limit is parameterized just in case anybody ever wants to
# Line 396  AH_VERBATIM([PCRE_EXP_DEFN], [ Line 818  AH_VERBATIM([PCRE_EXP_DEFN], [
818  /* If you are compiling for a system other than a Unix-like system or  /* If you are compiling for a system other than a Unix-like system or
819     Win32, and it needs some magic to be inserted before the definition     Win32, and it needs some magic to be inserted before the definition
820     of a function that is exported by the library, define this macro to     of a function that is exported by the library, define this macro to
821     contain the relevant magic. If you do not define this macro, it     contain the relevant magic. If you do not define this macro, a suitable
822     defaults to "extern" for a C compiler and "extern C" for a C++      __declspec value is used for Windows systems; in other environments
823     compiler on non-Win32 systems. This macro apears at the start of     "extern" is used for a C compiler and "extern C" for a C++ compiler.
824     every exported function that is part of the external API. It does     This macro apears at the start of every exported function that is part
825     not appear on functions that are "external" in the C sense, but     of the external API. It does not appear on functions that are "external"
826     which are internal to the library. */     in the C sense, but which are internal to the library. */
827  #undef PCRE_EXP_DEFN])  #undef PCRE_EXP_DEFN])
828    
829  if test "$enable_ebcdic" = "yes"; then  if test "$enable_ebcdic" = "yes"; then
830    AC_DEFINE_UNQUOTED([EBCDIC], [], [    AC_DEFINE_UNQUOTED([EBCDIC], [], [
831      If you are compiling for a system that uses EBCDIC instead of ASCII      If you are compiling for a system that uses EBCDIC instead of ASCII
832      character codes, define this macro as 1. On systems that can use      character codes, define this macro to any value. You must also edit the
833      "configure", this can be done via --enable-ebcdic.])      NEWLINE macro below to set a suitable EBCDIC newline, commonly 21 (0x15).
834        On systems that can use "configure" or CMake to set EBCDIC, NEWLINE is
835        automatically adjusted. When EBCDIC is set, PCRE assumes that all input
836        strings are in EBCDIC. If you do not define this macro, PCRE will assume
837        input strings are ASCII or UTF-8/16/32 Unicode. It is not possible to build
838        a version of PCRE that supports both EBCDIC and UTF-8/16/32.])
839    fi
840    
841    if test "$enable_ebcdic_nl25" = "yes"; then
842      AC_DEFINE_UNQUOTED([EBCDIC_NL25], [], [
843        In an EBCDIC environment, define this macro to any value to arrange for
844        the NL character to be 0x25 instead of the default 0x15. NL plays the role
845        that LF does in an ASCII/Unicode environment. The value must also be set in
846        the NEWLINE macro below. On systems that can use "configure" or CMake to
847        set EBCDIC_NL25, the adjustment of NEWLINE is automatic.])
848    fi
849    
850    if test "$enable_valgrind" = "yes"; then
851      AC_DEFINE_UNQUOTED([SUPPORT_VALGRIND], [], [
852         Define to any value for valgrind support to find invalid memory reads.])
853  fi  fi
854    
855  # Platform specific issues  # Platform specific issues
# Line 426  esac Line 867  esac
867  # The extra LDFLAGS for each particular library  # The extra LDFLAGS for each particular library
868  # (Note: The libpcre*_version bits are m4 variables, assigned above)  # (Note: The libpcre*_version bits are m4 variables, assigned above)
869    
870  EXTRA_LIBPCRE_LDFLAGS="$NO_UNDEFINED -version-info libpcre_version"  EXTRA_LIBPCRE_LDFLAGS="$EXTRA_LIBPCRE_LDFLAGS \
871                           $NO_UNDEFINED -version-info libpcre_version"
872    
873  EXTRA_LIBPCREPOSIX_LDFLAGS="$NO_UNDEFINED -version-info libpcreposix_version"  EXTRA_LIBPCRE16_LDFLAGS="$EXTRA_LIBPCRE16_LDFLAGS \
874                           $NO_UNDEFINED -version-info libpcre16_version"
875    
876  EXTRA_LIBPCRECPP_LDFLAGS="$NO_UNDEFINED $EXPORT_ALL_SYMBOLS -version-info libpcrecpp_version"  EXTRA_LIBPCRE32_LDFLAGS="$EXTRA_LIBPCRE32_LDFLAGS \
877                           $NO_UNDEFINED -version-info libpcre32_version"
878    
879    EXTRA_LIBPCREPOSIX_LDFLAGS="$EXTRA_LIBPCREPOSIX_LDFLAGS \
880                                $NO_UNDEFINED -version-info libpcreposix_version"
881    
882    EXTRA_LIBPCRECPP_LDFLAGS="$EXTRA_LIBPCRECPP_LDFLAGS \
883                              $NO_UNDEFINED -version-info libpcrecpp_version \
884                              $EXPORT_ALL_SYMBOLS"
885    
886  AC_SUBST(EXTRA_LIBPCRE_LDFLAGS)  AC_SUBST(EXTRA_LIBPCRE_LDFLAGS)
887    AC_SUBST(EXTRA_LIBPCRE16_LDFLAGS)
888    AC_SUBST(EXTRA_LIBPCRE32_LDFLAGS)
889  AC_SUBST(EXTRA_LIBPCREPOSIX_LDFLAGS)  AC_SUBST(EXTRA_LIBPCREPOSIX_LDFLAGS)
890  AC_SUBST(EXTRA_LIBPCRECPP_LDFLAGS)  AC_SUBST(EXTRA_LIBPCRECPP_LDFLAGS)
891    
892  # When we run 'make distcheck', use these arguments.  # When we run 'make distcheck', use these arguments. Turning off compiler
893  DISTCHECK_CONFIGURE_FLAGS="--enable-cpp --enable-unicode-properties"  # optimization makes it run faster.
894    DISTCHECK_CONFIGURE_FLAGS="CFLAGS='' CXXFLAGS='' --enable-pcre16 --enable-pcre32 --enable-jit --enable-cpp --enable-unicode-properties"
895  AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)  AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)
896    
897    # Check that, if --enable-pcregrep-libz or --enable-pcregrep-libbz2 is
898    # specified, the relevant library is available.
899    
900    if test "$enable_pcregrep_libz" = "yes"; then
901      if test "$HAVE_ZLIB_H" != "1"; then
902        echo "** Cannot --enable-pcregrep-libz because zlib.h was not found"
903        exit 1
904      fi
905      if test "$HAVE_LIBZ" != "1"; then
906        echo "** Cannot --enable-pcregrep-libz because libz was not found"
907        exit 1
908      fi
909      LIBZ="-lz"
910    fi
911    AC_SUBST(LIBZ)
912    
913    if test "$enable_pcregrep_libbz2" = "yes"; then
914      if test "$HAVE_BZLIB_H" != "1"; then
915        echo "** Cannot --enable-pcregrep-libbz2 because bzlib.h was not found"
916        exit 1
917      fi
918      if test "$HAVE_LIBBZ2" != "1"; then
919        echo "** Cannot --enable-pcregrep-libbz2 because libbz2 was not found"
920        exit 1
921      fi
922      LIBBZ2="-lbz2"
923    fi
924    AC_SUBST(LIBBZ2)
925    
926    # Similarly for --enable-pcretest-readline
927    
928    if test "$enable_pcretest_libedit" = "yes"; then
929      if test "$enable_pcretest_libreadline" = "yes"; then
930        echo "** Cannot use both --enable-pcretest-libedit and --enable-pcretest-readline"
931        exit 1
932      fi
933      if test "$HAVE_EDITLINE_READLINE_H" != "1" -a \
934              "$HAVE_READLINE_READLINE_H" != "1"; then
935        echo "** Cannot --enable-pcretest-libedit because neither editline/readline.h"
936        echo "** nor readline/readline.h was found."
937        exit 1
938      fi
939      if test -z "$LIBEDIT"; then
940        echo "** Cannot --enable-pcretest-libedit because libedit library was not found."
941        exit 1
942      fi
943    fi
944    
945    if test "$enable_pcretest_libreadline" = "yes"; then
946      if test "$HAVE_READLINE_H" != "1"; then
947        echo "** Cannot --enable-pcretest-readline because readline/readline.h was not found."
948        exit 1
949      fi
950      if test "$HAVE_HISTORY_H" != "1"; then
951        echo "** Cannot --enable-pcretest-readline because readline/history.h was not found."
952        exit 1
953      fi
954      if test -z "$LIBREADLINE"; then
955        echo "** Cannot --enable-pcretest-readline because readline library was not found."
956        exit 1
957      fi
958    fi
959    
960    # Check for valgrind
961    
962    if test "$enable_valgrind" = "yes"; then
963      m4_ifdef([PKG_CHECK_MODULES],
964               [PKG_CHECK_MODULES([VALGRIND],[valgrind])],
965               [AC_MSG_ERROR([pkg-config not supported])])
966    fi
967    
968    # test code coverage reporting
969    if test "$enable_coverage" = "yes"; then
970      if test "x$GCC" != "xyes"; then
971        AC_MSG_ERROR([Code coverage reports can only be generated when using GCC])
972      fi
973    
974      # ccache is incompatible with gcov
975      AC_PATH_PROG([SHTOOL],[shtool],[false])
976      case `$SHTOOL path $CC` in
977        *ccache*) cc_ccache=yes;;
978        *) cc_ccache=no;;
979      esac
980    
981      if test "$cc_ccache" = "yes"; then
982        if test -z "$CCACHE_DISABLE" -o "$CCACHE_DISABLE" != "1"; then
983          AC_MSG_ERROR([must export CCACHE_DISABLE=1 to disable ccache for code coverage])
984        fi
985      fi
986    
987      AC_ARG_VAR([LCOV],[the ltp lcov program])
988      AC_PATH_PROG([LCOV],[lcov],[false])
989      if test "x$LCOV" = "xfalse"; then
990        AC_MSG_ERROR([lcov not found])
991      fi
992    
993      AC_ARG_VAR([GENHTML],[the ltp genhtml program])
994      AC_PATH_PROG([GENHTML],[genhtml],[false])
995      if test "x$GENHTML" = "xfalse"; then
996        AC_MSG_ERROR([genhtml not found])
997      fi
998    
999      AC_DEFINE([SUPPORT_GCOV],[1], [
1000        Define to allow pcretest and pcregrep to be linked with gcov, so that they
1001        are able to generate code coverage reports.])
1002    
1003      # And add flags needed for gcov
1004      GCOV_CFLAGS="-O0 -ggdb3 -fprofile-arcs -ftest-coverage"
1005      GCOV_CXXFLAGS="-O0 -ggdb3 -fprofile-arcs -ftest-coverage"
1006      GCOV_LIBS="-lgcov"
1007      AC_SUBST([GCOV_CFLAGS])
1008      AC_SUBST([GCOV_CXXFLAGS])
1009      AC_SUBST([GCOV_LIBS])
1010    fi # enable_coverage
1011    
1012    AM_CONDITIONAL([WITH_GCOV],[test "x$enable_coverage" = "xyes"])
1013    
1014  # Produce these files, in addition to config.h.  # Produce these files, in addition to config.h.
1015  AC_CONFIG_FILES(  AC_CONFIG_FILES(
1016          Makefile          Makefile
1017          libpcre.pc          libpcre.pc
1018            libpcre16.pc
1019            libpcre32.pc
1020            libpcreposix.pc
1021          libpcrecpp.pc          libpcrecpp.pc
1022          pcre-config          pcre-config
1023          pcre.h          pcre.h
# Line 460  AC_CONFIG_COMMANDS([delete-old-chartable Line 1034  AC_CONFIG_COMMANDS([delete-old-chartable
1034    
1035  AC_OUTPUT  AC_OUTPUT
1036    
1037  # Print out a nice little message after configure is run displaying your  # Print out a nice little message after configure is run displaying the
1038  # chosen options.  # chosen options.
1039  #  
1040    ebcdic_nl_code=n/a
1041    if test "$enable_ebcdic_nl25" = "yes"; then
1042      ebcdic_nl_code=0x25
1043    elif test "$enable_ebcdic" = "yes"; then
1044      ebcdic_nl_code=0x15
1045    fi
1046    
1047  cat <<EOF  cat <<EOF
1048    
1049  $PACKAGE-$VERSION configuration summary:  $PACKAGE-$VERSION configuration summary:
1050    
1051      Install prefix ........... : ${prefix}      Install prefix .................. : ${prefix}
1052      C preprocessor ........... : ${CPP}      C preprocessor .................. : ${CPP}
1053      C compiler ............... : ${CC}      C compiler ...................... : ${CC}
1054      C++ preprocessor ......... : ${CXXCPP}      C++ preprocessor ................ : ${CXXCPP}
1055      C++ compiler ............. : ${CXX}      C++ compiler .................... : ${CXX}
1056      Linker ................... : ${LD}      Linker .......................... : ${LD}
1057      C preprocessor flags ..... : ${CPPFLAGS}      C preprocessor flags ............ : ${CPPFLAGS}
1058      C compiler flags ......... : ${CFLAGS}      C compiler flags ................ : ${CFLAGS} ${VISIBILITY_CFLAGS}
1059      C++ compiler flags ....... : ${CXXFLAGS}      C++ compiler flags .............. : ${CXXFLAGS} ${VISIBILITY_CXXFLAGS}
1060      Linker flags ............. : ${LDFLAGS}      Linker flags .................... : ${LDFLAGS}
1061      Extra libraries .......... : ${LIBS}      Extra libraries ................. : ${LIBS}
1062    
1063      Build C++ library ........ : ${enable_cpp}      Build 8 bit pcre library ........ : ${enable_pcre8}
1064      Enable UTF-8 support ..... : ${enable_utf8}      Build 16 bit pcre library ....... : ${enable_pcre16}
1065      Unicode properties ....... : ${enable_unicode_properties}      Build 32 bit pcre library ....... : ${enable_pcre32}
1066      Newline char/sequence .... : ${enable_newline}      Build C++ library ............... : ${enable_cpp}
1067      \R matches only ANYCRLF .. : ${enable_bsr_anycrlf}      Enable JIT compiling support .... : ${enable_jit}
1068      EBCDIC coding ............ : ${enable_ebcdic}      Enable UTF-8/16/32 support ...... : ${enable_utf}
1069      Rebuild char tables ...... : ${enable_rebuild_chartables}      Unicode properties .............. : ${enable_unicode_properties}
1070      Use stack recursion ...... : ${enable_stack_for_recursion}      Newline char/sequence ........... : ${enable_newline}
1071      POSIX mem threshold ...... : ${with_posix_malloc_threshold}      \R matches only ANYCRLF ......... : ${enable_bsr_anycrlf}
1072      Internal link size ....... : ${with_link_size}      EBCDIC coding ................... : ${enable_ebcdic}
1073      Match limit .............. : ${with_match_limit}      EBCDIC code for NL .............. : ${ebcdic_nl_code}
1074      Match limit recursion .... : ${with_match_limit_recursion}      Rebuild char tables ............. : ${enable_rebuild_chartables}
1075      Build shared libs ........ : ${enable_shared}      Use stack recursion ............. : ${enable_stack_for_recursion}
1076      Build static libs ........ : ${enable_static}      POSIX mem threshold ............. : ${with_posix_malloc_threshold}
1077        Internal link size .............. : ${with_link_size}
1078        Match limit ..................... : ${with_match_limit}
1079        Match limit recursion ........... : ${with_match_limit_recursion}
1080        Build shared libs ............... : ${enable_shared}
1081        Build static libs ............... : ${enable_static}
1082        Use JIT in pcregrep ............. : ${enable_pcregrep_jit}
1083        Buffer size for pcregrep ........ : ${with_pcregrep_bufsize}
1084        Link pcregrep with libz ......... : ${enable_pcregrep_libz}
1085        Link pcregrep with libbz2 ....... : ${enable_pcregrep_libbz2}
1086        Link pcretest with libedit ...... : ${enable_pcretest_libedit}
1087        Link pcretest with libreadline .. : ${enable_pcretest_libreadline}
1088        Valgrind support ................ : ${enable_valgrind}
1089        Code coverage ................... : ${enable_coverage}
1090    
1091  EOF  EOF
1092    

Legend:
Removed from v.231  
changed lines
  Added in v.1320

  ViewVC Help
Powered by ViewVC 1.1.5