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

Legend:
Removed from v.127  
changed lines
  Added in v.1235

  ViewVC Help
Powered by ViewVC 1.1.5