DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
dnl Process this file with autoconf to produce a configure script.

dnl This configure.in file has been hacked around quite a lot as a result of
dnl patches that various people have sent to me (PH). Sometimes the information
dnl I get is contradictory. I've tried to put in comments that explain things,
dnl but in some cases the information is second-hand and I have no way of
dnl verifying it. I am not an autoconf or libtool expert!

dnl This is required at the start; the name is the name of a file
dnl it should be seeing, to verify it is in the same directory.

AC_INIT(dftables.c)

dnl A safety precaution

AC_PREREQ(2.57)

dnl Arrange to build config.h from config.h.in. Note that pcre.h is
dnl built differently, as it is just a "substitution" file.
dnl Manual says this macro should come right after AC_INIT.
AC_CONFIG_HEADER(config.h)

dnl Provide the current PCRE version information. Do not use numbers
dnl with leading zeros for the minor version, as they end up in a C
dnl macro, and may be treated as octal constants. Stick to single
dnl digits for minor numbers less than 10. There are unlikely to be
dnl that many releases anyway.

PCRE_MAJOR=6
PCRE_MINOR=4
PCRE_DATE=05-Sep-2005
PCRE_VERSION=${PCRE_MAJOR}.${PCRE_MINOR}

dnl Default values for miscellaneous macros

POSIX_MALLOC_THRESHOLD=-DPOSIX_MALLOC_THRESHOLD=10

dnl Provide versioning information for libtool shared libraries that
dnl are built by default on Unix systems.

PCRE_LIB_VERSION=0:1:0
PCRE_POSIXLIB_VERSION=0:0:0
PCRE_CPPLIB_VERSION=0:0:0

dnl Handle --disable-cpp

AC_ARG_ENABLE(cpp,
[  --disable-cpp           disable C++ support],
want_cpp="$enableval", want_cpp=yes)

dnl Checks for programs.

AC_PROG_CC

dnl Test for C++ for the C++ wrapper libpcrecpp. It seems, however, that
dnl AC_PROC_CXX will set $CXX to "g++" when no C++ compiler is installed, even
dnl though that is completely bogus. (This may happen only on certain systems
dnl with certain versions of autoconf, of course.) An attempt to include this
dnl test inside a check for want_cpp was criticized by a libtool expert, who
dnl tells me that it isn't allowed.

AC_PROG_CXX

dnl The icc compiler has the same options as gcc, so let the rest of the
dnl configure script think it has gcc when setting up dnl options etc.
dnl This is a nasty hack which no longer seems necessary with the update
dnl to the latest libtool files, so I have commented it out.
dnl
dnl if test "$CC" = "icc" ; then GCC=yes ; fi

AC_PROG_INSTALL
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL

dnl We need to find a compiler for compiling a program to run on the local host
dnl while building. It needs to be different from CC when cross-compiling.
dnl There is a macro called AC_PROG_CC_FOR_BUILD in the GNU archive for
dnl figuring this out automatically. Unfortunately, it does not work with the
dnl latest versions of autoconf. So for the moment, we just default to the
dnl same values as the "main" compiler. People who are cross-compiling will
dnl just have to adjust the Makefile by hand or set these values when they
dnl run "configure".

CC_FOR_BUILD=${CC_FOR_BUILD:-'$(CC)'}
CXX_FOR_BUILD=${CXX_FOR_BUILD:-'$(CXX)'}
CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD:-'$(CFLAGS)'}
CPPFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD:-'$(CPPFLAGS)'}
CXXFLAGS_FOR_BUILD=${CXXFLAGS_FOR_BUILD:-'$(CXXFLAGS)'}
BUILD_EXEEXT=${BUILD_EXEEXT:-'$(EXEEXT)'}
BUILD_OBJEXT=${BUILD_OBJEXT:-'$(OBJEXT)'}

dnl Checks for header files.

AC_HEADER_STDC
AC_CHECK_HEADERS(limits.h)

dnl The files below are C++ header files. One person told me (PH) that
dnl AC_LANG_CPLUSPLUS unsets CXX if it was explicitly set to something which
dnl doesn't work. However, this doesn't always seem to be the case.

if test "x$want_cpp" = "xyes" -a -n "$CXX"
then
AC_LANG_SAVE
AC_LANG_CPLUSPLUS

dnl We could be more clever here, given we're doing AC_SUBST with this
dnl (eg set a var to be the name of the include file we want).  But we're not
dnl so it's easy to change back to 'regular' autoconf vars if we needed to.
AC_CHECK_HEADERS(string, [pcre_have_cpp_headers="1"],
                         [pcre_have_cpp_headers="0"])
AC_CHECK_HEADERS(bits/type_traits.h, [pcre_have_bits_type_traits="1"],
                                     [pcre_have_bits_type_traits="0"])
AC_CHECK_HEADERS(type_traits.h, [pcre_have_type_traits="1"],
                                [pcre_have_type_traits="0"])
dnl Using AC_SUBST eliminates the need to include config.h in a public .h file
AC_SUBST(pcre_have_bits_type_traits)
AC_SUBST(pcre_have_type_traits)
AC_LANG_RESTORE
fi

dnl From the above, we now have enough info to know if C++ is fully installed
if test "x$want_cpp" = "xyes" -a -n "$CXX" -a "$pcre_have_cpp_headers" = 1; then
  MAYBE_CPP_TARGETS='$(CPP_TARGETS)'
  HAVE_CPP=
else
  MAYBE_CPP_TARGETS=
  HAVE_CPP="#"
fi
AC_SUBST(MAYBE_CPP_TARGETS)
AC_SUBST(HAVE_CPP)

dnl Checks for typedefs, structures, and compiler characteristics.

AC_C_CONST
AC_TYPE_SIZE_T

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)

dnl Checks for library functions.

AC_CHECK_FUNCS(bcopy memmove strerror strtoq strtoll)

dnl Handle --enable-utf8

AC_ARG_ENABLE(utf8,
[  --enable-utf8           enable UTF8 support],
if test "$enableval" = "yes"; then
  UTF8=-DSUPPORT_UTF8
fi
)

dnl Handle --enable-unicode-properties

AC_ARG_ENABLE(unicode-properties,
[  --enable-unicode-properties  enable Unicode properties support],
if test "$enableval" = "yes"; then
  UCP=-DSUPPORT_UCP
fi
)

dnl Handle --enable-newline-is-cr

AC_ARG_ENABLE(newline-is-cr,
[  --enable-newline-is-cr  use CR as the newline character],
if test "$enableval" = "yes"; then
  NEWLINE=-DNEWLINE=13
fi
)

dnl Handle --enable-newline-is-lf

AC_ARG_ENABLE(newline-is-lf,
[  --enable-newline-is-lf  use LF as the newline character],
if test "$enableval" = "yes"; then
  NEWLINE=-DNEWLINE=10
fi
)

dnl Handle --enable-ebcdic

AC_ARG_ENABLE(ebcdic,
[  --enable-ebcdic         assume EBCDIC coding rather than ASCII],
if test "$enableval" == "yes"; then
  EBCDIC=-DEBCDIC=1
fi
)

dnl Handle --disable-stack-for-recursion

AC_ARG_ENABLE(stack-for-recursion,
[  --disable-stack-for-recursion  disable use of stack recursion when matching],
if test "$enableval" = "no"; then
  NO_RECURSE=-DNO_RECURSE
fi
)

dnl There doesn't seem to be a straightforward way of having parameters
dnl that set values, other than fudging the --with thing. So that's what
dnl I've done.

dnl Handle --with-posix-malloc-threshold=n

AC_ARG_WITH(posix-malloc-threshold,
[  --with-posix-malloc-threshold=5  threshold for POSIX malloc usage],
  POSIX_MALLOC_THRESHOLD=-DPOSIX_MALLOC_THRESHOLD=$withval
)

dnl Handle --with-link-size=n

AC_ARG_WITH(link-size,
[  --with-link-size=2    internal link size (2, 3, or 4 allowed)],
  LINK_SIZE=-DLINK_SIZE=$withval
)

dnl Handle --with-match_limit=n

AC_ARG_WITH(match-limit,
[  --with-match-limit=10000000      default limit on internal looping)],
  MATCH_LIMIT=-DMATCH_LIMIT=$withval
)

dnl Unicode character property support implies UTF-8 support

if test "$UCP" != "" ; then
  UTF8=-DSUPPORT_UTF8
fi

dnl "Export" these variables

AC_SUBST(BUILD_EXEEXT)
AC_SUBST(BUILD_OBJEXT)
AC_SUBST(CC_FOR_BUILD)
AC_SUBST(CXX_FOR_BUILD)
AC_SUBST(CFLAGS_FOR_BUILD)
AC_SUBST(CXXFLAGS_FOR_BUILD)
AC_SUBST(EBCDIC)
AC_SUBST(HAVE_MEMMOVE)
AC_SUBST(HAVE_STRERROR)
AC_SUBST(LINK_SIZE)
AC_SUBST(MATCH_LIMIT)
AC_SUBST(NEWLINE)
AC_SUBST(NO_RECURSE)
AC_SUBST(PCRE_MAJOR)
AC_SUBST(PCRE_MINOR)
AC_SUBST(PCRE_DATE)
AC_SUBST(PCRE_VERSION)
AC_SUBST(PCRE_LIB_VERSION)
AC_SUBST(PCRE_POSIXLIB_VERSION)
AC_SUBST(PCRE_CPPLIB_VERSION)
AC_SUBST(POSIX_MALLOC_THRESHOLD)
AC_SUBST(UCP)
AC_SUBST(UTF8)

dnl Stuff to make MinGW work better. Special treatment is no longer
dnl needed for Cygwin.

case $host_os in
mingw* )
    POSIX_OBJ=pcreposix.o
    POSIX_LOBJ=pcreposix.lo
    POSIX_LIB=
    ON_WINDOWS=
    NOT_ON_WINDOWS="#"
    WIN_PREFIX=
    ;;
* )
    ON_WINDOWS="#"
    NOT_ON_WINDOWS=
    POSIX_OBJ=
    POSIX_LOBJ=
    POSIX_LIB=libpcreposix.la
    WIN_PREFIX=
    ;;
esac
AC_SUBST(WIN_PREFIX)
AC_SUBST(ON_WINDOWS)
AC_SUBST(NOT_ON_WINDOWS)
AC_SUBST(POSIX_OBJ)
AC_SUBST(POSIX_LOBJ)
AC_SUBST(POSIX_LIB)

if test "x$enable_shared" = "xno" ; then
    AC_DEFINE([PCRE_STATIC],[1],[to link statically])
fi

dnl This must be last; it determines what files are written as well as config.h
AC_OUTPUT(Makefile pcre.h:pcre.h.in pcre-config:pcre-config.in libpcre.pc:libpcre.pc.in pcrecpp.h:pcrecpp.h.in pcre_stringpiece.h:pcre_stringpiece.h.in RunGrepTest:RunGrepTest.in RunTest:RunTest.in,[chmod a+x RunTest RunGrepTest pcre-config])