From af8dbd4a5c1eef9488dc44064b14641421021dd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Mon, 12 Feb 2001 14:44:53 +0000 Subject: [PATCH] some boost changes and updates git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1487 a592a061-630c-0410-9148-cb99ea01b6c8 --- boost/Makefile.am | 4 +- boost/acconfig.h | 61 + boost/acinclude.m4 | 25 + boost/aclocal.m4 | 571 +++ boost/boost/config.h.in | 98 + boost/boost/cregex.hpp | 305 ++ boost/boost/re_detail/fileiter.hpp | 439 ++ boost/boost/re_detail/regex_compile.hpp | 2033 +++++++++ boost/boost/re_detail/regex_config.hpp | 1294 ++++++ boost/boost/re_detail/regex_cstring.hpp | 139 + boost/boost/re_detail/regex_format.hpp | 583 +++ boost/boost/re_detail/regex_kmp.hpp | 118 + .../boost/re_detail/regex_library_include.hpp | 148 + boost/boost/re_detail/regex_match.hpp | 1819 ++++++++ boost/boost/re_detail/regex_options.hpp | 467 ++ boost/boost/re_detail/regex_raw_buffer.hpp | 251 + boost/boost/re_detail/regex_split.hpp | 155 + boost/boost/re_detail/regex_stack.hpp | 229 + boost/boost/re_detail/regex_synch.hpp | 183 + boost/boost/regex.h | 102 + boost/boost/regex.hpp | 1515 +++++++ boost/boost/regex_traits.hpp | 800 ++++ boost/boost/smart_ptr.hpp | 394 ++ boost/config.guess | 1183 +++++ boost/config.sub | 1268 ++++++ boost/configure.in | 1765 ++++++++ boost/install-sh | 251 + boost/ltconfig | 3114 +++++++++++++ boost/ltmain.sh | 4028 +++++++++++++++++ boost/missing | 190 + boost/mkinstalldirs | 40 + config/boost.m4 | 25 + po/POTFILES.in | 12 +- 33 files changed, 23600 insertions(+), 9 deletions(-) create mode 100644 boost/acconfig.h create mode 100644 boost/acinclude.m4 create mode 100644 boost/aclocal.m4 create mode 100644 boost/boost/config.h.in create mode 100644 boost/boost/cregex.hpp create mode 100644 boost/boost/re_detail/fileiter.hpp create mode 100644 boost/boost/re_detail/regex_compile.hpp create mode 100644 boost/boost/re_detail/regex_config.hpp create mode 100644 boost/boost/re_detail/regex_cstring.hpp create mode 100644 boost/boost/re_detail/regex_format.hpp create mode 100644 boost/boost/re_detail/regex_kmp.hpp create mode 100644 boost/boost/re_detail/regex_library_include.hpp create mode 100644 boost/boost/re_detail/regex_match.hpp create mode 100644 boost/boost/re_detail/regex_options.hpp create mode 100644 boost/boost/re_detail/regex_raw_buffer.hpp create mode 100644 boost/boost/re_detail/regex_split.hpp create mode 100644 boost/boost/re_detail/regex_stack.hpp create mode 100644 boost/boost/re_detail/regex_synch.hpp create mode 100644 boost/boost/regex.h create mode 100644 boost/boost/regex.hpp create mode 100644 boost/boost/regex_traits.hpp create mode 100644 boost/boost/smart_ptr.hpp create mode 100755 boost/config.guess create mode 100755 boost/config.sub create mode 100644 boost/configure.in create mode 100755 boost/install-sh create mode 100755 boost/ltconfig create mode 100644 boost/ltmain.sh create mode 100755 boost/missing create mode 100755 boost/mkinstalldirs create mode 100644 config/boost.m4 diff --git a/boost/Makefile.am b/boost/Makefile.am index 60d517510d..79c0003b2b 100644 --- a/boost/Makefile.am +++ b/boost/Makefile.am @@ -1,7 +1,7 @@ AUTOMAKE_OPTIONS = foreign DISTCLEANFILES= *.orig *.rej *~ *.bak core MAINTAINERCLEANFILES= $(srcdir)/Makefile.in -SUBDIRS = libs +# SUBDIRS = libs ETAGS_ARGS = --lang=c++ -EXTRA_DIST = boost +EXTRA_DIST = boost libs diff --git a/boost/acconfig.h b/boost/acconfig.h new file mode 100644 index 0000000000..4b3e889a2b --- /dev/null +++ b/boost/acconfig.h @@ -0,0 +1,61 @@ +#undef BOOST_RE_NO_ITERATOR_H +#undef BOOST_RE_NO_WCHAR_H +#undef BOOST_RE_NO_WCSTRING +#undef BOOST_RE_NO_WCTYPE_H +#undef BOOST_RE_NO_SWPRINTF +#undef BOOST_RE_SIZEOF_INT +#undef BOOST_RE_SIZEOF_LONG +#undef BOOST_RE_SIZEOF_SHORT +#undef BOOST_RE_INT32_LONG +#undef BOOST_RE_USE_ALGO +#undef BOOST_RE_THREADS +#undef BOOST_RE_RI_T_3 +#undef BOOST_RE_RI_T_0 +#undef BOOST_RE_PLATFORM_WINDOWS +#undef BOOST_RE_PLATFORM_W32 +#undef BOOST_RE_PLATFORM_DOS +#undef BOOST_RE_OLD_IOSTREAM +#undef BOOST_RE_OI_T_3 +#undef BOOST_RE_OI_T_0 +#undef BOOST_RE_NO_W32 +#undef BOOST_RE_NO_TEMPLATE_SWITCH_MERGE +#undef BOOST_RE_NO_TEMPLATE_RETURNS +#undef BOOST_RE_NO_TEMPLATE_MERGE_A +#undef BOOST_RE_NO_TEMPLATE_INST +#undef BOOST_RE_NO_TEMPLATE_FRIEND +#undef BOOST_RE_NO_STRING_H +#undef BOOST_RE_NO_STRING_DEF_ARGS +#undef BOOST_RE_NO_STL +#undef BOOST_RE_NO_PARTIAL_FUNC_SPEC +#undef BOOST_RE_NO_OI_ASSIGN +#undef BOOST_RE_NO_MUTABLE +#undef BOOST_RE_NO_MEMORY_H +#undef BOOST_RE_NO_MEMBER_TEMPLATES +#undef BOOST_RE_NO_LOCALE_H +#undef BOOST_RE_NO_EXCEPTION_H +#undef BOOST_RE_NO_CAT +#undef BOOST_RE_NO_BOOL +#undef BOOST_RE_NESTED_TEMPLATE_DECL +#undef BOOST_RE_ITERATOR_T_2 +#undef BOOST_RE_ITERATOR_T_1 +#undef BOOST_RE_INT64_T_2 +#undef BOOST_RE_INT64_T_3 +#undef BOOST_RE_INT64_T_4 +#undef BOOST_RE_INT64_T_5 +#undef BOOST_RE_FI_T_3 +#undef BOOST_RE_II_T_0 +#undef BOOST_RE_II_T_3 +#undef BOOST_RE_II_T_4 +#undef BOOST_RE_INT64_T_6 +#undef BOOST_RE_ITERATOR_T_0 +#undef BOOST_RE_AUTO_CONFIGURE +#undef BOOST_RE_BI_T_ +#undef BOOST_RE_BI_T_0 +#undef BOOST_RE_CALL +#undef BOOST_RE_CCALL +#undef BOOST_RE_DISTANCE_T_0 +#undef BOOST_RE_INT64_T_0 +#undef BOOST_RE_INT64_T_1 +#undef BOOST_RE_DISTANCE_T_1 +#undef BOOST_RE_DISTANCE_T_2 +#undef BOOST_RE_FI_T_0 diff --git a/boost/acinclude.m4 b/boost/acinclude.m4 new file mode 100644 index 0000000000..aef4b3729c --- /dev/null +++ b/boost/acinclude.m4 @@ -0,0 +1,25 @@ + +dnl AC_VALIDATE_CACHE_SYSTEM_TYPE[(cmd)] +dnl if the cache file is inconsistent with the current host, +dnl target and build system types, execute CMD or print a default +dnl error message. +AC_DEFUN(AC_VALIDATE_CACHE_SYSTEM_TYPE, [ + AC_REQUIRE([AC_CANONICAL_SYSTEM]) + AC_MSG_CHECKING([config.cache system type]) + if { test x"${ac_cv_host_system_type+set}" = x"set" && + test x"$ac_cv_host_system_type" != x"$host"; } || + { test x"${ac_cv_build_system_type+set}" = x"set" && + test x"$ac_cv_build_system_type" != x"$build"; } || + { test x"${ac_cv_target_system_type+set}" = x"set" && + test x"$ac_cv_target_system_type" != x"$target"; }; then + AC_MSG_RESULT([different]) + ifelse($#, 1, [$1], + [AC_MSG_ERROR(["you must remove config.cache and restart configure"])]) + else + AC_MSG_RESULT([same]) + fi + ac_cv_host_system_type="$host" + ac_cv_build_system_type="$build" + ac_cv_target_system_type="$target" +]) + diff --git a/boost/aclocal.m4 b/boost/aclocal.m4 new file mode 100644 index 0000000000..325d08d1e8 --- /dev/null +++ b/boost/aclocal.m4 @@ -0,0 +1,571 @@ +dnl aclocal.m4 generated automatically by aclocal 1.4 + +dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. + + +dnl AC_VALIDATE_CACHE_SYSTEM_TYPE[(cmd)] +dnl if the cache file is inconsistent with the current host, +dnl target and build system types, execute CMD or print a default +dnl error message. +AC_DEFUN(AC_VALIDATE_CACHE_SYSTEM_TYPE, [ + AC_REQUIRE([AC_CANONICAL_SYSTEM]) + AC_MSG_CHECKING([config.cache system type]) + if { test x"${ac_cv_host_system_type+set}" = x"set" && + test x"$ac_cv_host_system_type" != x"$host"; } || + { test x"${ac_cv_build_system_type+set}" = x"set" && + test x"$ac_cv_build_system_type" != x"$build"; } || + { test x"${ac_cv_target_system_type+set}" = x"set" && + test x"$ac_cv_target_system_type" != x"$target"; }; then + AC_MSG_RESULT([different]) + ifelse($#, 1, [$1], + [AC_MSG_ERROR(["you must remove config.cache and restart configure"])]) + else + AC_MSG_RESULT([same]) + fi + ac_cv_host_system_type="$host" + ac_cv_build_system_type="$build" + ac_cv_target_system_type="$target" +]) + + +# Like AC_CONFIG_HEADER, but automatically create stamp file. + +AC_DEFUN(AM_CONFIG_HEADER, +[AC_PREREQ([2.12]) +AC_CONFIG_HEADER([$1]) +dnl When config.status generates a header, we must update the stamp-h file. +dnl This file resides in the same directory as the config header +dnl that is generated. We must strip everything past the first ":", +dnl and everything past the last "/". +AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl +ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, +<>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, +<>; do + case " <<$>>CONFIG_HEADERS " in + *" <<$>>am_file "*<<)>> + echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx + ;; + esac + am_indx=`expr "<<$>>am_indx" + 1` +done<<>>dnl>>) +changequote([,]))]) + +# Do all the work for Automake. This macro actually does too much -- +# some checks are only needed if your package does certain things. +# But this isn't really a big deal. + +# serial 1 + +dnl Usage: +dnl AM_INIT_AUTOMAKE(package,version, [no-define]) + +AC_DEFUN(AM_INIT_AUTOMAKE, +[AC_REQUIRE([AC_PROG_INSTALL]) +PACKAGE=[$1] +AC_SUBST(PACKAGE) +VERSION=[$2] +AC_SUBST(VERSION) +dnl test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi +ifelse([$3],, +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) +AC_REQUIRE([AM_SANITY_CHECK]) +AC_REQUIRE([AC_ARG_PROGRAM]) +dnl FIXME This is truly gross. +missing_dir=`cd $ac_aux_dir && pwd` +AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) +AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) +AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) +AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) +AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) +AC_REQUIRE([AC_PROG_MAKE_SET])]) + +# +# Check to make sure that the build environment is sane. +# + +AC_DEFUN(AM_SANITY_CHECK, +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "[$]*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "[$]*" != "X $srcdir/configure conftestfile" \ + && test "[$]*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "[$]2" = conftestfile + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +rm -f conftest* +AC_MSG_RESULT(yes)]) + +dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) +dnl The program must properly implement --version. +AC_DEFUN(AM_MISSING_PROG, +[AC_MSG_CHECKING(for working $2) +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if ($2 --version) < /dev/null > /dev/null 2>&1; then + $1=$2 + AC_MSG_RESULT(found) +else + $1="$3/missing $2" + AC_MSG_RESULT(missing) +fi +AC_SUBST($1)]) + + +# serial 40 AC_PROG_LIBTOOL +AC_DEFUN(AC_PROG_LIBTOOL, +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl + +# Save cache, so that ltconfig can load it +AC_CACHE_SAVE + +# Actually configure libtool. ac_aux_dir is where install-sh is found. +CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ +LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \ +DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ +$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \ +|| AC_MSG_ERROR([libtool configure failed]) + +# Reload cache, that may have been modified by ltconfig +AC_CACHE_LOAD + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log +]) + +AC_DEFUN(AC_LIBTOOL_SETUP, +[AC_PREREQ(2.13)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_RANLIB])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_NM])dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +dnl + +case "$target" in +NONE) lt_target="$host" ;; +*) lt_target="$target" ;; +esac + +# Check for any special flags to pass to ltconfig. +# +# the following will cause an existing older ltconfig to fail, so +# we ignore this at the expense of the cache file... Checking this +# will just take longer ... bummer! +#libtool_flags="--cache-file=$cache_file" +# +test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" +test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" +test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" +test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" +test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" +ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], +[libtool_flags="$libtool_flags --enable-dlopen"]) +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[libtool_flags="$libtool_flags --enable-win32-dll"]) +AC_ARG_ENABLE(libtool-lock, + [ --disable-libtool-lock avoid locking (might break parallel builds)]) +test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" +test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case "$lt_target" in +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case "`/usr/bin/file conftest.o`" in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; +]) +esac +]) + +# AC_LIBTOOL_DLOPEN - enable checks for dlopen support +AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) + +# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's +AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) + +# AC_ENABLE_SHARED - implement the --enable-shared flag +# Usage: AC_ENABLE_SHARED[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN(AC_ENABLE_SHARED, [dnl +define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(shared, +changequote(<<, >>)dnl +<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case "$enableval" in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl +]) + +# AC_DISABLE_SHARED - set the default shared flag to --disable-shared +AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no)]) + +# AC_ENABLE_STATIC - implement the --enable-static flag +# Usage: AC_ENABLE_STATIC[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN(AC_ENABLE_STATIC, [dnl +define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(static, +changequote(<<, >>)dnl +<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case "$enableval" in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_static=AC_ENABLE_STATIC_DEFAULT)dnl +]) + +# AC_DISABLE_STATIC - set the default static flag to --disable-static +AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no)]) + + +# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag +# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl +define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(fast-install, +changequote(<<, >>)dnl +<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case "$enableval" in +yes) enable_fast_install=yes ;; +no) enable_fast_install=no ;; +*) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl +]) + +# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install +AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no)]) + +# AC_PROG_LD - find the path to the GNU or non-GNU linker +AC_DEFUN(AC_PROG_LD, +[AC_ARG_WITH(gnu-ld, +[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], +test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +ac_prog=ld +if test "$ac_cv_prog_gcc" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + ac_prog=`($CC -print-prog-name=ld) 2>&5` + case "$ac_prog" in + # Accept absolute paths. +changequote(,)dnl + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' +changequote([,])dnl + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(ac_cv_path_LD, +[if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + ac_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + ac_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$ac_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_PROG_LD_GNU +]) + +AC_DEFUN(AC_PROG_LD_GNU, +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + ac_cv_prog_gnu_ld=yes +else + ac_cv_prog_gnu_ld=no +fi]) +]) + +# AC_PROG_NM - find the path to a BSD-compatible name lister +AC_DEFUN(AC_PROG_NM, +[AC_MSG_CHECKING([for BSD-compatible nm]) +AC_CACHE_VAL(ac_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + ac_cv_path_NM="$NM" +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + ac_cv_path_NM="$ac_dir/nm -B" + break + elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + ac_cv_path_NM="$ac_dir/nm -p" + break + else + ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm +fi]) +NM="$ac_cv_path_NM" +AC_MSG_RESULT([$NM]) +]) + +# AC_CHECK_LIBM - check for math library +AC_DEFUN(AC_CHECK_LIBM, +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case "$lt_target" in +*-*-beos* | *-*-cygwin*) + # These system don't have libm + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, main, LIBM="-lm") + ;; +esac +]) + +# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl convenience library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-convenience to the +# configure arguments. Note that LIBLTDL and INCLTDL are not +# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not +# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed +# with '${top_builddir}/' and INCLTDL will be prefixed with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case "$enable_ltdl_convenience" in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la + INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) +]) + +# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl installable library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-install to the configure +# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is +# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed +# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed +# with '${top_srcdir}/' (note the single quotes!). If your package is +# not flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, main, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la + INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + INCLTDL= + fi +]) + +dnl old names +AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl +AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl +AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl +AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl +AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl +AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl +AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl + +dnl This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL])dnl + diff --git a/boost/boost/config.h.in b/boost/boost/config.h.in new file mode 100644 index 0000000000..4a13047437 --- /dev/null +++ b/boost/boost/config.h.in @@ -0,0 +1,98 @@ +/* boost/config.h.in. Generated automatically from configure.in by autoheader. */ + +/* Define if on AIX 3. + System headers sometimes define this. + We just want to avoid a redefinition error message. */ +#ifndef _ALL_SOURCE +#undef _ALL_SOURCE +#endif + +/* Define if you need to in order for stat and other things to work. */ +#undef _POSIX_SOURCE + +#undef BOOST_RE_NO_ITERATOR_H +#undef BOOST_RE_NO_WCHAR_H +#undef BOOST_RE_NO_WCSTRING +#undef BOOST_RE_NO_WCTYPE_H +#undef BOOST_RE_NO_SWPRINTF +#undef BOOST_RE_SIZEOF_INT +#undef BOOST_RE_SIZEOF_LONG +#undef BOOST_RE_SIZEOF_SHORT +#undef BOOST_RE_INT32_LONG +#undef BOOST_RE_USE_ALGO +#undef BOOST_RE_THREADS +#undef BOOST_RE_RI_T_3 +#undef BOOST_RE_RI_T_0 +#undef BOOST_RE_PLATFORM_WINDOWS +#undef BOOST_RE_PLATFORM_W32 +#undef BOOST_RE_PLATFORM_DOS +#undef BOOST_RE_OLD_IOSTREAM +#undef BOOST_RE_OI_T_3 +#undef BOOST_RE_OI_T_0 +#undef BOOST_RE_NO_W32 +#undef BOOST_RE_NO_TEMPLATE_SWITCH_MERGE +#undef BOOST_RE_NO_TEMPLATE_RETURNS +#undef BOOST_RE_NO_TEMPLATE_MERGE_A +#undef BOOST_RE_NO_TEMPLATE_INST +#undef BOOST_RE_NO_TEMPLATE_FRIEND +#undef BOOST_RE_NO_STRING_H +#undef BOOST_RE_NO_STRING_DEF_ARGS +#undef BOOST_RE_NO_STL +#undef BOOST_RE_NO_PARTIAL_FUNC_SPEC +#undef BOOST_RE_NO_OI_ASSIGN +#undef BOOST_RE_NO_MUTABLE +#undef BOOST_RE_NO_MEMORY_H +#undef BOOST_RE_NO_MEMBER_TEMPLATES +#undef BOOST_RE_NO_LOCALE_H +#undef BOOST_RE_NO_EXCEPTION_H +#undef BOOST_RE_NO_CAT +#undef BOOST_RE_NO_BOOL +#undef BOOST_RE_NESTED_TEMPLATE_DECL +#undef BOOST_RE_ITERATOR_T_2 +#undef BOOST_RE_ITERATOR_T_1 +#undef BOOST_RE_INT64_T_2 +#undef BOOST_RE_INT64_T_3 +#undef BOOST_RE_INT64_T_4 +#undef BOOST_RE_INT64_T_5 +#undef BOOST_RE_FI_T_3 +#undef BOOST_RE_II_T_0 +#undef BOOST_RE_II_T_3 +#undef BOOST_RE_II_T_4 +#undef BOOST_RE_INT64_T_6 +#undef BOOST_RE_ITERATOR_T_0 +#undef BOOST_RE_AUTO_CONFIGURE +#undef BOOST_RE_BI_T_ +#undef BOOST_RE_BI_T_0 +#undef BOOST_RE_CALL +#undef BOOST_RE_CCALL +#undef BOOST_RE_DISTANCE_T_0 +#undef BOOST_RE_INT64_T_0 +#undef BOOST_RE_INT64_T_1 +#undef BOOST_RE_DISTANCE_T_1 +#undef BOOST_RE_DISTANCE_T_2 +#undef BOOST_RE_FI_T_0 + +/* The number of bytes in a int. */ +#undef SIZEOF_INT + +/* The number of bytes in a long. */ +#undef SIZEOF_LONG + +/* The number of bytes in a short. */ +#undef SIZEOF_SHORT + +/* Define if you have the nl_types library (-lnl_types). */ +#undef HAVE_LIBNL_TYPES + +/* Define if you have the posix library (-lposix). */ +#undef HAVE_LIBPOSIX + +/* Define if you have the pthread library (-lpthread). */ +#undef HAVE_LIBPTHREAD + +/* Name of package */ +#undef PACKAGE + +/* Version number of package */ +#undef VERSION + diff --git a/boost/boost/cregex.hpp b/boost/boost/cregex.hpp new file mode 100644 index 0000000000..0edef1ba06 --- /dev/null +++ b/boost/boost/cregex.hpp @@ -0,0 +1,305 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE cregex.cpp + * VERSION 3.03 + * DESCRIPTION: Declares POSIX API functions + * + boost::RegEx high level wrapper. + */ + +#ifndef BOOST_RE_CREGEX_HPP +#define BOOST_RE_CREGEX_HPP + +#include + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b -Ve + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b -Ve + #endif +#endif + +/* include these defs only for POSIX compatablity */ +#ifdef __cplusplus +namespace boost{ +extern "C" { +#endif + +typedef int regoff_t; + +typedef struct +{ + unsigned int re_magic; + unsigned int re_nsub; /* number of parenthesized subexpressions */ + const char* re_endp; /* end pointer for REG_PEND */ + void* guts; /* none of your business :-) */ + unsigned int eflags; /* none of your business :-) */ +} regex_tA; + +#ifndef BOOST_RE_NO_WCSTRING +typedef struct +{ + unsigned int re_magic; + unsigned int re_nsub; /* number of parenthesized subexpressions */ + const wchar_t* re_endp; /* end pointer for REG_PEND */ + void* guts; /* none of your business :-) */ + unsigned int eflags; /* none of your business :-) */ +} regex_tW; +#endif + +typedef struct +{ + regoff_t rm_so; /* start of match */ + regoff_t rm_eo; /* end of match */ +} regmatch_t; + +/* regcomp() flags */ +typedef enum{ + REG_BASIC = 0000, + REG_EXTENDED = 0001, + REG_ICASE = 0002, + REG_NOSUB = 0004, + REG_NEWLINE = 0010, + REG_NOSPEC = 0020, + REG_PEND = 0040, + REG_DUMP = 0200, + REG_NOCOLLATE = 0400, + REG_ESCAPE_IN_LISTS = 01000, + REG_NEWLINE_ALT = 02000, + + REG_PERL = REG_EXTENDED | REG_NOCOLLATE | REG_ESCAPE_IN_LISTS, + REG_AWK = REG_EXTENDED | REG_ESCAPE_IN_LISTS, + REG_GREP = REG_BASIC | REG_NEWLINE_ALT, + REG_EGREP = REG_EXTENDED | REG_NEWLINE_ALT, + + REG_ASSERT = 15, + REG_INVARG = 16, + REG_ATOI = 255, /* convert name to number (!) */ + REG_ITOA = 0400 /* convert number to name (!) */ +} reg_comp_flags; + +/* regexec() flags */ +typedef enum{ + REG_NOTBOL = 00001, + REG_NOTEOL = 00002, + REG_STARTEND = 00004 +} reg_exec_flags; + +BOOST_RE_IX_DECL int BOOST_RE_CCALL regcompA(regex_tA*, const char*, int); +BOOST_RE_IX_DECL unsigned int BOOST_RE_CCALL regerrorA(int, const regex_tA*, char*, unsigned int); +BOOST_RE_IX_DECL int BOOST_RE_CCALL regexecA(const regex_tA*, const char*, unsigned int, regmatch_t*, int); +BOOST_RE_IX_DECL void BOOST_RE_CCALL regfreeA(regex_tA*); + +#ifndef BOOST_RE_NO_WCSTRING +BOOST_RE_IX_DECL int BOOST_RE_CCALL regcompW(regex_tW*, const wchar_t*, int); +BOOST_RE_IX_DECL unsigned int BOOST_RE_CCALL regerrorW(int, const regex_tW*, wchar_t*, unsigned int); +BOOST_RE_IX_DECL int BOOST_RE_CCALL regexecW(const regex_tW*, const wchar_t*, unsigned int, regmatch_t*, int); +BOOST_RE_IX_DECL void BOOST_RE_CCALL regfreeW(regex_tW*); +#endif + +#ifdef UNICODE +#define regcomp regcompW +#define regerror regerrorW +#define regexec regexecW +#define regfree regfreeW +#define regex_t regex_tW +#else +#define regcomp regcompA +#define regerror regerrorA +#define regexec regexecA +#define regfree regfreeA +#define regex_t regex_tA +#endif + +/* regerror() flags */ +typedef enum +{ + REG_NOERROR = 0, /* Success. */ + REG_NOMATCH = 1, /* Didn't find a match (for regexec). */ + + /* POSIX regcomp return error codes. (In the order listed in the + standard.) */ + REG_BADPAT = 2, /* Invalid pattern. */ + REG_ECOLLATE = 3, /* Undefined collating element. */ + REG_ECTYPE = 4, /* Invalid character class name. */ + REG_EESCAPE = 5, /* Trailing backslash. */ + REG_ESUBREG = 6, /* Invalid back reference. */ + REG_EBRACK = 7, /* Unmatched left bracket. */ + REG_EPAREN = 8, /* Parenthesis imbalance. */ + REG_EBRACE = 9, /* Unmatched \{. */ + REG_BADBR = 10, /* Invalid contents of \{\}. */ + REG_ERANGE = 11, /* Invalid range end. */ + REG_ESPACE = 12, /* Ran out of memory. */ + REG_BADRPT = 13, /* No preceding re for repetition op. */ + REG_EEND = 14, /* unexpected end of expression */ + REG_ESIZE = 15, /* expression too big */ + REG_ERPAREN = 16, /* unmatched right parenthesis */ + REG_EMPTY = 17, /* empty expression */ + REG_E_MEMORY = REG_ESIZE, /* out of memory */ + REG_E_UNKNOWN = 18 /* unknown error */ +} reg_errcode_t; + +enum match_flags +{ + match_default = 0, + match_not_bol = 1, // first is not start of line + match_not_eol = match_not_bol << 1, // last is not end of line + match_not_bob = match_not_eol << 1, // first is not start of buffer + match_not_eob = match_not_bob << 1, // last is not end of buffer + match_not_bow = match_not_eob << 1, // first is not start of word + match_not_eow = match_not_bow << 1, // last is not end of word + match_not_dot_newline = match_not_eow << 1, // \n is not matched by '.' + match_not_dot_null = match_not_dot_newline << 1, // '\0' is not matched by '.' + match_prev_avail = match_not_dot_null << 1, // *--first is a valid expression + match_init = match_prev_avail << 1, // internal use + match_any = match_init << 1, // don't care what we match + match_not_null = match_any << 1, // string can't be null + match_continuous = match_not_null << 1, // each grep match must continue from + // uninterupted from the previous one + match_partial = match_continuous << 1, // find partial matches + + match_stop = match_partial << 1, // stop after first match (grep) + match_all = match_stop << 1, // must find the whole of input even if match_any is set + match_max = match_all +}; + + +#ifdef __cplusplus +} // extern "C" +} // namespace +#endif + + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + + +// +// C++ high level wrapper goes here: +// +#if defined(__cplusplus) && !defined(BOOST_RE_NO_STRING_H) +#include +#include +namespace boost{ + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b + #endif +#endif + +class RegEx; + +namespace re_detail{ + +class RegExData; +struct pred1; +struct pred2; +struct pred3; +struct pred4; + +} // namespace re_detail + +#if defined(BOOST_MSVC) || defined(__BORLANDC__) +typedef bool (__cdecl *GrepCallback)(const RegEx& expression); +typedef bool (__cdecl *GrepFileCallback)(const char* file, const RegEx& expression); +typedef bool (__cdecl *FindFilesCallback)(const char* file); +#else +typedef bool (*GrepCallback)(const RegEx& expression); +typedef bool (*GrepFileCallback)(const char* file, const RegEx& expression); +typedef bool (*FindFilesCallback)(const char* file); +#endif + +class BOOST_RE_IX_DECL RegEx +{ +private: + re_detail::RegExData* pdata; +public: + RegEx(); + RegEx(const RegEx& o); + ~RegEx(); + explicit RegEx(const char* c, bool icase = false); + explicit RegEx(const std::string& s, bool icase = false); + RegEx& operator=(const RegEx& o); + RegEx& operator=(const char* p); + RegEx& operator=(const std::string& s){ return this->operator=(s.c_str()); } + unsigned int SetExpression(const char* p, bool icase = false); + unsigned int SetExpression(const std::string& s, bool icase = false){ return SetExpression(s.c_str(), icase); } + std::string Expression()const; + // + // now matching operators: + // + bool Match(const char* p, unsigned int flags = match_default); + bool Match(const std::string& s, unsigned int flags = match_default) { return Match(s.c_str(), flags); } + bool Search(const char* p, unsigned int flags = match_default); + bool Search(const std::string& s, unsigned int flags = match_default) { return Search(s.c_str(), flags); } + unsigned int Grep(GrepCallback cb, const char* p, unsigned int flags = match_default); + unsigned int Grep(GrepCallback cb, const std::string& s, unsigned int flags = match_default) { return Grep(cb, s.c_str(), flags); } + unsigned int Grep(std::vector& v, const char* p, unsigned int flags = match_default); + unsigned int Grep(std::vector& v, const std::string& s, unsigned int flags = match_default) { return Grep(v, s.c_str(), flags); } + unsigned int Grep(std::vector& v, const char* p, unsigned int flags = match_default); + unsigned int Grep(std::vector& v, const std::string& s, unsigned int flags = match_default) { return Grep(v, s.c_str(), flags); } + unsigned int GrepFiles(GrepFileCallback cb, const char* files, bool recurse = false, unsigned int flags = match_default); + unsigned int GrepFiles(GrepFileCallback cb, const std::string& files, bool recurse = false, unsigned int flags = match_default) { return GrepFiles(cb, files.c_str(), recurse, flags); } + unsigned int FindFiles(FindFilesCallback cb, const char* files, bool recurse = false, unsigned int flags = match_default); + unsigned int FindFiles(FindFilesCallback cb, const std::string& files, bool recurse = false, unsigned int flags = match_default) { return FindFiles(cb, files.c_str(), recurse, flags); } + + std::string Merge(const std::string& in, const std::string& fmt, + bool copy = true, unsigned int flags = match_default); + std::string Merge(const char* in, const char* fmt, + bool copy = true, unsigned int flags = match_default); + + unsigned int Split(std::vector& v, std::string& s, unsigned flags = match_default, unsigned max_count = ~0); + // + // now operators for returning what matched in more detail: + // + unsigned int Position(int i = 0)const; + unsigned int Length(int i = 0)const; + unsigned int Line()const; + unsigned int Marks()const; + std::string What(int i = 0)const; + std::string operator[](int i)const { return What(i); } + + friend struct re_detail::pred1; + friend struct re_detail::pred2; + friend struct re_detail::pred3; + friend struct re_detail::pred4; +}; + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + +} // namespace boost + +#endif + +#endif // include guard + + + + + + diff --git a/boost/boost/re_detail/fileiter.hpp b/boost/boost/re_detail/fileiter.hpp new file mode 100644 index 0000000000..1eb337ad85 --- /dev/null +++ b/boost/boost/re_detail/fileiter.hpp @@ -0,0 +1,439 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE fileiter.hpp + * VERSION 3.03 + * DESCRIPTION: Declares various platform independent file and + * directory iterators, plus binary file input in + * the form of class map_file. + */ + +#ifndef BOOST_RE_FILEITER_HPP +#define BOOST_RE_FILEITER_HPP + +#include + +#if (defined(__CYGWIN__) || defined(__CYGWIN32__)) && !defined(BOOST_RE_NO_W32) +#error "Sorry, can't mix with STL code and gcc compiler: if you ran configure, try again with configure --disable-ms-windows" +#define FI_WIN32_MAP +#define FI_POSIX_DIR +#elif (defined(__WIN32__) || defined(_WIN32) || defined(WIN32)) && !defined(BOOST_RE_NO_W32) +#define FI_WIN32_MAP +#define FI_WIN32_DIR +#else +#define FI_POSIX_MAP +#define FI_POSIX_DIR +#endif + +#if defined(FI_WIN32_MAP)||defined(FI_WIN32_DIR) +#include +#endif + +#if defined(FI_WIN32_DIR) + +namespace boost{ + namespace re_detail{ + +typedef WIN32_FIND_DATA _fi_find_data; +typedef HANDLE _fi_find_handle; + + } // namespace re_detail + +} // namespace boost + +#define _fi_invalid_handle INVALID_HANDLE_VALUE +#define _fi_dir FILE_ATTRIBUTE_DIRECTORY + +#elif defined(FI_POSIX_DIR) + +#include +#include +#include +#include +#include +#include + +#if defined(__SUNPRO_CC) +using std::list; +#endif + +#ifndef MAX_PATH +#define MAX_PATH 256 +#endif + +namespace boost{ + namespace re_detail{ + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b -Ve + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b -Ve + #endif +#endif + +struct _fi_find_data +{ + unsigned dwFileAttributes; + char cFileName[MAX_PATH]; +}; + +struct _fi_priv_data; + +typedef _fi_priv_data* _fi_find_handle; +#define _fi_invalid_handle NULL +#define _fi_dir 1 + +_fi_find_handle _fi_FindFirstFile(const char* lpFileName, _fi_find_data* lpFindFileData); +bool _fi_FindNextFile(_fi_find_handle hFindFile, _fi_find_data* lpFindFileData); +bool _fi_FindClose(_fi_find_handle hFindFile); + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + + } // namespace re_detail +} // namespace boost + +#ifdef FindFirstFile + #undef FindFirstFile +#endif +#ifdef FindNextFile + #undef FindNextFile +#endif +#ifdef FindClose + #undef FindClose +#endif + +#define FindFirstFile _fi_FindFirstFile +#define FindNextFile _fi_FindNextFile +#define FindClose _fi_FindClose + +#endif + +namespace boost{ + namespace re_detail{ + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b + #endif +#endif + +#ifdef FI_WIN32_MAP // win32 mapfile + +class BOOST_RE_IX_DECL mapfile +{ + HANDLE hfile; + HANDLE hmap; + const char* _first; + const char* _last; +public: + + typedef const char* iterator; + + mapfile(){ hfile = hmap = 0; _first = _last = 0; } + mapfile(const char* file){ hfile = hmap = 0; _first = _last = 0; open(file); } + ~mapfile(){ close(); } + void open(const char* file); + void close(); + const char* begin(){ return _first; } + const char* end(){ return _last; } + size_t size(){ return _last - _first; } + bool valid(){ return (hfile != 0) && (hfile != INVALID_HANDLE_VALUE); } +}; + + +#elif !defined(BOOST_RE_NO_STL) // use C API to emulate the memory map: + +class BOOST_RE_IX_DECL mapfile_iterator; + +class BOOST_RE_IX_DECL mapfile +{ + typedef char* pointer; + std::FILE* hfile; + long int _size; + pointer* _first; + pointer* _last; + mutable std::list condemed; + enum sizes + { + buf_size = 4096 + }; + void lock(pointer* node)const; + void unlock(pointer* node)const; +public: + + typedef mapfile_iterator iterator; + + mapfile(){ hfile = 0; _size = 0; _first = _last = 0; } + mapfile(const char* file){ hfile = 0; _size = 0; _first = _last = 0; open(file); } + ~mapfile(){ close(); } + void open(const char* file); + void close(); + iterator begin()const; + iterator end()const; + unsigned long size()const{ return _size; } + bool valid()const{ return hfile != 0; } + friend class mapfile_iterator; +}; + +class BOOST_RE_IX_DECL mapfile_iterator : public BOOST_RE_RA_ITERATOR(char, long) +{ + typedef mapfile::pointer internal_pointer; + internal_pointer* node; + const mapfile* file; + unsigned long offset; + long position()const + { + return file ? ((node - file->_first) * mapfile::buf_size + offset) : 0; + } + void position(long pos) + { + if(file) + { + node = file->_first + (pos / mapfile::buf_size); + offset = pos % mapfile::buf_size; + } + } +public: + typedef std::ptrdiff_t difference_type; + typedef char value_type; + typedef const char* pointer; + typedef const char& reference; + typedef std::random_access_iterator_tag iterator_category; + + mapfile_iterator() { node = 0; file = 0; offset = 0; } + mapfile_iterator(const mapfile* f, long position) + { + file = f; + node = f->_first + position / mapfile::buf_size; + offset = position % mapfile::buf_size; + if(file) + file->lock(node); + } + mapfile_iterator(const mapfile_iterator& i) + { + file = i.file; + node = i.node; + offset = i.offset; + if(file) + file->lock(node); + } + ~mapfile_iterator() + { + if(file && node) + file->unlock(node); + } + mapfile_iterator& operator = (const mapfile_iterator& i); + char operator* ()const + { + assert(node >= file->_first); + assert(node < file->_last); + return file ? *(*node + sizeof(int) + offset) : char(0); + } + char operator[] (long off)const + { + mapfile_iterator tmp(*this); + tmp += off; + return *tmp; + } + mapfile_iterator& operator++ (); + mapfile_iterator operator++ (int); + mapfile_iterator& operator-- (); + mapfile_iterator operator-- (int); + + mapfile_iterator& operator += (long off) + { + position(position() + off); + return *this; + } + mapfile_iterator& operator -= (long off) + { + position(position() - off); + return *this; + } + + friend inline bool operator==(const mapfile_iterator& i, const mapfile_iterator& j) + { + return (i.file == j.file) && (i.node == j.node) && (i.offset == j.offset); + } +#ifndef BOOST_RE_NO_NOT_EQUAL + friend inline bool operator!=(const mapfile_iterator& i, const mapfile_iterator& j) + { + return !(i == j); + } +#endif + friend inline bool operator<(const mapfile_iterator& i, const mapfile_iterator& j) + { + return i.position() < j.position(); + } + friend inline bool operator>(const mapfile_iterator& i, const mapfile_iterator& j) + { + return i.position() > j.position(); + } + friend inline bool operator<=(const mapfile_iterator& i, const mapfile_iterator& j) + { + return i.position() <= j.position(); + } + friend inline bool operator>=(const mapfile_iterator& i, const mapfile_iterator& j) + { + return i.position() >= j.position(); + } + + friend mapfile_iterator operator + (const mapfile_iterator& i, long off); + friend mapfile_iterator operator + (long off, const mapfile_iterator& i) + { + mapfile_iterator tmp(i); + return tmp += off; + } + friend mapfile_iterator operator - (const mapfile_iterator& i, long off); + friend inline long operator - (const mapfile_iterator& i, const mapfile_iterator& j) + { + return i.position() - j.position(); + } +}; + +#endif + +// _fi_sep determines the directory separator, either '\\' or '/' +BOOST_RE_IX_DECL extern const char* _fi_sep; + +struct file_iterator_ref +{ + _fi_find_handle hf; + _fi_find_data _data; + long count; +}; + + +class BOOST_RE_IX_DECL file_iterator : public BOOST_RE_INPUT_ITERATOR(const char*, std::ptrdiff_t) +{ + char* _root; + char* _path; + char* ptr; + file_iterator_ref* ref; + +public: + file_iterator(); + file_iterator(const char* wild); + ~file_iterator(); + file_iterator(const file_iterator&); + file_iterator& operator=(const file_iterator&); + const char* root()const { return _root; } + const char* path()const { return _path; } + const char* name()const { return ptr; } + _fi_find_data* data() { return &(ref->_data); } + void next(); + file_iterator& operator++() { next(); return *this; } + file_iterator operator++(int); + const char* operator*() { return path(); } + + friend inline bool operator == (const file_iterator& f1, const file_iterator& f2) + { + return ((f1.ref->hf == _fi_invalid_handle) && (f2.ref->hf == _fi_invalid_handle)); + } +#ifndef BOOST_RE_NO_NOT_EQUAL + friend inline bool operator != (const file_iterator& f1, const file_iterator& f2) + { + return !(f1 == f2); + } +#endif +}; + +// dwa 9/13/00 - suppress unused parameter warning +inline bool operator < (const file_iterator&, const file_iterator&) +{ + return false; +} + + +class BOOST_RE_IX_DECL directory_iterator : public BOOST_RE_INPUT_ITERATOR(const char*, std::ptrdiff_t) +{ + char* _root; + char* _path; + char* ptr; + file_iterator_ref* ref; + +public: + directory_iterator(); + directory_iterator(const char* wild); + ~directory_iterator(); + directory_iterator(const directory_iterator& other); + directory_iterator& operator=(const directory_iterator& other); + + const char* root()const { return _root; } + const char* path()const { return _path; } + const char* name()const { return ptr; } + _fi_find_data* data() { return &(ref->_data); } + void next(); + directory_iterator& operator++() { next(); return *this; } + directory_iterator operator++(int); + const char* operator*() { return path(); } + + static const char* separator() { return _fi_sep; } + + friend inline bool operator == (const directory_iterator& f1, const directory_iterator& f2) + { + return ((f1.ref->hf == _fi_invalid_handle) && (f2.ref->hf == _fi_invalid_handle)); + } + +#ifndef BOOST_RE_NO_NOT_EQUAL + friend inline bool operator != (const directory_iterator& f1, const directory_iterator& f2) + { + return !(f1 == f2); + } +#endif +}; + +inline bool operator < (const directory_iterator&, const directory_iterator&) +{ + return false; +} + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + + +} // namespace re_detail +using boost::re_detail::directory_iterator; +using boost::re_detail::file_iterator; +using boost::re_detail::mapfile; +} // namespace boost + +#endif // _FILEITER_H + + + + + + + + + + + + + + diff --git a/boost/boost/re_detail/regex_compile.hpp b/boost/boost/re_detail/regex_compile.hpp new file mode 100644 index 0000000000..3699606977 --- /dev/null +++ b/boost/boost/re_detail/regex_compile.hpp @@ -0,0 +1,2033 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE regex_compile.hpp + * VERSION 3.03 + * DESCRIPTION: Declares reg_expression<> member functions. This is + * an internal header file, do not include directly. + */ + +#ifndef BOOST_REGEX_COMPILE_HPP +#define BOOST_REGEX_COMPILE_HPP + +namespace boost{ + namespace re_detail{ + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b -Ve + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b -Ve + #endif +#endif + +template +struct kmp_translator +{ + typedef typename traits::char_type char_type; + bool icase; + const traits* pt; + kmp_translator(bool c, traits* p) : icase(c), pt(p) {} + char_type operator()(char_type c) + { + return pt->translate(c, icase); + } +}; + + +template +bool BOOST_RE_CALL re_maybe_set_member(charT c, + re_set_long* set_, + const reg_expression& e) +{ + const charT* p = (const charT*)(set_+1); + bool icase = e.flags() & regbase::icase; + charT col = e.get_traits().translate(c, icase); + for(unsigned int i = 0; i < set_->csingles; ++i) + { + if(col == *p) + return set_->isnot ? false : true; + + while(*p)++p; + ++p; // skip null + } + return set_->isnot ? true : false; +} + +} // namespace re_detail + +#if defined(BOOST_RE_NO_TEMPLATE_SWITCH_MERGE) && !defined(BOOST_RE_NO_NAMESPACES) +// +// Ugly ugly hack, +// templates don't merge if they contain switch statements so declare these +// templates in unnamed namespace (ie with internal linkage), each translation +// unit then gets its own local copy, it works seemlessly but bloats the app. +namespace{ +#endif + +template +inline bool BOOST_RE_CALL reg_expression::can_start(charT c, const unsigned char* _map, unsigned char mask, const re_detail::_wide_type&) +{ + if((traits_size_type)(traits_uchar_type)c >= 256) + return true; + return BOOST_RE_MAKE_BOOL(_map[(traits_uchar_type)c] & mask); +} + +template +inline bool BOOST_RE_CALL reg_expression::can_start(charT c, const unsigned char* _map, unsigned char mask, const re_detail::_narrow_type&) +{ + return BOOST_RE_MAKE_BOOL(_map[(traits_uchar_type)c] & mask); +} + +template +CONSTRUCTOR_INLINE reg_expression::reg_expression(const Allocator& a) + : regbase(), data(a), pkmp(0), error_code_(REG_EMPTY) +{ +} + +template +CONSTRUCTOR_INLINE reg_expression::reg_expression(const charT* p, flag_type f, const Allocator& a) + : data(a), pkmp(0), error_code_(REG_EMPTY) +{ + set_expression(p, f); +} + +template +CONSTRUCTOR_INLINE reg_expression::reg_expression(const charT* p1, const charT* p2, flag_type f, const Allocator& a) + : data(a), pkmp(0), error_code_(REG_EMPTY) +{ + set_expression(p1, p2, f); +} + +template +CONSTRUCTOR_INLINE reg_expression::reg_expression(const charT* p, size_type len, flag_type f, const Allocator& a) + : data(a), pkmp(0), error_code_(REG_EMPTY) +{ + set_expression(p, p + len, f); +} + +template +reg_expression::reg_expression(const reg_expression& e) + : regbase(e), data(e.allocator()), pkmp(0), error_code_(REG_EMPTY) +{ + // + // we do a deep copy only if e is a valid expression, otherwise fail. + // + if(e.error_code() == 0) + { + const charT* pe = e.expression(); + set_expression(pe, pe + e._expression_len, e.flags()); + } + else + fail(e.error_code()); +} + +template +reg_expression::~reg_expression() +{ + if(pkmp) + re_detail::kmp_free(pkmp, data.allocator()); +} + +template +reg_expression& BOOST_RE_CALL reg_expression::operator=(const reg_expression& e) +{ + // + // we do a deep copy only if e is a valid expression, otherwise fail. + // + if(this == &e) return *this; + _flags = use_except; + fail(e.error_code()); + if(error_code() == 0) + set_expression(e._expression, e._expression + e._expression_len, e.flags()); + return *this; +} + +template +inline bool BOOST_RE_CALL reg_expression::operator==(const reg_expression& e)const +{ + return (_flags == e.flags()) + && (_expression_len == e._expression_len) + && (std::memcmp(_expression, e._expression, _expression_len * sizeof(charT)) == 0); +} + +template +bool BOOST_RE_CALL reg_expression::operator<(const reg_expression& e)const +{ + // + // we can't offer a diffinitive ordering, but we can be consistant: + if(_flags != e.flags()) return _flags < e.flags(); + if(_expression_len != e._expression_len) return _expression_len < e._expression_len; + return std::memcmp(expression(), e.expression(), _expression_len); +} + +template +Allocator BOOST_RE_CALL reg_expression::allocator()const +{ + return data.allocator(); +} + +template +Allocator BOOST_RE_CALL reg_expression::get_allocator()const +{ + return data.allocator(); +} + +template +unsigned int BOOST_RE_CALL reg_expression::parse_inner_set(const charT*& first, const charT* last) +{ + // + // we have an inner [...] construct + // + jm_assert(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*first) == traits_type::syntax_open_set); + const charT* base = first; + while( (first != last) + && (traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*first) != traits_type::syntax_close_set) ) + ++first; + if(first == last) + return 0; + ++first; + if((first-base) < 5) + return 0; + if(*(base+1) != *(first-2)) + return 0; + unsigned int result = traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*(base+1)); + if((result == traits_type::syntax_colon) && ((first-base) == 5)) + { + return traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*(base+2)); + } + return ((result == traits_type::syntax_colon) || (result == traits_type::syntax_dot) || (result == traits_type::syntax_equal)) ? result : 0; +} + + +template +bool BOOST_RE_CALL reg_expression::skip_space(const charT*& first, const charT* last) +{ + // + // returns true if we get to last: + // + while((first != last) && (traits_inst.is_class(*first, traits_type::char_class_space) == true)) + { + ++first; + } + return first == last; +} + +template +void BOOST_RE_CALL reg_expression::parse_range(const charT*& ptr, const charT* end, unsigned& min, unsigned& max) +{ + // + // we have {x} or {x,} or {x,y} NB no spaces inside braces + // anything else is illegal + // On input ptr points to "{" + // + ++ptr; + if(skip_space(ptr, end)) + { + fail(REG_EBRACE); + return; + } + if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*ptr) != traits_type::syntax_digit) + { + fail(REG_BADBR); + return; + } + min = traits_inst.toi(ptr, end, 10); + if(skip_space(ptr, end)) + { + fail(REG_EBRACE); + return; + } + if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*ptr) == traits_type::syntax_comma) + { + //we have a second interval: + ++ptr; + if(skip_space(ptr, end)) + { + fail(REG_EBRACE); + return; + } + if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*ptr) == traits_type::syntax_digit) + max = traits_inst.toi(ptr, end, 10); + else + max = (unsigned)-1; + } + else + max = min; + + // validate input: + if(skip_space(ptr, end)) + { + fail(REG_EBRACE); + return; + } + if(max < min) + { + fail(REG_ERANGE); + return; + } + if(_flags & bk_braces) + { + if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*ptr) != traits_type::syntax_slash) + { + fail(REG_BADBR); + return; + } + else + { + // back\ is OK now check the } + ++ptr; + if((ptr == end) || (traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*ptr) != traits_type::syntax_close_brace)) + { + fail(REG_BADBR); + return; + } + } + } + else if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*ptr) != traits_type::syntax_close_brace) + { + fail(REG_BADBR); + return; + } +} + +template +charT BOOST_RE_CALL reg_expression::parse_escape(const charT*& first, const charT* last) +{ + charT c(*first); + traits_size_type c_unsigned = (traits_size_type)(traits_uchar_type)*first; + // this is only used for the switch(), but cannot be folded in + // due to a bug in Comeau 4.2.44beta3 + traits_size_type syntax = traits_inst.syntax_type(c_unsigned); + switch(syntax) + { + case traits_type::syntax_a: + c = '\a'; + ++first; + break; + case traits_type::syntax_f: + c = '\f'; + ++first; + break; + case traits_type::syntax_n: + c = '\n'; + ++first; + break; + case traits_type::syntax_r: + c = '\r'; + ++first; + break; + case traits_type::syntax_t: + c = '\t'; + ++first; + break; + case traits_type::syntax_v: + c = '\v'; + ++first; + break; + case traits_type::syntax_x: + ++first; + if(first == last) + { + fail(REG_EESCAPE); + break; + } + // maybe have \x{ddd} + if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*first)) == traits_type::syntax_open_brace) + { + ++first; + if(first == last) + { + fail(REG_EESCAPE); + break; + } + if(traits_inst.is_class(*first, traits_type::char_class_xdigit) == false) + { + fail(REG_BADBR); + break; + } + c = (charT)traits_inst.toi(first, last, -16); + if((first == last) || (traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*first)) != traits_type::syntax_close_brace)) + { + fail(REG_BADBR); + } + ++first; + break; + } + else + { + if(traits_inst.is_class(*first, traits_type::char_class_xdigit) == false) + { + fail(REG_BADBR); + break; + } + c = (charT)traits_inst.toi(first, last, -16); + } + break; + case traits_type::syntax_c: + ++first; + if(first == last) + { + fail(REG_EESCAPE); + break; + } + if(((traits_uchar_type)(*first) < (traits_uchar_type)'@') + || ((traits_uchar_type)(*first) > (traits_uchar_type)127) ) + { + fail(REG_EESCAPE); + return (charT)0; + } + c = (charT)((traits_uchar_type)(*first) - (traits_uchar_type)'@'); + ++first; + break; + case traits_type::syntax_e: + c = (charT)27; + ++first; + break; + case traits_type::syntax_digit: + c = (charT)traits_inst.toi(first, last, -8); + break; + default: + //c = *first; + ++first; + } + return c; +} + +template +void BOOST_RE_CALL reg_expression::compile_maps() +{ + re_detail::re_syntax_base* record = (re_detail::re_syntax_base*)data.data(); + // always compile the first _map: + std::memset(startmap, 0, 256); + record->can_be_null = 0; + compile_map(record, startmap, NULL, re_detail::mask_all); + + while(record->type != re_detail::syntax_element_match) + { + if((record->type == re_detail::syntax_element_alt) || (record->type == re_detail::syntax_element_rep)) + { + std::memset(&(((re_detail::re_jump*)record)->_map), 0, 256); + record->can_be_null = 0; + compile_map(record->next.p, ((re_detail::re_jump*)record)->_map, &(record->can_be_null), re_detail::mask_take, ((re_detail::re_jump*)record)->alt.p); + compile_map(((re_detail::re_jump*)record)->alt.p, ((re_detail::re_jump*)record)->_map, &(record->can_be_null), re_detail::mask_skip); + } + else + { + record->can_be_null = 0; + compile_map(record, NULL, &(record->can_be_null), re_detail::mask_all); + } + record = record->next.p; + } + record->can_be_null = re_detail::mask_all; +} + +template +bool BOOST_RE_CALL reg_expression::probe_start( + re_detail::re_syntax_base* node, charT cc, re_detail::re_syntax_base* terminal) const +{ + unsigned int c; + + switch(node->type) + { + case re_detail::syntax_element_startmark: + case re_detail::syntax_element_endmark: + case re_detail::syntax_element_start_line: + case re_detail::syntax_element_word_boundary: + case re_detail::syntax_element_buffer_start: + case re_detail::syntax_element_restart_continue: + // doesn't tell us anything about the next character, so: + return probe_start(node->next.p, cc, terminal); + case re_detail::syntax_element_literal: + // only the first character of the literal can match: + // note these have already been translated: + if(*(charT*)(((re_detail::re_literal*)node)+1) == traits_inst.translate(cc, (_flags & regbase::icase))) + return true; + return false; + case re_detail::syntax_element_end_line: + // next character (if there is one!) must be a newline: + if(traits_inst.is_separator(traits_inst.translate(cc, (_flags & regbase::icase)))) + return true; + return false; + case re_detail::syntax_element_wild: + return true; + case re_detail::syntax_element_match: + return true; + case re_detail::syntax_element_within_word: + case re_detail::syntax_element_word_start: + return traits_inst.is_class(traits_inst.translate(cc, (_flags & regbase::icase)), traits_type::char_class_word); + case re_detail::syntax_element_word_end: + // what follows must not be a word character, + return traits_inst.is_class(traits_inst.translate(cc, (_flags & regbase::icase)), traits_type::char_class_word) ? false : true; + case re_detail::syntax_element_buffer_end: + // we can be null, nothing must follow, + // NB we assume that this is followed by + // re_detail::syntax_element_match, if its not then we can + // never match anything anyway!! + return false; + case re_detail::syntax_element_soft_buffer_end: + // we can be null, only newlines must follow, + // NB we assume that this is followed by + // re_detail::syntax_element_match, if its not then we can + // never match anything anyway!! + return traits_inst.is_separator(traits_inst.translate(cc, (_flags & regbase::icase))); + case re_detail::syntax_element_backref: + // there's no easy way to determine this + // which is not to say it can't be done! + // for now: + return true; + case re_detail::syntax_element_long_set: + // we can not be null, + // we need to add already translated values in the set + // to values in the _map + return re_detail::re_maybe_set_member(cc, (re_detail::re_set_long*)node, *this) || (re_detail::re_is_set_member((const charT*)&cc, (const charT*)(&cc+1), (re_detail::re_set_long*)node, *this) != &cc); + case re_detail::syntax_element_set: + // set all the elements that are set in corresponding set: + c = (traits_size_type)(traits_uchar_type)traits_inst.translate(cc, (_flags & regbase::icase)); + return ((re_detail::re_set*)node)->_map[c] != 0; + case re_detail::syntax_element_jump: + if(((re_detail::re_jump*)node)->alt.p < node) + { + // backwards jump, + // caused only by end of repeat section, we'll treat this + // the same as a match, because the sub-expression has matched. + if(node->next.p == terminal) + return true; // null repeat - we can always take this + else + { + // + // take the jump, add in fix for the fact that if the + // repeat that we're jumping to has non-zero minimum count + // then we need to add in the possiblity that we could still + // skip that repeat. + re_detail::re_syntax_base* next = ((re_detail::re_jump*)node)->alt.p; + bool b = probe_start(next, cc, terminal); + if((next->type == re_detail::syntax_element_rep) && (((re_detail::re_repeat*)next)->min != 0)) + { + b = b || probe_start(((re_detail::re_jump*)next)->alt.p, cc, terminal); + } + return b; + } + } + else + // take the jump and compile: + return probe_start(((re_detail::re_jump*)node)->alt.p, cc, terminal); + case re_detail::syntax_element_alt: + // we need to take the OR of the two alternatives: + return probe_start(((re_detail::re_jump*)node)->alt.p, cc, terminal) || probe_start(node->next.p, cc, terminal); + case re_detail::syntax_element_rep: + // we need to take the OR of the two alternatives + if(((re_detail::re_repeat*)node)->min == 0) + return probe_start(node->next.p, cc, ((re_detail::re_jump*)node)->alt.p) || probe_start(((re_detail::re_jump*)node)->alt.p, cc, terminal); + else + return probe_start(node->next.p, cc, ((re_detail::re_jump*)node)->alt.p); + case re_detail::syntax_element_combining: + return !traits_inst.is_combining(traits_inst.translate(cc, (_flags & regbase::icase))); + } + return false; +} + +template +bool BOOST_RE_CALL reg_expression::probe_start_null(re_detail::re_syntax_base* node, re_detail::re_syntax_base* terminal)const +{ + switch(node->type) + { + case re_detail::syntax_element_startmark: + case re_detail::syntax_element_endmark: + case re_detail::syntax_element_start_line: + case re_detail::syntax_element_word_boundary: + case re_detail::syntax_element_buffer_start: + case re_detail::syntax_element_restart_continue: + case re_detail::syntax_element_end_line: + case re_detail::syntax_element_word_end: + // doesn't tell us anything about the next character, so: + return probe_start_null(node->next.p, terminal); + case re_detail::syntax_element_match: + case re_detail::syntax_element_buffer_end: + case re_detail::syntax_element_soft_buffer_end: + case re_detail::syntax_element_backref: + return true; + case re_detail::syntax_element_jump: + if(((re_detail::re_jump*)node)->alt.p < node) + { + // backwards jump, + // caused only by end of repeat section, we'll treat this + // the same as a match, because the sub-expression has matched. + // this is only caused by NULL repeats as in "(a*)*" or "(\<)*" + // these are really nonsensence and make the matching code much + // harder, it would be nice to get rid of them altogether. + if(node->next.p == terminal) + return true; + else + return probe_start_null(((re_detail::re_jump*)node)->alt.p, terminal); + } + else + // take the jump and compile: + return probe_start_null(((re_detail::re_jump*)node)->alt.p, terminal); + case re_detail::syntax_element_alt: + // we need to take the OR of the two alternatives: + return probe_start_null(((re_detail::re_jump*)node)->alt.p, terminal) || probe_start_null(node->next.p, terminal); + case re_detail::syntax_element_rep: + // only need to consider skipping the repeat: + return probe_start_null(((re_detail::re_jump*)node)->alt.p, terminal); + default: + break; + } + return false; +} + +template +void BOOST_RE_CALL reg_expression::compile_map( + re_detail::re_syntax_base* node, unsigned char* _map, + unsigned int* pnull, unsigned char mask, re_detail::re_syntax_base* terminal)const +{ + if(_map) + { + for(unsigned int i = 0; i < 256; ++i) + { + if(probe_start(node, (charT)i, terminal)) + _map[i] |= mask; + } + } + if(pnull && probe_start_null(node, terminal)) + *pnull |= mask; +} + +template +void BOOST_RE_CALL reg_expression::move_offsets(re_detail::re_syntax_base* j, unsigned size) +{ + // move all offsets starting with j->link forward by size + // called after an insert: + j = (re_detail::re_syntax_base*)((const char*)data.data() + j->next.i); + while(true) + { + switch(j->type) + { + case re_detail::syntax_element_rep: + ((re_detail::re_jump*)j)->alt.i += size; + j->next.i += size; + break; + case re_detail::syntax_element_jump: + case re_detail::syntax_element_alt: + ((re_detail::re_jump*)j)->alt.i += size; + j->next.i += size; + break; + default: + j->next.i += size; + break; + } + if(j->next.i == size) + break; + j = (re_detail::re_syntax_base*)((const char*)data.data() + j->next.i); + } +} + +template +re_detail::re_syntax_base* BOOST_RE_CALL reg_expression::compile_set_simple(re_detail::re_syntax_base* dat, unsigned long cls, bool isnot) +{ + re_detail::jstack singles(64, data.allocator()); + re_detail::jstack ranges(64, data.allocator()); + re_detail::jstack classes(64, data.allocator()); + re_detail::jstack equivalents(64, data.allocator()); + classes.push(cls); + if(dat) + { + data.align(); + dat->next.i = data.size(); + } + return compile_set_aux(singles, ranges, classes, equivalents, isnot, re_detail::is_byte::width_type()); +} + +template +re_detail::re_syntax_base* BOOST_RE_CALL reg_expression::compile_set(const charT*& first, const charT* last) +{ + re_detail::jstack singles(64, data.allocator()); + re_detail::jstack ranges(64, data.allocator()); + re_detail::jstack classes(64, data.allocator()); + re_detail::jstack equivalents(64, data.allocator()); + bool has_digraphs = false; + jm_assert(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*first) == traits_type::syntax_open_set); + ++first; + bool started = false; + bool done = false; + bool isnot = false; + + enum last_type + { + last_single, + last_none, + last_dash + }; + + unsigned l = last_none; + traits_string_type s; + + while((first != last) && !done) + { + traits_size_type c = (traits_size_type)(traits_uchar_type)*first; + // this is only used for the switch(), but cannot be folded in + // due to a bug in Comeau 4.2.44beta3 + traits_size_type syntax = traits_inst.syntax_type(c); + switch(syntax) + { + case traits_type::syntax_caret: + if(!started && !isnot) + { + isnot = true; + } + else + { + s = (charT)c; + goto char_set_literal; + } + break; + case traits_type::syntax_open_set: + { + if((_flags & char_classes) == 0) + { + s = (charT)c; + goto char_set_literal; + } + // check to see if we really have a class: + const charT* base = first; + // this is only used for the switch(), but cannot be folded in + // due to a bug in Comeau 4.2.44beta3 + unsigned int inner_set = parse_inner_set(first, last); + switch(inner_set) + { + case traits_type::syntax_colon: + { + if(l == last_dash) + { + fail(REG_ERANGE); + return NULL; + } + jm_uintfast32_t id = traits_inst.lookup_classname(base+2, first-2); + if(_flags & regbase::icase) + { + if((id == traits_type::char_class_upper) || (id == traits_type::char_class_lower)) + { + id = traits_type::char_class_alpha; + } + } + if(id == 0) + { + fail(REG_ECTYPE); + return NULL; + } + classes.push(id); + started = true; + l = last_none; + } + break; + case traits_type::syntax_dot: + // + // we have a collating element [.collating-name.] + // + if(traits_inst.lookup_collatename(s, base+2, first-2)) + { + --first; + if(s.size() > 1) + has_digraphs = true; + if(s.size())goto char_set_literal; + } + fail(REG_ECOLLATE); + return NULL; + case traits_type::syntax_equal: + // + // we have an equivalence class [=collating-name=] + // + if(traits_inst.lookup_collatename(s, base+2, first-2)) + { + unsigned len = s.size(); + if(len) + { + unsigned i = 0; + while(i < len) + { + s[i] = traits_inst.translate(s[i], (_flags & regbase::icase)); + ++i; + } + traits_string_type s2; + traits_inst.transform_primary(s2, s); + equivalents.push(s2); + started = true; + l = last_none; + break; + } + } + fail(REG_ECOLLATE); + return NULL; + case traits_type::syntax_left_word: + if((started == false) && (traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*first) == traits_type::syntax_close_set)) + { + ++first; + return add_simple(0, re_detail::syntax_element_word_start); + } + fail(REG_EBRACK); + return NULL; + case traits_type::syntax_right_word: + if((started == false) && (traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*first) == traits_type::syntax_close_set)) + { + ++first; + return add_simple(0, re_detail::syntax_element_word_end); + } + fail(REG_EBRACK); + return NULL; + default: + if(started == false) + { + unsigned int t = traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*(base+1)); + if((t != traits_type::syntax_colon) && (t != traits_type::syntax_dot) && (t != traits_type::syntax_equal)) + { + first = base; + s = (charT)c; + goto char_set_literal; + } + } + fail(REG_EBRACK); + return NULL; + } + if(first == last) + { + fail(REG_EBRACK); + return NULL; + } + continue; + } + case traits_type::syntax_close_set: + if(started == false) + { + s = (charT)c; + goto char_set_literal; + } + done = true; + break; + case traits_type::syntax_dash: + if(!started) + { + s = (charT)c; + goto char_set_literal; + } + ++first; + if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*first) == traits_type::syntax_close_set) + { + --first; + s = (charT)c; + goto char_set_literal; + } + if((singles.empty() == true) || (l != last_single)) + { + fail(REG_ERANGE); + return NULL; + } + ranges.push(singles.peek()); + if(singles.peek().size() <= 1) // leave digraphs and ligatures in place + singles.pop(); + l = last_dash; + continue; + case traits_type::syntax_slash: + if(_flags & regbase::escape_in_lists) + { + ++first; + if(first == last) + continue; + traits_size_type c = (traits_size_type)(traits_uchar_type)*first; + // this is only used for the switch(), but cannot be folded in + // due to a bug in Comeau 4.2.44beta3 + traits_size_type syntax = traits_inst.syntax_type(c); + switch(syntax) + { + case traits_type::syntax_w: + if(l == last_dash) + { + fail(REG_ERANGE); + return NULL; + } + classes.push(traits_type::char_class_word); + started = true; + l = last_none; + ++first; + continue; + case traits_type::syntax_d: + if(l == last_dash) + { + fail(REG_ERANGE); + return NULL; + } + classes.push(traits_type::char_class_digit); + started = true; + l = last_none; + ++first; + continue; + case traits_type::syntax_s: + if(l == last_dash) + { + fail(REG_ERANGE); + return NULL; + } + classes.push(traits_type::char_class_space); + started = true; + l = last_none; + ++first; + continue; + case traits_type::syntax_l: + if(l == last_dash) + { + fail(REG_ERANGE); + return NULL; + } + classes.push(traits_type::char_class_lower); + started = true; + l = last_none; + ++first; + continue; + case traits_type::syntax_u: + if(l == last_dash) + { + fail(REG_ERANGE); + return NULL; + } + classes.push(traits_type::char_class_upper); + started = true; + l = last_none; + ++first; + continue; + case traits_type::syntax_W: + case traits_type::syntax_D: + case traits_type::syntax_S: + case traits_type::syntax_U: + case traits_type::syntax_L: + fail(REG_EESCAPE); + return NULL; + default: + c = parse_escape(first, last); + --first; + s = (charT)c; + goto char_set_literal; + } + } + else + { + s = (charT)c; + goto char_set_literal; + } + default: + s = (charT)c; + char_set_literal: + unsigned i = 0; + // get string length to stop us going past the end of string (DWA) + unsigned len = s.size(); + while(i < len) + { + s[i] = traits_inst.translate(s[i], (_flags & regbase::icase)); + ++i; + } + started = true; + if(l == last_dash) + { + ranges.push(s); + l = last_none; + if(s.size() > 1) // add ligatures to singles list as well + singles.push(s); + } + else + { + singles.push(s); + l = last_single; + } + } + ++first; + } + if(!done) + return NULL; + + re_detail::re_syntax_base* result; + if(has_digraphs) + result = compile_set_aux(singles, ranges, classes, equivalents, isnot, re_detail::_wide_type()); + else + result = compile_set_aux(singles, ranges, classes, equivalents, isnot, re_detail::is_byte::width_type()); + #ifdef __BORLANDC__ + // delayed throw: + if((result == 0) && (_flags & regbase::use_except)) + fail(error_code()); + #endif + return result; +} + +template +re_detail::re_syntax_base* BOOST_RE_CALL reg_expression::compile_set_aux(re_detail::jstack& singles, re_detail::jstack& ranges, re_detail::jstack& classes, re_detail::jstack& equivalents, bool isnot, const re_detail::_wide_type&) +{ + size_type base = data.size(); + data.extend(sizeof(re_detail::re_set_long)); + unsigned int csingles = 0; + unsigned int cranges = 0; + jm_uintfast32_t cclasses = 0; + unsigned int cequivalents = 0; + bool nocollate_state = flags() & regbase::nocollate; + + while(singles.empty() == false) + { + ++csingles; + const traits_string_type& s = singles.peek(); + unsigned len = (s.size() + 1) * sizeof(charT); + std::memcpy((charT*)data.extend(len), s.c_str(), len); + singles.pop(); + } + while(ranges.empty() == false) + { + traits_string_type c1, c2; + if(nocollate_state) + c1 = ranges.peek(); + else + traits_inst.transform(c1, ranges.peek()); + ranges.pop(); + if(nocollate_state) + c2 = ranges.peek(); + else + traits_inst.transform(c2, ranges.peek()); + ranges.pop(); + if(c1 < c2) + { + // for some reason bc5 crashes when throwing exceptions + // from here - probably an EH-compiler bug, but hard to + // be sure... + // delay throw to later: + #ifdef __BORLANDC__ + jm_uintfast32_t f = _flags; + _flags &= ~regbase::use_except; + #endif + fail(REG_ERANGE); + #ifdef __BORLANDC__ + _flags = f; + #endif + return NULL; + } + ++cranges; + unsigned len = (re_detail::re_strlen(c1.c_str()) + 1) * sizeof(charT); + std::memcpy(data.extend(len), c1.c_str(), len); + len = (re_detail::re_strlen(c2.c_str()) + 1) * sizeof(charT); + std::memcpy(data.extend(len), c2.c_str(), len); + } + while(classes.empty() == false) + { + cclasses |= classes.peek(); + classes.pop(); + } + while(equivalents.empty() == false) + { + ++cequivalents; + const traits_string_type& s = equivalents.peek(); + unsigned len = (re_detail::re_strlen(s.c_str()) + 1) * sizeof(charT); + std::memcpy((charT*)data.extend(len), s.c_str(), len); + equivalents.pop(); + } + + re_detail::re_set_long* dat = (re_detail::re_set_long*)((unsigned char*)data.data() + base); + dat->type = re_detail::syntax_element_long_set; + dat->csingles = csingles; + dat->cranges = cranges; + dat->cclasses = cclasses; + dat->cequivalents = cequivalents; + dat->isnot = isnot; + dat->next.i = 0; + return dat; +} + +template +re_detail::re_syntax_base* BOOST_RE_CALL reg_expression::compile_set_aux(re_detail::jstack& singles, re_detail::jstack& ranges, re_detail::jstack& classes, re_detail::jstack& equivalents, bool isnot, const re_detail::_narrow_type&) +{ + re_detail::re_set* dat = (re_detail::re_set*)data.extend(sizeof(re_detail::re_set)); + std::memset(dat, 0, sizeof(re_detail::re_set)); + + while(singles.empty() == false) + { + dat->_map[(traits_size_type)(traits_uchar_type)*(singles.peek().c_str())] = re_detail::mask_all; + singles.pop(); + } + while(ranges.empty() == false) + { + traits_string_type c1, c2, c3, c4; + + if(flags() & regbase::nocollate) + c1 = ranges.peek(); + else + traits_inst.transform(c1, ranges.peek()); + ranges.pop(); + if(flags() & regbase::nocollate) + c2 = ranges.peek(); + else + traits_inst.transform(c2, ranges.peek()); + ranges.pop(); + + if(c1 < c2) + { + // for some reason bc5 crashes when throwing exceptions + // from here - probably an EH-compiler bug, but hard to + // be sure... + // delay throw to later: + #ifdef __BORLANDC__ + jm_uintfast32_t f = _flags; + _flags &= ~regbase::use_except; + #endif + fail(REG_ERANGE); + #ifdef __BORLANDC__ + _flags = f; + #endif + return NULL; + } + for(unsigned int i = 0; i < 256; ++i) + { + c4 = (charT)i; + if(flags() & regbase::nocollate) + c3 = c4; + else + traits_inst.transform(c3, c4); + if((c3 <= c1) && (c3 >= c2)) + dat->_map[i] = re_detail::mask_all; + } + } + while(equivalents.empty() == false) + { + traits_string_type c1, c2; + for(unsigned int i = 0; i < 256; ++i) + { + c2 = (charT)i; + traits_inst.transform_primary(c1, c2); + if(c1 == equivalents.peek()) + dat->_map[i] = re_detail::mask_all; + } + equivalents.pop(); + } + + jm_uintfast32_t flags = 0; + while(classes.empty() == false) + { + flags |= classes.peek(); + classes.pop(); + } + if(flags) + { + for(unsigned int i = 0; i < 256; ++i) + { + if(traits_inst.is_class(charT(i), flags)) + dat->_map[(traits_uchar_type)traits_inst.translate((charT)i, (_flags & regbase::icase))] = re_detail::mask_all; + } + } + + if(isnot) + { + for(unsigned int i = 0; i < 256; ++i) + { + dat->_map[i] = !dat->_map[i]; + } + } + + dat->type = re_detail::syntax_element_set; + dat->next.i = 0; + return dat; +} + + +template +void BOOST_RE_CALL reg_expression::fixup_apply(re_detail::re_syntax_base* b, unsigned cbraces) +{ + typedef BOOST_RE_MAYBE_TYPENAME REBIND_TYPE(bool, Allocator) b_alloc; + + register unsigned char* base = (unsigned char*)b; + register re_detail::re_syntax_base* ptr = b; + bool* pb = 0; + b_alloc a(data.allocator()); + try + { + pb = a.allocate(cbraces); + for(unsigned i = 0; i < cbraces; ++i) + pb[i] = false; + + repeats = 0; + + while(ptr->next.i) + { + switch(ptr->type) + { + case re_detail::syntax_element_rep: + ((re_detail::re_jump*)ptr)->alt.p = (re_detail::re_syntax_base*)(base + ((re_detail::re_jump*)ptr)->alt.i); +#ifdef BOOST_RE_DEBUG + if((re_detail::padding_mask & (int)((re_detail::re_jump*)ptr)->alt.p) && (((re_detail::re_jump*)ptr)->alt.p != b)) + { + jm_trace("padding mis-aligment in repeat jump to object type: " << ((re_detail::re_jump*)ptr)->alt.p->type) + //jm_assert(0 == (padding_mask & (int)((re_detail::re_jump*)ptr)->alt.p)); + } +#endif + ((re_detail::re_repeat*)ptr)->id = repeats; + ++repeats; + goto rebase; + case re_detail::syntax_element_jump: + case re_detail::syntax_element_alt: + ((re_detail::re_jump*)ptr)->alt.p = (re_detail::re_syntax_base*)(base + ((re_detail::re_jump*)ptr)->alt.i); +#ifdef BOOST_RE_DEBUG + if((re_detail::padding_mask & (int)((re_detail::re_jump*)ptr)->alt.p) && (((re_detail::re_jump*)ptr)->alt.p != b)) + { + jm_trace("padding mis-aligment in alternation jump to object type: " << ((re_detail::re_jump*)ptr)->alt.p->type) + //jm_assert(0 == (padding_mask & (int)((re_detail::re_jump*)ptr)->alt.p)); + } +#endif + goto rebase; + case re_detail::syntax_element_backref: + if((((re_detail::re_brace*)ptr)->index >= cbraces) || (pb[((re_detail::re_brace*)ptr)->index] == false) ) + { + fail(REG_ESUBREG); + a.deallocate(pb, cbraces); + return; + } + goto rebase; + case re_detail::syntax_element_endmark: + pb[((re_detail::re_brace*)ptr)->index] = true; + goto rebase; + default: + rebase: + ptr->next.p = (re_detail::re_syntax_base*)(base + ptr->next.i); +#ifdef BOOST_RE_DEBUG + if((re_detail::padding_mask & (int)(ptr->next.p)) && (((re_detail::re_jump*)ptr)->alt.p != b)) + { + jm_trace("padding mis-alignment in next record of type " << ptr->next.p->type) + jm_assert(0 == (re_detail::padding_mask & (int)(ptr->next.p))); + } +#endif + ptr = ptr->next.p; + } + } + a.deallocate(pb, cbraces); + pb = 0; + } + catch(...) + { + if(pb) + a.deallocate(pb, cbraces); + throw; + } +} + + +template +unsigned int BOOST_RE_CALL reg_expression::set_expression(const charT* p, const charT* end, flag_type f) +{ + if(p == expression()) + { + traits_string_type s(p, end); + return set_expression(s.c_str(), s.c_str() + s.size(), f); + } + typedef typename traits_type::sentry sentry_t; + sentry_t sent(traits_inst); + if(sent){ + + const charT* base = p; + data.clear(); + _flags = f; + fail(REG_NOERROR); // clear any error + + if(p >= end) + { + fail(REG_EMPTY); + return error_code(); + } + + const charT* ptr = p; + marks = 0; + re_detail::jstack mark(64, data.allocator()); + re_detail::jstack markid(64, data.allocator()); + unsigned int last_mark_popped = 0; + register traits_size_type c; + register re_detail::re_syntax_base* dat; + + unsigned rep_min = 0; + unsigned rep_max = 0; + + // + // set up header: + // + ++marks; + dat = 0; + + if(_flags & regbase::literal) + { + while(ptr != end) + { + dat = add_literal(dat, traits_inst.translate(*ptr, (_flags & regbase::icase))); + ++ptr; + } + } + + while (ptr < end) + { + c = (traits_size_type)(traits_uchar_type)*ptr; + // this is only used for the switch(), but cannot be folded in + // due to a bug in Comeau 4.2.44beta3 + traits_size_type syntax = traits_inst.syntax_type(c); + switch(syntax) + { + case traits_type::syntax_open_bracket: + if(_flags & bk_parens) + { + dat = add_literal(dat, (charT)c); + ++ptr; + continue; + } + open_bracked_jump: + // extend: + dat = add_simple(dat, re_detail::syntax_element_startmark, sizeof(re_detail::re_brace)); + markid.push(marks); + ((re_detail::re_brace*)dat)->index = marks++; + mark.push(data.index(dat)); + ++ptr; + // + // check for perl like (?...) extention syntax + c = (traits_size_type)(traits_uchar_type)*ptr; + if(((_flags & bk_parens) == 0) && (traits_type::syntax_question == traits_inst.syntax_type(c))) + { + ++ptr; + c = (traits_size_type)(traits_uchar_type)*ptr; + // this is only used for the switch(), but cannot be folded in + // due to a bug in Comeau 4.2.44beta3 + traits_size_type syntax = traits_inst.syntax_type(c); + switch(syntax) + { + case traits_type::syntax_colon: + ((re_detail::re_brace*)dat)->index = 0; + --marks; + markid.pop(); + markid.push(0); + ++ptr; + continue; + case traits_type::syntax_hash: + // comment just skip it: + ((re_detail::re_brace*)dat)->index = 0; + --marks; + markid.pop(); + mark.pop(); + do{ + ++ptr; + c = (traits_size_type)(traits_uchar_type)*ptr; + }while(traits_type::syntax_close_bracket != traits_inst.syntax_type(c)); + ++ptr; + continue; + default: + // + // error, return to standard parsing and let that handle the error: + --ptr; + continue; + } + } + break; + case traits_type::syntax_close_bracket: + if(_flags & bk_parens) + { + dat = add_literal(dat, (charT)c); + ++ptr; + continue; + } + + close_bracked_jump: + if(dat) + { + data.align(); + dat->next.i = data.size(); + } + + if(mark.empty()) + { + fail(REG_EPAREN); + return error_code(); + } + // see if we have an empty alternative: + if(mark.peek() == data.index(dat) ) + { + re_detail::re_syntax_base* para = (re_detail::re_syntax_base*)((char*)data.data() + mark.peek()); + if(para->type == re_detail::syntax_element_jump) + { + fail(REG_EMPTY); + return error_code(); + } + } + + // pop any pushed alternatives and set the target end destination: + dat = (re_detail::re_syntax_base*)((unsigned char*)data.data() + mark.peek()); + while(dat->type == re_detail::syntax_element_jump) + { + ((re_detail::re_jump*)dat)->alt.i = data.size(); + mark.pop(); + dat = (re_detail::re_jump*)((unsigned char*)data.data() + mark.peek()); + if(mark.empty()) + { + fail(REG_EPAREN); + return error_code(); + } + } + + dat = add_simple(0, re_detail::syntax_element_endmark, sizeof(re_detail::re_brace)); + ((re_detail::re_brace*)dat)->index = markid.peek(); + markid.pop(); + last_mark_popped = mark.peek(); + mark.pop(); + ++ptr; + break; + case traits_type::syntax_char: + dat = add_literal(dat, (charT)c); + ++ptr; + break; + case traits_type::syntax_slash: + { + if(++ptr == end) + { + fail(REG_EESCAPE); + return error_code(); + } + c = (traits_size_type)(traits_uchar_type)*ptr; + // this is only used for the switch(), but cannot be folded in + // due to a bug in Comeau 4.2.44beta3 + traits_size_type syntax = traits_inst.syntax_type(c); + switch(syntax) + { + case traits_type::syntax_open_bracket: + if(_flags & bk_parens) + goto open_bracked_jump; + break; + case traits_type::syntax_close_bracket: + if(_flags & bk_parens) + goto close_bracked_jump; + break; + case traits_type::syntax_plus: + if((_flags & bk_plus_qm) && ((_flags & limited_ops) == 0)) + { + rep_min = 1; + rep_max = (unsigned)-1; + goto repeat_jump; + } + break; + case traits_type::syntax_question: + if((_flags & bk_plus_qm) && ((_flags & limited_ops) == 0)) + { + rep_min = 0; + rep_max = 1; + goto repeat_jump; + } + break; + case traits_type::syntax_or: + if(((_flags & bk_vbar) == 0) || (_flags & limited_ops)) + break; + goto alt_string_jump; + case traits_type::syntax_open_brace: + if( ((_flags & bk_braces) == 0) || ((_flags & intervals) == 0)) + break; + + // we have {x} or {x,} or {x,y}: + parse_range(ptr, end, rep_min, rep_max); + goto repeat_jump; + + case traits_type::syntax_digit: + if(_flags & bk_refs) + { + // update previous: + int i = traits_inst.toi((charT)c); + if(i == 0) + { + // we can have \025 which means take char whose + // code is 25 (octal), so parse string: + c = traits_inst.toi(ptr, end, -8); + --ptr; + break; + } + dat = add_simple(dat, re_detail::syntax_element_backref, sizeof(re_detail::re_brace)); + ((re_detail::re_brace*)dat)->index = i; + ++ptr; + continue; + } + break; + case traits_type::syntax_b: // re_detail::syntax_element_word_boundary + dat = add_simple(dat, re_detail::syntax_element_word_boundary); + ++ptr; + continue; + case traits_type::syntax_B: + dat = add_simple(dat, re_detail::syntax_element_within_word); + ++ptr; + continue; + case traits_type::syntax_left_word: + dat = add_simple(dat, re_detail::syntax_element_word_start); + ++ptr; + continue; + case traits_type::syntax_right_word: + dat = add_simple(dat, re_detail::syntax_element_word_end); + ++ptr; + continue; + case traits_type::syntax_w: //re_detail::syntax_element_word_char + dat = compile_set_simple(dat, traits_type::char_class_word); + ++ptr; + continue; + case traits_type::syntax_W: + dat = compile_set_simple(dat, traits_type::char_class_word, true); + ++ptr; + continue; + case traits_type::syntax_d: //re_detail::syntax_element_word_char + dat = compile_set_simple(dat, traits_type::char_class_digit); + ++ptr; + continue; + case traits_type::syntax_D: + dat = compile_set_simple(dat, traits_type::char_class_digit, true); + ++ptr; + continue; + case traits_type::syntax_s: //re_detail::syntax_element_word_char + dat = compile_set_simple(dat, traits_type::char_class_space); + ++ptr; + continue; + case traits_type::syntax_S: + dat = compile_set_simple(dat, traits_type::char_class_space, true); + ++ptr; + continue; + case traits_type::syntax_l: //re_detail::syntax_element_word_char + dat = compile_set_simple(dat, traits_type::char_class_lower); + ++ptr; + continue; + case traits_type::syntax_L: + dat = compile_set_simple(dat, traits_type::char_class_lower, true); + ++ptr; + continue; + case traits_type::syntax_u: //re_detail::syntax_element_word_char + dat = compile_set_simple(dat, traits_type::char_class_upper); + ++ptr; + continue; + case traits_type::syntax_U: + dat = compile_set_simple(dat, traits_type::char_class_upper, true); + ++ptr; + continue; + case traits_type::syntax_Q: + ++ptr; + while(true) + { + if(ptr == end) + { + fail(REG_EESCAPE); + return error_code(); + } + if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*ptr) == traits_type::syntax_slash) + { + ++ptr; + if((ptr != end) && (traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*ptr) == traits_type::syntax_E)) + break; + else + { + dat = add_literal(dat, *(ptr-1)); + continue; + } + } + dat = add_literal(dat, *ptr); + ++ptr; + } + ++ptr; + continue; + case traits_type::syntax_C: + dat = add_simple(dat, re_detail::syntax_element_wild); + ++ptr; + continue; + case traits_type::syntax_X: + dat = add_simple(dat, re_detail::syntax_element_combining); + ++ptr; + continue; + case traits_type::syntax_Z: + dat = add_simple(dat, re_detail::syntax_element_soft_buffer_end); + ++ptr; + continue; + case traits_type::syntax_G: + dat = add_simple(dat, re_detail::syntax_element_restart_continue); + ++ptr; + continue; + case traits_type::syntax_start_buffer: + dat = add_simple(dat, re_detail::syntax_element_buffer_start); + ++ptr; + continue; + case traits_type::syntax_end_buffer: + dat = add_simple(dat, re_detail::syntax_element_buffer_end); + ++ptr; + continue; + default: + c = (traits_size_type)(traits_uchar_type)parse_escape(ptr, end); + dat = add_literal(dat, (charT)c); + continue; + } + dat = add_literal(dat, (charT)c); + ++ptr; + break; + } + case traits_type::syntax_dollar: + dat = add_simple(dat, re_detail::syntax_element_end_line, sizeof(re_detail::re_syntax_base)); + ++ptr; + continue; + case traits_type::syntax_caret: + dat = add_simple(dat, re_detail::syntax_element_start_line, sizeof(re_detail::re_syntax_base)); + ++ptr; + continue; + case traits_type::syntax_dot: + dat = add_simple(dat, re_detail::syntax_element_wild, sizeof(re_detail::re_syntax_base)); + ++ptr; + continue; + case traits_type::syntax_star: + rep_min = 0; + rep_max = (unsigned)-1; + + repeat_jump: + { + unsigned offset; + if(dat == 0) + { + fail(REG_BADRPT); + return error_code(); + } + switch(dat->type) + { + case re_detail::syntax_element_endmark: + offset = last_mark_popped; + break; + case re_detail::syntax_element_literal: + if(((re_detail::re_literal*)dat)->length > 1) + { + // update previous: + charT lit = *(charT*)((char*)dat + sizeof(re_detail::re_literal) + ((((re_detail::re_literal*)dat)->length-1)*sizeof(charT))); + --((re_detail::re_literal*)dat)->length; + dat = add_simple(dat, re_detail::syntax_element_literal, sizeof(re_detail::re_literal) + sizeof(charT)); + ((re_detail::re_literal*)dat)->length = 1; + *((charT*)(((re_detail::re_literal*)dat)+1)) = lit; + } + offset = (char*)dat - (char*)data.data(); + break; + case re_detail::syntax_element_backref: + case re_detail::syntax_element_long_set: + case re_detail::syntax_element_set: + case re_detail::syntax_element_wild: + case re_detail::syntax_element_combining: + // we're repeating a single item: + offset = (char*)dat - (char*)data.data(); + break; + default: + fail(REG_BADRPT); + return error_code(); + } + data.align(); + dat->next.i = data.size(); + //unsigned pos = (char*)dat - (char*)data.data(); + + // add the trailing jump: + dat = add_simple(dat, re_detail::syntax_element_jump, re_detail::re_jump_size); + ((re_detail::re_jump*)dat)->alt.i = 0; + + // now insert the leading repeater: + dat = (re_detail::re_syntax_base*)data.insert(offset, re_detail::re_repeater_size); + dat->next.i = ((char*)dat - (char*)data.data()) + re_detail::re_repeater_size; + dat->type = re_detail::syntax_element_rep; + ((re_detail::re_repeat*)dat)->alt.i = data.size(); + ((re_detail::re_repeat*)dat)->min = rep_min; + ((re_detail::re_repeat*)dat)->max = rep_max; + ((re_detail::re_repeat*)dat)->leading = false; + ((re_detail::re_repeat*)dat)->greedy = true; + move_offsets(dat, re_detail::re_repeater_size); + ++ptr; + // + // now check to see if we have a non-greedy repeat: + if((ptr != end) && (_flags & (limited_ops | bk_plus_qm | bk_braces)) == 0) + { + c = (traits_size_type)(traits_uchar_type)*ptr; + if(traits_type::syntax_question == traits_inst.syntax_type(c)) + { + // OK repeat is non-greedy: + ((re_detail::re_repeat*)dat)->greedy = false; + ++ptr; + } + } + dat = (re_detail::re_syntax_base*)((char*)data.data() + data.size() - re_detail::re_jump_size); + ((re_detail::re_repeat*)dat)->alt.i = offset; + continue; + } + case traits_type::syntax_plus: + if(_flags & (bk_plus_qm | limited_ops)) + { + dat = add_literal(dat, (charT)c); + ++ptr; + continue; + } + rep_min = 1; + rep_max = (unsigned)-1; + goto repeat_jump; + case traits_type::syntax_question: + if(_flags & (bk_plus_qm | limited_ops)) + { + dat = add_literal(dat, (charT)c); + ++ptr; + continue; + } + rep_min = 0; + rep_max = 1; + goto repeat_jump; + case traits_type::syntax_open_set: + // update previous: + if(dat) + { + data.align(); + dat->next.i = data.size(); + } + // extend: + dat = compile_set(ptr, end); + if(dat == 0) + { + if((_flags & regbase::failbit) == 0) + fail(REG_EBRACK); + return error_code(); + } + break; + case traits_type::syntax_or: + { + if(_flags & (bk_vbar | limited_ops)) + { + dat = add_literal(dat, (charT)c); + ++ptr; + continue; + } + + alt_string_jump: + + // update previous: + if(dat == 0) + { + // start of pattern can't have empty "|" + fail(REG_EMPTY); + return error_code(); + } + // see if we have an empty alternative: + if(mark.empty() == false) + if(mark.peek() == data.index(dat)) + { + fail(REG_EMPTY); + return error_code(); + } + // extend: + /*dat = */add_simple(dat, re_detail::syntax_element_jump, re_detail::re_jump_size); + data.align(); + + // now work out where to insert: + unsigned int offset = 0; + if(mark.empty() == false) + { + // we have a '(' or '|' to go back to: + offset = mark.peek(); + re_detail::re_syntax_base* base = (re_detail::re_syntax_base*)((unsigned char*)data.data() + offset); + offset = base->next.i; + } + re_detail::re_jump* j = (re_detail::re_jump*)data.insert(offset, re_detail::re_jump_size); + j->type = re_detail::syntax_element_alt; + j->next.i = offset + re_detail::re_jump_size; + j->alt.i = data.size(); + move_offsets(j, re_detail::re_jump_size); + dat = (re_detail::re_syntax_base*)((unsigned char*)data.data() + data.size() - re_detail::re_jump_size); + mark.push(data.size() - re_detail::re_jump_size); + ++ptr; + break; + } + case traits_type::syntax_open_brace: + if((_flags & bk_braces) || ((_flags & intervals) == 0)) + { + dat = add_literal(dat, (charT)c); + ++ptr; + continue; + } + // we have {x} or {x,} or {x,y}: + parse_range(ptr, end, rep_min, rep_max); + goto repeat_jump; + case traits_type::syntax_newline: + if(_flags & newline_alt) + goto alt_string_jump; + dat = add_literal(dat, (charT)c); + ++ptr; + continue; + case traits_type::syntax_close_brace: + if(_flags & bk_braces) + { + dat = add_literal(dat, (charT)c); + ++ptr; + continue; + } + fail(REG_BADPAT); + return error_code(); + default: + dat = add_literal(dat, (charT)c); + ++ptr; + break; + } // switch + } // while + + // + // update previous: + if(dat) + { + data.align(); + dat->next.i = data.size(); + } + + // see if we have an empty alternative: + if(mark.empty() == false) + if(mark.peek() == data.index(dat) ) + { + re_detail::re_syntax_base* para = (re_detail::re_syntax_base*)((char*)data.data() + mark.peek()); + if(para->type == re_detail::syntax_element_jump) + { + fail(REG_EMPTY); + return error_code(); + } + } + // + // set up tail: + // + if(mark.empty() == false) + { + // pop any pushed alternatives and set the target end destination: + dat = (re_detail::re_syntax_base*)((unsigned char*)data.data() + mark.peek()); + while(dat->type == re_detail::syntax_element_jump) + { + ((re_detail::re_jump*)dat)->alt.i = data.size(); + mark.pop(); + if(mark.empty() == true) + break; + dat = (re_detail::re_jump*)((unsigned char*)data.data() + mark.peek()); + } + } + + dat = (re_detail::re_brace*)data.extend(sizeof(re_detail::re_syntax_base)); + dat->type = re_detail::syntax_element_match; + dat->next.i = 0; + + if(mark.empty() == false) + { + fail(REG_EPAREN); + return error_code(); + } + + // + // allocate space for start _map: + startmap = (unsigned char*)data.extend(256 + ((end - base + 1) * sizeof(charT))); + // + // and copy the expression we just compiled: + _expression = (charT*)((const char*)startmap + 256); + _expression_len = end - base; + std::memcpy(_expression, base, _expression_len * sizeof(charT)); + *(_expression + _expression_len) = charT(0); + + // + // now we need to apply fixups to the array + // so that we can use pointers and not indexes + fixup_apply((re_detail::re_syntax_base*)data.data(), marks); + + // check for error during fixup: + if(_flags & regbase::failbit) + return error_code(); + + // + // finally compile the maps so that we can make intelligent choices + // whenever we encounter an alternative: + compile_maps(); + if(pkmp) + { + re_detail::kmp_free(pkmp, data.allocator()); + pkmp = 0; + } + re_detail::re_syntax_base* sbase = (re_detail::re_syntax_base*)data.data(); + _restart_type = probe_restart(sbase); + _leading_len = fixup_leading_rep(sbase, 0); + if((sbase->type == re_detail::syntax_element_literal) && (sbase->next.p->type == re_detail::syntax_element_match)) + { + _restart_type = restart_fixed_lit; + if(0 == pkmp) + { + charT* p1 = (charT*)((char*)sbase + sizeof(re_detail::re_literal)); + charT* p2 = p1 + ((re_detail::re_literal*)sbase)->length; + pkmp = re_detail::kmp_compile(p1, p2, charT(), re_detail::kmp_translator(_flags®base::icase, &traits_inst), data.allocator()); + } + } + return error_code(); + + } // sentry + return REG_EMPTY; +} + +template +re_detail::re_syntax_base* BOOST_RE_CALL reg_expression::add_simple(re_detail::re_syntax_base* dat, re_detail::syntax_element_type type, unsigned int size) +{ + if(dat) + { + data.align(); + dat->next.i = data.size(); + } + if(size < sizeof(re_detail::re_syntax_base)) + size = sizeof(re_detail::re_syntax_base); + dat = (re_detail::re_syntax_base*)data.extend(size); + dat->type = type; + dat->next.i = 0; + return dat; +} + +template +re_detail::re_syntax_base* BOOST_RE_CALL reg_expression::add_literal(re_detail::re_syntax_base* dat, charT c) +{ + if(dat && (dat->type == re_detail::syntax_element_literal)) + { + // add another charT to the list: + std::ptrdiff_t pos = (unsigned char*)dat - (unsigned char*)data.data(); + *(charT*)data.extend(sizeof(charT)) = traits_inst.translate(c, (_flags & regbase::icase)); + dat = (re_detail::re_syntax_base*)((unsigned char*)data.data() + pos); + ++(((re_detail::re_literal*)dat)->length); + } + else + { + // extend: + dat = add_simple(dat, re_detail::syntax_element_literal, sizeof(re_detail::re_literal) + sizeof(charT)); + ((re_detail::re_literal*)dat)->length = 1; + *((charT*)(((re_detail::re_literal*)dat)+1)) = traits_inst.translate(c, (_flags & regbase::icase)); + } + return dat; +} + +template +unsigned int BOOST_RE_CALL reg_expression::probe_restart(re_detail::re_syntax_base* dat) +{ + switch(dat->type) + { + case re_detail::syntax_element_startmark: + case re_detail::syntax_element_endmark: + return probe_restart(dat->next.p); + case re_detail::syntax_element_start_line: + return regbase::restart_line; + case re_detail::syntax_element_word_start: + return regbase::restart_word; + case re_detail::syntax_element_buffer_start: + return regbase::restart_buf; + case re_detail::syntax_element_restart_continue: + return regbase::restart_continue; + default: + return regbase::restart_any; + } +} + +template +unsigned int BOOST_RE_CALL reg_expression::fixup_leading_rep(re_detail::re_syntax_base* dat, re_detail::re_syntax_base* end) +{ + unsigned int len = 0; + bool leading_lit = end ? false : true; + while(dat != end) + { + switch(dat->type) + { + case re_detail::syntax_element_literal: + len += ((re_detail::re_literal*)dat)->length; + if((leading_lit) && (((re_detail::re_literal*)dat)->length > 2)) + { + // we can do a literal search for the leading literal string + // using Knuth-Morris-Pratt (or whatever), and only then check for + // matches. We need a decent length string though to make it + // worth while. + _leading_string = (charT*)((char*)dat + sizeof(re_detail::re_literal)); + _leading_string_len = ((re_detail::re_literal*)dat)->length; + _restart_type = restart_lit; + leading_lit = false; + const charT* p1 = _leading_string; + const charT* p2 = _leading_string + _leading_string_len; + pkmp = re_detail::kmp_compile(p1, p2, charT(), re_detail::kmp_translator(_flags®base::icase, &traits_inst), data.allocator()); + } + leading_lit = false; + break; + case re_detail::syntax_element_wild: + ++len; + leading_lit = false; + break; + case re_detail::syntax_element_match: + return len; + case re_detail::syntax_element_backref: + //case re_detail::syntax_element_jump: + case re_detail::syntax_element_alt: + case re_detail::syntax_element_combining: + return 0; + case re_detail::syntax_element_long_set: + { + // we need to verify that there are no multi-character + // collating elements inside the repeat: + const charT* p = (const charT*)((const char*)dat + sizeof(re_detail::re_set_long)); + unsigned int csingles = ((re_detail::re_set_long*)dat)->csingles; + for(unsigned int i = 0; i < csingles; ++i) + { + if(re_detail::re_strlen(p) > 1) + return 0; + while(*p)++p; + ++p; + } + ++len; + leading_lit = false; + break; + } + case re_detail::syntax_element_set: + ++len; + leading_lit = false; + break; + case re_detail::syntax_element_rep: + if((len == 0) && (1 == fixup_leading_rep(dat->next.p, ((re_detail::re_repeat*)dat)->alt.p) )) + { + ((re_detail::re_repeat*)dat)->leading = true; + return len; + } + return len; + default: + break; + } + dat = dat->next.p; + } + return len; +} + +template +void BOOST_RE_CALL reg_expression::fail(unsigned int err) +{ + error_code_ = err; + if(err) + throw bad_expression(traits_inst.error_string(err)); +} + + +#if defined(BOOST_RE_NO_TEMPLATE_SWITCH_MERGE) && !defined(BOOST_RE_NO_NAMESPACES) +} // namespace +#endif + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + +} // namespace boost + + +#endif // BOOST_REGEX_COMPILE_HPP + + + + + + + + diff --git a/boost/boost/re_detail/regex_config.hpp b/boost/boost/re_detail/regex_config.hpp new file mode 100644 index 0000000000..f6d920ccbe --- /dev/null +++ b/boost/boost/re_detail/regex_config.hpp @@ -0,0 +1,1294 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE regex_config.hpp + * VERSION 3.03 + * DESCRIPTION: auto-configure options for regular expression code. + */ + +#ifndef BOOST_REGEX_CONFIG_HPP +#define BOOST_REGEX_CONFIG_HPP + +/************************************************************************ + +The purpose of this header is to provide compiler and STL configuration +options. Options fall into three categaries (namespaces, compiler and STL), +throughout, the defaults assume that the compiler and STL are fully C++ standard +compliant, features that are not supported on your system may be selectively +turned off by defining the appropriate macros. Borland C++, Borland C++ Builder, +and Microsoft Visual C++ should be auto-recognised and configured. The HP aCC and +SunPro C++ compiler should also be supported - but run configure for best results. +The SGI, HP, Microsoft and Rogue Wave STL's should be auto-recognised and configured. +Do not change this file unless you really really have to, add options to + instead. See for a full list of macros and their usage. + +************************************************************************/ + +/* LGB */ +#include + +#include + +#ifdef __cplusplus +#include +#include +#include +#include +#include +#include +#include +#include +#else +// +// C build, +// don't include because that may +// do C++ specific things in future... +// +#include +#ifdef _MSC_VER +#define BOOST_MSVC _MSC_VER +#endif +#endif + +/* this will increase in future versions: */ +#define BOOST_RE_VERSION 300 + +// fix: +#if defined(_UNICODE) && !defined(UNICODE) +#define UNICODE +#endif + +#ifndef BOOST_RE_AUTO_CONFIGURE +#if (defined(__WIN32__) || defined(_WIN32) || defined(WIN32)) && !defined(__GNUC__) + #define BOOST_RE_PLATFORM_W32 +#endif + +#ifdef __MWERKS__ +// no std::maessages facet +#define BOOST_RE_NO_MESSAGES +#endif + +#ifdef __BORLANDC__ + + #if __BORLANDC__ < 0x500 + #define BOOST_RE_NO_NAMESPACES + #define BOOST_RE_NO_BOOL + #define BOOST_RE_NO_MUTABLE + #endif + + #if __BORLANDC__ < 0x520 + #define BOOST_RE_NO_WCSTRING + #define BOOST_RE_NO_INT64 + // Early versions of Borlands namespace code can't cope with iterators + // that are in different namespaces from STL code. + #define boost std + #define BOOST_RE_NO_NOT_EQUAL + #endif + + #if __BORLANDC__ < 0x530 + #define BOOST_RE_NO_WCTYPE_H + #define BOOST_RE_NO_WCHAR_H + #define BOOST_RE_OLD_IOSTREAM + #define BOOST_RE_NO_TRICKY_DEFAULT_PARAM + #define BOOST_RE_NO_EXCEPTION_H + #ifndef __WIN32__ + #define BOOST_RE_NO_WCSTRING + #endif + #define BOOST_RE_NO_LOCALE_H + #define BOOST_RE_NO_TEMPLATE_RETURNS + // + // this is a hack to get around buggy namespace support in the + // 0x520 compiler version + #define BOOST_RE_NO_USING + #define BOOST_RE_USING_HACK + #define BOOST_RE_OLD_IOSTREAM + #endif + + #if __BORLANDC__ < 0x540 + #define BOOST_RE_NO_MEMBER_TEMPLATES + // inline contructors exhibit strange behaviour + // under Builder 3 and C++ 5.x when throwing exceptions + #define INLINE_EXCEPTION_BUG + #define BOOST_RE_NESTED_TEMPLATE_DECL + #define BOOST_RE_NO_PARTIAL_FUNC_SPEC + #define BOOST_RE_NO_STRING_DEF_ARGS + #define BOOST_RE_NO_TYPEINFO // bad_cast etc not in namespace std. + #endif + // + // Builder 4 seems to have broken template friend support: + #define BOOST_RE_NO_TEMPLATE_FRIEND + + #if (__BORLANDC__ == 0x550) || (__BORLANDC__ == 0x551) + // problems with std::basic_string and dll RTL: + #if defined(_RTLDLL) && defined(_RWSTD_COMPILE_INSTANTIATE) + #ifdef BOOST_RE_BUILD_DLL + #error _RWSTD_COMPILE_INSTANTIATE must not be defined when building regex++ as a DLL + #else + #pragma warn defining _RWSTD_COMPILE_INSTANTIATE when linking to the DLL version of the RTL may produce memory corruption problems in std::basic_string, as a result of separate versions of basic_string's static data in the RTL and you're exe/dll: be warned!! + #endif + #endif + #ifndef _RTLDLL + // this is harmless for a staic link: + #define _RWSTD_COMPILE_INSTANTIATE + #endif + #endif + + #ifndef _CPPUNWIND + #error exception handling support required + #endif + + #ifdef _Windows + #define BOOST_RE_PLATFORM_WINDOWS + #else + #define BOOST_RE_PLATFORM_DOS + #endif + + #ifndef __WIN32__ + #define BOOST_RE_CALL + #define BOOST_RE_CCALL + #else + #define BOOST_RE_CALL __fastcall + #define BOOST_RE_CCALL __stdcall + #endif + + #define BOOST_RE_INT64t __int64 + #define BOOST_RE_IMM64(val) val##i64 + #define BOOST_RE_NO_CAT + // broken wide character support: + #define BOOST_RE_NO_SWPRINTF + + #ifdef __MT__ + #define BOOST_RE_THREADS + #endif + + // + // VCL support: + // if we're building a console app then there can't be any VCL (can there?) + #if !defined(__CONSOLE__) && !defined(_NO_VCL) + #define BOOST_RE_USE_VCL + #endif + // + // import export options: + #ifdef _RTLDLL + #ifdef BOOST_RE_BUILD_DLL + #define BOOST_RE_IX_DECL __declspec( dllexport ) + #elif !defined(BOOST_REGEX_LIBRARY_INCLUDE_HPP) && !defined(BOOST_RE_NO_LIB) + #define BOOST_RE_IX_DECL __declspec( dllimport ) + #endif + #endif + #include + +#include +#include + +#endif + +// +// only want "real" Visual C++ here: +#if defined(BOOST_MSVC) && !defined(__WATCOMC__) && !defined(__BORLANDC__) && !defined(__GNUC__) && !defined(__MWERKS__) && !defined (__ICL) + #define BOOST_RE_CALL __fastcall + #define BOOST_RE_CCALL __stdcall + + #if BOOST_MSVC < 1100 + #define BOOST_RE_NO_NAMESPACES + #define BOOST_RE_NO_DEFAULT_PARAM + #define BOOST_RE_NO_BOOL + #define BOOST_RE_NO_MUTABLE + #define BOOST_RE_NO_WCSTRING + #define BOOST_RE_NO_LOCALE_H + #define BOOST_RE_NO_TEMPLATE_RETURNS + #define BOOST_RE_NO_INT64 + #endif + + #if BOOST_MSVC < 1200 + #define BOOST_RE_NESTED_TEMPLATE_DECL + #define BOOST_RE_NO_STRING_DEF_ARGS + #endif + + #if !defined(_CPPUNWIND) && defined(__cplusplus) + #error exception handling support required + #endif + + #define BOOST_RE_PLATFORM_WINDOWS + // + // no support for nested template classes yet.... + // although this part of VC6 is badly documented + #define BOOST_RE_NO_MEMBER_TEMPLATES + #define BOOST_RE_INT64t __int64 + #define BOOST_RE_IMM64(val) val##i64 + #define BOOST_RE_NO_CAT + #define BOOST_RE_NO_PARTIAL_FUNC_SPEC + #define BOOST_RE_NO_TEMPLATE_FRIEND + #define BOOST_RE_NO_SWPRINTF + + #ifdef _MT + #define BOOST_RE_THREADS + #endif + +#ifdef __cplusplus +#include +#include +#endif +#pragma warning(disable: 4786) +#pragma warning(disable: 4800) +#pragma warning(disable: 4200) +#pragma warning(disable: 4097) +#pragma warning(disable: 4127) + + // + // import export options: + #ifdef _DLL + #ifdef BOOST_RE_BUILD_DLL + #define BOOST_RE_IX_DECL __declspec( dllexport ) + #elif !defined(BOOST_REGEX_LIBRARY_INCLUDE_HPP) && !defined(BOOST_RE_NO_LIB) + #define BOOST_RE_IX_DECL __declspec( dllimport ) + #endif + #endif + #include + +#endif + +#ifdef __GNUC__ + #if (__GNUC__ < 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ < 91)) + #define BOOST_RE_NO_NAMESPACES + #define BOOST_RE_NO_MUTABLE + #define BOOST_RE_NO_MEMBER_TEMPLATES + #define BOOST_RE_NO_PARTIAL_FUNC_SPEC + #define BOOST_RE_NO_TEMPLATE_FRIEND + #endif + #ifndef __STL_USE_NAMESPACES + //#define BOOST_RE_NO_EXCEPTION_H + #endif + #define BOOST_RE_INT64t long long + #define BOOST_RE_IMM64(val) val##LL + + #ifdef _WIN32 + /* there seems to be a problem with in gcc */ + #define BOOST_RE_LOCALE_C + #define BOOST_RE_NO_W32 + #define BOOST_RE_NO_WCTYPE_H + #define BOOST_RE_NO_TEMPLATE_SWITCH_MERGE + #endif + #define BOOST_RE_NO_CAT + #define BOOST_RE_NESTED_TEMPLATE_DECL + #define BOOST_RE_NO_SWPRINTF + #include + #ifdef __BASTRING__ + #define BOOST_RE_NO_WCSTRING + #endif + // + // for now we'll always define these + // unless we know that the platform can cope + // with woide character strings: + #if !defined(linux) + #define BOOST_RE_NO_WCTYPE_H + #define BOOST_RE_NO_WCSTRING + #endif + +#endif + +#ifdef __MWERKS__ + #define BOOST_RE_NO_CAT +#endif + +#ifdef __SUNPRO_CC + #if (__SUNPRO_CC < 0x500) + #define BOOST_RE_NO_NAMESPACES + #define BOOST_RE_NO_MUTABLE + #define BOOST_RE_NO_MEMBER_TEMPLATES + #define BOOST_RE_OLD_IOSTREAM + #endif + #ifndef __STL_USE_NAMESPACES + #define BOOST_RE_NO_EXCEPTION_H + #endif + #define BOOST_RE_INT64t long long + #define BOOST_RE_IMM64(val) val##LL + #define BOOST_RE_NESTED_TEMPLATE_DECL + #define BOOST_RE_NO_SWPRINTF + #define BOOST_RE_NO_TEMPLATE_FRIEND +#endif + +#ifdef __HP_aCC + // putative HP aCC support, run configure for + // support tailored to your system.... + #define BOOST_RE_NO_NAMESPACES + #define BOOST_RE_NO_MUTABLE + #define BOOST_RE_NO_MEMBER_TEMPLATES + #define BOOST_RE_OLD_IOSTREAM + #ifndef __STL_USE_NAMESPACES + #define BOOST_RE_NO_EXCEPTION_H + #endif + #define BOOST_RE_INT64t long long + #define BOOST_RE_IMM64(val) val##LL + #define BOOST_RE_NESTED_TEMPLATE_DECL + #define BOOST_RE_NO_TEMPLATE_FRIEND + #define BOOST_RE_NO_SWPRINTF +#endif + +#ifdef __sgi // SGI IRIX C++ +#define BOOST_RE_NO_SWPRINTF +#if defined(__SGI_STL_PORT) +// STLPort on IRIX is misconfigured: does not compile +// as a temporary fix include instead and prevent inclusion +// of STLPort version of +#include +#define __STLPORT_CWCTYPE +#define BOOST_RE_NO_WCTYPE_H +#endif +#endif + +#if defined __KCC +// Kai 3.4 appears to have no wide character string support: +# if __KCC_VERSION <= 3499 +# define BOOST_RE_NO_WCSTRING +# endif +#endif + +#endif // BOOST_RE_AUTO_CONFIGURE + +#ifdef __cplusplus +#ifndef BOOST_RE_NO_WCSTRING +#ifndef BOOST_RE_NO_WCTYPE_H +#include +#endif +#ifndef BOOST_RE_NO_WCHAR_H +#include +#endif +#endif +#endif + +#ifdef BOOST_RE_NO_NAMESPACES +#define BOOST_RE_MAYBE_ACCESS_SPEC :: +#else +#define BOOST_RE_MAYBE_ACCESS_SPEC +#endif + +#if !defined(BOOST_RE_INT64t) || !defined(BOOST_RE_IMM64) +#define BOOST_RE_NO_INT64 +#endif + +#ifndef BOOST_RE_INT32_LONG +typedef unsigned int jm_uintfast32_t; +#else +typedef unsigned long jm_uintfast32_t; +#endif + +#ifndef BOOST_RE_NESTED_TEMPLATE_DECL +#define BOOST_RE_NESTED_TEMPLATE_DECL template +#endif + +#ifndef BOOST_RE_IX_DECL +#define BOOST_RE_IX_DECL +#endif + +#ifndef MB_CUR_MAX +// yuk! +// better make a conservative guess! +#define MB_CUR_MAX 10 +#endif + + +/* everything else is C++: */ + +#ifdef __cplusplus + +/* define macro's to make default parameter declaration easier: */ + +#ifdef BOOST_RE_NO_DEFAULT_PARAM + #define BOOST_RE_DEFAULT_PARAM(x) + #define BOOST_RE_TRICKY_DEFAULT_PARAM(x) +#elif defined(BOOST_RE_NO_TRICKY_DEFAULT_PARAM) + #define BOOST_RE_DEFAULT_PARAM(x) = x + #define BOOST_RE_TRICKY_DEFAULT_PARAM(x) +#else + #define BOOST_RE_DEFAULT_PARAM(x) = x + #define BOOST_RE_TRICKY_DEFAULT_PARAM(x) = x +#endif + +/* STL configuration goes here: */ + +#ifndef BOOST_RE_AUTO_CONFIGURE +#ifdef BOOST_RE_NO_STL + #define BOOST_RE_NO_EXCEPTION_H + #define BOOST_RE_NO_ITERATOR_H + #define BOOST_RE_NO_MEMORY_H + #define BOOST_RE_NO_LOCALE_H + #define BOOST_RE_NO_STRING_H +#endif + +#ifndef BOOST_RE_NO_EXCEPTION_H + #include +#endif + +#ifndef BOOST_RE_NO_ITERATOR_H + #include + + #if defined(__SGI_STL_INTERNAL_ITERATOR_H) || defined(__SGI_STL_ITERATOR_H) + + /* we are using SGI's STL + some of these (std) + may be guesswork: */ + + # if !defined (__SGI_STL_OWN_IOSTREAMS) || defined (__STL_HAS_NO_NEW_IOSTREAMS) || defined (__STL_USE_NO_IOSTREAMS) || defined(__STL_NO_MBSTATE_T) + // Old IO streams: + #define BOOST_RE_NO_LOCALE_H + #define BOOST_RE_OLD_IOSTREAM + #else + #ifdef __STL_NO_EXPLICIT_FUNCTION_TMPL_ARGS + #define BOOST_RE_USE_FACET(l, m) (*std::_Use_facet(l)) + #endif + #endif + #ifdef __BASTRING__ + #define BOOST_RE_NO_WCSTRING + #endif + #if !defined(__STL_MEMBER_TEMPLATE_CLASSES) || !defined(__STL_MEMBER_TEMPLATES) + #define BOOST_RE_NO_MEMBER_TEMPLATES + #endif + #define BOOST_RE_NO_TYPEINFO + + #ifdef __STL_NO_BOOL + #define BOOST_RE_NO_BOOL + #endif + #ifdef __STL_LIMITED_DEFAULT_TEMPLATES + #define BOOST_RE_NO_TRICKY_DEFAULT_PARAM + #define BOOST_RE_NO_STRING_DEF_ARGS + #endif + #ifndef __STL_USE_EXCEPTIONS + #error exception handling support required + #endif + + #include + #include + + #define BOOST_RE_ALGO_INCLUDED + + #define BOOST_RE_DISTANCE(i, j, n) do { n = 0; std::distance(i, j, n); } while(false) + #define BOOST_RE_OUTPUT_ITERATOR(T, D) std::output_iterator + #define BOOST_RE_INPUT_ITERATOR(T, D) std::input_iterator + #define BOOST_RE_FWD_ITERATOR(T, D) std::forward_iterator + #define BOOST_RE_BIDI_ITERATOR(T, D) std::bidirectional_iterator + #define BOOST_RE_RA_ITERATOR(T, D) std::random_access_iterator + + #if defined(__STL_USE_STD_ALLOCATORS) || (defined(__SGI_STL_PORT ) && !defined(__STL_MEMBER_TEMPLATE_CLASSES) && !defined(__STL_MEMBER_TEMPLATES)) + + /* new style allocator's with nested template classes */ + #undef BOOST_RE_NO_MEMBER_TEMPLATES + #define REBIND_INSTANCE(x, y, inst) y::BOOST_RE_NESTED_TEMPLATE_DECL rebind::other(inst) + #define REBIND_TYPE(x, y) y::BOOST_RE_NESTED_TEMPLATE_DECL rebind::other + #define BOOST_RE_DEF_ALLOC_PARAM(x) BOOST_RE_TRICKY_DEFAULT_PARAM( std::allocator ) + #define BOOST_RE_DEF_ALLOC(x) std::allocator + + #else /* __STL_USE_STD_ALLOCATORS */ + #define BOOST_RE_OLD_ALLOCATORS + #define REBIND_INSTANCE(x, y, inst) BOOST_RE_MAYBE_ACCESS_SPEC boost::re_detail::re_alloc_binder(inst) + #define REBIND_TYPE(x, y) BOOST_RE_MAYBE_ACCESS_SPEC re_alloc_binder + #define BOOST_RE_DEF_ALLOC_PARAM(x) BOOST_RE_TRICKY_DEFAULT_PARAM( jm_def_alloc ) + #define BOOST_RE_DEF_ALLOC(x) jm_def_alloc + #define BOOST_RE_NEED_BINDER + #define BOOST_RE_NEED_ALLOC + #endif /* __STL_USE_STD_ALLOCATORS */ + + #define BOOST_RE_STL_DONE + #ifndef __SGI_STL_PORT + //#define BOOST_RE_NO_NOT_EQUAL + #endif + + #elif defined(__STD_ITERATOR__) + + /* Rogue Wave STL */ + + #if defined(RWSTD_NO_MEMBER_TEMPLATES) || defined(RWSTD_NO_MEM_CLASS_TEMPLATES) + #define BOOST_RE_NO_MEMBER_TEMPLATES + #endif + #ifdef _RWSTD_NO_TEMPLATE_ON_RETURN_TYPE + #define BOOST_RE_NO_TEMPLATE_RETURNS + #endif + + #ifdef RWSTD_NO_EXCEPTIONS + #error exception handling support required + #endif + + #ifdef RWSTD_NO_MUTABLE + #define BOOST_RE_NO_MUTABLE + #endif + + #ifdef RWSTD_NO_DEFAULT_TEMPLATES + #define BOOST_RE_NO_DEFAULT_PARAM + #define BOOST_RE_NO_TRICKY_DEFAULT_PARAM + #define BOOST_RE_NO_STRING_DEF_ARGS + #endif + + #ifdef _RWSTD_NO_COMPLEX_DEFAULT_TEMPLATES + #define BOOST_RE_NO_TRICKY_DEFAULT_PARAM + #define BOOST_RE_NO_STRING_DEF_ARGS + #endif + + #ifdef RWSTD_NO_BOOL + #define BOOST_RE_NO_BOOL + #endif + + #if _RWSTD_VER > 0x020000 + #ifdef _RWSTD_NO_CLASS_PARTIAL_SPEC + #define BOOST_RE_DISTANCE(i, j, n) do { n = 0; std::distance(i, j, n); } while(false) + #else + #define BOOST_RE_DISTANCE(i, j, n) (n = std::distance(i, j)) + #endif + #define BOOST_RE_OUTPUT_ITERATOR(T, D) std::iterator + #define BOOST_RE_INPUT_ITERATOR(T, D) std::iterator + #define BOOST_RE_FWD_ITERATOR(T, D) std::iterator + #define BOOST_RE_BIDI_ITERATOR(T, D) std::iterator + #define BOOST_RE_RA_ITERATOR(T, D) std::iterator + #else + #define BOOST_RE_DISTANCE(i, j, n) std::distance(i, j, n)do { n = 0; std::distance(i, j, n); } while(false) + #define BOOST_RE_OUTPUT_ITERATOR(T, D) std::output_iterator + #if _RWSTD_VER >= 0x0200 + #define BOOST_RE_INPUT_ITERATOR(T, D) std::input_iterator + #else + #define BOOST_RE_INPUT_ITERATOR(T, D) std::input_iterator + #endif + #define BOOST_RE_FWD_ITERATOR(T, D) std::forward_iterator + #define BOOST_RE_BIDI_ITERATOR(T, D) std::bidirectional_iterator + #define BOOST_RE_RA_ITERATOR(T, D) std::random_access_iterator + #endif + + #include + + #ifdef _RWSTD_ALLOCATOR + + /* new style allocator */ + + #define REBIND_INSTANCE(x, y, inst) y::BOOST_RE_NESTED_TEMPLATE_DECL rebind::other(inst) + #define REBIND_TYPE(x, y) y::BOOST_RE_NESTED_TEMPLATE_DECL rebind::other + #define BOOST_RE_DEF_ALLOC_PARAM(x) BOOST_RE_TRICKY_DEFAULT_PARAM( std::allocator ) + #define BOOST_RE_DEF_ALLOC(x) std::allocator + + #else + /* + // old style allocator + // this varies a great deal between versions, and there is no way + // that I can tell of differentiating between them, so use our + // own default allocator... + */ + #define BOOST_RE_OLD_ALLOCATORS + #define REBIND_INSTANCE(x, y, inst) BOOST_RE_MAYBE_ACCESS_SPEC boost::re_detail::re_alloc_binder(inst) + #define REBIND_TYPE(x, y) BOOST_RE_MAYBE_ACCESS_SPEC re_alloc_binder + #define BOOST_RE_DEF_ALLOC_PARAM(x) BOOST_RE_TRICKY_DEFAULT_PARAM( jm_def_alloc ) + #define BOOST_RE_DEF_ALLOC(x) jm_def_alloc + + #define BOOST_RE_NEED_BINDER + #define BOOST_RE_NEED_ALLOC + + #endif + + #define BOOST_RE_STL_DONE + #if _RWSTD_VER < 0x020100 + #define BOOST_RE_NO_OI_ASSIGN + #endif + + #elif defined (ITERATOR_H) + + /* HP STL */ + + #define BOOST_RE_NO_LOCALE_H + + #include + #define BOOST_RE_ALGO_INCLUDED + + #define BOOST_RE_DISTANCE(i, j, n) std::distance(i, j, n)do { n = 0; std::distance(i, j, n); } while(false) + #define BOOST_RE_OUTPUT_ITERATOR(T, D) std::output_iterator + #define BOOST_RE_INPUT_ITERATOR(T, D) std::input_iterator + #define BOOST_RE_FWD_ITERATOR(T, D) std::forward_iterator + #define BOOST_RE_BIDI_ITERATOR(T, D) std::bidirectional_iterator + #define BOOST_RE_RA_ITERATOR(T, D) std::random_access_iterator + + /* old style allocator */ + #define BOOST_RE_OLD_ALLOCATORS + #define REBIND_INSTANCE(x, y, inst) BOOST_RE_MAYBE_ACCESS_SPEC boost::re_detail::re_alloc_binder(inst) + #define REBIND_TYPE(x, y) BOOST_RE_MAYBE_ACCESS_SPEC re_alloc_binder + #define BOOST_RE_DEF_ALLOC_PARAM(x) BOOST_RE_TRICKY_DEFAULT_PARAM( jm_def_alloc ) + #define BOOST_RE_DEF_ALLOC(x) jm_def_alloc + + #define BOOST_RE_NEED_BINDER + #define BOOST_RE_NEED_ALLOC + #define BOOST_RE_NO_NOT_EQUAL + + #define BOOST_RE_STL_DONE + + #elif defined (BOOST_MSVC) + + /* assume we're using MS's own STL (VC++ 5/6) */ + #define BOOST_RE_NO_OI_ASSIGN + + #define BOOST_RE_DISTANCE(i, j, n) n = std::distance(i, j) + #define BOOST_RE_OUTPUT_ITERATOR(T, D) std::iterator + #define BOOST_RE_INPUT_ITERATOR(T, D) std::iterator + #define BOOST_RE_FWD_ITERATOR(T, D) std::iterator + #define BOOST_RE_BIDI_ITERATOR(T, D) std::iterator + #define BOOST_RE_RA_ITERATOR(T, D) std::iterator + + /* MS's allocators are rather ambiguous about their properties + at least as far as MSDN is concerned, so play safe: */ + #define BOOST_RE_OLD_ALLOCATORS + #define REBIND_INSTANCE(x, y, inst) BOOST_RE_MAYBE_ACCESS_SPEC boost::re_detail::re_alloc_binder(inst) + #define REBIND_TYPE(x, y) BOOST_RE_MAYBE_ACCESS_SPEC re_alloc_binder + #define BOOST_RE_DEF_ALLOC_PARAM(x) BOOST_RE_TRICKY_DEFAULT_PARAM( jm_def_alloc ) + #define BOOST_RE_DEF_ALLOC(x) jm_def_alloc + + #define BOOST_RE_NEED_BINDER + #define BOOST_RE_NEED_ALLOC + + #define BOOST_RE_STL_DONE + #ifndef _CPPLIB_VER + #define BOOST_RE_USE_FACET(l, type) std::use_facet(l, (type*)0, true) + #define BOOST_RE_HAS_FACET(l, type) std::has_facet(l, (type*)0) + #else + #define BOOST_RE_USE_FACET(l, type) std::use_facet(l, (type*)0) + #define BOOST_RE_HAS_FACET(l, type) std::has_facet(l, (type*)0) + #endif + + + #else + + /* unknown STL version + try the defaults: */ + + // dwa 10/05/00 Why were we assuming a broken distance in this case? + #define BOOST_RE_DISTANCE(i, j, n) (n = std::distance(i, j)) + /* these may be suspect for older libraries */ + #define BOOST_RE_OUTPUT_ITERATOR(T, D) std::iterator + #define BOOST_RE_INPUT_ITERATOR(T, D) std::iterator + #define BOOST_RE_FWD_ITERATOR(T, D) std::iterator + #define BOOST_RE_BIDI_ITERATOR(T, D) std::iterator + #define BOOST_RE_RA_ITERATOR(T, D) std::iterator + + #endif /* config */ + +#else /* no at all */ + + #define BOOST_RE_DISTANCE(i, j, n) (n = j - i) + #define BOOST_RE_OUTPUT_ITERATOR(T, D) boost::re_detail::dummy_iterator_base + #define BOOST_RE_INPUT_ITERATOR(T, D) boost::re_detail::dummy_iterator_base + #define BOOST_RE_FWD_ITERATOR(T, D) boost::re_detail::dummy_iterator_base + #define BOOST_RE_BIDI_ITERATOR(T, D) boost::re_detail::dummy_iterator_base + #define BOOST_RE_RA_ITERATOR(T, D) boost::re_detail::dummy_iterator_base + + +#endif + +/* now do allocator if not already done */ + +#ifndef BOOST_RE_STL_DONE + + #ifdef BOOST_RE_NO_MEMORY_H + + /* old style allocator */ + + #define BOOST_RE_OLD_ALLOCATORS + + #define REBIND_INSTANCE(x, y, inst) BOOST_RE_MAYBE_ACCESS_SPEC boost::re_detail::re_alloc_binder(inst) + #define REBIND_TYPE(x, y) BOOST_RE_MAYBE_ACCESS_SPEC re_alloc_binder + #define BOOST_RE_DEF_ALLOC_PARAM(x) BOOST_RE_TRICKY_DEFAULT_PARAM( jm_def_alloc ) + #define BOOST_RE_DEF_ALLOC(x) jm_def_alloc + + #define BOOST_RE_NEED_BINDER + #define BOOST_RE_NEED_ALLOC + + #else + + /* new style allocator's with nested template classes */ + + #define REBIND_INSTANCE(x, y, inst) y::BOOST_RE_NESTED_TEMPLATE_DECL rebind::other(inst) + #define REBIND_TYPE(x, y) y::BOOST_RE_NESTED_TEMPLATE_DECL rebind::other + #define BOOST_RE_DEF_ALLOC_PARAM(x) BOOST_RE_TRICKY_DEFAULT_PARAM( std::allocator ) + #define BOOST_RE_DEF_ALLOC(x) std::allocator + + #endif + +#endif +#endif // BOOST_RE_AUTO_CONFIGURE + + + +/* namespace configuration goes here: */ +#define BOOST_RE_USING(x) using namespace x; + + +/* locale configuration goes here */ +#if !defined(BOOST_RE_NO_LOCALE_H) + #include + #define LOCALE_INSTANCE(i) std::locale i; + #define MAYBE_PASS_LOCALE(i) , i + #ifndef BOOST_RE_NO_TEMPLATE_RETURNS + #ifndef BOOST_RE_USE_FACET + #define BOOST_RE_USE_FACET(l, type) std::use_facet< type >(l) + #endif + #ifndef BOOST_RE_HAS_FACET + #define BOOST_RE_HAS_FACET(l, type) std::has_facet< type >(l) + #endif + #else + #ifndef BOOST_RE_USE_FACET + #define BOOST_RE_USE_FACET(l, type) std::use_facet(l, (type*)0) + #endif + #ifndef BOOST_RE_HAS_FACET + #define BOOST_RE_HAS_FACET(l, type) std::has_facet(l, (type*)0) + #endif + #endif +#else + #define LOCALE_INSTANCE(i) + #define MAYBE_PASS_LOCALE(i) +#endif + +/* compiler configuration goes here: */ + +#ifdef BOOST_RE_NO_MUTABLE + #define BOOST_RE_MUTABLE +#else + #define BOOST_RE_MUTABLE mutable +#endif + +#if defined( BOOST_RE_NO_BOOL) && !defined(bool) + #define bool int + #define true 1 + #define false 0 +#endif + +#ifndef BOOST_RE_CALL +#define BOOST_RE_CALL +#endif + +#ifndef BOOST_RE_CCALL +#define BOOST_RE_CCALL +#endif + +#ifndef BOOST_RE_DECL +#define BOOST_RE_DECL +#endif + +#if defined(BOOST_RE_NO_DEFAULT_PARAM) || defined(BOOST_RE_NO_TRICKY_DEFAULT_PARAM) +#define BOOST_RE_NO_STRING_DEF_ARGS +#endif + + + +/* add our class def's if they are needed: */ + +namespace boost{ + namespace re_detail{ + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b + #endif +#endif + +// add our destroy functions: + +template +inline void BOOST_RE_CALL jm_destroy(T* t) +{ + t->~T(); + (void)t; // suppress incorrect MSVC compiler warning +} +#if 0 +inline void BOOST_RE_CALL jm_destroy(char* t){} +inline void BOOST_RE_CALL jm_destroy(short* t){} +inline void BOOST_RE_CALL jm_destroy(unsigned short* t){} +inline void BOOST_RE_CALL jm_destroy(int* t){} +inline void BOOST_RE_CALL jm_destroy(unsigned int* t){} +inline void BOOST_RE_CALL jm_destroy(long* t){} +inline void BOOST_RE_CALL jm_destroy(unsigned long* t){} +#endif + +template +inline void BOOST_RE_CALL jm_construct(void* p, const T& t) +{ + new (p) T(t); +} + + +template +class re_alloc_binder : public Allocator +{ +public: + typedef T value_type; + typedef T* pointer; + typedef const T* const_pointer; + typedef T& reference; + typedef const T& const_reference; + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + + re_alloc_binder(const Allocator& i); + re_alloc_binder(const re_alloc_binder& o) : Allocator(o) {} + + T* BOOST_RE_CALL allocate(std::size_t n, std::size_t /* hint */ = 0) + { return 0 == n ? 0 : (T*) this->Allocator::allocate(n * sizeof(T)); } + void BOOST_RE_CALL deallocate(T *p, std::size_t n) + { if (0 != n) this->Allocator::deallocate((char*)p, n * sizeof (T)); } + + pointer BOOST_RE_CALL address(reference x) const { return &x; } + const_pointer BOOST_RE_CALL address(const_reference x) const { return &x; } + static size_type BOOST_RE_CALL max_size() { return (size_type)-1; } + static void BOOST_RE_CALL construct(pointer p, const T& val) { jm_construct(p, val); } + void BOOST_RE_CALL destroy(pointer p) { jm_destroy(p); } + + const Allocator& BOOST_RE_CALL instance()const { return *this; } + +#ifndef BOOST_RE_NO_MEMBER_TEMPLATES + + template + struct rebind + { + typedef re_alloc_binder other; + }; + + template + BOOST_RE_CALL re_alloc_binder(const re_alloc_binder& o) throw() + : Allocator(o.instance()) + { + } +#endif +}; + +template +inline re_alloc_binder::re_alloc_binder(const Allocator &i) + : Allocator(i) +{} + + +// +// class jm_def_alloc +// basically a standard allocator that only allocates bytes... +// think of it as allocator, with a non-standard +// rebind::other typedef. +// +class jm_def_alloc +{ +public: + typedef char value_type; + typedef char* pointer; + typedef const char* const_pointer; + typedef char& reference; + typedef const char& const_reference; + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + + pointer BOOST_RE_CALL address(reference x) const { return &x; } + const_pointer BOOST_RE_CALL address(const_reference x) const { return &x; } + static size_type BOOST_RE_CALL max_size() { return (size_type)-1; } + static void BOOST_RE_CALL construct(pointer , const char& ) { } + void BOOST_RE_CALL destroy(pointer ) { } + static void * BOOST_RE_CALL allocate(std::size_t n, std::size_t /* hint */ = 0) + { + return ::operator new(n); + } + static void BOOST_RE_CALL deallocate(void *p, std::size_t /*n*/ ) + { + ::operator delete(p); + } + +#ifndef BOOST_RE_NO_MEMBER_TEMPLATES + template + struct rebind + { + typedef re_alloc_binder other; + }; + + template + BOOST_RE_CALL jm_def_alloc(const re_alloc_binder& ) throw() { } +#endif + jm_def_alloc(const jm_def_alloc&) {} + jm_def_alloc() {} +}; + +template +struct dummy_iterator_base +{ + typedef T value_type; + typedef std::ptrdiff_t difference_type; + typedef T* pointer; + typedef T& reference; + //typedef Category iterator_category; +}; + +// we need to absolutely sure that int values are correctly +// translated to bool (true or false) values... +// note that the original HP STL redefines the bool type regardless +// of whether the compiler supports it.... yuk + +#if defined(BOOST_RE_NO_BOOL) || defined(ITERATOR_H) || defined(bool) +#define BOOST_RE_MAKE_BOOL(x) boost::re_detail::boolify(x) + +template +inline bool BOOST_RE_CALL boolify(I val) +{ + return val ? true : false; +} + +#else +#define BOOST_RE_MAKE_BOOL(x) x +#endif + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + +} // namespace re_detail +#ifdef BOOST_RE_NEED_BINDER +using re_detail::re_alloc_binder; +#endif +#ifdef BOOST_RE_NEED_ALLOC +using re_detail::jm_def_alloc; +#endif +} // namespace boost + +#ifdef __GNUC__ +#define INLINE_EXCEPTION_BUG +#endif + +#if !defined(INLINE_EXCEPTION_BUG) || defined(BOOST_RE_NO_TEMPLATE_MERGE) + #define CONSTRUCTOR_INLINE inline +#else + #define CONSTRUCTOR_INLINE +#endif + +#if defined(BOOST_RE_PLATFORM_W32) && !defined(BOOST_RE_LOCALE_W32) && !defined(BOOST_RE_LOCALE_C) && !defined(BOOST_RE_LOCALE_CPP) && !defined(BOOST_RE_NO_W32) +#define BOOST_RE_LOCALE_W32 +#endif + +#if !defined(BOOST_RE_LOCALE_W32) && !defined(BOOST_RE_LOCALE_C) && !defined(BOOST_RE_LOCALE_CPP) +#define BOOST_RE_LOCALE_C +#endif + +#if defined(BOOST_RE_OLD_ALLOCATORS) +#define BOOST_RE_MAYBE_TYPENAME +#else +#define BOOST_RE_MAYBE_TYPENAME typename +#endif + +#if defined(_WIN32) && !defined(BOOST_RE_NO_W32) +#include +#endif + + +/* now do debugging stuff: */ + +#ifdef BOOST_RE_DEBUG + +#ifdef BOOST_RE_OLD_IOSTREAM +#include +#else +#include +using std::cout; +using std::cin; +using std::cerr; +using std::endl; +using std::hex; +using std::dec; +#endif + + #ifndef jm_assert + #define jm_assert(x) if((x) == 0){ cerr << "Assertion failed: " << #x << " in file " << __FILE__ << "and line " << __LINE__ << endl; exit(-1); } + #endif + #ifndef jm_trace + #define jm_trace(x) cerr << x << endl; + #endif + #ifndef jm_instrument + #define jm_instrument jm_trace(__FILE__<<"#"<<__LINE__) + #endif + +namespace boost{ + namespace re_detail{ +class debug_guard +{ +public: + char g1[32]; + const char* pc; + char* pnc; + const char* file; + int line; + char g2[32]; + debug_guard(const char* f, int l, const char* p1 = 0, char* p2 = 0); + ~debug_guard(); +}; + +#define BOOST_RE_GUARD_STACK boost::re_detail::debug_guard sg(__FILE__, __LINE__); +#define BOOST_RE_GUARD_GLOBAL(x) const char g1##x[] = { 0, 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, }; char g2##x[32]; boost::debug_guard g3##x(__FILE__, __LINE__, g1##x, g2##x); + + } // namespace re_detail +} // namespace boost + + #ifdef __BORLANDC__ + #pragma message "macro allocator: " BOOST_RE_DEF_ALLOC_PARAM(wchar_t) + #pragma message "macro jm_input_iterator: " BOOST_RE_INPUT_ITERATOR(char, std::ptrdiff_t) + #pragma message "macro jm_output_iterator: " BOOST_RE_OUTPUT_ITERATOR(char, std::ptrdiff_t) + #pragma message "macro jm_fwd_iterator: " BOOST_RE_FWD_ITERATOR(char, std::ptrdiff_t) + #pragma message "macro jm_bidi_iterator: " BOOST_RE_BIDI_ITERATOR(char, std::ptrdiff_t) + #pragma message "macro jm_ra_iterator: " BOOST_RE_RA_ITERATOR(char, std::ptrdiff_t) + #ifdef BOOST_RE_LOCALE_CPP + #pragma message "locale support enabled" + #endif + #endif + +#else + + #define jm_assert(x) + #define jm_trace(x) + #define BOOST_RE_GUARD_STACK + #define BOOST_RE_GUARD_GLOBAL(x) + #ifndef jm_instrument + #define jm_instrument + #endif + + +#endif + +// +// compiler fixes: + +// fix for namespace problems: +// +// the following are defined as macros which are +// incompatable with std::something syntax, no +// choice but to undef them? +#ifdef memcpy +#undef memcpy +#endif +#ifdef memmove +#undef memmove +#endif +#ifdef memset +#undef memset +#endif +#ifdef sprintf +#undef sprintf +#endif +#ifdef strcat +#undef strcat +#endif +#ifdef strcmp +#undef strcmp +#endif +#ifdef strcpy +#undef strcpy +#endif +#ifdef strlen +#undef strlen +#endif +#ifdef swprintf +#undef swprintf +#endif +#ifdef wcslen +#undef wcslen +#endif +#ifdef wcscpy +#undef wcscpy +#endif +#ifdef wcscmp +#undef wcscmp +#endif +#ifdef isalpha +#undef isalpha +#endif +#ifdef iscntrl +#undef iscntrl +#endif +#ifdef isdigit +#undef isdigit +#endif +#ifdef islower +#undef islower +#endif +#ifdef isupper +#undef isupper +#endif +#ifdef ispunct +#undef ispunct +#endif +#ifdef isspace +#undef isspace +#endif +#ifdef isxdigit +#undef isxdigit +#endif + +#ifdef tolower +#undef tolower +#endif +#ifdef iswalpha +#undef iswalpha +#endif +#ifdef iswcntrl +#undef iswcntrl +#endif +#ifdef iswdigit +#undef iswdigit +#endif +#ifdef iswlower +#undef iswlower +#endif +#ifdef iswpunct +#undef iswpunct +#endif +#ifdef iswspace +#undef iswspace +#endif +#ifdef iswupper +#undef iswupper +#endif +#ifdef iswxdigit +#undef iswxdigit +#endif +#ifdef towlower +#undef towlower +#endif +#ifdef wcsxfrm +#undef wcsxfrm +#endif + +#if defined(BOOST_NO_STDC_NAMESPACE) || (defined(std) && defined(__SGI_STL_PORT)) +// +// fix namespaces, +// note that we almost always do this for STLPort, as it doesn't always +// catch all the wide character functions: +namespace std{ + using ::ptrdiff_t; + using ::size_t; + using ::memcpy; + using ::memmove; + using ::memset; + using ::memcmp; + using ::sprintf; + using ::strcat; + using ::strcmp; + using ::strcpy; + using ::strlen; + using ::strxfrm; + using ::isalpha; + using ::iscntrl; + using ::isdigit; + using ::islower; + using ::isupper; + using ::ispunct; + using ::isspace; + using ::isxdigit; + using ::tolower; + using ::abs; + using ::setlocale; +#ifndef BOOST_RE_NO_WCSTRING +#ifndef BOOST_RE_NO_SWPRINTF + using ::swprintf; +#endif + using ::wcslen; + using ::wcscpy; + using ::wcscmp; + using ::iswalpha; + using ::iswcntrl; + using ::iswdigit; + using ::iswlower; + using ::iswpunct; + using ::iswspace; + using ::iswupper; + using ::iswxdigit; + using ::towlower; + using ::wcsxfrm; + using ::wcstombs; + using ::mbstowcs; +#if !defined(BOOST_RE_NO_LOCALE_H) && !defined (__STL_NO_NATIVE_MBSTATE_T) + using ::mbstate_t; +#endif + using ::fseek; + using ::fread; + using ::ftell; + using ::fopen; + using ::fclose; + using ::FILE; +#endif // BOOST_RE_NO_WCSTRING +} + +#endif + +#if defined(__SGI_STL_PORT) && defined(BOOST_MSVC) && !defined(_MT) && (__SGI_STL_PORT >= 0x400) +#error STLPort libraries require multithread support to be turned on. +#endif + + +#endif /* __cplusplus */ + +#ifndef BOOST_RE_CALL +#define BOOST_RE_CALL +#endif + +#ifndef BOOST_RE_CCALL +#define BOOST_RE_CCALL +#endif + +#ifndef BOOST_RE_DECL +#define BOOST_RE_DECL +#endif + + +#endif // BOOST_REGEX_CONFIG_HPP + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boost/boost/re_detail/regex_cstring.hpp b/boost/boost/re_detail/regex_cstring.hpp new file mode 100644 index 0000000000..5e34e97b48 --- /dev/null +++ b/boost/boost/re_detail/regex_cstring.hpp @@ -0,0 +1,139 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE regex_cstring.hpp + * VERSION 3.03 + * DESCRIPTION: This is an internal header file, do not include directly. + * String support and helper functions, for regular + * expression library. + */ + +#ifndef BOOST_REGEX_CSTRING_HPP +#define BOOST_REGEX_CSTRING_HPP + +#ifndef BOOST_REGEX_CONFIG_HPP +#include +#endif + +#include + +namespace boost{ + namespace re_detail{ + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b -Ve + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b -Ve + #endif +#endif + +// +// start by defining some template function aliases for C API functions: +// + +template +std::size_t BOOST_RE_CALL re_strlen(const charT *s) +{ + std::size_t len = 0; + while(*s) + { + ++s; + ++len; + } + return len; +} + +inline std::size_t BOOST_RE_CALL re_strlen(const char *s) +{ + return std::strlen(s); +} + +#ifndef BOOST_RE_NO_WCSTRING + +inline std::size_t BOOST_RE_CALL re_strlen(const wchar_t *s) +{ + return std::wcslen(s); +} + +#endif + +#ifndef BOOST_RE_NO_WCSTRING +BOOST_RE_IX_DECL void BOOST_RE_CALL re_transform(std::basic_string& out, const std::basic_string& in); +#endif +BOOST_RE_IX_DECL void BOOST_RE_CALL re_transform(std::string& out, const std::string& in); + +template +void BOOST_RE_CALL re_trunc_primary(std::basic_string& s) +{ + for(unsigned int i = 0; i < s.size(); ++i) + { + if(s[i] <= 1) + { + s.erase(i); + break; + } + } +} + +inline char* BOOST_RE_CALL re_strcpy(char *s1, const char *s2) +{ + #if defined(__BORLANDC__) && defined(strcpy) + return ::strcpy(s1, s2); + #else + return std::strcpy(s1, s2); + #endif +} + +#ifndef BOOST_RE_NO_WCSTRING + +inline wchar_t* BOOST_RE_CALL re_strcpy(wchar_t *s1, const wchar_t *s2) +{ + return std::wcscpy(s1, s2); +} + +#endif + + +template +charT* BOOST_RE_CALL re_strdup(const charT* p) +{ + charT* buf = new charT[re_strlen(p) + 1]; + re_strcpy(buf, p); + return buf; +} + +template +inline void BOOST_RE_CALL re_strfree(charT* p) +{ + delete[] p; +} + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + +} // namespace re_detail +} // namespace boost + +#endif // BOOST_REGEX_CSTRING_HPP + + + + diff --git a/boost/boost/re_detail/regex_format.hpp b/boost/boost/re_detail/regex_format.hpp new file mode 100644 index 0000000000..8930ae9b0b --- /dev/null +++ b/boost/boost/re_detail/regex_format.hpp @@ -0,0 +1,583 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE regex_format.hpp + * VERSION 3.03 + * DESCRIPTION: Provides formatting output routines for search and replace + * operations. Note this is an internal header file included + * by regex.hpp, do not include on its own. + */ + +#ifndef BOOST_REGEX_FORMAT_HPP +#define BOOST_REGEX_FORMAT_HPP + + +namespace boost{ + +enum format_flags_t{ + format_all = 0, // enable all extentions to sytax + format_sed = match_max << 1, // sed style replacement. + format_perl = format_sed << 1, // perl style replacement. + format_no_copy = format_perl << 1, // don't copy non-matching segments. + format_is_if = format_no_copy << 1 // internal use only. +}; + +namespace re_detail{ + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b -Ve + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b -Ve -w-8037 + #endif +#endif + +template +O BOOST_RE_CALL re_copy_out(O out, I first, I last) +{ + while(first != last) + { + *out = *first; + ++out; + ++first; + } + return out; +} + +template +void BOOST_RE_CALL re_skip_format(const charT*& fmt, const traits_type& traits_inst) +{ + // dwa 9/13/00 - suppress incorrect unused parameter warning for MSVC + (void)traits_inst; + + typedef typename traits_type::size_type traits_size_type; + typedef typename traits_type::uchar_type traits_uchar_type; + typedef typename traits_type::string_type traits_string_type; + + unsigned int parens = 0; + unsigned int c; + while(*fmt) + { + c = traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*fmt)); + if((c == traits_type::syntax_colon) && (parens == 0)) + { + ++fmt; + return; + } + else if(c == traits_type::syntax_close_bracket) + { + if(parens == 0) + { + ++fmt; + return; + } + --parens; + } + else if(c == traits_type::syntax_open_bracket) + ++parens; + else if(c == traits_type::syntax_slash) + { + ++fmt; + if(*fmt == 0) + return; + } + ++fmt; + } +} + +#ifdef BOOST_RE_NO_OI_ASSIGN + +// +// ugly hack for buggy output iterators + +template +inline void oi_assign(T* p, T v) +{ + jm_destroy(p); + jm_construct(p, v); +} + +#else + +template +inline void oi_assign(T* p, T v) +{ + // + // if you get a compile time error in here then you either + // need to rewrite your output iterator to make it assignable + // (as is required by the standard), or define BOOST_RE_NO_OI_ASSIGN + // to use the ugly hack above + *p = v; +} + +#endif + + +#if defined(BOOST_RE_NO_TEMPLATE_SWITCH_MERGE) && !defined(BOOST_RE_NO_NAMESPACES) +// +// Ugly ugly hack, +// template don't merge if they contain switch statements so declare these +// templates in unnamed namespace (ie with internal linkage), each translation +// unit then gets its own local copy, it works seemlessly but bloats the app. +namespace{ +#endif + +// +// algorithm reg_format: +// takes the result of a match and a format string +// and merges them to produce a new string which +// is sent to an OutputIterator, +// _reg_format_aux does the actual work: +// +template +OutputIterator BOOST_RE_CALL _reg_format_aux(OutputIterator out, + const match_results& m, + const charT*& fmt, + unsigned flags, const traits_type& traits_inst) +{ + const charT* fmt_end = fmt; + while(*fmt_end) ++ fmt_end; + + typedef typename traits_type::size_type traits_size_type; + typedef typename traits_type::uchar_type traits_uchar_type; + typedef typename traits_type::string_type traits_string_type; + + while(*fmt) + { + switch(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*fmt))) + { + case traits_type::syntax_dollar: + if(flags & format_sed) + { + // no perl style replacement, + // $ is an ordinary character: + goto default_opt; + } + ++fmt; + if(*fmt == 0) // oops trailing $ + { + --fmt; + *out = *fmt; + ++out; + return out; + } + switch(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*fmt))) + { + case traits_type::syntax_start_buffer: + oi_assign(&out, re_copy_out(out, iterator(m[-1].first), iterator(m[-1].second))); + ++fmt; + continue; + case traits_type::syntax_end_buffer: + oi_assign(&out, re_copy_out(out, iterator(m[-2].first), iterator(m[-2].second))); + ++fmt; + continue; + case traits_type::syntax_digit: + { +expand_sub: + unsigned int index = traits_inst.toi(fmt, fmt_end, 10); + oi_assign(&out, re_copy_out(out, iterator(m[index].first), iterator(m[index].second))); + continue; + } + } + // anything else: + if(*fmt == '&') + { + oi_assign(&out, re_copy_out(out, iterator(m[0].first), iterator(m[0].second))); + ++fmt; + } + else + { + // probably an error, treat as a literal '$' + --fmt; + *out = *fmt; + ++out; + ++fmt; + } + continue; + case traits_type::syntax_slash: + { + // escape sequence: + ++fmt; + charT c(*fmt); + if(*fmt == 0) + { + --fmt; + *out = *fmt; + ++out; + ++fmt; + return out; + } + switch(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*fmt))) + { + case traits_type::syntax_a: + c = '\a'; + ++fmt; + break; + case traits_type::syntax_f: + c = '\f'; + ++fmt; + break; + case traits_type::syntax_n: + c = '\n'; + ++fmt; + break; + case traits_type::syntax_r: + c = '\r'; + ++fmt; + break; + case traits_type::syntax_t: + c = '\t'; + ++fmt; + break; + case traits_type::syntax_v: + c = '\v'; + ++fmt; + break; + case traits_type::syntax_x: + ++fmt; + if(fmt == fmt_end) + { + *out = *--fmt; + ++out; + return out; + } + // maybe have \x{ddd} + if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*fmt)) == traits_type::syntax_open_brace) + { + ++fmt; + if(fmt == fmt_end) + { + fmt -= 2; + *out = *fmt; + ++out; + ++fmt; + continue; + } + if(traits_inst.is_class(*fmt, traits_type::char_class_xdigit) == false) + { + fmt -= 2; + *out = *fmt; + ++out; + ++fmt; + continue; + } + c = (charT)traits_inst.toi(fmt, fmt_end, -16); + if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*fmt)) != traits_type::syntax_close_brace) + { + while(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*fmt)) != traits_type::syntax_slash) + --fmt; + ++fmt; + *out = *fmt; + ++out; + ++fmt; + continue; + } + ++fmt; + break; + } + else + { + if(traits_inst.is_class(*fmt, traits_type::char_class_xdigit) == false) + { + --fmt; + *out = *fmt; + ++out; + ++fmt; + continue; + } + c = (charT)traits_inst.toi(fmt, fmt_end, -16); + } + break; + case traits_type::syntax_c: + ++fmt; + if(fmt == fmt_end) + { + --fmt; + *out = *fmt; + ++out; + return out; + } + if(((typename traits_type::uchar_type)(*fmt) < (typename traits_type::uchar_type)'@') + || ((typename traits_type::uchar_type)(*fmt) > (typename traits_type::uchar_type)127) ) + { + --fmt; + *out = *fmt; + ++out; + ++fmt; + break; + } + c = (charT)((typename traits_type::uchar_type)(*fmt) - (typename traits_type::uchar_type)'@'); + ++fmt; + break; + case traits_type::syntax_e: + c = (charT)27; + ++fmt; + break; + case traits_type::syntax_digit: + if(flags & format_sed) + goto expand_sub; + else + c = (charT)traits_inst.toi(fmt, fmt_end, -8); + break; + default: + //c = *fmt; + ++fmt; + } + *out = c; + ++out; + continue; + } + case traits_type::syntax_open_bracket: + if(flags & (format_sed|format_perl)) + { + *out = *fmt; + ++out; + ++fmt; + continue; + } + else + { + ++fmt; // recurse + oi_assign(&out, _reg_format_aux(out, m, fmt, flags, traits_inst)); + continue; + } + case traits_type::syntax_close_bracket: + if(flags & (format_sed|format_perl)) + { + *out = *fmt; + ++out; + ++fmt; + continue; + } + else + { + ++fmt; // return from recursion + return out; + } + case traits_type::syntax_colon: + if(flags & format_is_if) + { + ++fmt; + return out; + } + *out = *fmt; + ++out; + ++fmt; + continue; + case traits_type::syntax_question: + { + if(flags & (format_sed|format_perl)) + { + *out = *fmt; + ++out; + ++fmt; + continue; + } + else + { + ++fmt; + if(*fmt == 0) + { + --fmt; + *out = *fmt; + ++out; + ++fmt; + return out; + } + unsigned int id = traits_inst.toi(fmt, fmt_end, 10); + if(m[id].matched) + { + oi_assign(&out, _reg_format_aux(out, m, fmt, flags | format_is_if, traits_inst)); + if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*(fmt-1))) == traits_type::syntax_colon) + re_skip_format(fmt, traits_inst); + } + else + { + re_skip_format(fmt, traits_inst); + if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*(fmt-1))) == traits_type::syntax_colon) + oi_assign(&out, _reg_format_aux(out, m, fmt, flags | format_is_if, traits_inst)); + } + return out; + } + } + default: +default_opt: + if((flags & format_sed) && (*fmt == '&')) + { + oi_assign(&out, re_copy_out(out, iterator(m[0].first), iterator(m[0].second))); + ++fmt; + continue; + } + *out = *fmt; + ++out; + ++fmt; + } + } + + return out; +} + +#if defined(BOOST_RE_NO_TEMPLATE_SWITCH_MERGE) && !defined(BOOST_RE_NO_NAMESPACES) +} // namespace +#endif + +template +class string_out_iterator +{ + S* out; +public: + string_out_iterator(S& s) : out(&s) {} + string_out_iterator& operator++() { return *this; } + string_out_iterator& operator++(int) { return *this; } + string_out_iterator& operator*() { return *this; } + string_out_iterator& operator=(typename S::value_type v) + { + out->append(1, v); + return *this; + } +}; + +template +class merge_out_predicate +{ + OutputIterator* out; + iterator* last; + const charT* fmt; + unsigned flags; + const traits_type* pt; + +public: + merge_out_predicate(OutputIterator& o, iterator& pi, const charT* f, unsigned format_flags, const traits_type& p) + : out(&o), last(&pi), fmt(f), flags(format_flags), pt(&p){} + + ~merge_out_predicate() {} + bool BOOST_RE_CALL operator()(const boost::match_results& m) + { + const charT* f = fmt; + if(0 == (flags & format_no_copy)) + oi_assign(out, re_copy_out(*out, iterator(m[-1].first), iterator(m[-1].second))); + oi_assign(out, _reg_format_aux(*out, m, f, flags, *pt)); + *last = m[-2].first; + return true; + } +}; + +} // namespace re_detail + +template +OutputIterator regex_format(OutputIterator out, + const match_results& m, + const charT* fmt, + unsigned flags = 0 + ) +{ + regex_traits t; + return re_detail::_reg_format_aux(out, m, fmt, flags, t); +} + +template +OutputIterator regex_format(OutputIterator out, + const match_results& m, + const std::basic_string& fmt, + unsigned flags = 0 + ) +{ + regex_traits t; + const charT* start = fmt.c_str(); + return re_detail::_reg_format_aux(out, m, start, flags, t); +} + +template +std::basic_string regex_format(const match_results& m, const charT* fmt, unsigned flags = 0) +{ + std::basic_string result; + re_detail::string_out_iterator > i(result); + regex_format(i, m, fmt, flags); + return result; +} + +template +std::basic_string regex_format(const match_results& m, const std::basic_string& fmt, unsigned flags = 0) +{ + std::basic_string result; + re_detail::string_out_iterator > i(result); + regex_format(i, m, fmt.c_str(), flags); + return result; +} + +template +OutputIterator regex_merge(OutputIterator out, + iterator first, + iterator last, + const reg_expression& e, + const charT* fmt, + unsigned int flags = match_default) +{ + iterator l = first; + re_detail::merge_out_predicate oi(out, l, fmt, flags, e.get_traits()); + regex_grep(oi, first, last, e, flags); + return (flags & format_no_copy) ? out : re_detail::re_copy_out(out, l, last); +} + +template +inline OutputIterator regex_merge(OutputIterator out, + iterator first, + iterator last, + const reg_expression& e, + const std::basic_string& fmt, + unsigned int flags = match_default) +{ + return regex_merge(out, first, last, e, fmt.c_str(), flags); +} + +template +std::basic_string regex_merge(const std::basic_string& s, + const reg_expression& e, + const charT* fmt, + unsigned int flags = match_default) +{ + std::basic_string result; + re_detail::string_out_iterator > i(result); + regex_merge(i, s.begin(), s.end(), e, fmt, flags); + return result; +} + +template +std::basic_string regex_merge(const std::basic_string& s, + const reg_expression& e, + const std::basic_string& fmt, + unsigned int flags = match_default) +{ + std::basic_string result; + re_detail::string_out_iterator > i(result); + regex_merge(i, s.begin(), s.end(), e, fmt.c_str(), flags); + return result; +} + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + +} // namespace boost + +#endif // BOOST_REGEX_FORMAT_HPP + + + + diff --git a/boost/boost/re_detail/regex_kmp.hpp b/boost/boost/re_detail/regex_kmp.hpp new file mode 100644 index 0000000000..0f70c7dc66 --- /dev/null +++ b/boost/boost/re_detail/regex_kmp.hpp @@ -0,0 +1,118 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE regex_kmp.hpp + * VERSION 3.03 + * DESCRIPTION: Provides Knuth Morris Pratt search operations. + * Note this is an internal header file included + * by regex.hpp, do not include on its own. + */ + +#ifndef BOOST_REGEX_KMP_HPP +#define BOOST_REGEX_KMP_HPP + +#ifdef BOOST_REGEX_CONFIG_HPP +#include +#endif + + +namespace boost{ + namespace re_detail{ + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b -Ve + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b -Ve + #endif +#endif + +template +struct kmp_info +{ + unsigned int size; + unsigned int len; + const charT* pstr; + int kmp_next[1]; +}; + +template +void kmp_free(kmp_info* pinfo, Allocator a) +{ + typedef BOOST_RE_MAYBE_TYPENAME REBIND_TYPE(char, Allocator) atype; + atype(a).deallocate((char*)pinfo, pinfo->size); +} + +template +kmp_info* kmp_compile(iterator first, iterator last, charT, Trans translate, Allocator a) +{ + typedef BOOST_RE_MAYBE_TYPENAME REBIND_TYPE(char, Allocator) atype; + int i, j, m; + i = 0; + BOOST_RE_DISTANCE(first, last, m); + ++m; + unsigned int size = sizeof(kmp_info) + sizeof(int)*m + sizeof(charT)*m; + --m; + // + // allocate struct and fill it in: + // + kmp_info* pinfo = (kmp_info*)atype(a).allocate(size); + pinfo->size = size; + pinfo->len = m; + charT* p = (charT*)((char*)pinfo + sizeof(kmp_info) + sizeof(int)*(m+1)); + pinfo->pstr = p; + while(first != last) + { + *p = translate(*first); + ++first; + ++p; + } + *p = 0; + // + // finally do regular kmp compile: + // + j = pinfo->kmp_next[0] = -1; + while (i < m) + { + while ((j > -1) && (pinfo->pstr[i] != pinfo->pstr[j])) + j = pinfo->kmp_next[j]; + ++i; + ++j; + if (pinfo->pstr[i] == pinfo->pstr[j]) + pinfo->kmp_next[i] = pinfo->kmp_next[j]; + else + pinfo->kmp_next[i] = j; + } + + return pinfo; +} + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + + } // namepsace re_detail +} // namespace boost + +#endif // BOOST_REGEX_KMP_HPP + + + + + diff --git a/boost/boost/re_detail/regex_library_include.hpp b/boost/boost/re_detail/regex_library_include.hpp new file mode 100644 index 0000000000..dbe785662a --- /dev/null +++ b/boost/boost/re_detail/regex_library_include.hpp @@ -0,0 +1,148 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE regex_libary_include.hpp + * VERSION 3.03 + * DESCRIPTION: Automatic library inclusion for Borland/Microsoft compilers. + * Note this is an internal header file included + * by regex.hpp, do not include on its own. + */ + + +#ifndef BOOST_REGEX_LIBRARY_INCLUDE_HPP +#define BOOST_REGEX_LIBRARY_INCLUDE_HPP +#ifndef BOOST_RE_NO_LIB + +#if defined(BOOST_MSVC) && !defined(BOOST_RE_BUILD_DLL) +#ifdef __SGI_STL_PORT + #ifdef _DLL + #if defined(_DEBUG) && defined(__STL_DEBUG) + #pragma comment(lib, "vc6-stlport-re300ddl.lib") + #elif defined(_DEBUG) + #pragma comment(lib, "vc6-stlport-re300dl.lib") + #else // DEBUG + #pragma comment(lib, "vc6-stlport-re300l.lib") + #endif // _DEBUG + #else // _DLL + #ifdef _MT + #if defined(_DEBUG) && defined(__STL_DEBUG) + #pragma comment(lib, "vc6-stlport-re300ddm.lib") + #elif defined(_DEBUG) + #pragma comment(lib, "vc6-stlport-re300dm.lib") + #else //_DEBUG + #pragma comment(lib, "vc6-stlport-re300m.lib") + #endif //_DEBUG + #else //_MT + // STLPort does not support single threaded builds: + #error STLPort does not support single threaded builds + #endif //_MT + #endif //_DLL +#else + #ifdef _DLL + #ifdef _DEBUG + #pragma comment(lib, "vc6-re300dl.lib") + #else // DEBUG + #pragma comment(lib, "vc6-re300l.lib") + #endif // _DEBUG + #else // _DLL + #ifdef _MT + #ifdef _DEBUG + #pragma comment(lib, "vc6-re300dm.lib") + #else //_DEBUG + #pragma comment(lib, "vc6-re300m.lib") + #endif //_DEBUG + #else //_MT + #ifdef _DEBUG + #pragma comment(lib, "vc6-re300d.lib") + #else //_DEBUG + #pragma comment(lib, "vc6-re300.lib") + #endif //_DEBUG + #endif //_MT + #endif //_DLL +#endif // __SGI_STL_PORT +#endif //BOOST_MSVC + + +#if defined(__BORLANDC__) && !defined(BOOST_RE_BUILD_DLL) + + #if __BORLANDC__ < 0x550 + + #ifdef BOOST_RE_USE_VCL + + #ifdef _RTLDLL + #pragma comment(lib, "bcb4re300lv.lib") + #else + #pragma comment(lib, "bcb4re300v.lib") + #endif + + #else // VCL + + #ifdef _RTLDLL + #ifdef __MT__ + #pragma comment(lib, "bcb4re300lm.lib") + #else // __MT__ + #pragma comment(lib, "bcb4re300l.lib") + #endif // __MT__ + #else //_RTLDLL + #ifdef __MT__ + #pragma comment(lib, "bcb4re300m.lib") + #else // __MT__ + #pragma comment(lib, "bcb4re300.lib") + #endif // __MT__ + #endif // _RTLDLL + + #endif // VCL + + #else // C++ Builder 5: + + #ifdef BOOST_RE_USE_VCL + + #ifdef _RTLDLL + #pragma comment(lib, "bcb5re300lv.lib") + #else + #pragma comment(lib, "bcb5re300v.lib") + #endif + + #else // VCL + + #ifdef _RTLDLL + #ifdef __MT__ + #pragma comment(lib, "bcb5re300lm.lib") + #else // __MT__ + #pragma comment(lib, "bcb5re300l.lib") + #endif // __MT__ + #else //_RTLDLL + #ifdef __MT__ + #pragma comment(lib, "bcb5re300m.lib") + #else // __MT__ + #pragma comment(lib, "bcb5re300.lib") + #endif // __MT__ + #endif // _RTLDLL + + #endif // VCL + + #endif + +#endif //__BORLANDC__ + +#endif //BOOST_RE_NO_LIB + +#endif // BOOST_REGEX_LIBRARY_INCLUDE_HPP + + + + diff --git a/boost/boost/re_detail/regex_match.hpp b/boost/boost/re_detail/regex_match.hpp new file mode 100644 index 0000000000..47cbee6634 --- /dev/null +++ b/boost/boost/re_detail/regex_match.hpp @@ -0,0 +1,1819 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE regex_match.hpp + * VERSION 3.03 + * DESCRIPTION: Regular expression matching algorithms. + * Note this is an internal header file included + * by regex.hpp, do not include on its own. + */ + + +#ifndef BOOST_REGEX_MATCH_HPP +#define BOOST_REGEX_MATCH_HPP + + +namespace boost{ + namespace re_detail{ + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b -Ve + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b -Ve + #endif +#endif + +template +iterator BOOST_RE_CALL re_is_set_member(iterator next, + iterator last, + re_set_long* set_, + const reg_expression& e) +{ + const charT* p = (const charT*)(set_+1); + iterator ptr; + unsigned int i; + bool icase = e.flags() & regbase::icase; + + if(next == last) return next; + + typedef typename traits_type::string_type traits_string_type; + const traits_type& traits_inst = e.get_traits(); + + // dwa 9/13/00 suppress incorrect MSVC warning - it claims this is never + // referenced + (void)traits_inst; + + // try and match a single character, could be a multi-character + // collating element... + for(i = 0; i < set_->csingles; ++i) + { + ptr = next; + if(*p == 0) + { + // treat null string as special case: + if(traits_inst.translate(*ptr, icase) != *p) + { + while(*p == 0)++p; + continue; + } + return set_->isnot ? next : (ptr == next) ? ++next : ptr; + } + else + { + while(*p && (ptr != last)) + { + if(traits_inst.translate(*ptr, icase) != *p) + break; + ++p; + ++ptr; + } + + if(*p == 0) // if null we've matched + return set_->isnot ? next : (ptr == next) ? ++next : ptr; + + while(*p)++p; + ++p; // skip null + } + } + + charT col = traits_inst.translate(*next, icase); + + + if(set_->cranges || set_->cequivalents) + { + traits_string_type s2(1, col); + traits_string_type s1; + // + // try and match a range, NB only a single character can match + if(set_->cranges) + { + if(e.flags() & regbase::nocollate) + s1 = s2; + else + traits_inst.transform(s1, s2); + for(i = 0; i < set_->cranges; ++i) + { + if(s1 <= p) + { + while(*p)++p; + ++p; + if(s1 >= p) + return set_->isnot ? next : ++next; + } + else + { + // skip first string + while(*p)++p; + ++p; + } + // skip second string + while(*p)++p; + ++p; + } + } + // + // try and match an equivalence class, NB only a single character can match + if(set_->cequivalents) + { + traits_inst.transform_primary(s1, s2); + for(i = 0; i < set_->cequivalents; ++i) + { + if(s1 == p) + return set_->isnot ? next : ++next; + // skip string + while(*p)++p; + ++p; + } + } + } + if(traits_inst.is_class(col, set_->cclasses) == true) + return set_->isnot ? next : ++next; + return set_->isnot ? ++next : next; +} + +template +class _priv_match_data +{ +public: + typedef BOOST_RE_MAYBE_TYPENAME REBIND_TYPE(int, Allocator) i_alloc; + typedef BOOST_RE_MAYBE_TYPENAME REBIND_TYPE(iterator, Allocator) it_alloc; + + match_results_base temp_match; + // failure stacks: + jstack, Allocator> matches; + jstack prev_pos; + jstack prev_record; + jstack prev_acc; + int* accumulators; + unsigned int caccumulators; + iterator* loop_starts; + + _priv_match_data(const match_results_base&); + + ~_priv_match_data() + { + free(); + } + void free(); + void set_accumulator_size(unsigned int size); + int* get_accumulators() + { + return accumulators; + } + iterator* get_loop_starts() + { + return loop_starts; + } +}; + +template +_priv_match_data::_priv_match_data(const match_results_base& m) + : temp_match(m), matches(64, m.allocator()), prev_pos(64, m.allocator()), prev_record(64, m.allocator()) +{ + accumulators = 0; + caccumulators = 0; + loop_starts = 0; +} + +template +void _priv_match_data::set_accumulator_size(unsigned int size) +{ + if(size > caccumulators) + { + free(); + caccumulators = size; + accumulators = i_alloc(temp_match.allocator()).allocate(caccumulators); + loop_starts = it_alloc(temp_match.allocator()).allocate(caccumulators); + for(unsigned i = 0; i < caccumulators; ++i) + new (loop_starts + i) iterator(); + } +} + +template +void _priv_match_data::free() +{ + if(caccumulators) + { + //REBIND_INSTANCE(int, Allocator, temp_match.allocator()).deallocate(accumulators, caccumulators); + i_alloc temp1(temp_match.allocator()); + temp1.deallocate(accumulators, caccumulators); + for(unsigned i = 0; i < caccumulators; ++i) + jm_destroy(loop_starts + i); + //REBIND_INSTANCE(iterator, Allocator, temp_match.allocator()).deallocate(loop_starts, caccumulators); + it_alloc temp2(temp_match.allocator()); + temp2.deallocate(loop_starts, caccumulators); + } +} + +template +struct access_t : public reg_expression +{ + typedef typename is_byte::width_type width_type; + typedef reg_expression base_type; + typedef charT char_type; + typedef traits traits_type; + typedef Allocator alloc_type; + + static int repeat_count(const base_type& b) + { return base_type::repeat_count(b); } + static unsigned int restart_type(const base_type& b) + { return base_type::restart_type(b); } + static const re_syntax_base* first(const base_type& b) + { return base_type::first(b); } + static const unsigned char* get_map(const base_type& b) + { return base_type::get_map(b); } + static unsigned int leading_length(const base_type& b) + { return base_type::leading_length(b); } + static const kmp_info* get_kmp(const base_type& b) + { return base_type::get_kmp(b); } + static bool can_start(char_type c, const unsigned char* _map, unsigned char mask) + { + return reg_expression::can_start(c, _map, mask, width_type()); + } +}; + + +#if defined(BOOST_RE_NO_TEMPLATE_SWITCH_MERGE) && !defined(BOOST_RE_NO_NAMESPACES) +// +// Ugly ugly hack, +// template don't merge if they contain switch statements so declare these +// templates in unnamed namespace (ie with internal linkage), each translation +// unit then gets its own local copy, it works seemlessly but bloats the app. +namespace{ +#endif + +template +bool query_match_aux(iterator first, + iterator last, + match_results& m, + const reg_expression& e, + unsigned flags, + _priv_match_data& pd, + iterator* restart) +{ + typedef access_t access; + + if(e.flags() & regbase::failbit) + return false; + + typedef typename traits::size_type traits_size_type; + typedef typename traits::uchar_type traits_uchar_type; + typedef typename is_byte::width_type width_type; + + // declare some local aliases to reduce pointer loads + // good optimising compilers should make this unnecessary!! + jstack, Allocator>& matches = pd.matches; + jstack& prev_pos = pd.prev_pos; + jstack& prev_record = pd.prev_record; + jstack& prev_acc = pd.prev_acc; + match_results_base& temp_match = pd.temp_match; + temp_match.set_first(first); + + const re_syntax_base* ptr = access::first(e); + bool match_found = false; + bool have_partial_match = false; + bool need_push_match = (e.mark_count() > 1); + int cur_acc = -1; // no active accumulator + pd.set_accumulator_size(access::repeat_count(e)); + int* accumulators = pd.get_accumulators(); + iterator* start_loop = pd.get_loop_starts(); + int k; // for loops + bool icase = e.flags() & regbase::icase; + *restart = first; + iterator base = first; + const traits& traits_inst = e.get_traits(); + // dwa 9/13/00 suppress incorrect MSVC warning - it claims this is never + // referenced + (void)traits_inst; + + // prepare m for failure: + /* + if((flags & match_init) == 0) + { + m.init_fail(first, last); + } */ + + retry: + + while(first != last) + { + jm_assert(ptr); + switch(ptr->type) + { + case syntax_element_match: + match_jump: + { + // match found, save then fallback in case we missed a + // longer one. + if((flags & match_not_null) && (first == temp_match[0].first)) + goto failure; + temp_match.set_second(first); + m.maybe_assign(temp_match); + match_found = true; + if(((flags & match_any) && ((first == last) || !(flags & match_all))) || ((first == last) && (need_push_match == false))) + { + // either we don't care what we match or we've matched + // the whole string and can't match anything longer. + while(matches.empty() == false) + matches.pop(); + while(prev_pos.empty() == false) + prev_pos.pop(); + while(prev_record.empty() == false) + prev_record.pop(); + while(prev_acc.empty() == false) + prev_acc.pop(); + return true; + } + } + goto failure; + case syntax_element_startmark: + if(((re_brace*)ptr)->index > 0) + temp_match.set_first(first, ((re_brace*)ptr)->index); + ptr = ptr->next.p; + break; + case syntax_element_endmark: + if(((re_brace*)ptr)->index > 0) + temp_match.set_second(first, ((re_brace*)ptr)->index); + ptr = ptr->next.p; + break; + case syntax_element_literal: + { + unsigned int len = ((re_literal*)ptr)->length; + charT* what = (charT*)(((re_literal*)ptr) + 1); + // + // compare string with what we stored in + // our records: + for(unsigned int i = 0; i < len; ++i, ++first) + { + if((first == last) || (traits_inst.translate(*first, icase) != what[i])) + goto failure; + } + ptr = ptr->next.p; + break; + } + case syntax_element_start_line: + outer_line_check: + if(first == temp_match[0].first) + { + // we're at the start of the buffer + if(flags & match_prev_avail) + { + inner_line_check: + // check the previous value even though its before + // the start of our "buffer". + iterator t(first); + --t; + if(traits::is_separator(*t) && !((*t == '\r') && (*first == '\n')) ) + { + ptr = ptr->next.p; + continue; + } + goto failure; + } + if((flags & match_not_bol) == 0) + { + ptr = ptr->next.p; + continue; + } + goto failure; + } + // we're in the middle of the string + goto inner_line_check; + case syntax_element_end_line: + // we're not yet at the end so *first is always valid: + if(traits::is_separator(*first)) + { + if((first != base) || (flags & match_prev_avail)) + { + // check that we're not in the middle of \r\n sequence + iterator t(first); + --t; + if((*t == '\r') && (*first == '\n')) + { + goto failure; + } + } + ptr = ptr->next.p; + continue; + } + goto failure; + case syntax_element_wild: + // anything except possibly NULL or \n: + if(traits::is_separator(*first)) + { + if(flags & match_not_dot_newline) + goto failure; + ptr = ptr->next.p; + ++first; + continue; + } + if(*first == charT(0)) + { + if(flags & match_not_dot_null) + goto failure; + ptr = ptr->next.p; + ++first; + continue; + } + ptr = ptr->next.p; + ++first; + break; + case syntax_element_word_boundary: + { + // prev and this character must be opposites: + bool b = traits_inst.is_class(*first, traits::char_class_word); + if((first == temp_match[0].first) && ((flags & match_prev_avail) == 0)) + { + if(flags & match_not_bow) + b ^= true; + else + b ^= false; + } + else + { + --first; + b ^= traits_inst.is_class(*first, traits::char_class_word); + ++first; + } + if(b) + { + ptr = ptr->next.p; + continue; + } + goto failure; + } + case syntax_element_within_word: + // both prev and this character must be traits::char_class_word: + if(traits_inst.is_class(*first, traits::char_class_word)) + { + bool b; + if((first == temp_match[0].first) && ((flags & match_prev_avail) == 0)) + b = false; + else + { + --first; + b = traits_inst.is_class(*first, traits::char_class_word); + ++first; + } + if(b) + { + ptr = ptr->next.p; + continue; + } + } + goto failure; + case syntax_element_word_start: + if((first == temp_match[0].first) && ((flags & match_prev_avail) == 0)) + { + // start of buffer: + if(flags & match_not_bow) + goto failure; + if(traits_inst.is_class(*first, traits::char_class_word)) + { + ptr = ptr->next.p; + continue; + } + goto failure; + } + // otherwise inside buffer: + if(traits_inst.is_class(*first, traits::char_class_word)) + { + iterator t(first); + --t; + if(traits_inst.is_class(*t, traits::char_class_word) == false) + { + ptr = ptr->next.p; + continue; + } + } + goto failure; // if we fall through to here then we've failed + case syntax_element_word_end: + if((first == temp_match[0].first) && ((flags & match_prev_avail) == 0)) + goto failure; // start of buffer can't be end of word + + // otherwise inside buffer: + if(traits_inst.is_class(*first, traits::char_class_word) == false) + { + iterator t(first); + --t; + if(traits_inst.is_class(*t, traits::char_class_word)) + { + ptr = ptr->next.p; + continue; + } + } + goto failure; // if we fall through to here then we've failed + case syntax_element_buffer_start: + if((first != temp_match[0].first) || (flags & match_not_bob)) + goto failure; + // OK match: + ptr = ptr->next.p; + break; + case syntax_element_buffer_end: + if((first != last) || (flags & match_not_eob)) + goto failure; + // OK match: + ptr = ptr->next.p; + break; + case syntax_element_backref: + { + // compare with what we previously matched: + iterator i = temp_match[((re_brace*)ptr)->index].first; + iterator j = temp_match[((re_brace*)ptr)->index].second; + while(i != j) + { + if((first == last) || (traits_inst.translate(*first, icase) != traits_inst.translate(*i, icase))) + goto failure; + ++i; + ++first; + } + ptr = ptr->next.p; + break; + } + case syntax_element_long_set: + { + // let the traits class do the work: + iterator t = re_is_set_member(first, last, (re_set_long*)ptr, e); + if(t != first) + { + ptr = ptr->next.p; + first = t; + continue; + } + goto failure; + } + case syntax_element_set: + // lookup character in table: + if(((re_set*)ptr)->_map[(traits_uchar_type)traits_inst.translate(*first, icase)]) + { + ptr = ptr->next.p; + ++first; + continue; + } + goto failure; + case syntax_element_jump: + ptr = ((re_jump*)ptr)->alt.p; + continue; + case syntax_element_alt: + { + // alt_jump: + if(access::can_start(*first, ((re_jump*)ptr)->_map, (unsigned char)mask_take)) + { + // we can take the first alternative, + // see if we need to push next alternative: + if(access::can_start(*first, ((re_jump*)ptr)->_map, mask_skip)) + { + if(need_push_match) + matches.push(temp_match); + for(k = 0; k <= cur_acc; ++k) + prev_pos.push(start_loop[k]); + prev_pos.push(first); + prev_record.push(ptr); + for(k = 0; k <= cur_acc; ++k) + prev_acc.push(accumulators[k]); + prev_acc.push(cur_acc); + } + ptr = ptr->next.p; + continue; + } + if(access::can_start(*first, ((re_jump*)ptr)->_map, mask_skip)) + { + ptr = ((re_jump*)ptr)->alt.p; + continue; + } + goto failure; // neither option is possible + } + case syntax_element_rep: + { + // repeater_jump: + // if we're moving to a higher id (nested repeats etc) + // zero out our accumualtors: + if(cur_acc < ((re_repeat*)ptr)->id) + { + cur_acc = ((re_repeat*)ptr)->id; + accumulators[cur_acc] = 0; + start_loop[cur_acc] = first; + } + + cur_acc = ((re_repeat*)ptr)->id; + + if(((re_repeat*)ptr)->leading) + *restart = first; + + //charT c = traits_inst.translate(*first); + + // first of all test for special case where this is last element, + // if that is the case then repeat as many times as possible, + // as long as the repeat is greedy: + + if((((re_repeat*)ptr)->alt.p->type == syntax_element_match) + && (((re_repeat*)ptr)->greedy == true)) + { + // see if we can take the repeat: + if(((unsigned int)accumulators[cur_acc] < ((re_repeat*)ptr)->max) + && access::can_start(*first, ((re_repeat*)ptr)->_map, mask_take)) + { + // push terminating match as fallback: + if((unsigned int)accumulators[cur_acc] >= ((re_repeat*)ptr)->min) + { + if((prev_record.empty() == false) && (prev_record.peek() == ((re_repeat*)ptr)->alt.p)) + { + // we already have the required fallback + // don't add any more, just update this one: + if(need_push_match) + matches.peek() = temp_match; + prev_pos.peek() = first; + } + else + { + if(need_push_match) + matches.push(temp_match); + prev_pos.push(first); + prev_record.push(((re_repeat*)ptr)->alt.p); + } + } + // move to next item in list: + if((first != start_loop[cur_acc]) || !accumulators[cur_acc]) + { + ++accumulators[cur_acc]; + ptr = ptr->next.p; + start_loop[cur_acc] = first; + continue; + } + goto failure; + } + // see if we can skip the repeat: + if(((unsigned int)accumulators[cur_acc] >= ((re_repeat*)ptr)->min) + && access::can_start(*first, ((re_repeat*)ptr)->_map, mask_skip)) + { + ptr = ((re_repeat*)ptr)->alt.p; + continue; + } + // otherwise fail: + goto failure; + } + + // OK if we get to here then the repeat is either non-terminal or non-greedy, + // see if we can skip the repeat: + if(((unsigned int)accumulators[cur_acc] >= ((re_repeat*)ptr)->min) + && access::can_start(*first, ((re_repeat*)ptr)->_map, mask_skip)) + { + // see if we can push failure info: + if(((unsigned int)accumulators[cur_acc] < ((re_repeat*)ptr)->max) + && access::can_start(*first, ((re_repeat*)ptr)->_map, mask_take)) + { + // check to see if the last loop matched a NULL string + // if so then we really don't want to loop again: + if(((unsigned int)accumulators[cur_acc] == ((re_repeat*)ptr)->min) + || (first != start_loop[cur_acc])) + { + if(need_push_match) + matches.push(temp_match); + prev_pos.push(first); + prev_record.push(ptr); + for(k = 0; k <= cur_acc; ++k) + prev_acc.push(accumulators[k]); + // for non-greedy repeats save whether we have a match already: + if(((re_repeat*)ptr)->greedy == false) + { + prev_acc.push(match_found); + match_found = false; + } + } + } + ptr = ((re_repeat*)ptr)->alt.p; + continue; + } + + // otherwise see if we can take the repeat: + if(((unsigned int)accumulators[cur_acc] < ((re_repeat*)ptr)->max) + && access::can_start(*first, ((re_repeat*)ptr)->_map, mask_take) && + ((first != start_loop[cur_acc]) || !accumulators[cur_acc])) + { + // move to next item in list: + ++accumulators[cur_acc]; + ptr = ptr->next.p; + start_loop[cur_acc] = first; + continue; + } + + // if we get here then neither option is allowed so fail: + goto failure; + + } + case syntax_element_combining: + if(traits_inst.is_combining(traits_inst.translate(*first, icase))) + goto failure; + ++first; + while((first != last) && traits_inst.is_combining(traits_inst.translate(*first, icase)))++first; + ptr = ptr->next.p; + continue; + case syntax_element_soft_buffer_end: + { + if(flags & match_not_eob) + goto failure; + iterator p(first); + while((p != last) && traits_inst.is_separator(traits_inst.translate(*first, icase)))++p; + if(p != last) + goto failure; + ptr = ptr->next.p; + continue; + } + case syntax_element_restart_continue: + if(first != temp_match[-1].first) + goto failure; + ptr = ptr->next.p; + continue; + default: + jm_assert(0); // should never get to here!! + return false; + } + } + + // + // if we get to here then we've run out of characters to match against, + // we could however still have non-character regex items left + if((ptr->can_be_null == 0) && ((flags & match_partial) == 0)) + goto failure; + while(true) + { + jm_assert(ptr); + switch(ptr->type) + { + case syntax_element_match: + goto match_jump; + case syntax_element_startmark: + temp_match.set_first(first, ((re_brace*)ptr)->index); + ptr = ptr->next.p; + break; + case syntax_element_endmark: + temp_match.set_second(first, ((re_brace*)ptr)->index); + ptr = ptr->next.p; + break; + case syntax_element_start_line: + goto outer_line_check; + case syntax_element_end_line: + // we're at the end so *first is never valid: + if((flags & match_not_eol) == 0) + { + ptr = ptr->next.p; + continue; + } + goto failure; + case syntax_element_word_boundary: + case syntax_element_word_end: + if(((flags & match_not_eow) == 0) && (first != temp_match[0].first)) + { + iterator t(first); + --t; + if(traits_inst.is_class(*t, traits::char_class_word)) + { + ptr = ptr->next.p; + continue; + } + } + goto failure; + case syntax_element_buffer_end: + case syntax_element_soft_buffer_end: + if(flags & match_not_eob) + goto failure; + // OK match: + ptr = ptr->next.p; + break; + case syntax_element_jump: + ptr = ((re_jump*)ptr)->alt.p; + continue; + case syntax_element_alt: + if(ptr->can_be_null & mask_take) + { + // we can test the first alternative, + // see if we need to push next alternative: + if(ptr->can_be_null & mask_skip) + { + if(need_push_match) + matches.push(temp_match); + for(k = 0; k <= cur_acc; ++k) + prev_pos.push(start_loop[k]); + prev_pos.push(first); + prev_record.push(ptr); + for(k = 0; k <= cur_acc; ++k) + prev_acc.push(accumulators[k]); + prev_acc.push(cur_acc); + } + ptr = ptr->next.p; + continue; + } + if(ptr->can_be_null & mask_skip) + { + ptr = ((re_jump*)ptr)->alt.p; + continue; + } + goto failure; // neither option is possible + case syntax_element_rep: + // if we're moving to a higher id (nested repeats etc) + // zero out our accumualtors: + if(cur_acc < ((re_repeat*)ptr)->id) + { + cur_acc = ((re_repeat*)ptr)->id; + accumulators[cur_acc] = 0; + start_loop[cur_acc] = first; + } + + cur_acc = ((re_repeat*)ptr)->id; + + // see if we can skip the repeat: + if(((unsigned int)accumulators[cur_acc] >= ((re_repeat*)ptr)->min) + && ((ptr->can_be_null & mask_skip) || (flags & match_partial))) + { + // don't push failure info, there's no point: + ptr = ((re_repeat*)ptr)->alt.p; + continue; + } + + // otherwise see if we can take the repeat: + if(((unsigned int)accumulators[cur_acc] < ((re_repeat*)ptr)->max) + && (((ptr->can_be_null & (mask_take | mask_skip)) == (mask_take | mask_skip))) || (flags & match_partial)) + { + // move to next item in list: + ++accumulators[cur_acc]; + ptr = ptr->next.p; + start_loop[cur_acc] = first; + continue; + } + + // if we get here then neither option is allowed so fail: + goto failure; + case syntax_element_restart_continue: + if(first != temp_match[-1].first) + goto failure; + ptr = ptr->next.p; + continue; + default: + goto failure; + } + } + + failure: + + // + // check for possible partial match: + // + if((flags & match_partial) + && !match_found // no full match already + && (base != first) // some charcters have been consumed + && (first == last)) // end of input has been reached + { + have_partial_match = true; + m.maybe_assign(temp_match); + } + + if(prev_record.empty() == false) + { + ptr = prev_record.peek(); + switch(ptr->type) + { + case syntax_element_alt: + // get next alternative: + ptr = ((re_jump*)ptr)->alt.p; + if(need_push_match) + matches.pop(temp_match); + prev_acc.pop(cur_acc); + for(k = cur_acc; k >= 0; --k) + prev_acc.pop(accumulators[k]); + prev_pos.pop(first); + for(k = cur_acc; k >= 0; --k) + prev_pos.pop(start_loop[k]); + prev_record.pop(); + goto retry; + case syntax_element_rep: + { + // we're doing least number of repeats first, + // increment count and repeat again: + bool saved_matched = match_found; + if(need_push_match) + matches.pop(temp_match); + prev_pos.pop(first); + cur_acc = ((re_repeat*)ptr)->id; + if(((re_repeat*)ptr)->greedy == false) + { + saved_matched = prev_acc.peek(); + prev_acc.pop(); + } + for(k = cur_acc; k >= 0; --k) + prev_acc.pop(accumulators[k]); + prev_record.pop(); + if((unsigned int)++accumulators[cur_acc] > ((re_repeat*)ptr)->max) + goto failure; // repetions exhausted. + // + // if the repeat is non-greedy, and we found a match then fail again: + if((((re_repeat*)ptr)->greedy == false) && (match_found == true)) + { + goto failure; + } + else if (match_found == false) + match_found = saved_matched; + ptr = ptr->next.p; + start_loop[cur_acc] = first; + goto retry; + } + case syntax_element_match: + if(need_push_match) + matches.pop(temp_match); + prev_pos.pop(first); + prev_record.pop(); + goto retry; + default: + jm_assert(0); + // mustn't get here!! + } + } + + if(match_found || have_partial_match) + return true; + + // if we get to here then everything has failed + // and no match was found: + return false; +} +#if defined(BOOST_RE_NO_TEMPLATE_SWITCH_MERGE) && !defined(BOOST_RE_NO_NAMESPACES) +} // namespace +#endif + + +template +void _skip_and_inc(unsigned int& clines, iterator& last_line, iterator& first, const iterator last) +{ + while(first != last) + { + if(*first == '\n') + { + last_line = ++first; + ++clines; + } + else + ++first; + } +} + +template +void _skip_and_dec(unsigned int& clines, iterator& last_line, iterator& first, iterator base, unsigned int len) +{ + bool need_line = false; + for(unsigned int i = 0; i < len; ++i) + { + --first; + if(*first == '\n') + { + need_line = true; + --clines; + } + } + + if(need_line) + { + last_line = first; + + if(last_line != base) + --last_line; + else + return; + + while((last_line != base) && (*last_line != '\n')) + --last_line; + if(*last_line == '\n') + ++last_line; + } +} + +template +inline void _inc_one(unsigned int& clines, iterator& last_line, iterator& first) +{ + if(*first == '\n') + { + last_line = ++first; + ++clines; + } + else + ++first; +} + +template +struct grep_search_predicate +{ + match_results* pm; + grep_search_predicate(match_results* p) : pm(p) {} + bool operator()(const match_results& m) + { + *pm = static_cast&>(m); + return false; + } +}; + +#if !defined(BOOST_RE_NO_TEMPLATE_RETURNS) && !defined(BOOST_RE_NO_PARTIAL_FUNC_SPEC) + +template +inline const match_results_base& grep_out_type(const grep_search_predicate& o, const Allocator&) +{ + return *(o.pm); +} + +#endif + +template +inline const Allocator& grep_out_type(const T&, const Allocator& a) +{ + return a; +} + +#if defined(BOOST_RE_NO_TEMPLATE_SWITCH_MERGE) && !defined(BOOST_RE_NO_NAMESPACES) +// +// Ugly ugly hack, +// template don't merge if they contain switch statements so declare these +// templates in unnamed namespace (ie with internal linkage), each translation +// unit then gets its own local copy, it works seemlessly but bloats the app. +namespace{ +#endif + +// +// reg_grep2: +// find all non-overlapping matches within the sequence first last: +// +template +unsigned int reg_grep2(Predicate foo, I first, I last, const reg_expression& e, unsigned flags, A2 a) +{ + typedef access_t access; + + if(e.flags() & regbase::failbit) + return 0; + + typedef typename traits::size_type traits_size_type; + typedef typename traits::uchar_type traits_uchar_type; + typedef typename is_byte::width_type width_type; + + match_results m(grep_out_type(foo, a)); + I restart; + m.set_size(e.mark_count(), first, last); + m.set_line(1, first); + m.set_base(first); + + unsigned int clines = 1; + unsigned int cmatches = 0; + I last_line = first; + I next_base; + I base = first; + bool need_init; + const traits& traits_inst = e.get_traits(); + // dwa 9/13/00 suppress incorrect MSVC warning - it claims this is never + // referenced + (void)traits_inst; + + flags |= match_init; + + _priv_match_data pd(m); + + const unsigned char* _map = access::get_map(e); + unsigned int type; + + if(first == last) + { + // special case, only test if can_be_null, + // don't dereference any pointers!! + if(access::first(e)->can_be_null) + { + if(query_match_aux(first, last, m, e, flags, pd, &restart)) + { + foo(m); + ++cmatches; + } + } + return cmatches; + } + + // try one time whatever: + if( access::can_start(*first, _map, (unsigned char)mask_any) ) + { + if(query_match_aux(first, last, m, e, flags, pd, &restart)) + { + ++cmatches; + if(foo(m) == false) + return cmatches; + // update to end of what matched + // trying to match again with match_not_null set if this + // is a null match... + need_init = true; + if(first == m[0].second) + { + next_base = m[0].second; + pd.temp_match.init_fail(next_base, last); + m.init_fail(next_base, last); + if(query_match_aux(first, last, m, e, flags | match_not_null, pd, &restart)) + { + ++cmatches; + if(foo(m) == false) + return cmatches; + } + else + { + need_init = false; + for(unsigned int i = 0; (restart != first) && (i < access::leading_length(e)); ++i, --restart) + {} // dwa 10/20/2000 - warning suppression for MWCW + if(restart != last) + ++restart; + _skip_and_inc(clines, last_line, first, restart); + } + } + if(need_init) + { + _skip_and_inc(clines, last_line, first, m[0].second); + next_base = m[0].second; + pd.temp_match.init_fail(next_base, last); + m.init_fail(next_base, last); + } + } + else + { + for(unsigned int i = 0; (restart != first) && (i < access::leading_length(e)); ++i, --restart) + {} // dwa 10/20/2000 - warning suppression for MWCW + if(restart != last) + ++restart; + _skip_and_inc(clines, last_line, first, restart); + } + } + else + _inc_one(clines, last_line, first); + flags |= match_prev_avail | match_not_bob; + + + // depending on what the first record is we may be able to + // optimise the search: + type = (flags & match_continuous) ? regbase::restart_continue : access::restart_type(e); + + if(type == regbase::restart_buf) + return cmatches; + + switch(type) + { + case regbase::restart_lit: + case regbase::restart_fixed_lit: + { + const kmp_info* info = access::get_kmp(e); + int len = info->len; + const charT* x = info->pstr; + int j = 0; + bool icase = e.flags() & regbase::icase; + while (first != last) + { + while((j > -1) && (x[j] != traits_inst.translate(*first, icase))) + j = info->kmp_next[j]; + _inc_one(clines, last_line, first); + ++j; + if(j >= len) + { + if(type == regbase::restart_fixed_lit) + { + _skip_and_dec(clines, last_line, first, base, j); + restart = first; + restart += len; + m.set_first(first); + m.set_second(restart); + m.set_line(clines, last_line); + ++cmatches; + if(foo(m) == false) + return cmatches; + _skip_and_inc(clines, last_line, first, restart); + next_base = m[0].second; + pd.temp_match.init_fail(next_base, last); + m.init_fail(next_base, last); + j = 0; + } + else + { + restart = first; + _skip_and_dec(clines, last_line, first, base, j); + if(query_match_aux(first, last, m, e, flags, pd, &restart)) + { + + m.set_line(clines, last_line); + ++cmatches; + if(foo(m) == false) + return cmatches; + // update to end of what matched + _skip_and_inc(clines, last_line, first, m[0].second); + next_base = m[0].second; + pd.temp_match.init_fail(next_base, last); + m.init_fail(next_base, last); + j = 0; + } + else + { + for(int k = 0; (restart != first) && (k < j); ++k, --restart) + {} // dwa 10/20/2000 - warning suppression for MWCW + if(restart != last) + ++restart; + _skip_and_inc(clines, last_line, first, restart); + j = 0; //we could do better than this... + } + } + } + } + break; + } + case regbase::restart_any: + { + while(first != last) + { + if( access::can_start(*first, _map, (unsigned char)mask_any) ) + { + if(query_match_aux(first, last, m, e, flags, pd, &restart)) + { + + m.set_line(clines, last_line); + ++cmatches; + if(foo(m) == false) + return cmatches; + // update to end of what matched + // trying to match again with match_not_null set if this + // is a null match... + need_init = true; + if(first == m[0].second) + { + next_base = m[0].second; + pd.temp_match.init_fail(next_base, last); + m.init_fail(next_base, last); + if(query_match_aux(first, last, m, e, flags | match_not_null, pd, &restart)) + { + m.set_line(clines, last_line); + ++cmatches; + if(foo(m) == false) + return cmatches; + } + else + { + need_init = false; + for(unsigned int i = 0; (restart != first) && (i < access::leading_length(e)); ++i, --restart) + {} // dwa 10/20/2000 - warning suppression for MWCW + if(restart != last) + ++restart; + _skip_and_inc(clines, last_line, first, restart); + } + } + if(need_init) + { + _skip_and_inc(clines, last_line, first, m[0].second); + next_base = m[0].second; + pd.temp_match.init_fail(next_base, last); + m.init_fail(next_base, last); + } + continue; + } + else + { + for(unsigned int i = 0; (restart != first) && (i < access::leading_length(e)); ++i, --restart) + {} // dwa 10/20/2000 - warning suppression for MWCW + if(restart != last) + ++restart; + _skip_and_inc(clines, last_line, first, restart); + } + } + else + _inc_one(clines, last_line, first); + } + } + break; + case regbase::restart_word: + { + // do search optimised for word starts: + while(first != last) + { + --first; + if(*first == '\n') + --clines; + // skip the word characters: + while((first != last) && traits_inst.is_class(*first, traits::char_class_word)) + ++first; + // now skip the white space: + while((first != last) && (traits_inst.is_class(*first, traits::char_class_word) == false)) + { + #ifdef __GNUC__ + // + // hack to work around gcc optimisation bug + // just expand the contents of _inc_one here: + if(*first == '\n') + { + last_line = ++first; + ++clines; + } + else + ++first; + #else + _inc_one(clines, last_line, first); + #endif + } + if(first == last) + break; + + if( access::can_start(*first, _map, (unsigned char)mask_any) ) + { + if(query_match_aux(first, last, m, e, flags, pd, &restart)) + { + m.set_line(clines, last_line); + ++cmatches; + if(foo(m) == false) + return cmatches; + // update to end of what matched + // trying to match again with match_not_null set if this + // is a null match... + need_init = true; + if(first == m[0].second) + { + next_base = m[0].second; + pd.temp_match.init_fail(next_base, last); + m.init_fail(next_base, last); + if(query_match_aux(first, last, m, e, flags | match_not_null, pd, &restart)) + { + m.set_line(clines, last_line); + ++cmatches; + if(foo(m) == false) + return cmatches; + } + else + { + need_init = false; + for(unsigned int i = 0; (restart != first) && (i < access::leading_length(e)); ++i, --restart) + {} // dwa 10/20/2000 - warning suppression for MWCW + if(restart != last) + ++restart; + _skip_and_inc(clines, last_line, first, restart); + } + } + if(need_init) + { + _skip_and_inc(clines, last_line, first, m[0].second); + next_base = m[0].second; + pd.temp_match.init_fail(next_base, last); + m.init_fail(next_base, last); + } + } + else + { + for(unsigned int i = 0; (restart != first) && (i < access::leading_length(e)); ++i, --restart) + {} // dwa 10/20/2000 - warning suppression for MWCW + if(restart != last) + ++restart; + _skip_and_inc(clines, last_line, first, restart); + } + } + else + _inc_one(clines, last_line, first); + } + } + break; + case regbase::restart_line: + { + // do search optimised for line starts: + while(first != last) + { + // find first charcter after a line break: + --first; + if(*first == '\n') + --clines; + while((first != last) && (*first != '\n')) + ++first; + if(first == last) + break; + ++first; + if(first == last) + break; + + ++clines; + last_line = first; + + if( access::can_start(*first, _map, (unsigned char)mask_any) ) + { + if(query_match_aux(first, last, m, e, flags, pd, &restart)) + { + m.set_line(clines, last_line); + ++cmatches; + if(foo(m) == false) + return cmatches; + // update to end of what matched + // trying to match again with match_not_null set if this + // is a null match... + need_init = true; + if(first == m[0].second) + { + next_base = m[0].second; + pd.temp_match.init_fail(next_base, last); + m.init_fail(next_base, last); + if(query_match_aux(first, last, m, e, flags | match_not_null, pd, &restart)) + { + m.set_line(clines, last_line); + ++cmatches; + if(foo(m) == false) + return cmatches; + } + else + { + need_init = false; + for(unsigned int i = 0; (restart != first) && (i < access::leading_length(e)); ++i, --restart) + {} // dwa 10/20/2000 - warning suppression for MWCW + if(restart != last) + ++restart; + _skip_and_inc(clines, last_line, first, restart); + } + } + if(need_init) + { + _skip_and_inc(clines, last_line, first, m[0].second); + next_base = m[0].second; + pd.temp_match.init_fail(next_base, last); + m.init_fail(next_base, last); + } + } + else + { + for(unsigned int i = 0; (restart != first) && (i < access::leading_length(e)); ++i, --restart) + {} // dwa 10/20/2000 - warning suppression for MWCW + if(restart != last) + ++restart; + _skip_and_inc(clines, last_line, first, restart); + } + } + else + _inc_one(clines, last_line, first); + } + } + break; + case regbase::restart_continue: + { + while(first != last) + { + if( access::can_start(*first, _map, (unsigned char)mask_any) ) + { + if(query_match_aux(first, last, m, e, flags, pd, &restart)) + { + m.set_line(clines, last_line); + ++cmatches; + if(foo(m) == false) + return cmatches; + // update to end of what matched + // trying to match again with match_not_null set if this + // is a null match... + if(first == m[0].second) + { + next_base = m[0].second; + pd.temp_match.init_fail(next_base, last); + m.init_fail(next_base, last); + if(query_match_aux(first, last, m, e, flags | match_not_null, pd, &restart)) + { + m.set_line(clines, last_line); + ++cmatches; + if(foo(m) == false) + return cmatches; + } + else + return cmatches; // can't continue from null match + } + _skip_and_inc(clines, last_line, first, m[0].second); + next_base = m[0].second; + pd.temp_match.init_fail(next_base, last); + m.init_fail(next_base, last); + continue; + } + } + return cmatches; + } + } + break; + } + + + // finally check trailing null string: + if(access::first(e)->can_be_null) + { + if(query_match_aux(first, last, m, e, flags, pd, &restart)) + { + m.set_line(clines, last_line); + ++cmatches; + if(foo(m) == false) + return cmatches; + } + } + + return cmatches; +} +#if defined(BOOST_RE_NO_TEMPLATE_SWITCH_MERGE) && !defined(BOOST_RE_NO_NAMESPACES) +} // namespace {anon} +#endif + +} // namespace re_detail + +// +// proc regex_match +// returns true if the specified regular expression matches +// the whole of the input. Fills in what matched in m. +// +template +bool regex_match(iterator first, iterator last, match_results& m, const reg_expression& e, unsigned flags = match_default) +{ + // prepare m for failure: + if((flags & match_init) == 0) + { + m.set_size(e.mark_count(), first, last); + m.set_base(first); + m.set_line(1, first); + } + flags |= match_all; // must match all of input. + re_detail::_priv_match_data pd(m); + iterator restart; + bool result = re_detail::query_match_aux(first, last, m, e, flags, pd, &restart); + if(result && (last == m[0].second)) + return true; + return false; +} +template +bool regex_match(iterator first, iterator last, const reg_expression& e, unsigned flags = match_default) +{ + match_results m; + return regex_match(first, last, m, e, flags); +} +// +// query_match convenience interfaces: +#ifndef BOOST_RE_NO_PARTIAL_FUNC_SPEC +// +// this isn't really a partial specialisation, but template function +// overloading - if the compiler doesn't support partial specialisation +// then it really won't support this either: +template +inline bool regex_match(const charT* str, + match_results& m, + const reg_expression& e, + unsigned flags = match_default) +{ + return regex_match(str, str + traits::length(str), m, e, flags); +} + +template +inline bool regex_match(const std::basic_string& s, + match_results::const_iterator, Allocator>& m, + const reg_expression& e, + unsigned flags = match_default) +{ + return regex_match(s.begin(), s.end(), m, e, flags); +} +template +inline bool regex_match(const charT* str, + const reg_expression& e, + unsigned flags = match_default) +{ + match_results m; + return regex_match(str, str + traits::length(str), m, e, flags); +} + +template +inline bool regex_match(const std::basic_string& s, + const reg_expression& e, + unsigned flags = match_default) +{ + typedef typename std::basic_string::const_iterator iterator; + match_results m; + return regex_match(s.begin(), s.end(), m, e, flags); +} +#else // partial ordering +inline bool regex_match(const char* str, + cmatch& m, + const regex& e, + unsigned flags = match_default) +{ + return regex_match(str, str + regex::traits_type::length(str), m, e, flags); +} +inline bool regex_match(const char* str, + const regex& e, + unsigned flags = match_default) +{ + match_results m; + return regex_match(str, str + regex::traits_type::length(str), m, e, flags); +} +#ifndef BOOST_RE_NO_WCSTRING +inline bool regex_match(const wchar_t* str, + wcmatch& m, + const wregex& e, + unsigned flags = match_default) +{ + return regex_match(str, str + wregex::traits_type::length(str), m, e, flags); +} +inline bool regex_match(const wchar_t* str, + const wregex& e, + unsigned flags = match_default) +{ + match_results m; + return regex_match(str, str + wregex::traits_type::length(str), m, e, flags); +} +#endif +inline bool regex_match(const std::string& s, + match_results& m, + const regex& e, + unsigned flags = match_default) +{ + return regex_match(s.begin(), s.end(), m, e, flags); +} +inline bool regex_match(const std::string& s, + const regex& e, + unsigned flags = match_default) +{ + match_results m; + return regex_match(s.begin(), s.end(), m, e, flags); +} +#if !defined(BOOST_RE_NO_WCSTRING) +inline bool regex_match(const std::basic_string& s, + match_results::const_iterator, wregex::allocator_type>& m, + const wregex& e, + unsigned flags = match_default) +{ + return regex_match(s.begin(), s.end(), m, e, flags); +} +inline bool regex_match(const std::basic_string& s, + const wregex& e, + unsigned flags = match_default) +{ + match_results::const_iterator, wregex::allocator_type> m; + return regex_match(s.begin(), s.end(), m, e, flags); +} +#endif + +#endif + +template +bool regex_search(iterator first, iterator last, match_results& m, const reg_expression& e, unsigned flags = match_default) +{ + if(e.flags() & regbase::failbit) + return false; + + typedef typename traits::size_type traits_size_type; + typedef typename traits::uchar_type traits_uchar_type; + + return re_detail::reg_grep2(re_detail::grep_search_predicate(&m), first, last, e, flags, m.allocator()); +} + +// +// regex_search convenience interfaces: +#ifndef BOOST_RE_NO_PARTIAL_FUNC_SPEC +// +// this isn't really a partial specialisation, but template function +// overloading - if the compiler doesn't support partial specialisation +// then it really won't support this either: +template +inline bool regex_search(const charT* str, + match_results& m, + const reg_expression& e, + unsigned flags = match_default) +{ + return regex_search(str, str + traits::length(str), m, e, flags); +} + +template +inline bool regex_search(const std::basic_string& s, + match_results::const_iterator, Allocator>& m, + const reg_expression& e, + unsigned flags = match_default) +{ + return regex_search(s.begin(), s.end(), m, e, flags); +} +#else // partial specialisation +inline bool regex_search(const char* str, + cmatch& m, + const regex& e, + unsigned flags = match_default) +{ + return regex_search(str, str + regex::traits_type::length(str), m, e, flags); +} +#ifndef BOOST_RE_NO_WCSTRING +inline bool regex_search(const wchar_t* str, + wcmatch& m, + const wregex& e, + unsigned flags = match_default) +{ + return regex_search(str, str + wregex::traits_type::length(str), m, e, flags); +} +#endif +inline bool regex_search(const std::string& s, + match_results& m, + const regex& e, + unsigned flags = match_default) +{ + return regex_search(s.begin(), s.end(), m, e, flags); +} +#if !defined(BOOST_RE_NO_WCSTRING) +inline bool regex_search(const std::basic_string& s, + match_results::const_iterator, wregex::allocator_type>& m, + const wregex& e, + unsigned flags = match_default) +{ + return regex_search(s.begin(), s.end(), m, e, flags); +} +#endif + +#endif + + +// +// regex_grep: +// find all non-overlapping matches within the sequence first last: +// +template +inline unsigned int regex_grep(Predicate foo, iterator first, iterator last, const reg_expression& e, unsigned flags = match_default) +{ + return re_detail::reg_grep2(foo, first, last, e, flags, e.allocator()); +} + +// +// regex_grep convenience interfaces: +#ifndef BOOST_RE_NO_PARTIAL_FUNC_SPEC +// +// this isn't really a partial specialisation, but template function +// overloading - if the compiler doesn't support partial specialisation +// then it really won't support this either: +template +inline unsigned int regex_grep(Predicate foo, const charT* str, + const reg_expression& e, + unsigned flags = match_default) +{ + return regex_grep(foo, str, str + traits::length(str), e, flags); +} + +template +inline unsigned int regex_grep(Predicate foo, const std::basic_string& s, + const reg_expression& e, + unsigned flags = match_default) +{ + return regex_grep(foo, s.begin(), s.end(), e, flags); +} +#else // partial specialisation +inline unsigned int regex_grep(bool (*foo)(const cmatch&), const char* str, + const regex& e, + unsigned flags = match_default) +{ + return regex_grep(foo, str, str + regex::traits_type::length(str), e, flags); +} +#ifndef BOOST_RE_NO_WCSTRING +inline unsigned int regex_grep(bool (*foo)(const wcmatch&), const wchar_t* str, + const wregex& e, + unsigned flags = match_default) +{ + return regex_grep(foo, str, str + wregex::traits_type::length(str), e, flags); +} +#endif +inline unsigned int regex_grep(bool (*foo)(const match_results&), const std::string& s, + const regex& e, + unsigned flags = match_default) +{ + return regex_grep(foo, s.begin(), s.end(), e, flags); +} +#if !defined(BOOST_RE_NO_WCSTRING) +inline unsigned int regex_grep(bool (*foo)(const match_results::const_iterator, wregex::allocator_type>&), + const std::basic_string& s, + const wregex& e, + unsigned flags = match_default) +{ + return regex_grep(foo, s.begin(), s.end(), e, flags); +} +#endif + +#endif + + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + +} // namespace boost + +#endif // BOOST_REGEX_MATCH_HPP + + + + + + + + + + + diff --git a/boost/boost/re_detail/regex_options.hpp b/boost/boost/re_detail/regex_options.hpp new file mode 100644 index 0000000000..615a215bc3 --- /dev/null +++ b/boost/boost/re_detail/regex_options.hpp @@ -0,0 +1,467 @@ + +#ifndef BOOST_RE_OPT_H +#define BOOST_RE_OPT_H + +/* #define BOOST_RE_AUTO_CONFIGURE */ +#ifdef BOOST_RE_AUTO_CONFIGURE + +/* Compiler options: */ + +/* BOOST_NO_STDC_NAMESPACE C library not in namespace std */ +/* #define BOOST_NO_STDC_NAMESPACE */ + +/* BOOST_RE_NO_MUTABLE Disables use of mutable keyword. */ +/* #define BOOST_RE_NO_MUTABLE */ + +/* BOOST_RE_INT32_LONG If 32-bit integers are long */ +/* #define BOOST_RE_INT32_LONG */ + +/* BOOST_RE_NO_TEMPLATE_FRIEND If template friend declarations are not supported */ +/* #define BOOST_RE_NO_TEMPLATE_FRIEND */ + +/* BOOST_RE_PLATFORM_WINDOWS Platform is MS Windows. */ +/* #define BOOST_RE_PLATFORM_WINDOWS */ + +/* BOOST_RE_PLATFORM_DOS Platform if MSDOS. */ +/* #define BOOST_RE_PLATFORM_DOS */ + +/* BOOST_RE_PLATFORM_W32 Platform is MS Win32 */ +/* #define BOOST_RE_PLATFORM_W32 */ + +/* BOOST_RE_NO_W32 Disable Win32 support even when present */ +/* #define BOOST_RE_NO_W32 */ + +/* BOOST_RE_NO_BOOL If bool is not a distict type. */ +/* #define BOOST_RE_NO_BOOL */ + +/* BOOST_RE_NO_WCHAR_H If there is no */ +/* #define BOOST_RE_NO_WCHAR_H */ + +/* BOOST_RE_NO_WCTYPE_H If there is no */ +/* #define BOOST_RE_NO_WCTYPE_H */ + +/* BOOST_RE_NO_WCSTRING If there are no wcslen and wcsncmp functions available. */ +/* #define BOOST_RE_NO_WCSTRING */ + +/* BOOST_RE_NO_SWPRINTF If there is no swprintf available. */ +/* #define BOOST_RE_NO_SWPRINTF */ + +/* BOOST_RE_NO_WSPRINTF If there is no wsprintf available. */ +/* #define BOOST_RE_NO_WSPRINTF */ + +/* BOOST_RE_NO_MEMBER_TEMPLATES If member function templates or nested template classes are not allowed. */ +/* #define BOOST_RE_NO_MEMBER_TEMPLATES */ + +/* BOOST_RE_NO_TEMPLATE_RETURNS If template functions based on return type are not supported. */ +/* #define BOOST_RE_NO_TEMPLATE_RETURNS */ + +/* BOOST_RE_NO_PARTIAL_FUNC_SPEC If partial template function specialisation is not supported */ +/* #define BOOST_RE_NO_PARTIAL_FUNC_SPEC */ + +/* BOOST_RE_NO_INT64 If 64bit integers are not supported. */ +/* BOOST_RE_INT64t The type of a 64-bit signed integer if available. */ +/* BOOST_RE_IMM64(val) Declares a 64-bit immediate value by appending any + necessary suffix to val. */ +/* BOOST_RE_INT64_T 0 = NA + 1 = short + 2 = int + 3 = long + 4 = int64_t + 5 = long long + 6 = __int64 */ +/* #define BOOST_RE_INT64_T_0 */ +/* #define BOOST_RE_INT64_T_1 */ +/* #define BOOST_RE_INT64_T_2 */ +/* #define BOOST_RE_INT64_T_3 */ +/* #define BOOST_RE_INT64_T_4 */ +/* #define BOOST_RE_INT64_T_5 */ +/* #define BOOST_RE_INT64_T_6 */ + +/* BOOST_RE_NO_CAT Define if the compiler does not support POSIX style + message categories (catopen catgets catclose). */ +/* #define BOOST_RE_NO_CAT */ + +/* BOOST_RE_THREADS Define if the compiler supports multiple threads in + the current translation mode. */ +/* #define BOOST_RE_THREADS */ + +/* BOOST_RE_NESTED_TEMPLATE_DECL Defaults to template, the standard prefix when accessing + nested template classes, can be redefined to nothing if + the compiler does not support this. */ +/* #define BOOST_RE_NESTED_TEMPLATE_DECL */ + +/* BOOST_RE_NO_TEMPLATE_INST If explicit template instantiation with the "template class X" + syntax is not supported */ +/* #define BOOST_RE_NO_TEMPLATE_INST */ + +/* BOOST_RE_NO_TEMPLATE_MERGE If template in separate translation units don't merge at link time */ +/* #define BOOST_RE_NO_TEMPLATE_MERGE */ + +/* BOOST_RE_NO_TEMPLATE_MERGE_A If template merging from library archives is not supported */ +/* #define BOOST_RE_NO_TEMPLATE_MERGE_A */ + +/* BOOST_RE_NO_TEMPLATE_SWITCH_MERGE If merging of templates containing switch statements is not supported */ +/* #define BOOST_RE_NO_TEMPLATE_SWITCH_MERGE */ + +/* BOOST_RE_CALL Optionally define a calling convention for C++ functions */ +/* #define BOOST_RE_CALL */ + +/* BOOST_RE_CCALL Optionally define a calling convention for C functions */ +/* #define BOOST_RE_CCALL */ + +/* BOOST_RE_SIZEOF_SHORT sizeof(short) */ +/* #define BOOST_RE_SIZEOF_SHORT */ + +/* BOOST_RE_SIZEOF_INT sizeof(int) */ +/* #define BOOST_RE_SIZEOF_INT */ + +/* BOOST_RE_SIZEOF_LONG sizeof(long) */ +/* #define BOOST_RE_SIZEOF_LONG */ + +/* BOOST_RE_SIZEOF_WCHAR_T sizeof(wchar_t) */ +/* #define BOOST_RE_SIZEOF_WCHAR_T */ + + +/* STL options: */ + +/* BOOST_RE_NO_EXCEPTION_H Define if you do not a compliant + header file. */ +/* #define BOOST_RE_NO_EXCEPTION_H */ + +/* BOOST_RE_NO_ITERATOR_H Define if you do not have a version of . */ +/* #define BOOST_RE_NO_ITERATOR_H */ + +/* BOOST_RE_NO_MEMORY_H Define if does not fully comply with the + latest standard, and is not auto-recognised, + that means nested template classes + which hardly any compilers support at present. */ +/* #define BOOST_RE_NO_MEMORY_H */ + +/* BOOST_RE_NO_LOCALE_H Define if there is no verion of the standard + header available. */ +/* #define BOOST_RE_NO_LOCALE_H */ + +/* BOOST_RE_NO_STL Disables the use of any supporting STL code. */ +/* #define BOOST_RE_NO_STL */ + +/* BOOST_RE_NO_NOT_EQUAL Disables the generation of operator!= if this + clashes with the STL version. */ + +/* BOOST_RE_NO_STRING_DEF_ARGS Define if std::basic_string not allowed - in + other words if the template is missing its required + default arguments. */ +/* #define BOOST_RE_NO_STRING_DEF_ARGS */ + +/* BOOST_RE_USE_ALGO If not is present */ +/* #define BOOST_RE_USE_ALGO */ + +/* BOOST_RE_OLD_IOSTREAM If the new iostreamm classes are not available */ +/* #define BOOST_RE_OLD_IOSTREAM */ + +/* BOOST_RE_DISTANCE_T For std::distance: + 0 = NA + 1 = std::distance(i, j, n) + 2 = n = std::distance(i, j) */ +/* #define BOOST_RE_DISTANCE_T_0 */ +/* #define BOOST_RE_DISTANCE_T_1 */ +/* #define BOOST_RE_DISTANCE_T_2 */ + +/* BOOST_RE_ITERATOR_T Defines generic standard iterator type if available, use this as + a shortcut to define all the other iterator types. + 1 = std::iterator + 2 = std::iterator */ +/* #define BOOST_RE_ITERATOR_T_0 */ +/* #define BOOST_RE_ITERATOR_T_1 */ +/* #define BOOST_RE_ITERATOR_T_2 */ + +/* BOOST_RE_OI_T For output iterators: + 0 = NA + 1 = std::iterator + 2 = std::iterator + 3 = std::output_iterator */ +/* #define BOOST_RE_OI_T_0 */ +/* #define BOOST_RE_OI_T_1 */ +/* #define BOOST_RE_OI_T_2 */ +/* #define BOOST_RE_OI_T_3 */ + +/* BOOST_RE_II_T For input iterators: + 0 = NA + 1 = std::iterator + 2 = std::iterator + 3 = std::input_iterator + 4 = std::input_iterator */ +/* #define BOOST_RE_II_T_0 */ +/* #define BOOST_RE_II_T_1 */ +/* #define BOOST_RE_II_T_2 */ +/* #define BOOST_RE_II_T_3 */ +/* #define BOOST_RE_II_T_4 */ + + +/* BOOST_RE_FI_T For forward iterators: + 0 = NA + 1 = std::iterator + 2 = std::iterator + 3 = std::forward_iterator */ +/* #define BOOST_RE_FI_T_0 */ +/* #define BOOST_RE_FI_T_1 */ +/* #define BOOST_RE_FI_T_2 */ +/* #define BOOST_RE_FI_T_3 */ + +/* BOOST_RE_BI_T For bidirectional iterators: + 0 = NA + 1 = std::iterator + 2 = std::iterator + 3 = std::bidirectional_iterator */ +/* #define BOOST_RE_BI_T_0 */ +/* #define BOOST_RE_BI_T_1 */ +/* #define BOOST_RE_BI_T_2 */ +/* #define BOOST_RE_BI_T_3 */ + +/* BOOST_RE_RI_T For random access iterators: + 0 = NA + 1 = std::iterator + 2 = std::iterator + 3 = std::random_access_iterator */ +/* #define BOOST_RE_RI_T_0 */ +/* #define BOOST_RE_RI_T_1 */ +/* #define BOOST_RE_RI_T_2 */ +/* #define BOOST_RE_RI_T_3 */ + +/* BOOST_RE_NO_OI_ASSIGN If output iterators ostream_iterator<>, back_insert_iterator<> and + front_insert_iterator<> do not have assignment operators */ +/* #define BOOST_RE_NO_OI_ASSIGN */ + + +#ifdef BOOST_RE_INT64_T_0 +#define BOOST_RE_NO_INT64 +#elif defined(BOOST_RE_INT64_T_1) +#define BOOST_RE_INT64t short +#define BOOST_RE_IMM64(val) val +#elif defined(BOOST_RE_INT64_T_2) +#define BOOST_RE_INT64t int +#define BOOST_RE_IMM64(val) val +#elif defined(BOOST_RE_INT64_T_3) +#define BOOST_RE_INT64t long +#define BOOST_RE_IMM64(val) val##L +#elif defined(BOOST_RE_INT64_T_4) +#define BOOST_RE_INT64t int64_t +#define BOOST_RE_IMM64(val) INT64_C(val) +#elif defined(BOOST_RE_INT64_T_5) +#define BOOST_RE_INT64t long long +#define BOOST_RE_IMM64(val) val##LL +#elif defined(BOOST_RE_INT64_T_6) +#define BOOST_RE_INT64t __int64 +#define BOOST_RE_IMM64(val) val##i64 +#else +syntax error: unknown value for BOOST_RE_INT64_T +#endif + +#ifdef BOOST_RE_DISTANCE_T_0 +# define BOOST_RE_DISTANCE(i, j, n) n = j - i +#elif defined(BOOST_RE_DISTANCE_T_1) +# define BOOST_RE_DISTANCE(i, j, n) n = std::distance(i, j) +#elif defined(BOOST_RE_DISTANCE_T_2) +# define BOOST_RE_DISTANCE(i, j, n) (n = 0, std::distance(i, j, n)) +#else +syntax erorr +#endif + +#ifdef BOOST_RE_ITERATOR_T_0 +#ifndef BOOST_RE_OI_T_0 +#define BOOST_RE_OI_T_0 BOOST_RE_ITERATOR_T_0 +#endif +#ifndef BOOST_RE_II_T_0 +#define BOOST_RE_II_T_0 BOOST_RE_ITERATOR_T_0 +#endif +#ifndef BOOST_RE_FI_T_0 +#define BOOST_RE_FI_T_0 BOOST_RE_ITERATOR_T_0 +#endif +#ifndef BOOST_RE_BI_T_0 +#define BOOST_RE_BI_T_0 BOOST_RE_ITERATOR_T_0 +#endif +#ifndef BOOST_RE_RI_T_0 +#define BOOST_RE_RI_T_0 BOOST_RE_ITERATOR_T_0 +#endif +#endif + +#ifdef BOOST_RE_ITERATOR_T_1 +#ifndef BOOST_RE_OI_T_1 +#define BOOST_RE_OI_T_1 BOOST_RE_ITERATOR_T_1 +#endif +#ifndef BOOST_RE_II_T_1 +#define BOOST_RE_II_T_1 BOOST_RE_ITERATOR_T_1 +#endif +#ifndef BOOST_RE_FI_T_1 +#define BOOST_RE_FI_T_1 BOOST_RE_ITERATOR_T_1 +#endif +#ifndef BOOST_RE_BI_T_1 +#define BOOST_RE_BI_T_1 BOOST_RE_ITERATOR_T_1 +#endif +#ifndef BOOST_RE_RI_T_1 +#define BOOST_RE_RI_T_1 BOOST_RE_ITERATOR_T_1 +#endif +#endif + +#ifdef BOOST_RE_ITERATOR_T_2 +#ifndef BOOST_RE_OI_T_2 +#define BOOST_RE_OI_T_2 BOOST_RE_ITERATOR_T_2 +#endif +#ifndef BOOST_RE_II_T_2 +#define BOOST_RE_II_T_2 BOOST_RE_ITERATOR_T_2 +#endif +#ifndef BOOST_RE_FI_T_2 +#define BOOST_RE_FI_T_2 BOOST_RE_ITERATOR_T_2 +#endif +#ifndef BOOST_RE_BI_T_2 +#define BOOST_RE_BI_T_2 BOOST_RE_ITERATOR_T_2 +#endif +#ifndef BOOST_RE_RI_T_2 +#define BOOST_RE_RI_T_2 BOOST_RE_ITERATOR_T_2 +#endif +#endif + +#ifdef BOOST_RE_ITERATOR_T_3 +#ifndef BOOST_RE_OI_T_3 +#define BOOST_RE_OI_T_3 BOOST_RE_ITERATOR_T_3 +#endif +#ifndef BOOST_RE_II_T_3 +#define BOOST_RE_II_T_3 BOOST_RE_ITERATOR_T_3 +#endif +#ifndef BOOST_RE_FI_T_3 +#define BOOST_RE_FI_T_3 BOOST_RE_ITERATOR_T_3 +#endif +#ifndef BOOST_RE_BI_T_3 +#define BOOST_RE_BI_T_3 BOOST_RE_ITERATOR_T_3 +#endif +#ifndef BOOST_RE_RI_T_3 +#define BOOST_RE_RI_T_3 BOOST_RE_ITERATOR_T_3 +#endif +#endif + +#ifdef BOOST_RE_ITERATOR_T_4 +#ifndef BOOST_RE_OI_T_4 +#define BOOST_RE_OI_T_4 BOOST_RE_ITERATOR_T_4 +#endif +#ifndef BOOST_RE_II_T_4 +#define BOOST_RE_II_T_4 BOOST_RE_ITERATOR_T_4 +#endif +#ifndef BOOST_RE_FI_T_4 +#define BOOST_RE_FI_T_4 BOOST_RE_ITERATOR_T_4 +#endif +#ifndef BOOST_RE_BI_T_4 +#define BOOST_RE_BI_T_4 BOOST_RE_ITERATOR_T_4 +#endif +#ifndef BOOST_RE_RI_T_4 +#define BOOST_RE_RI_T_4 BOOST_RE_ITERATOR_T_4 +#endif +#endif + +#ifdef BOOST_RE_OI_T_0 +# define BOOST_RE_OUTPUT_ITERATOR(T, D) boost::re_detail::dummy_iterator_base +#elif defined(BOOST_RE_OI_T_1) +# define BOOST_RE_OUTPUT_ITERATOR(T, D) std::iterator +#elif defined(BOOST_RE_OI_T_2) +# define BOOST_RE_OUTPUT_ITERATOR(T, D) std::iterator +#elif defined(BOOST_RE_OI_T_3) +# define BOOST_RE_OUTPUT_ITERATOR(T, D) std::output_iterator +#else +syntax error +#endif + +#ifdef BOOST_RE_II_T_0 +# define BOOST_RE_INPUT_ITERATOR(T, D) boost::re_detail::dummy_iterator_base +#elif defined(BOOST_RE_II_T_1) +#define BOOST_RE_INPUT_ITERATOR(T, D) std::iterator +#elif defined(BOOST_RE_II_T_2) +#define BOOST_RE_INPUT_ITERATOR(T, D) std::iterator +#elif defined(BOOST_RE_II_T_3) +# define BOOST_RE_INPUT_ITERATOR(T, D) std::input_iterator +#elif defined(BOOST_RE_II_T_4) +# define BOOST_RE_INPUT_ITERATOR(T, D) std::input_iterator +#else +syntax error +#endif + +#ifdef BOOST_RE_FI_T_0 +# define BOOST_RE_FWD_ITERATOR(T, D) boost::re_detail::dummy_iterator_base +#elif defined(BOOST_RE_FI_T_1) +# define BOOST_RE_FWD_ITERATOR(T, D) std::iterator +#elif defined(BOOST_RE_FI_T_2) +# define BOOST_RE_FWD_ITERATOR(T, D) std::iterator +#elif defined(BOOST_RE_FI_T_3) +# define BOOST_RE_FWD_ITERATOR(T, D) std::forward_iterator +#else +syntax error +#endif + +#ifdef BOOST_RE_BI_T_0 +# define BOOST_RE_BIDI_ITERATOR(T, D) boost::re_detail::dummy_iterator_base +#elif defined(BOOST_RE_BI_T_1) +# define BOOST_RE_BIDI_ITERATOR(T, D) std::iterator +#elif defined(BOOST_RE_BI_T_2) +# define BOOST_RE_BIDI_ITERATOR(T, D) std::iterator +#elif defined(BOOST_RE_BI_T_3) +# define BOOST_RE_BIDI_ITERATOR(T, D) std::bidirectional_iterator +#else +syntax error +#endif + +#ifdef BOOST_RE_RI_T_0 +# define BOOST_RE_RA_ITERATOR(T, D) boost::re_detail::dummy_iterator_base +#elif defined(BOOST_RE_RI_T_1) +# define BOOST_RE_RA_ITERATOR(T, D) std::iterator +#elif defined(BOOST_RE_RI_T_2) +# define BOOST_RE_RA_ITERATOR(T, D) std::iterator +#elif defined(BOOST_RE_RI_T_3) +# define BOOST_RE_RA_ITERATOR(T, D) std::random_access_iterator +#else +syntax error +#endif + + +#ifndef BOOST_RE_NO_EXCEPTION_H +#include +#endif + +#ifndef BOOST_RE_NO_ITERATOR_H +#include +#ifdef BOOST_RE_USE_ALGO +#include +#else +#include +#endif +#endif + +#if defined(BOOST_RE_NO_MEMORY_H) || defined(__GNUC__) + #define BOOST_RE_OLD_ALLOCATORS + #define REBIND_INSTANCE(x, y, inst) re_alloc_binder(inst) + #define REBIND_TYPE(x, y) re_alloc_binder + #define BOOST_RE_DEF_ALLOC_PARAM(x) BOOST_RE_DEFAULT_PARAM( boost::re_detail::jm_def_alloc ) + #define BOOST_RE_DEF_ALLOC(x) boost::re_detail::jm_def_alloc + + #define BOOST_RE_NEED_BINDER + #define BOOST_RE_NEED_ALLOC +#else +#include + #define REBIND_INSTANCE(x, y, inst) y::BOOST_RE_NESTED_TEMPLATE_DECL rebind::other(inst) + #define REBIND_TYPE(x, y) y::BOOST_RE_NESTED_TEMPLATE_DECL rebind::other + #define BOOST_RE_DEF_ALLOC_PARAM(x) BOOST_RE_TRICKY_DEFAULT_PARAM( std::allocator ) + #define BOOST_RE_DEF_ALLOC(x) std::allocator +#endif + + +#endif // BOOST_RE_AUTO_CONFIGURE + + +#endif /* BOOST_RE_OPT_H */ + + + + + + + + + + + diff --git a/boost/boost/re_detail/regex_raw_buffer.hpp b/boost/boost/re_detail/regex_raw_buffer.hpp new file mode 100644 index 0000000000..9df15aed71 --- /dev/null +++ b/boost/boost/re_detail/regex_raw_buffer.hpp @@ -0,0 +1,251 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE regex_raw_buffer.hpp + * VERSION 3.03 + * DESCRIPTION: Raw character buffer for regex code. + * Note this is an internal header file included + * by regex.hpp, do not include on its own. + */ + +#ifndef BOOST_REGEX_RAW_BUFFER_HPP +#define BOOST_REGEX_RAW_BUFFER_HPP + +#ifndef BOOST_REGEX_CONFIG_HPP +#include +#endif + +namespace boost{ + namespace re_detail{ + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b -Ve + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b -Ve + #endif +#endif + +struct empty_padding{}; + +union padding +{ + void* p; + unsigned int i; +}; + +template +struct padding3 +{ + enum{ + padding_size = 8, + padding_mask = 7 + }; +}; + +template<> +struct padding3<2> +{ + enum{ + padding_size = 2, + padding_mask = 1 + }; +}; + +template<> +struct padding3<4> +{ + enum{ + padding_size = 4, + padding_mask = 3 + }; +}; + +template<> +struct padding3<8> +{ + enum{ + padding_size = 8, + padding_mask = 7 + }; +}; + +template<> +struct padding3<16> +{ + enum{ + padding_size = 16, + padding_mask = 15 + }; +}; + +enum{ + padding_size = padding3::padding_size, + padding_mask = padding3::padding_mask +}; + +// +// class raw_storage +// basically this is a simplified vector +// this is used by reg_expression for expression storage +// + +template +class raw_storage +{ +public: + typedef Allocator allocator_type; + typedef typename REBIND_TYPE(unsigned char, allocator_type)::size_type size_type; + typedef BOOST_RE_MAYBE_TYPENAME REBIND_TYPE(unsigned char, allocator_type) alloc_inst_type; + typedef typename REBIND_TYPE(unsigned char, allocator_type)::pointer pointer; +private: + // + // empty member optimisation: + struct alloc_data : public alloc_inst_type + { + typename alloc_inst_type::pointer last; + alloc_data(const Allocator& a) : alloc_inst_type(a){} + } alloc_inst; + pointer start, end; +public: + + raw_storage(const Allocator& a = Allocator()); + raw_storage(size_type n, const Allocator& a = Allocator()); + + ~raw_storage() + { + alloc_inst.deallocate(start, (alloc_inst.last - start)); + } + + void BOOST_RE_CALL resize(size_type n); + + void* BOOST_RE_CALL extend(size_type n) + { + if(size_type(alloc_inst.last - end) < n) + resize(n + (end - start)); + register void* result = end; + end += n; + return result; + } + + void* BOOST_RE_CALL insert(size_type pos, size_type n); + + size_type BOOST_RE_CALL size() + { + return end - start; + } + + size_type BOOST_RE_CALL capacity() + { + return alloc_inst.last - start; + } + + void* BOOST_RE_CALL data()const + { + return start; + } + + size_type BOOST_RE_CALL index(void* ptr) + { + return (unsigned char*)ptr - (unsigned char*)data(); + } + + void BOOST_RE_CALL clear() + { + end = start; + } + + void BOOST_RE_CALL align() + { + // move end up to a boundary: + end = (unsigned char*)start + ((((unsigned char*)end - (unsigned char*)start) + padding_mask) & ~padding_mask); + } + + Allocator BOOST_RE_CALL allocator()const; +}; + +template +CONSTRUCTOR_INLINE raw_storage::raw_storage(const Allocator& a) + : alloc_inst(a) +{ + start = end = alloc_inst.allocate(1024); + alloc_inst.last = start + 1024; +} + +template +CONSTRUCTOR_INLINE raw_storage::raw_storage(size_type n, const Allocator& a) + : alloc_inst(a) +{ + start = end = alloc_inst.allocate(n); + alloc_inst.last = start + n; +} + +template +Allocator BOOST_RE_CALL raw_storage::allocator()const +{ + return alloc_inst; +} + +template +void BOOST_RE_CALL raw_storage::resize(size_type n) +{ + register size_type newsize = (alloc_inst.last - start) * 2; + register size_type datasize = end - start; + if(newsize < n) + newsize = n; + // extend newsize to WORD/DWORD boundary: + newsize = (newsize + padding_mask) & ~(padding_mask); + + // allocate and copy data: + register unsigned char* ptr = alloc_inst.allocate(newsize); + std::memcpy(ptr, start, datasize); + + // get rid of old buffer: + alloc_inst.deallocate(start, (alloc_inst.last - start)); + + // and set up pointers: + start = ptr; + end = ptr + datasize; + alloc_inst.last = ptr + newsize; +} + +template +void* BOOST_RE_CALL raw_storage::insert(size_type pos, size_type n) +{ + jm_assert(pos <= size_type(end - start)); + if(size_type(alloc_inst.last - end) < n) + resize(n + (end - start)); + register void* result = start + pos; + std::memmove(start + pos + n, start + pos, (end - start) - pos); + end += n; + return result; +} + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + +} // namespace re_detail +} // namespace boost + +#endif + + + + diff --git a/boost/boost/re_detail/regex_split.hpp b/boost/boost/re_detail/regex_split.hpp new file mode 100644 index 0000000000..72d5be071f --- /dev/null +++ b/boost/boost/re_detail/regex_split.hpp @@ -0,0 +1,155 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE regex_split.hpp + * VERSION 3.03 + * DESCRIPTION: Implements regex_split and associated functions. + * Note this is an internal header file included + * by regex.hpp, do not include on its own. + */ + +#ifndef BOOST_REGEX_SPLIT_HPP +#define BOOST_REGEX_SPLIT_HPP + +namespace boost{ + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b -Ve + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b -Ve + #endif +#endif + +namespace re_detail{ + +template +const reg_expression& get_default_expression(charT) +{ + static const charT expression_text[] = { '\\', 's', '+', '\00', }; + static const reg_expression e(expression_text); + return e; +} + +template +class split_pred +{ + typedef std::basic_string string_type; + typedef typename string_type::const_iterator iterator_type; + iterator_type* p_last; + OutputIterator* p_out; + std::size_t* p_max; + std::size_t initial_max; +public: + split_pred(iterator_type* a, OutputIterator* b, std::size_t* c) + : p_last(a), p_out(b), p_max(c), initial_max(*c) {} + + bool operator()(const match_results& what); +}; + +template +bool split_pred::operator() + (const match_results& what) +{ + *p_last = what[0].second; + if(what.size() > 1) + { + // output sub-expressions only: + for(unsigned i = 1; i < what.size(); ++i) + { + *(*p_out) = static_cast(what[i]); + ++(*p_out); + return --*p_max; + } + } + else + { + // output $` only if it's not-null or not at the start of the input: + const sub_match& sub = what[-1]; + if((sub.first != sub.second) || (*p_max != initial_max)) + { + *(*p_out) = static_cast(sub); + ++(*p_out); + return --*p_max; + } + } + // + // initial null, do nothing: + return true; +} + +} // namespace re_detail + +template +std::size_t regex_split(OutputIterator out, + std::basic_string& s, + const reg_expression& e, + unsigned flags, + std::size_t max_split) +{ + typedef typename std::basic_string::const_iterator ci_t; + ci_t last = s.begin(); + std::size_t init_size = max_split; + re_detail::split_pred pred(&last, &out, &max_split); + ci_t i, j; + i = s.begin(); + j = s.end(); + regex_grep(pred, i, j, e, flags); + // + // if there is still input left, do a final push as long as max_split + // is not exhausted, and we're not splitting sub-expressions rather + // than whitespace: + if(max_split && (last != s.end()) && (e.mark_count() == 1)) + { + *out = std::basic_string((ci_t)last, (ci_t)s.end()); + ++out; + last = s.end(); + --max_split; + } + // + // delete from the string everything that has been processed so far: + s.erase(0, last - s.begin()); + // + // return the number of new records pushed: + return init_size - max_split; +} + +template +inline std::size_t regex_split(OutputIterator out, + std::basic_string& s, + const reg_expression& e, + unsigned flags = match_default) +{ + return regex_split(out, s, e, flags, UINT_MAX); +} + +template +inline std::size_t regex_split(OutputIterator out, + std::basic_string& s) +{ + return regex_split(out, s, re_detail::get_default_expression(charT(0)), match_default, UINT_MAX); +} + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + +} // namespace boost + +#endif diff --git a/boost/boost/re_detail/regex_stack.hpp b/boost/boost/re_detail/regex_stack.hpp new file mode 100644 index 0000000000..9cf8b8e31a --- /dev/null +++ b/boost/boost/re_detail/regex_stack.hpp @@ -0,0 +1,229 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE regex_stack.hpp + * VERSION 3.03 + * DESCRIPTION: Implements customised internal regex stacks. + * Note this is an internal header file included + * by regex.hpp, do not include on its own. + */ + +#ifndef BOOST_REGEX_STACK_HPP +#define BOOST_REGEX_STACK_HPP + +#ifndef BOOST_REGEX_CONFIG_HPP +#include +#endif +#ifndef BOOST_REGEX_RAW_BUFFER_HPP +#include +#endif + +namespace boost{ + namespace re_detail{ + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b -Ve + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b -Ve + #endif +#endif + +// +// class jstack +// simplified stack optimised for push/peek/pop +// operations, we could use std::stack> instead... +// +template +class jstack +{ +private: + typedef BOOST_RE_MAYBE_TYPENAME REBIND_TYPE(unsigned char, Allocator) allocator_type; + typedef typename REBIND_TYPE(T, Allocator)::size_type size_type; + typedef T value_type; + struct node + { + node* next; + T* start; // first item + T* end; // last item + T* last; // end of storage + }; + + // + // empty base member optimisation: + struct data : public allocator_type + { + padding buf[(sizeof(T) * 16 + sizeof(padding) - 1) / sizeof(padding)]; + data(const Allocator& a) : allocator_type(a){} + }; + + data alloc_inst; + mutable node* m_stack; + mutable node* unused; + node base; + size_type block_size; + + void BOOST_RE_CALL pop_aux()const; + void BOOST_RE_CALL push_aux(); + +public: + jstack(size_type n = 64, const Allocator& a = Allocator()); + + ~jstack(); + + node* BOOST_RE_CALL get_node() + { + node* new_stack = (node*)alloc_inst.allocate(sizeof(node) + sizeof(T) * block_size); + new_stack->last = (T*)(new_stack+1); + new_stack->start = new_stack->end = new_stack->last + block_size; + new_stack->next = 0; + return new_stack; + } + + bool BOOST_RE_CALL empty() + { + return (m_stack->start == m_stack->end) && (m_stack->next == 0); + } + + bool BOOST_RE_CALL good() + { + return (m_stack->start != m_stack->end) || (m_stack->next != 0); + } + + T& BOOST_RE_CALL peek() + { + if(m_stack->start == m_stack->end) + pop_aux(); + return *m_stack->end; + } + + const T& BOOST_RE_CALL peek()const + { + if(m_stack->start == m_stack->end) + pop_aux(); + return *m_stack->end; + } + + void BOOST_RE_CALL pop() + { + if(m_stack->start == m_stack->end) + pop_aux(); + jm_destroy(m_stack->end); + ++(m_stack->end); + } + + void BOOST_RE_CALL pop(T& t) + { + if(m_stack->start == m_stack->end) + pop_aux(); + t = *m_stack->end; + jm_destroy(m_stack->end); + ++(m_stack->end); + } + + void BOOST_RE_CALL push(const T& t) + { + if(m_stack->end == m_stack->last) + push_aux(); + --(m_stack->end); + jm_construct(m_stack->end, t); + } + +}; + +template +jstack::jstack(size_type n, const Allocator& a) + : alloc_inst(a) +{ + unused = 0; + block_size = n; + m_stack = &base; + base.last = reinterpret_cast(alloc_inst.buf); + base.end = base.start = base.last + 16; + base.next = 0; +} + +template +void BOOST_RE_CALL jstack::push_aux() +{ + // make sure we have spare space on TOS: + register node* new_node; + if(unused) + { + new_node = unused; + unused = new_node->next; + new_node->next = m_stack; + m_stack = new_node; + } + else + { + new_node = get_node(); + new_node->next = m_stack; + m_stack = new_node; + } +} + +template +void BOOST_RE_CALL jstack::pop_aux()const +{ + // make sure that we have a valid item + // on TOS: + jm_assert(m_stack->next); + register node* p = m_stack; + m_stack = p->next; + p->next = unused; + unused = p; +} + +template +jstack::~jstack() +{ + node* condemned; + while(good()) + pop(); + while(unused) + { + condemned = unused; + unused = unused->next; + alloc_inst.deallocate((unsigned char*)condemned, sizeof(node) + sizeof(T) * block_size); + } + while(m_stack != &base) + { + condemned = m_stack; + m_stack = m_stack->next; + alloc_inst.deallocate((unsigned char*)condemned, sizeof(node) + sizeof(T) * block_size); + } +} + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + +} // namespace re_detail +} // namespace boost + +#endif + + + + + + + + diff --git a/boost/boost/re_detail/regex_synch.hpp b/boost/boost/re_detail/regex_synch.hpp new file mode 100644 index 0000000000..f9c611249f --- /dev/null +++ b/boost/boost/re_detail/regex_synch.hpp @@ -0,0 +1,183 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE regex_synch.hpp + * VERSION 3.03 + * DESCRIPTION: Thread synchronisation for regex code. + * Note this is an internal header file included + * by regex.hpp, do not include on its own. + */ + +#ifndef BOOST_REGEX_SYNCH_HPP +#define BOOST_REGEX_SYNCH_HPP + +#ifndef BOOST_REGEX_CONFIG_HPP +#include +#endif + +#if defined(BOOST_RE_PLATFORM_W32) && defined(BOOST_RE_THREADS) +#include +#endif + +#if !defined(BOOST_RE_PLATFORM_W32) && defined(BOOST_RE_THREADS) +#include +#endif + + +namespace boost{ + namespace re_detail{ + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b -Ve + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b -Ve + #endif +#endif + +void BOOST_RE_CALL re_init_threads(); +void BOOST_RE_CALL re_free_threads(); + +#ifdef BOOST_RE_THREADS + +#ifndef BOOST_RE_PLATFORM_W32 + +typedef pthread_mutex_t CRITICAL_SECTION; + +inline void BOOST_RE_CALL InitializeCriticalSection(CRITICAL_SECTION* ps) +{ + pthread_mutex_init(ps, NULL); +} + +inline void BOOST_RE_CALL DeleteCriticalSection(CRITICAL_SECTION* ps) +{ + pthread_mutex_destroy(ps); +} + +inline void BOOST_RE_CALL EnterCriticalSection(CRITICAL_SECTION* ps) +{ + pthread_mutex_lock(ps); +} + +inline void BOOST_RE_CALL LeaveCriticalSection(CRITICAL_SECTION* ps) +{ + pthread_mutex_unlock(ps); +} + +#endif + +template +class lock_guard +{ + typedef Lock lock_type; +public: + lock_guard(lock_type& m, bool aq = true) + : mut(m), owned(false){ acquire(aq); } + + ~lock_guard() + { acquire(false); } + + void BOOST_RE_CALL acquire(bool aq = true) + { + if(aq && !owned) + { + mut.acquire(true); + owned = true; + } + else if(!aq && owned) + { + mut.acquire(false); + owned = false; + } + } +private: + lock_type& mut; + bool owned; + // VC6 warning suppression: + lock_guard& operator=(const lock_guard&); +}; + + +class critical_section +{ +public: + critical_section() + { InitializeCriticalSection(&hmutex);} + + critical_section(const critical_section&) + { InitializeCriticalSection(&hmutex);} + + const critical_section& BOOST_RE_CALL operator=(const critical_section&) + {return *this;} + + ~critical_section() + {DeleteCriticalSection(&hmutex);} + +private: + + void BOOST_RE_CALL acquire(bool aq) + { if(aq) EnterCriticalSection(&hmutex); + else LeaveCriticalSection(&hmutex); + } + + CRITICAL_SECTION hmutex; + +public: + typedef lock_guard ro_guard; + typedef lock_guard rw_guard; + + friend lock_guard; +}; + +inline bool BOOST_RE_CALL operator==(const critical_section&, const critical_section&) +{ + return false; +} + +inline bool BOOST_RE_CALL operator<(const critical_section&, const critical_section&) +{ + return true; +} + +typedef lock_guard cs_guard; + +BOOST_RE_IX_DECL extern critical_section* p_re_lock; +BOOST_RE_IX_DECL extern unsigned int re_lock_count; + +#define BOOST_RE_GUARD(inst) boost::re_detail::critical_section::rw_guard g(inst); + +#else // BOOST_RE_THREADS + +#define BOOST_RE_GUARD(inst) + +#endif // BOOST_RE_THREADS + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + +} // namespace re_detail +} // namespace boost + +#endif // sentry + + + + + diff --git a/boost/boost/regex.h b/boost/boost/regex.h new file mode 100644 index 0000000000..79af8ba852 --- /dev/null +++ b/boost/boost/regex.h @@ -0,0 +1,102 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE regex.h + * VERSION 3.03 + * DESCRIPTION: Declares POSIX API functions + */ + +#ifndef BOOST_RE_REGEX_H +#define BOOST_RE_REGEX_H + +#include + +// +// add using declarations to bring POSIX API functions into +// global scope, only if this is C++ (and not C). +// +#ifdef __cplusplus + +using boost::regoff_t; +using boost::regex_tA; +using boost::regmatch_t; +using boost::REG_BASIC; +using boost::REG_EXTENDED; +using boost::REG_ICASE; +using boost::REG_NOSUB; +using boost::REG_NEWLINE; +using boost::REG_NOSPEC; +using boost::REG_PEND; +using boost::REG_DUMP; +using boost::REG_NOCOLLATE; +using boost::REG_ESCAPE_IN_LISTS; +using boost::REG_NEWLINE_ALT; +using boost::REG_PERL; +using boost::REG_AWK; +using boost::REG_GREP; +using boost::REG_EGREP; +using boost::REG_ASSERT; +using boost::REG_INVARG; +using boost::REG_ATOI; +using boost::REG_ITOA; + +using boost::REG_NOTBOL; +using boost::REG_NOTEOL; +using boost::REG_STARTEND; + +using boost::reg_comp_flags; +using boost::reg_exec_flags; +using boost::regcompA; +using boost::regerrorA; +using boost::regexecA; +using boost::regfreeA; + +#ifndef BOOST_RE_NO_WCSTRING +using boost::regcompW; +using boost::regerrorW; +using boost::regexecW; +using boost::regfreeW; +using boost::regex_tW; +#endif + +using boost::REG_NOERROR; +using boost::REG_NOMATCH; +using boost::REG_BADPAT; +using boost::REG_ECOLLATE; +using boost::REG_ECTYPE; +using boost::REG_EESCAPE; +using boost::REG_ESUBREG; +using boost::REG_EBRACK; +using boost::REG_EPAREN; +using boost::REG_EBRACE; +using boost::REG_BADBR; +using boost::REG_ERANGE; +using boost::REG_ESPACE; +using boost::REG_BADRPT; +using boost::REG_EEND; +using boost::REG_ESIZE; +using boost::REG_ERPAREN; +using boost::REG_EMPTY; +using boost::REG_E_MEMORY; +using boost::REG_E_UNKNOWN; +using boost::reg_errcode_t; + +#endif // __cplusplus + +#endif // BOOST_RE_REGEX_H + + diff --git a/boost/boost/regex.hpp b/boost/boost/regex.hpp new file mode 100644 index 0000000000..070abda84a --- /dev/null +++ b/boost/boost/regex.hpp @@ -0,0 +1,1515 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE regex.cpp + * VERSION 3.03 + * DESCRIPTION: Declares boost::reg_expression<> and associated + * functions and classes. This header is the main + * entry point for the template regex code. + */ + + +/* start with C compatability API */ + +#ifndef BOOST_RE_REGEX_HPP +#define BOOST_RE_REGEX_HPP + +#include + +#ifdef __cplusplus + +// what follows is all C++ don't include in C builds!! + +#ifdef BOOST_RE_DEBUG +# include +#endif + +#include +#include +#if !defined(BOOST_RE_NO_TYPEINFO) +#include +#endif +#include +#include +#include +#include +#include +#include +#include + + +namespace boost{ + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b -Ve + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b -Ve + #endif +#endif + +namespace re_detail{ + +struct re_set_long; +struct re_syntax_base; + +} // namespace re_detail + +namespace deprecated{ +// +// class char_regex_traits_i +// provides case insensitive traits classes (deprecated): +template +class char_regex_traits_i : public regex_traits {}; + +template<> +class char_regex_traits_i : public regex_traits +{ +public: + typedef char char_type; + typedef unsigned char uchar_type; + typedef unsigned int size_type; + typedef regex_traits base_type; + + char BOOST_RE_CALL translate(char c, bool)const + { + return static_cast*>(this)->translate(c, true); + } +}; + +#ifndef BOOST_RE_NO_WCSTRING +template<> +class char_regex_traits_i : public regex_traits +{ +public: + typedef wchar_t char_type; + typedef unsigned short uchar_type; + typedef unsigned int size_type; + typedef regex_traits base_type; + + wchar_t BOOST_RE_CALL translate(wchar_t c, bool)const + { + return static_cast*>(this)->translate(c, true); + } + jm_uintfast32_t BOOST_RE_CALL lookup_classname(const wchar_t* first, const wchar_t* last)const + { + jm_uintfast32_t result = static_cast*>(this)->lookup_classname(first, last); + if((result & base_type::char_class_upper) == base_type::char_class_upper) + result |= base_type::char_class_alpha; + return result; + } +}; +#endif +} // namespace deprecated + + +namespace re_detail{ + +enum mask_type +{ + mask_take = 1, + mask_skip = 2, + mask_any = mask_skip | mask_take, + mask_all = mask_any +}; + +struct _narrow_type{}; +struct _wide_type{}; + +template +class is_byte; + +template<> +class is_byte +{ +public: + typedef _narrow_type width_type; +}; + +template<> +class is_byte +{ +public: + typedef _narrow_type width_type; +}; + +template<> +class is_byte +{ +public: + typedef _narrow_type width_type; +}; + +template +class is_byte +{ +public: + typedef _wide_type width_type; +}; + + +// +// compiled structures +// +// the following defs describe the format of the compiled string +// + +// +// enum syntax_element_type +// describes the type of a record +enum syntax_element_type +{ + syntax_element_startmark = 0, + syntax_element_endmark = syntax_element_startmark + 1, + syntax_element_literal = syntax_element_endmark + 1, + syntax_element_start_line = syntax_element_literal + 1, + syntax_element_end_line = syntax_element_start_line + 1, + syntax_element_wild = syntax_element_end_line + 1, + syntax_element_match = syntax_element_wild + 1, + syntax_element_word_boundary = syntax_element_match + 1, + syntax_element_within_word = syntax_element_word_boundary + 1, + syntax_element_word_start = syntax_element_within_word + 1, + syntax_element_word_end = syntax_element_word_start + 1, + syntax_element_buffer_start = syntax_element_word_end + 1, + syntax_element_buffer_end = syntax_element_buffer_start + 1, + syntax_element_backref = syntax_element_buffer_end + 1, + syntax_element_long_set = syntax_element_backref + 1, + syntax_element_set = syntax_element_long_set + 1, + syntax_element_jump = syntax_element_set + 1, + syntax_element_alt = syntax_element_jump + 1, + syntax_element_rep = syntax_element_alt + 1, + syntax_element_combining = syntax_element_rep + 1, + syntax_element_soft_buffer_end = syntax_element_combining + 1, + syntax_element_restart_continue = syntax_element_soft_buffer_end + 1 +}; + +#ifdef BOOST_RE_DEBUG +// dwa 09/26/00 - This is needed to suppress warnings about an ambiguous conversion +std::ostream& operator<<(std::ostream&, syntax_element_type); +#endif + +union offset_type +{ + re_syntax_base* p; + unsigned i; +}; + +// +// struct re_syntax_base +// base class for all syntax types: +struct re_syntax_base +{ + syntax_element_type type; + offset_type next; + unsigned int can_be_null; +}; + +// +// struct re_brace +// marks start or end of (...) +struct re_brace : public re_syntax_base +{ + unsigned int index; +}; + +// +// struct re_literal +// marks a literal string and +// is followed by an array of charT[length]: +struct re_literal : public re_syntax_base +{ + unsigned int length; +}; + +// +// struct re_long_set +// provides data for sets [...] containing +// wide characters +struct re_set_long : public re_syntax_base +{ + unsigned int csingles, cranges, cequivalents; + jm_uintfast32_t cclasses; + bool isnot; +}; + +// +// struct re_set +// provides a map of bools for sets containing +// narrow, single byte characters. +struct re_set : public re_syntax_base +{ + unsigned char _map[256]; +}; + +// +// struct re_jump +// provides alternative next destination +struct re_jump : public re_syntax_base +{ + offset_type alt; + unsigned char _map[256]; +}; + +// +// struct re_repeat +// provides repeat expressions +struct re_repeat : public re_jump +{ + unsigned min, max; + int id; + bool leading; + bool greedy; +}; + + +// +// enum re_jump_size_type +// provides compiled size of re_jump +// allowing for trailing alignment +// provide this so we know how many +// bytes to insert +enum re_jump_size_type +{ + re_jump_size = (sizeof(re_jump) + padding_mask) & ~(padding_mask), + re_repeater_size = (sizeof(re_repeat) + padding_mask) & ~(padding_mask) +}; + +} // namespace re_detail + +// +// class basic_regex +// handles error codes and flags + +class BOOST_RE_IX_DECL regbase +{ +public: + enum flag_type_ + { + escape_in_lists = 1, // '\' special inside [...] + char_classes = escape_in_lists << 1, // [[:CLASS:]] allowed + intervals = char_classes << 1, // {x,y} allowed + limited_ops = intervals << 1, // all of + ? and | are normal characters + newline_alt = limited_ops << 1, // \n is the same as | + bk_plus_qm = newline_alt << 1, // uses \+ and \? + bk_braces = bk_plus_qm << 1, // uses \{ and \} + bk_parens = bk_braces << 1, // uses \( and \) + bk_refs = bk_parens << 1, // \d allowed + bk_vbar = bk_refs << 1, // uses \| + + use_except = bk_vbar << 1, // exception on error + failbit = use_except << 1, // error flag + literal = failbit << 1, // all characters are literals + icase = literal << 1, // characters are matched regardless of case + nocollate = icase << 1, // don't use locale specific collation + + basic = char_classes | intervals | limited_ops | bk_braces | bk_parens | bk_refs, + extended = char_classes | intervals | bk_refs, + normal = escape_in_lists | char_classes | intervals | bk_refs | nocollate, + emacs = bk_braces | bk_parens | bk_refs | bk_vbar, + awk = extended | escape_in_lists, + grep = basic | newline_alt, + egrep = extended | newline_alt, + sed = basic, + perl = normal + }; + typedef unsigned int flag_type; + + enum restart_info + { + restart_any = 0, + restart_word = 1, + restart_line = 2, + restart_buf = 3, + restart_continue = 4, + restart_lit = 5, + restart_fixed_lit = 6 + }; + + flag_type BOOST_RE_CALL flags()const + { + return _flags; + } + + regbase(); + regbase(const regbase& b); +protected: + flag_type _flags; +}; + +// +// some forward declarations: +namespace re_detail{ +template +class _priv_match_data; + +#if defined(BOOST_NO_STD_ITERATOR_TRAITS) || defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + +template +struct regex_iterator_traits +{ + typedef typename T::iterator_category iterator_category; + typedef typename T::value_type value_type; +#ifndef BOOST_MSVC + typedef typename T::difference_type difference_type; + typedef typename T::pointer pointer; + typedef typename T::reference reference; +#else + typedef std::ptrdiff_t difference_type; + typedef value_type* pointer; + typedef value_type& reference; +#endif +}; + +template +struct pointer_iterator_traits +{ + typedef std::ptrdiff_t difference_type; + typedef T value_type; + typedef T* pointer; + typedef T& reference; + typedef std::random_access_iterator_tag iterator_category; +}; +template +struct const_pointer_iterator_traits +{ + typedef std::ptrdiff_t difference_type; + typedef T value_type; + typedef const T* pointer; + typedef const T& reference; + typedef std::random_access_iterator_tag iterator_category; +}; + +template<> +struct regex_iterator_traits : pointer_iterator_traits{}; +template<> +struct regex_iterator_traits : const_pointer_iterator_traits{}; +template<> +struct regex_iterator_traits : pointer_iterator_traits{}; +template<> +struct regex_iterator_traits : const_pointer_iterator_traits{}; + +#if defined(__SGI_STL_PORT) && defined(__STL_DEBUG) +template<> +struct regex_iterator_traits : pointer_iterator_traits{}; +template<> +struct regex_iterator_traits : const_pointer_iterator_traits{}; +#ifndef BOOST_NO_WSTRING +template<> +struct regex_iterator_traits : pointer_iterator_traits{}; +template<> +struct regex_iterator_traits : const_pointer_iterator_traits{}; +#endif // BOOST_NO_WSTRING +#endif // stport + +#else + +template +struct regex_iterator_traits : public std::iterator_traits {}; + +#endif + +template +struct def_alloc_param_traits +{ + typedef typename regex_iterator_traits::value_type const_value_type; + typedef typename remove_cv::type type; +}; + +} + +template ::type) > +class match_results; + +// +// class reg_expression +// represents the compiled +// regular expression: +// + +#if defined(BOOST_RE_NO_TEMPLATE_SWITCH_MERGE) && !defined(BOOST_RE_NO_NAMESPACES) +// +// Ugly ugly hack, +// template don't merge if they contain switch statements so declare these +// templates in unnamed namespace (ie with internal linkage), each translation +// unit then gets its own local copy, it works seemlessly but bloats the app. +namespace{ +#endif + +template ), class Allocator BOOST_RE_DEF_ALLOC_PARAM(charT) > +class reg_expression : public regbase +{ + typedef typename traits::size_type traits_size_type; + typedef typename traits::uchar_type traits_uchar_type; + typedef typename traits::string_type traits_string_type; +public: + // typedefs: + typedef charT char_type; + typedef traits traits_type; + + // locale_type + // placeholder for actual locale type used by the + // traits class to localise *this. + typedef typename traits::locale_type locale_type; + // value_type + typedef charT value_type; + // reference, const_reference + typedef charT& reference; + typedef const charT& const_reference; + // iterator, const_iterator + typedef const charT* const_iterator; + typedef const_iterator iterator; + // difference_type + typedef typename Allocator::difference_type difference_type; + // size_type + typedef typename Allocator::size_type size_type; + // allocator_type + typedef Allocator allocator_type; + typedef Allocator alloc_type; + // flag_type + typedef regbase::flag_type flag_type; + +public: + explicit reg_expression(const Allocator& a = Allocator()); + explicit reg_expression(const charT* p, flag_type f = regbase::normal, const Allocator& a = Allocator()); + reg_expression(const charT* p1, const charT* p2, flag_type f = regbase::normal, const Allocator& a = Allocator()); + reg_expression(const charT* p, size_type len, flag_type f, const Allocator& a = Allocator()); + reg_expression(const reg_expression&); + ~reg_expression(); + reg_expression& BOOST_RE_CALL operator=(const reg_expression&); + reg_expression& BOOST_RE_CALL operator=(const charT* ptr) + { + set_expression(ptr, regbase::normal | regbase::use_except); + return *this; + } + + // + // assign: + reg_expression& assign(const reg_expression& that) + { return *this = that; } + reg_expression& assign(const charT* ptr, flag_type f = regbase::normal) + { + set_expression(ptr, f | regbase::use_except); + return *this; + } + + reg_expression& assign(const charT* first, + const charT* last, + flag_type f = regbase::normal) + { + set_expression(first, last, f | regbase::use_except); + return *this; + } +#ifndef BOOST_RE_NO_MEMBER_TEMPLATES + + template + unsigned int BOOST_RE_CALL set_expression(const std::basic_string& p, flag_type f = regbase::normal) + { return set_expression(p.data(), p.data() + p.size(), f); } + + template + explicit reg_expression(const std::basic_string& p, flag_type f = regbase::normal, const Allocator& a = Allocator()) + : data(a), pkmp(0) { set_expression(p, f); } + + template + reg_expression(I first, I last, flag_type f = regbase::normal, const Allocator& al = Allocator()) + : data(al), pkmp(0) + { + size_type len = last-first; + scoped_array a(new charT[len]); + std::copy(first, last, a.get()); + set_expression(a.get(), a.get() + len, f | regbase::use_except); + } + + template + reg_expression& BOOST_RE_CALL operator=(const std::basic_string& p) + { + set_expression(p.c_str(), p.c_str() + p.size(), regbase::normal | regbase::use_except); + return *this; + } + + template + reg_expression& BOOST_RE_CALL assign( + const std::basic_string& s, + flag_type f = regbase::normal) + { + set_expression(s.c_str(), s.c_str() + s.size(), f | regbase::use_except); + return *this; + } + + template + reg_expression& BOOST_RE_CALL assign(fwd_iterator first, + fwd_iterator last, + flag_type f = regbase::normal) + { + size_type len = last-first; + scoped_array a(new charT[len]); + std::copy(first, last, a.get()); + set_expression(a.get(), a.get() + len, f | regbase::use_except); + return *this; + } +#elif !defined(BOOST_RE_NO_STRING_DEF_ARGS) + unsigned int BOOST_RE_CALL set_expression(const std::basic_string& p, flag_type f = regbase::normal) + { return set_expression(p.data(), p.data() + p.size(), f); } + + reg_expression(const std::basic_string& p, flag_type f = regbase::normal, const Allocator& a = Allocator()) + : data(a), pkmp(0) { set_expression(p, f); } + + reg_expression& BOOST_RE_CALL operator=(const std::basic_string& p) + { + set_expression(p.c_str(), p.c_str() + p.size(), regbase::normal | regbase::use_except); + return *this; + } + + reg_expression& BOOST_RE_CALL assign( + const std::basic_string& s, + flag_type f = regbase::normal) + { + set_expression(s.c_str(), s.c_str() + s.size(), f | regbase::use_except); + return *this; + } + +#endif + + + // + // allocator access: + Allocator BOOST_RE_CALL get_allocator()const; + // + // locale: + locale_type BOOST_RE_CALL imbue(locale_type l){ return traits_inst.imbue(l); } + locale_type BOOST_RE_CALL getloc()const{ return traits_inst.getloc(); } + // + // flags: + flag_type BOOST_RE_CALL getflags()const + { return flags(); } + // + // str: + std::basic_string BOOST_RE_CALL str()const + { return std::basic_string(_expression, _expression_len); } + // + // begin, end: + const_iterator BOOST_RE_CALL begin()const + { return _expression; } + const_iterator BOOST_RE_CALL end()const + { return _expression + _expression_len; } + // + // swap: + void BOOST_RE_CALL swap(reg_expression&)throw(); + // + // size: + size_type BOOST_RE_CALL size()const + { return _expression_len; } + // + // max_size: + size_type BOOST_RE_CALL max_size()const + { return UINT_MAX; } + // + // empty: + bool BOOST_RE_CALL empty()const + { return this->error_code(); } + + unsigned BOOST_RE_CALL mark_count()const { return marks; } + bool BOOST_RE_CALL operator==(const reg_expression&)const; + bool BOOST_RE_CALL operator<(const reg_expression&)const; + // + // The following are deprecated as public interfaces + // but are available for compatability with earlier versions. + allocator_type BOOST_RE_CALL allocator()const; + const charT* BOOST_RE_CALL expression()const { return _expression; } + unsigned int BOOST_RE_CALL set_expression(const charT* p, const charT* end, flag_type f = regbase::normal); + unsigned int BOOST_RE_CALL set_expression(const charT* p, flag_type f = regbase::normal) { return set_expression(p, p + traits_type::length(p), f); } + // + // this should be private but template friends don't work: + const traits_type& get_traits()const { return traits_inst; } + unsigned int BOOST_RE_CALL error_code()const + { + return error_code_; + } + +private: + re_detail::raw_storage data; + unsigned _restart_type; + unsigned marks; + int repeats; + unsigned char* startmap; + charT* _expression; + unsigned _expression_len; + unsigned int _leading_len; + const charT* _leading_string; + unsigned int _leading_string_len; + re_detail::kmp_info* pkmp; + traits_type traits_inst; + unsigned error_code_; + + void BOOST_RE_CALL compile_maps(); + void BOOST_RE_CALL compile_map(re_detail::re_syntax_base* node, unsigned char* _map, unsigned int* pnull, unsigned char mask, re_detail::re_syntax_base* terminal = NULL)const; + bool BOOST_RE_CALL probe_start(re_detail::re_syntax_base* node, charT c, re_detail::re_syntax_base* terminal)const; + bool BOOST_RE_CALL probe_start_null(re_detail::re_syntax_base* node, re_detail::re_syntax_base* terminal)const; + void BOOST_RE_CALL fixup_apply(re_detail::re_syntax_base* b, unsigned cbraces); + void BOOST_RE_CALL move_offsets(re_detail::re_syntax_base* j, unsigned size); + re_detail::re_syntax_base* BOOST_RE_CALL compile_set(const charT*& first, const charT* last); + re_detail::re_syntax_base* BOOST_RE_CALL compile_set_aux(re_detail::jstack& singles, re_detail::jstack& ranges, re_detail::jstack& classes, re_detail::jstack& equivalents, bool isnot, const re_detail::_narrow_type&); + re_detail::re_syntax_base* BOOST_RE_CALL compile_set_aux(re_detail::jstack& singles, re_detail::jstack& ranges, re_detail::jstack& classes, re_detail::jstack& equivalents, bool isnot, const re_detail::_wide_type&); + re_detail::re_syntax_base* BOOST_RE_CALL compile_set_simple(re_detail::re_syntax_base* dat, unsigned long cls, bool isnot = false); + unsigned int BOOST_RE_CALL parse_inner_set(const charT*& first, const charT* last); + + re_detail::re_syntax_base* BOOST_RE_CALL add_simple(re_detail::re_syntax_base* dat, re_detail::syntax_element_type type, unsigned int size = sizeof(re_detail::re_syntax_base)); + re_detail::re_syntax_base* BOOST_RE_CALL add_literal(re_detail::re_syntax_base* dat, charT c); + charT BOOST_RE_CALL parse_escape(const charT*& first, const charT* last); + void BOOST_RE_CALL parse_range(const charT*& first, const charT* last, unsigned& min, unsigned& max); + bool BOOST_RE_CALL skip_space(const charT*& first, const charT* last); + unsigned int BOOST_RE_CALL probe_restart(re_detail::re_syntax_base* dat); + unsigned int BOOST_RE_CALL fixup_leading_rep(re_detail::re_syntax_base* dat, re_detail::re_syntax_base* end); + void BOOST_RE_CALL fail(unsigned int err); + +protected: + static int BOOST_RE_CALL repeat_count(const reg_expression& e) + { return e.repeats; } + static unsigned int BOOST_RE_CALL restart_type(const reg_expression& e) + { return e._restart_type; } + static const re_detail::re_syntax_base* BOOST_RE_CALL first(const reg_expression& e) + { return (const re_detail::re_syntax_base*)e.data.data(); } + static const unsigned char* BOOST_RE_CALL get_map(const reg_expression& e) + { return e.startmap; } + static unsigned int BOOST_RE_CALL leading_length(const reg_expression& e) + { return e._leading_len; } + static const re_detail::kmp_info* get_kmp(const reg_expression& e) + { return e.pkmp; } + static bool BOOST_RE_CALL can_start(charT c, const unsigned char* _map, unsigned char mask, const re_detail::_wide_type&); + static bool BOOST_RE_CALL can_start(charT c, const unsigned char* _map, unsigned char mask, const re_detail::_narrow_type&); +}; + +template +void BOOST_RE_CALL reg_expression::swap(reg_expression& that)throw() +{ + // this is not as efficient as it should be, + // however swapping traits classes is problematic + // so just use 'brute force' method for now: + reg_expression e(that); + that = *this; + *this = e; +} + + +#if defined(BOOST_RE_NO_TEMPLATE_SWITCH_MERGE) && !defined(BOOST_RE_NO_NAMESPACES) +} // namespace +#endif + +// +// class match_results and match_results_base +// handles what matched where + +template +struct sub_match +{ + typedef typename re_detail::regex_iterator_traits::value_type value_type; +#if defined(BOOST_NO_STD_ITERATOR_TRAITS) || defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + typedef std::ptrdiff_t difference_type; +#else + typedef typename re_detail::regex_iterator_traits::difference_type difference_type; +#endif + typedef iterator iterator_type; + + iterator first; + iterator second; + bool matched; + + operator std::basic_string ()const + { + std::basic_string result; + unsigned len; + BOOST_RE_DISTANCE((iterator)first, (iterator)second, len); + result.reserve(len); + iterator i = first; + while(i != second) + { + result.append(1, *i); + ++i; + } + return result; + } + #ifdef BOOST_OLD_REGEX_H + // + // the following are deprecated, do not use!! + // + operator int()const; + operator unsigned int()const; + operator short()const + { + return (short)(int)(*this); + } + operator unsigned short()const + { + return (unsigned short)(unsigned int)(*this); + } + #endif + sub_match() { matched = false; } + sub_match(iterator i) : first(i), second(i), matched(false) {} + + bool operator==(const sub_match& that)const + { + return (first == that.first) && (second == that.second) && (matched == that.matched); + } + bool BOOST_RE_CALL operator !=(const sub_match& that)const + { return !(*this == that); } + + difference_type BOOST_RE_CALL length()const + { + difference_type n; + BOOST_RE_DISTANCE((iterator)first, (iterator)second, n); + return n; + } +}; + +#ifdef BOOST_OLD_REGEX_H +namespace re_detail{ +template +int do_toi(iterator i, iterator j, char c, int radix) +{ + std::string s(i, j); + char* p; + int result = std::strtol(s.c_str(), &p, radix); + if(*p)throw bad_pattern("Bad sub-expression"); + return result; +} + +// +// helper: +template +int do_toi(I& i, I j, charT c) +{ + int result = 0; + while((i != j) && (isdigit(*i))) + { + result = result*10 + (*i - '0'); + ++i; + } + return result; +} +} + + +template +sub_match::operator int()const +{ + iterator i = first; + iterator j = second; + if(i == j)throw bad_pattern("Bad sub-expression"); + int neg = 1; + if((i != j) && (*i == '-')) + { + neg = -1; + ++i; + } + neg *= re_detail::do_toi(i, j, *i); + if(i != j)throw bad_pattern("Bad sub-expression"); + return neg; +} +template +sub_match::operator unsigned int()const +{ + iterator i = first; + iterator j = second; + if(i == j) + throw bad_pattern("Bad sub-expression"); + return re_detail::do_toi(i, j, *first); +} +#endif + +namespace re_detail{ + +template ::type) > +class match_results_base +{ +public: + typedef Allocator alloc_type; + typedef typename REBIND_TYPE(iterator, Allocator)::size_type size_type; +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + typedef typename std::iterator_traits::difference_type difference_type; + typedef typename std::iterator_traits::value_type char_type; +#else + typedef std::ptrdiff_t difference_type; + typedef typename re_detail::regex_iterator_traits::value_type char_type; +#endif + typedef sub_match value_type; + typedef iterator iterator_type; + +protected: + typedef BOOST_RE_MAYBE_TYPENAME REBIND_TYPE(char, Allocator) c_alloc; + + struct c_reference : public c_alloc + { + unsigned int cmatches; + unsigned count; + sub_match head, tail, null; + unsigned int lines; + iterator line_pos, base; + c_reference(const Allocator& a) : c_alloc(a) { } + + bool operator==(const c_reference& that)const + { + return (cmatches == that.cmatches) && + (count == that.count) && + (head == that.head) && + (tail == that.tail) && + (lines == that.lines) && + (base == that.base); + } + bool operator!=(const c_reference& that)const + { return !(*this == that); } + }; + + c_reference* ref; + + void BOOST_RE_CALL cow(); + + // protected contructor for derived class... + match_results_base(bool){} + void BOOST_RE_CALL free(); + +public: + + match_results_base(const Allocator& a = Allocator()); + + match_results_base(const match_results_base& m) + { + ref = m.ref; + ++(ref->count); + } + + match_results_base& BOOST_RE_CALL operator=(const match_results_base& m); + + ~match_results_base() + { + free(); + } + + size_type BOOST_RE_CALL size()const + { + //return (*this)[0].matched ? ref->cmatches : 0; + return ref->cmatches; + } + + const sub_match& BOOST_RE_CALL operator[](int n) const + { + if((n >= 0) && ((unsigned int)n < ref->cmatches)) + return *(sub_match*)((char*)ref + sizeof(c_reference) + sizeof(sub_match)*n); + return (n == -1) ? ref->head : (n == -2) ? ref->tail : ref->null; + } + + Allocator BOOST_RE_CALL allocator()const; + + difference_type BOOST_RE_CALL length(unsigned int sub = 0)const + { + jm_assert(ref->cmatches); + const sub_match& m = (*this)[sub]; + if(m.matched == false) + return 0; + difference_type n; + BOOST_RE_DISTANCE((iterator)m.first, (iterator)m.second, n); + return n; + } + + std::basic_string str(int i)const + { + return static_cast >((*this)[i]); + } + + unsigned int BOOST_RE_CALL line()const + { + return ref->lines; + } + + difference_type BOOST_RE_CALL position(unsigned int sub = 0)const + { + jm_assert(ref->cmatches); + const sub_match& s = (*this)[sub]; + if(s.matched == false) + return -1; + difference_type n; + BOOST_RE_DISTANCE((iterator)ref->base, (iterator)s.first, n); + return n; + } + + iterator BOOST_RE_CALL line_start()const + { + return ref->line_pos; + } + + void swap(match_results_base& that) + { + c_reference* t = that.ref; + that.ref = ref; + ref = t; + } + + bool operator==(const match_results_base& that)const; + bool operator<(const match_results_base& that)const + { return position() < that.position(); } + + friend class match_results; + + void BOOST_RE_CALL set_size(size_type n); + void BOOST_RE_CALL set_size(size_type n, iterator i, iterator j); + void BOOST_RE_CALL maybe_assign(const match_results_base& m); + void BOOST_RE_CALL init_fail(iterator i, iterator j); + + void BOOST_RE_CALL set_first(iterator i); + void BOOST_RE_CALL set_first(iterator i, size_t pos); + + void BOOST_RE_CALL set_second(iterator i) + { + cow(); + ((sub_match*)(ref+1))->second = i; + ((sub_match*)(ref+1))->matched = true; + ref->tail.first = i; + ref->tail.matched = (ref->tail.first == ref->tail.second) ? false : true; + } + + void BOOST_RE_CALL set_second(iterator i, size_t pos) + { + cow(); + ((sub_match*)((char*)ref + sizeof(c_reference) + sizeof(sub_match) * pos))->second = i; + ((sub_match*)((char*)ref + sizeof(c_reference) + sizeof(sub_match) * pos))->matched = true; + if(pos == 0) + { + ref->tail.first = i; + ref->tail.matched = (ref->tail.first == ref->tail.second) ? false : true; + } + } + + void BOOST_RE_CALL set_line(unsigned int i, iterator pos) + { + ref->lines = i; + ref->line_pos = pos; + } + + void BOOST_RE_CALL set_base(iterator pos) + { + ref->base = pos; + } +}; + +template +void BOOST_RE_CALL match_results_base::set_first(iterator i) +{ + cow(); + ref->head.second = i; + ref->head.matched = (ref->head.first == ref->head.second) ? false : true; + sub_match* p1 = (sub_match*)(ref+1); + sub_match* p2 = p1 + ref->cmatches; + p1->first = i; + p1->matched = false; + ++p1; + while(p1 != p2) + { + p1->matched = false; + p1->first = ref->tail.second; + p1->second = ref->tail.second; + ++p1; + } +} + +template +void BOOST_RE_CALL match_results_base::set_first(iterator i, size_t pos) +{ + cow(); + ((sub_match*)((char*)ref + sizeof(c_reference) + sizeof(sub_match) * pos))->first = i; + if(pos == 0) + { + ref->head.second = i; + ref->head.matched = (ref->head.first == ref->head.second) ? false : true; + sub_match* p1 = (sub_match*)(ref+1); + sub_match* p2 = p1 + ref->cmatches; + p1->first = i; + p1->matched = false; + ++p1; + while(p1 != p2) + { + p1->matched = false; + p1->first = ref->tail.second; + p1->second = ref->tail.second; + ++p1; + } + } +} + + +template +match_results_base::match_results_base(const Allocator& a) +{ + ref = (c_reference*)c_alloc(a).allocate(sizeof(sub_match) + sizeof(c_reference)); + try + { + new (ref) c_reference(a); + ref->cmatches = 1; + ref->count = 1; + // construct the sub_match: + try + { + new ((sub_match*)(ref+1)) sub_match(); + } + catch(...) + { + jm_destroy(ref); + throw; + } + } + catch(...) + { + c_alloc(a).deallocate((char*)(void*)ref, sizeof(sub_match) + sizeof(c_reference)); + throw; + } +} + +template +Allocator BOOST_RE_CALL match_results_base::allocator()const +{ + return *((c_alloc*)ref); +} + +template +inline match_results_base& BOOST_RE_CALL match_results_base::operator=(const match_results_base& m) +{ + if(ref != m.ref) + { + free(); + ref = m.ref; + ++(ref->count); + } + return *this; +} + + +template +void BOOST_RE_CALL match_results_base::free() +{ + if(--(ref->count) == 0) + { + c_alloc a(*ref); + sub_match* p1, *p2; + p1 = (sub_match*)(ref+1); + p2 = p1 + ref->cmatches; + while(p1 != p2) + { + jm_destroy(p1); + ++p1; + } + jm_destroy(ref); + a.deallocate((char*)(void*)ref, sizeof(sub_match) * ref->cmatches + sizeof(c_reference)); + } +} + +template +bool match_results_base::operator==(const match_results_base& that)const +{ + if(*ref != *(that.ref)) + return false; + const sub_match* p1 = (sub_match*)(ref+1); + const sub_match* p2 = p1 + ref->cmatches; + const sub_match* p3 = (sub_match*)(that.ref+1); + while(p1 != p2) + { + if(*p1 != *p3) + return false; + ++p1; + ++p3; + } + return true; +} + +template +void BOOST_RE_CALL match_results_base::set_size(size_type n) +{ + if(ref->cmatches != n) + { + c_reference* newref = (c_reference*)ref->allocate(sizeof(sub_match) * n + sizeof(c_reference)); + try + { + new (newref) c_reference(*ref); + newref->count = 1; + newref->cmatches = n; + sub_match* p1, *p2; + p1 = (sub_match*)(newref+1); + p2 = p1 + newref->cmatches; + try + { + while(p1 != p2) + { + new (p1) sub_match(); + ++p1; + } + free(); + } + catch(...) + { + p2 = (sub_match*)(newref+1); + while(p2 != p1) + { + jm_destroy(p2); + ++p2; + } + jm_destroy(ref); + throw; + } + ref = newref; + } + catch(...) + { + ref->deallocate((char*)(void*)newref, sizeof(sub_match) * n + sizeof(c_reference)); + throw; + } + } +} + +template +void BOOST_RE_CALL match_results_base::set_size(size_type n, iterator i, iterator j) +{ + if(ref->cmatches != n) + { + c_reference* newref = (c_reference*)ref->allocate(sizeof(sub_match) * n + sizeof(c_reference));; + try{ + new (newref) c_reference(*ref); + newref->count = 1; + newref->cmatches = n; + sub_match* p1 = (sub_match*)(newref+1); + sub_match* p2 = p1 + newref->cmatches; + try + { + while(p1 != p2) + { + new (p1) sub_match(j); + ++p1; + } + free(); + } + catch(...) + { + p2 = (sub_match*)(newref+1); + while(p2 != p1) + { + jm_destroy(p2); + ++p2; + } + jm_destroy(ref); + throw; + } + ref = newref; + } + catch(...) + { + ref->deallocate((char*)(void*)newref, sizeof(sub_match) * n + sizeof(c_reference)); + throw; + } + } + else + { + cow(); + // set iterators to be i, matched to false: + sub_match* p1, *p2; + p1 = (sub_match*)(ref+1); + p2 = p1 + ref->cmatches; + while(p1 != p2) + { + p1->first = j; + p1->second = j; + p1->matched = false; + ++p1; + } + } + ref->head.first = i; + ref->tail.second = j; + ref->head.matched = ref->tail.matched = true; + ref->null.first = ref->null.second = j; + ref->null.matched = false; +} + +template +inline void BOOST_RE_CALL match_results_base::init_fail(iterator i, iterator j) +{ + set_size(ref->cmatches, i, j); +} + +template +void BOOST_RE_CALL match_results_base::maybe_assign(const match_results_base& m) +{ + sub_match* p1, *p2; + p1 = (sub_match*)(ref+1); + p2 = (sub_match*)(m.ref+1); + iterator base = (*this)[-1].first; + unsigned int len1 = 0; + unsigned int len2 = 0; + unsigned int base1 = 0; + unsigned int base2 = 0; + unsigned int i; + for(i = 0; i < ref->cmatches; ++i) + { + // + // leftmost takes priority over longest: + BOOST_RE_DISTANCE(base, p1->first, base1); + BOOST_RE_DISTANCE(base, p2->first, base2); + if(base1 < base2) return; + if(base2 < base1) break; + + BOOST_RE_DISTANCE(p1->first, p1->second, len1); + BOOST_RE_DISTANCE(p2->first, p2->second, len2); + if((len1 != len2) || ((p1->matched == false) && (p2->matched == true))) + break; + if((p1->matched == true) && (p2->matched == false)) + return; + ++p1; + ++p2; + } + if(i == ref->cmatches) + return; + if(base2 < base1) + *this = m; + else if((len2 > len1) || ((p1->matched == false) && (p2->matched == true)) ) + *this = m; +} + +template +void BOOST_RE_CALL match_results_base::cow() +{ + if(ref->count > 1) + { + c_reference* newref = (c_reference*)ref->allocate(sizeof(sub_match) * ref->cmatches + sizeof(c_reference)); + try{ + new (newref) c_reference(*ref); + newref->count = 1; + sub_match* p1 = (sub_match*)(newref+1); + sub_match* p2 = p1 + newref->cmatches; + sub_match* p3 = (sub_match*)(ref+1); + try{ + while(p1 != p2) + { + new (p1) sub_match(*p3); + ++p1; + ++p3; + } + } + catch(...) + { + p2 = (sub_match*)(newref+1); + while(p2 != p1) + { + jm_destroy(p2); + ++p2; + } + jm_destroy(ref); + throw; + } + --(ref->count); + ref = newref; + } + catch(...) + { + ref->deallocate((char*)(void*)newref, sizeof(sub_match) * ref->cmatches + sizeof(c_reference)); + throw; + } + } +} + +} // namespace re_detail + +// +// class match_results +// encapsulates match_results_base, does a deep copy rather than +// reference counting to ensure thread safety when copying +// other match_results instances + +template +class match_results : public re_detail::match_results_base +{ + typedef re_detail::match_results_base base_type; +public: + + typedef typename base_type::alloc_type alloc_type; + typedef typename base_type::size_type size_type; + typedef typename base_type::char_type char_type; + typedef typename base_type::value_type value_type; + typedef typename base_type::difference_type difference_type; + typedef typename base_type::iterator_type iterator_type; + + explicit match_results(const Allocator& a = Allocator()) + : re_detail::match_results_base(a){} + + match_results(const re_detail::match_results_base& m) + : re_detail::match_results_base(m){} + + match_results& operator=(const re_detail::match_results_base& m) + { + // shallow copy + base_type::operator=(m); + return *this; + } + + match_results(const match_results& m); + match_results& operator=(const match_results& m); + // + // the following function definitions should *not* be required, except + // when this class is used as a template inside another template definition, + // in which members of the base class are not visible to the calling code. + // As a workaround we define simple forwarding functions: + // + size_type size()const + { return static_cast(this)->size(); } + + const sub_match& operator[](int n) const + { return (*static_cast(this))[n]; } + + Allocator allocator()const + { return static_cast(this)->allocator(); } + + difference_type length(int sub = 0)const + { return static_cast(this)->length(sub); } + + difference_type position(unsigned int sub = 0)const + { return static_cast(this)->position(sub); } + + unsigned int line()const + { return static_cast(this)->line(); } + + iterator line_start()const + { return static_cast(this)->line_start(); } + + std::basic_string str(int sub = 0)const + { return static_cast(this)->str(sub); } + + void swap(match_results& that) + { static_cast(this)->swap(that); } + + bool operator==(const match_results& that)const + { return static_cast(*this) == static_cast(that); } + + bool operator<(const match_results& that) const + { return position() < that.position(); } +}; + +template +match_results::match_results(const match_results& m) + : re_detail::match_results_base(false) +{ + this->ref = + reinterpret_cast::c_reference *> + (m.ref->allocate(sizeof(sub_match) * m.ref->cmatches + + sizeof(typename re_detail::match_results_base::c_reference))); + try{ + new (this->ref) typename re_detail::match_results_base::c_reference(*m.ref); + this->ref->count = 1; + sub_match* p1 = (sub_match*)(this->ref+1); + sub_match* p2 = p1 + this->ref->cmatches; + sub_match* p3 = (sub_match*)(m.ref+1); + try{ + while(p1 != p2) + { + new (p1) sub_match(*p3); + ++p1; + ++p3; + } + } + catch(...) + { + p2 = (sub_match*)(this->ref+1); + while(p2 != p1) + { + re_detail::jm_destroy(p2); + ++p2; + } + re_detail::jm_destroy(this->ref); + throw; + } + } + catch(...) + { + m.ref->deallocate((char*)(void*)this->ref, sizeof(sub_match) * m.ref->cmatches + sizeof(typename re_detail::match_results_base::c_reference)); + throw; + } +} + +template +match_results& match_results::operator=(const match_results& m) +{ + match_results t(m); + this->swap(t); + return *this; +} + +namespace re_detail{ +template +iterator BOOST_RE_CALL re_is_set_member(iterator next, + iterator last, + re_set_long* set_, + const reg_expression& e); +} // namepsace re_detail + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + +} // namespace boost + +#include + +namespace boost{ + +typedef reg_expression, BOOST_RE_DEF_ALLOC(char)> regex; +#ifndef BOOST_RE_NO_WCSTRING +typedef reg_expression, BOOST_RE_DEF_ALLOC(wchar_t)> wregex; +#endif + +typedef match_results cmatch; +#ifndef BOOST_RE_NO_WCSTRING +typedef match_results wcmatch; +#endif + +} // namespace boost + +#include +#include +#include + + +#endif // __cplusplus + +#endif // include + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boost/boost/regex_traits.hpp b/boost/boost/regex_traits.hpp new file mode 100644 index 0000000000..0345f8f168 --- /dev/null +++ b/boost/boost/regex_traits.hpp @@ -0,0 +1,800 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE regex.cpp + * VERSION 3.03 + * DESCRIPTION: Declares regular expression traits classes. + */ + +#ifndef BOOST_REGEX_TRAITS_HPP +#define BOOST_REGEX_TRAITS_HPP + +/* LGB */ +#include + +#include +#include + +namespace boost{ + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b -Ve + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b -Ve + #endif +#endif + +template +class c_regex_traits; + +namespace re_detail{ + +struct mss +{ + unsigned int id; + const char* what; +}; + +BOOST_RE_IX_DECL bool BOOST_RE_CALL re_lookup_def_collate_name(std::string& buf, const char* name); +BOOST_RE_IX_DECL unsigned int BOOST_RE_CALL re_get_default_message(char* buf, unsigned int len, unsigned int id); +extern BOOST_RE_IX_DECL const char *re_default_error_messages[]; +BOOST_RE_IX_DECL bool BOOST_RE_CALL re_lookup_def_collate_name(std::string& buf, const char* name); +BOOST_RE_IX_DECL bool BOOST_RE_CALL is_combining(wchar_t c); +//extern BOOST_RE_IX_DECL const wchar_t combining_ranges[]; + +#ifndef BOOST_RE_NO_WCSTRING +extern BOOST_RE_IX_DECL wchar_t wide_lower_case_map[]; +extern BOOST_RE_IX_DECL unsigned short wide_unicode_classes[]; +#endif + + +struct BOOST_RE_IX_DECL regex_traits_base +{ + enum char_syntax_type + { + syntax_char = 0, + syntax_open_bracket = 1, // ( + syntax_close_bracket = 2, // ) + syntax_dollar = 3, // $ + syntax_caret = 4, // ^ + syntax_dot = 5, // . + syntax_star = 6, // * + syntax_plus = 7, // + + syntax_question = 8, // ? + syntax_open_set = 9, // [ + syntax_close_set = 10, // ] + syntax_or = 11, // | + syntax_slash = 12, // + syntax_hash = 13, // # + syntax_dash = 14, // - + syntax_open_brace = 15, // { + syntax_close_brace = 16, // } + syntax_digit = 17, // 0-9 + syntax_b = 18, // for \b + syntax_B = 19, // for \B + syntax_left_word = 20, // for \< + syntax_right_word = 21, // for \> + syntax_w = 22, // for \w + syntax_W = 23, // for \W + syntax_start_buffer = 24, // for \` + syntax_end_buffer = 25, // for \' + syntax_newline = 26, // for newline alt + syntax_comma = 27, // for {x,y} + + syntax_a = 28, // for \a + syntax_f = 29, // for \f + syntax_n = 30, // for \n + syntax_r = 31, // for \r + syntax_t = 32, // for \t + syntax_v = 33, // for \v + syntax_x = 34, // for \xdd + syntax_c = 35, // for \cx + syntax_colon = 36, // for [:...:] + syntax_equal = 37, // for [=...=] + + // perl ops: + syntax_e = 38, // for \e + syntax_l = 39, // for \l + syntax_L = 40, // for \L + syntax_u = 41, // for \u + syntax_U = 42, // for \U + syntax_s = 43, // for \s + syntax_S = 44, // for \S + syntax_d = 45, // for \d + syntax_D = 46, // for \D + syntax_E = 47, // for \Q\E + syntax_Q = 48, // for \Q\E + syntax_X = 49, // for \X + syntax_C = 50, // for \C + syntax_Z = 51, // for \Z + syntax_G = 52, // for \G + + syntax_max = 53 + }; +}; + +struct BOOST_RE_IX_DECL c_traits_base : public regex_traits_base +{ +public: + enum{ + char_class_none = 0, + char_class_alpha = 1, + char_class_cntrl = char_class_alpha << 1, + char_class_digit = char_class_cntrl << 1, + char_class_lower = char_class_digit << 1, + char_class_punct = char_class_lower << 1, + char_class_space = char_class_punct << 1, + char_class_upper = char_class_space << 1, + char_class_xdigit = char_class_upper << 1, + char_class_blank = char_class_xdigit << 1, + char_class_unicode = char_class_blank << 1, + char_class_underscore = char_class_unicode << 1, + + char_class_alnum = char_class_alpha | char_class_digit, + char_class_graph = char_class_alpha | char_class_digit | char_class_punct | char_class_underscore, + char_class_print = char_class_alpha | char_class_digit | char_class_punct | char_class_underscore | char_class_blank, + char_class_word = char_class_alpha | char_class_digit | char_class_underscore + }; + static std::string set_message_catalogue(const std::string& s); +protected: +#if defined(__MWERKS__) && __MWERKS__ <= 0x6000 + friend class c_regex_traits; + friend class c_regex_traits; +#endif + + static char regex_message_catalogue[200]; + enum syntax_map_size + { + map_size = UCHAR_MAX + 1 + }; + + static unsigned char syntax_map[map_size]; + static unsigned short class_map[map_size]; + static char lower_case_map[map_size]; + + static jm_uintfast32_t BOOST_RE_CALL do_lookup_class(const char* p); + static bool BOOST_RE_CALL do_lookup_collate(std::string& buf, const char* p); + static void BOOST_RE_CALL do_update_ctype(); + static void BOOST_RE_CALL do_update_collate(); +public: + static std::string error_string(unsigned id); + static char* get_catalogue() { return regex_message_catalogue; } +}; + +} // namespace re_detail + + +template<> +class BOOST_RE_IX_DECL c_regex_traits : public re_detail::c_traits_base +{ + typedef re_detail::c_traits_base base_type; +public: + typedef char char_type; + typedef unsigned char uchar_type; + typedef unsigned int size_type; + typedef std::string string_type; + typedef int locale_type; + + static size_t BOOST_RE_CALL length(const char_type* p) + { + return std::strlen(p); + } + static unsigned int BOOST_RE_CALL syntax_type(size_type c) + { + return syntax_map[c]; + } + static char BOOST_RE_CALL translate(char c, bool icase) + { + return icase ? lower_case_map[(size_type)(uchar_type)c] : c; + } + static void BOOST_RE_CALL transform(std::string& out, const std::string& in); + + static void BOOST_RE_CALL transform_primary(std::string& out, const std::string& in); + + static bool BOOST_RE_CALL is_separator(char c) + { + return BOOST_RE_MAKE_BOOL((c == '\n') || (c == '\r')); + } + + static bool BOOST_RE_CALL is_combining(char) + { + return false; + } + + static bool BOOST_RE_CALL is_class(char c, jm_uintfast32_t f) + { + return BOOST_RE_MAKE_BOOL(class_map[(size_type)(uchar_type)c] & f); + } + + static int BOOST_RE_CALL toi(char c); + static int BOOST_RE_CALL toi(const char*& first, const char* last, int radix); + + static jm_uintfast32_t BOOST_RE_CALL lookup_classname(const char* first, const char* last) + { + std::string s(first, last); + return do_lookup_class(s.c_str()); + } + + static bool BOOST_RE_CALL lookup_collatename(std::string& buf, const char* first, const char* last) + { + std::string s(first, last); + return do_lookup_collate(buf, s.c_str()); + } + + static locale_type imbue(locale_type l){ return l; } + locale_type BOOST_RE_CALL getloc()const{ return locale_type(); } + + c_regex_traits() + { + init(); + } + ~c_regex_traits() + { + free(); + } + struct sentry + { + sentry(const c_regex_traits&) + { c_regex_traits::update(); } + operator void*() { return this; } + }; + static void update(); +private: + static void init(); + static void free(); + static c_regex_traits i; + + static unsigned sort_type; + static char sort_delim; +}; + +#ifndef BOOST_RE_NO_WCSTRING +template<> +class BOOST_RE_IX_DECL c_regex_traits : public re_detail::c_traits_base +{ + typedef re_detail::c_traits_base base_type; +public: + typedef wchar_t char_type; + typedef unsigned short uchar_type; + typedef unsigned int size_type; + typedef std::basic_string string_type; + typedef int locale_type; + static size_t BOOST_RE_CALL length(const char_type* p) + { + return std::wcslen(p); + } + static unsigned int BOOST_RE_CALL syntax_type(size_type c); + static wchar_t BOOST_RE_CALL translate(wchar_t c, bool icase) + { + return icase ? ((c < 256) ? re_detail::wide_lower_case_map[(uchar_type)c] : std::towlower(c)) : c; + } + + static void BOOST_RE_CALL transform(std::basic_string& out, const std::basic_string& in); + + static void BOOST_RE_CALL transform_primary(std::basic_string& out, const std::basic_string& in); + + static bool BOOST_RE_CALL is_separator(wchar_t c) + { + return BOOST_RE_MAKE_BOOL((c == L'\n') || (c == L'\r') || (c == (wchar_t)0x2028) || (c == (wchar_t)0x2029)); + } + + static bool BOOST_RE_CALL is_combining(wchar_t c) + { return re_detail::is_combining(c); } + + static bool BOOST_RE_CALL is_class(wchar_t c, jm_uintfast32_t f) + { + return BOOST_RE_MAKE_BOOL(((uchar_type)c < 256) ? (re_detail::wide_unicode_classes[(size_type)(uchar_type)c] & f) : do_iswclass(c, f)); + } + + static int BOOST_RE_CALL toi(wchar_t c); + static int BOOST_RE_CALL toi(const wchar_t*& first, const wchar_t* last, int radix); + + static jm_uintfast32_t BOOST_RE_CALL lookup_classname(const wchar_t* first, const wchar_t* last); + + static bool BOOST_RE_CALL lookup_collatename(std::basic_string& s, const wchar_t* first, const wchar_t* last); + + static locale_type imbue(locale_type l){ return l; } + locale_type BOOST_RE_CALL getloc()const{ return locale_type(); } + c_regex_traits() + { init(); } + ~c_regex_traits() + { free(); } + struct sentry + { + sentry(const c_regex_traits&) + { c_regex_traits::update(); } + operator void*() { return this; } + }; + static void BOOST_RE_CALL update(); + static unsigned int BOOST_RE_CALL strnarrow(char *s1, unsigned int len, const wchar_t *s2); + static unsigned int BOOST_RE_CALL strwiden(wchar_t *s1, unsigned int len, const char *s2); +private: + static bool BOOST_RE_CALL do_iswclass(wchar_t c, jm_uintfast32_t f); + static void BOOST_RE_CALL free(); + static void BOOST_RE_CALL init(); + static bool BOOST_RE_CALL do_lookup_collate(std::basic_string& out, const wchar_t* first, const wchar_t* last); + static c_regex_traits init_; + + static unsigned sort_type; + static wchar_t sort_delim; +}; +#endif + +#if defined(_WIN32) && !defined(BOOST_RE_NO_W32) + +namespace re_detail{ + +struct BOOST_RE_IX_DECL w32_traits_base : public regex_traits_base +{ + enum{ + char_class_none = 0, + char_class_alnum = C1_ALPHA | C1_DIGIT, + char_class_alpha = C1_ALPHA, + char_class_cntrl = C1_CNTRL, + char_class_digit = C1_DIGIT, + char_class_graph = C1_UPPER | C1_LOWER | C1_DIGIT | C1_PUNCT | C1_ALPHA, + char_class_lower = C1_LOWER, + char_class_print = C1_UPPER | C1_LOWER | C1_DIGIT | C1_PUNCT | C1_BLANK | C1_ALPHA, + char_class_punct = C1_PUNCT, + char_class_space = C1_SPACE, + char_class_upper = C1_UPPER, + char_class_xdigit = C1_XDIGIT, + char_class_blank = C1_BLANK, + char_class_underscore = 0x0200, + char_class_word = C1_ALPHA | C1_DIGIT | char_class_underscore, + char_class_unicode = 0x0400 + }; +public: + static std::string set_message_catalogue(const std::string& s); +protected: + static char regex_message_catalogue[200]; + enum syntax_map_size + { + map_size = UCHAR_MAX + 1 + }; + + static unsigned char syntax_map[map_size]; + static unsigned short class_map[map_size]; + static char lower_case_map[map_size]; + + static jm_uintfast32_t BOOST_RE_CALL do_lookup_class(const char* p); + static bool BOOST_RE_CALL do_lookup_collate(std::string& buf, const char* p); + static void BOOST_RE_CALL do_free(); + static void BOOST_RE_CALL do_init(); +public: + static std::string error_string(unsigned id); + static char* get_catalogue() { return regex_message_catalogue; } +}; + +} // namespace re_detail + +template +class w32_regex_traits; + +template<> +class BOOST_RE_IX_DECL w32_regex_traits : public re_detail::w32_traits_base +{ + typedef re_detail::w32_traits_base base_type; +public: + typedef char char_type; + typedef unsigned char uchar_type; + typedef unsigned int size_type; + typedef std::string string_type; + typedef int locale_type; + + static size_t BOOST_RE_CALL length(const char_type* p) + { + return std::strlen(p); + } + static unsigned int BOOST_RE_CALL syntax_type(size_type c) + { + return syntax_map[c]; + } + static char BOOST_RE_CALL translate(char c, bool icase) + { + return icase ? lower_case_map[(size_type)(uchar_type)c] : c; + } + static void BOOST_RE_CALL transform(std::string& out, const std::string& in); + + static void BOOST_RE_CALL transform_primary(std::string& out, const std::string& in); + + static bool BOOST_RE_CALL is_separator(char c) + { + return BOOST_RE_MAKE_BOOL((c == '\n') || (c == '\r')); + } + + static bool BOOST_RE_CALL is_combining(char) + { + return false; + } + + static bool BOOST_RE_CALL is_class(char c, jm_uintfast32_t f) + { + return BOOST_RE_MAKE_BOOL(class_map[(size_type)(uchar_type)c] & f); + } + + static int BOOST_RE_CALL toi(char c); + static int BOOST_RE_CALL toi(const char*& first, const char* last, int radix); + + static jm_uintfast32_t BOOST_RE_CALL lookup_classname(const char* first, const char* last) + { + std::string s(first, last); + return do_lookup_class(s.c_str()); + } + + static bool BOOST_RE_CALL lookup_collatename(std::string& buf, const char* first, const char* last) + { + std::string s(first, last); + return do_lookup_collate(buf, s.c_str()); + } + + static locale_type imbue(locale_type l){ return l; } + locale_type BOOST_RE_CALL getloc()const{ return locale_type(); } + + struct sentry + { + sentry(const w32_regex_traits&) + { w32_regex_traits::update(); } + ~sentry(){} + operator void*() { return this; } + }; + static void update(); + w32_regex_traits(); + ~w32_regex_traits(); +private: + static w32_regex_traits i; +}; + +#ifndef BOOST_RE_NO_WCSTRING +template<> +class BOOST_RE_IX_DECL w32_regex_traits : public re_detail::w32_traits_base +{ + typedef re_detail::w32_traits_base base_type; +public: + typedef wchar_t char_type; + typedef unsigned short uchar_type; + typedef unsigned int size_type; + typedef std::basic_string string_type; + typedef int locale_type; + static size_t BOOST_RE_CALL length(const char_type* p) + { + return std::wcslen(p); + } + static unsigned int BOOST_RE_CALL syntax_type(size_type c); + static wchar_t BOOST_RE_CALL translate(wchar_t c, bool icase) + { + return icase ? ((c < 256) ? re_detail::wide_lower_case_map[(uchar_type)c] : wtolower(c)) : c; + } + + static void BOOST_RE_CALL transform(std::basic_string& out, const std::basic_string& in); + + static void BOOST_RE_CALL transform_primary(std::basic_string& out, const std::basic_string& in); + + static bool BOOST_RE_CALL is_separator(wchar_t c) + { + return BOOST_RE_MAKE_BOOL((c == L'\n') || (c == L'\r') || (c == (wchar_t)0x2028) || (c == (wchar_t)0x2029)); + } + + static bool BOOST_RE_CALL is_combining(wchar_t c) + { return re_detail::is_combining(c); } + + static bool BOOST_RE_CALL is_class(wchar_t c, jm_uintfast32_t f) + { + return BOOST_RE_MAKE_BOOL(((uchar_type)c < 256) ? (wide_unicode_classes[(size_type)(uchar_type)c] & f) : do_iswclass(c, f)); + } + + static int BOOST_RE_CALL toi(wchar_t c); + static int BOOST_RE_CALL toi(const wchar_t*& first, const wchar_t* last, int radix); + + static jm_uintfast32_t BOOST_RE_CALL lookup_classname(const wchar_t* first, const wchar_t* last); + + static bool BOOST_RE_CALL lookup_collatename(std::basic_string& s, const wchar_t* first, const wchar_t* last); + + static locale_type imbue(locale_type l){ return l; } + locale_type BOOST_RE_CALL getloc()const{ return locale_type(); } + + struct sentry + { + sentry(const w32_regex_traits&) + { w32_regex_traits::update(); } + ~sentry(){} + operator void*() { return this; } + }; + static void BOOST_RE_CALL update(); + w32_regex_traits(); + ~w32_regex_traits(); + static unsigned int BOOST_RE_CALL strnarrow(char *s1, unsigned int len, const wchar_t *s2); + static unsigned int BOOST_RE_CALL strwiden(wchar_t *s1, unsigned int len, const char *s2); + +private: + static bool BOOST_RE_CALL do_iswclass(wchar_t c, jm_uintfast32_t f); + static bool BOOST_RE_CALL do_lookup_collate(std::basic_string& out, const wchar_t* first, const wchar_t* last); + static w32_regex_traits init_; + static wchar_t BOOST_RE_CALL wtolower(wchar_t c); + static unsigned short wide_unicode_classes[]; +}; +#endif // Wide strings +#endif // Win32 + +#ifndef BOOST_RE_NO_LOCALE_H + +} // namspace boost + +#include + +namespace boost{ + +namespace re_detail +{ + +template +struct message_data; + +template <> +struct message_data; + +template <> +struct message_data; + +struct BOOST_RE_IX_DECL cpp_regex_traits_base : public regex_traits_base +{ + enum char_class_type + { + char_class_none = 0, + char_class_alnum = std::ctype_base::alnum, + char_class_alpha = std::ctype_base::alpha, + char_class_cntrl = std::ctype_base::cntrl, + char_class_digit = std::ctype_base::digit, + char_class_graph = std::ctype_base::graph, + char_class_lower = std::ctype_base::lower, + char_class_print = std::ctype_base::print, + char_class_punct = std::ctype_base::punct, + char_class_space = std::ctype_base::space, + char_class_upper = std::ctype_base::upper, + char_class_xdigit = std::ctype_base::xdigit, + char_class_blank = 1<<12, + char_class_underscore = 1<<13, + char_class_word = std::ctype_base::alnum | char_class_underscore, + char_class_unicode = 1<<14, + char_class_all_base = char_class_alnum | char_class_alpha | char_class_cntrl + | char_class_digit | char_class_graph | char_class_lower + | char_class_print | char_class_punct | char_class_space + | char_class_upper | char_class_xdigit + }; + + static std::string set_message_catalogue(const std::string& s); +protected: + static char regex_message_cat[200]; +}; + +} // namespace re_detail + +template +class cpp_regex_traits; + +template<> +class BOOST_RE_IX_DECL cpp_regex_traits : public re_detail::cpp_regex_traits_base +{ + typedef re_detail::cpp_regex_traits_base base_type; +private: + re_detail::message_data* pmd; + const unsigned char* psyntax; + char* lower_map; + const std::ctype* pctype; + const std::collate* pcollate; + std::locale locale_inst; + unsigned sort_type; + char sort_delim; + + cpp_regex_traits(const cpp_regex_traits&); + cpp_regex_traits& operator=(const cpp_regex_traits&); + +public: + typedef char char_type; + typedef unsigned char uchar_type; + typedef unsigned int size_type; + typedef std::string string_type; + typedef std::locale locale_type; + + cpp_regex_traits(); + ~cpp_regex_traits(); + + static size_t BOOST_RE_CALL length(const char_type* p) + { + return std::strlen(p); + } + unsigned int BOOST_RE_CALL syntax_type(size_type c)const + { + return psyntax[c]; + } + char BOOST_RE_CALL translate(char c, bool icase)const + { + return icase ? lower_map[(size_type)(uchar_type)c] : c; + } + void BOOST_RE_CALL transform(std::string& out, const std::string& in)const + { + out = pcollate->transform(in.c_str(), in.c_str() + in.size()).c_str(); + } + + void BOOST_RE_CALL transform_primary(std::string& out, const std::string& in)const; + + static bool BOOST_RE_CALL is_separator(char c) + { + return BOOST_RE_MAKE_BOOL((c == '\n') || (c == '\r')); + } + + static bool BOOST_RE_CALL is_combining(char) + { + return false; + } + + bool BOOST_RE_CALL is_class(char c, jm_uintfast32_t f)const + { + if(pctype->is((std::ctype::mask)(f & char_class_all_base), c)) + return true; + if((f & char_class_underscore) && (c == '_')) + return true; + if((f & char_class_blank) && ((c == ' ') || (c == '\t'))) + return true; + return false; + } + + int BOOST_RE_CALL toi(char c)const; + int BOOST_RE_CALL toi(const char*& first, const char* last, int radix)const; + + jm_uintfast32_t BOOST_RE_CALL lookup_classname(const char* first, const char* last)const; + bool BOOST_RE_CALL lookup_collatename(std::string& s, const char* first, const char* last)const; + + std::string BOOST_RE_CALL error_string(unsigned id)const; + locale_type BOOST_RE_CALL imbue(locale_type l); + locale_type BOOST_RE_CALL BOOST_RE_CALL getloc()const{ return locale_inst; } + + struct sentry + { + sentry(const cpp_regex_traits&){} + operator void*() { return this; } + }; +}; + +#ifndef BOOST_RE_NO_WCSTRING +template<> +class BOOST_RE_IX_DECL cpp_regex_traits : public re_detail::cpp_regex_traits_base +{ + typedef re_detail::cpp_regex_traits_base base_type; +public: + typedef wchar_t char_type; + typedef unsigned short uchar_type; + typedef unsigned int size_type; + typedef std::basic_string string_type; + typedef std::locale locale_type; + +private: + re_detail::message_data* pmd; + const unsigned char* psyntax; + wchar_t* lower_map; + const std::ctype* pctype; + const std::collate* pcollate; + const std::codecvt* pcdv; + std::locale locale_inst; + unsigned int BOOST_RE_CALL do_syntax_type(size_type c)const; + unsigned sort_type; + wchar_t sort_delim; + + cpp_regex_traits(const cpp_regex_traits&); + cpp_regex_traits& operator=(const cpp_regex_traits&); + +public: + + static size_t BOOST_RE_CALL length(const char_type* p) + { + return std::wcslen(p); + } + unsigned int BOOST_RE_CALL syntax_type(size_type c)const + { + return (c < UCHAR_MAX) ? psyntax[c] : do_syntax_type(c); + } + wchar_t BOOST_RE_CALL translate(wchar_t c, bool icase)const + { + return icase ? (((uchar_type)c) <= UCHAR_MAX) ? lower_map[c] : pctype->tolower(c) : c; + } + void BOOST_RE_CALL transform(std::basic_string& out, const std::basic_string& in)const + { + out = pcollate->transform(in.c_str(), in.c_str() + in.size()); + } + + void BOOST_RE_CALL transform_primary(std::basic_string& out, const std::basic_string& in)const; + + static bool BOOST_RE_CALL is_separator(wchar_t c) + { + return BOOST_RE_MAKE_BOOL((c == L'\n') || (c == L'\r') || (c == (wchar_t)0x2028) || (c == (wchar_t)0x2029)); + } + + static bool BOOST_RE_CALL is_combining(wchar_t c) + { return re_detail::is_combining(c); } + + bool BOOST_RE_CALL is_class(wchar_t c, jm_uintfast32_t f)const + { + if(pctype->is((std::ctype::mask)(f & char_class_all_base), c)) + return true; + if((f & char_class_underscore) && (c == '_')) + return true; + if((f & char_class_blank) && ((c == ' ') || (c == '\t'))) + return true; + if((f & char_class_unicode) && (c > (size_type)(uchar_type)255)) + return true; + return false; + } + + int BOOST_RE_CALL toi(wchar_t c)const; + int BOOST_RE_CALL toi(const wchar_t*& first, const wchar_t* last, int radix)const; + + jm_uintfast32_t BOOST_RE_CALL lookup_classname(const wchar_t* first, const wchar_t* last)const; + bool BOOST_RE_CALL lookup_collatename(std::basic_string& s, const wchar_t* first, const wchar_t* last)const; + + std::string BOOST_RE_CALL error_string(unsigned id)const; + cpp_regex_traits(); + ~cpp_regex_traits(); + locale_type BOOST_RE_CALL imbue(locale_type l); + locale_type BOOST_RE_CALL BOOST_RE_CALL getloc()const{ return locale_inst; } + unsigned int BOOST_RE_CALL strwiden(wchar_t *s1, unsigned int len, const char *s2)const; + + struct sentry + { + sentry(const cpp_regex_traits&){} + operator void*() { return this; } + }; +}; +#endif // BOOST_RE_NO_WCSTRING + +#endif // BOOST_RE_NO_LOCALE_H + +#ifdef BOOST_RE_LOCALE_W32 + +template +class regex_traits : public w32_regex_traits +{ +}; + +#elif defined(BOOST_RE_LOCALE_C) + +template +class regex_traits : public c_regex_traits +{ +}; + +#elif defined(BOOST_RE_LOCALE_CPP) + +template +class regex_traits : public cpp_regex_traits +{ +}; + +#else +#error No default localisation model defined +#endif + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + +} // namespace boost + +#endif // include + diff --git a/boost/boost/smart_ptr.hpp b/boost/boost/smart_ptr.hpp new file mode 100644 index 0000000000..162b458bd7 --- /dev/null +++ b/boost/boost/smart_ptr.hpp @@ -0,0 +1,394 @@ +// Boost smart_ptr.hpp header file -----------------------------------------// + +// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. Permission to copy, +// use, modify, sell and distribute this software is granted provided this +// copyright notice appears in all copies. This software is provided "as is" +// without express or implied warranty, and with no claim as to its +// suitability for any purpose. + +// See http://www.boost.org for most recent version including documentation. + +// Revision History +// 21 Jan 01 Suppress some useless warnings with MSVC (David Abrahams) +// 19 Oct 00 Make shared_ptr ctor from auto_ptr explicit. (Robert Vugts) +// 24 Jul 00 Change throw() to // never throws. See lib guidelines +// Exception-specification rationale. (Beman Dawes) +// 22 Jun 00 Remove #if continuations to fix GCC 2.95.2 problem (Beman Dawes) +// 1 Feb 00 Additional shared_ptr BOOST_NO_MEMBER_TEMPLATES workarounds +// (Dave Abrahams) +// 31 Dec 99 Condition tightened for no member template friend workaround +// (Dave Abrahams) +// 30 Dec 99 Moved BOOST_NMEMBER_TEMPLATES compatibility code to config.hpp +// (Dave Abrahams) +// 30 Nov 99 added operator ==, operator !=, and std::swap and std::less +// specializations for shared types (Darin Adler) +// 11 Oct 99 replaced op[](int) with op[](std::size_t) (Ed Brey, Valentin +// Bonnard), added shared_ptr workaround for no member template +// friends (Matthew Langston) +// 25 Sep 99 added shared_ptr::swap and shared_array::swap (Luis Coelho). +// 20 Jul 99 changed name to smart_ptr.hpp, #include , +// #include and use boost::noncopyable +// 17 May 99 remove scoped_array and shared_array operator*() as +// unnecessary (Beman Dawes) +// 14 May 99 reorder code so no effects when bad_alloc thrown (Abrahams/Dawes) +// 13 May 99 remove certain throw() specifiers to avoid generated try/catch +// code cost (Beman Dawes) +// 11 May 99 get() added, conversion to T* placed in macro guard (Valentin +// Bonnard, Dave Abrahams, and others argued for elimination +// of the automatic conversion) +// 28 Apr 99 #include fix (Valentin Bonnard) +// 28 Apr 99 rename transfer() to share() for clarity (Dave Abrahams) +// 28 Apr 99 remove unsafe shared_array template conversions(Valentin Bonnard) +// 28 Apr 99 p(r) changed to p(r.px) for clarity (Dave Abrahams) +// 21 Apr 99 reset() self assignment fix (Valentin Bonnard) +// 21 Apr 99 dispose() provided to improve clarity (Valentin Bonnard) +// 27 Apr 99 leak when new throws fixes (Dave Abrahams) +// 21 Oct 98 initial Version (Greg Colvin/Beman Dawes) + +#ifndef BOOST_SMART_PTR_HPP +#define BOOST_SMART_PTR_HPP + +#include // for broken compiler workarounds +#include // for std::size_t +#include // for std::auto_ptr +#include // for std::swap +#include // for boost::noncopyable +#include // for std::less + +namespace boost { + +// scoped_ptr --------------------------------------------------------------// + +// scoped_ptr mimics a built-in pointer except that it guarantees deletion +// of the object pointed to, either on destruction of the scoped_ptr or via +// an explicit reset(). scoped_ptr is a simple solution for simple needs; +// see shared_ptr (below) or std::auto_ptr if your needs are more complex. + +template class scoped_ptr : noncopyable { + + T* ptr; + + public: + typedef T element_type; + + explicit scoped_ptr( T* p=0 ) : ptr(p) {} // never throws + ~scoped_ptr() { delete ptr; } + + void reset( T* p=0 ) { if ( ptr != p ) { delete ptr; ptr = p; } } + T& operator*() const { return *ptr; } // never throws +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable:4284) // return type for 'identifier::operator->' is not a UDT or reference to a UDT. Will produce errors if applied using infix notation +#endif + T* operator->() const { return ptr; } // never throws +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + T* get() const { return ptr; } // never throws +#ifdef BOOST_SMART_PTR_CONVERSION + // get() is safer! Define BOOST_SMART_PTR_CONVERSION at your own risk! + operator T*() const { return ptr; } // never throws +#endif + }; // scoped_ptr + +// scoped_array ------------------------------------------------------------// + +// scoped_array extends scoped_ptr to arrays. Deletion of the array pointed to +// is guaranteed, either on destruction of the scoped_array or via an explicit +// reset(). See shared_array or std::vector if your needs are more complex. + +template class scoped_array : noncopyable { + + T* ptr; + + public: + typedef T element_type; + + explicit scoped_array( T* p=0 ) : ptr(p) {} // never throws + ~scoped_array() { delete [] ptr; } + + void reset( T* p=0 ) { if ( ptr != p ) {delete [] ptr; ptr=p;} } + + T* get() const { return ptr; } // never throws +#ifdef BOOST_SMART_PTR_CONVERSION + // get() is safer! Define BOOST_SMART_PTR_CONVERSION at your own risk! + operator T*() const { return ptr; } // never throws +#else + T& operator[](std::size_t i) const { return ptr[i]; } // never throws +#endif + }; // scoped_array + +// shared_ptr --------------------------------------------------------------// + +// An enhanced relative of scoped_ptr with reference counted copy semantics. +// The object pointed to is deleted when the last shared_ptr pointing to it +// is destroyed or reset. + +template class shared_ptr { + public: + typedef T element_type; + + explicit shared_ptr(T* p =0) : px(p) { + try { pn = new long(1); } // fix: prevent leak if new throws + catch (...) { delete p; throw; } + } + + shared_ptr(const shared_ptr& r) : px(r.px) { ++*(pn = r.pn); } // never throws + + ~shared_ptr() { dispose(); } + + shared_ptr& operator=(const shared_ptr& r) { + share(r.px,r.pn); + return *this; + } + +#if !defined( BOOST_NO_MEMBER_TEMPLATES ) + template + shared_ptr(const shared_ptr& r) : px(r.px) { // never throws + ++*(pn = r.pn); + } +#ifndef BOOST_NO_AUTO_PTR + template + explicit shared_ptr(std::auto_ptr& r) { + pn = new long(1); // may throw + px = r.release(); // fix: moved here to stop leak if new throws + } +#endif + + template + shared_ptr& operator=(const shared_ptr& r) { + share(r.px,r.pn); + return *this; + } + +#ifndef BOOST_NO_AUTO_PTR + template + shared_ptr& operator=(std::auto_ptr& r) { + // code choice driven by guarantee of "no effect if new throws" + if (*pn == 1) { delete px; } + else { // allocate new reference counter + long * tmp = new long(1); // may throw + --*pn; // only decrement once danger of new throwing is past + pn = tmp; + } // allocate new reference counter + px = r.release(); // fix: moved here so doesn't leak if new throws + return *this; + } +#endif +#else +#ifndef BOOST_NO_AUTO_PTR + explicit shared_ptr(std::auto_ptr& r) { + pn = new long(1); // may throw + px = r.release(); // fix: moved here to stop leak if new throws + } + + shared_ptr& operator=(std::auto_ptr& r) { + // code choice driven by guarantee of "no effect if new throws" + if (*pn == 1) { delete px; } + else { // allocate new reference counter + long * tmp = new long(1); // may throw + --*pn; // only decrement once danger of new throwing is past + pn = tmp; + } // allocate new reference counter + px = r.release(); // fix: moved here so doesn't leak if new throws + return *this; + } +#endif +#endif + + void reset(T* p=0) { + if ( px == p ) return; // fix: self-assignment safe + if (--*pn == 0) { delete px; } + else { // allocate new reference counter + try { pn = new long; } // fix: prevent leak if new throws + catch (...) { + ++*pn; // undo effect of --*pn above to meet effects guarantee + delete p; + throw; + } // catch + } // allocate new reference counter + *pn = 1; + px = p; + } // reset + + T& operator*() const { return *px; } // never throws +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable:4284) // return type for 'identifier::operator->' is not a UDT or reference to a UDT. Will produce errors if applied using infix notation +#endif + T* operator->() const { return px; } // never throws +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + T* get() const { return px; } // never throws + #ifdef BOOST_SMART_PTR_CONVERSION + // get() is safer! Define BOOST_SMART_PTR_CONVERSION at your own risk! + operator T*() const { return px; } // never throws + #endif + + long use_count() const { return *pn; } // never throws + bool unique() const { return *pn == 1; } // never throws + + void swap(shared_ptr& other) // never throws + { std::swap(px,other.px); std::swap(pn,other.pn); } + +// Tasteless as this may seem, making all members public allows member templates +// to work in the absence of member template friends. (Matthew Langston) +// Don't split this line into two; that causes problems for some GCC 2.95.2 builds +#if defined(BOOST_NO_MEMBER_TEMPLATES) || !defined( BOOST_NO_MEMBER_TEMPLATE_FRIENDS ) + private: +#endif + + T* px; // contained pointer + long* pn; // ptr to reference counter + +// Don't split this line into two; that causes problems for some GCC 2.95.2 builds +#if !defined( BOOST_NO_MEMBER_TEMPLATES ) && !defined( BOOST_NO_MEMBER_TEMPLATE_FRIENDS ) + template friend class shared_ptr; +#endif + + void dispose() { if (--*pn == 0) { delete px; delete pn; } } + + void share(T* rpx, long* rpn) { + if (pn != rpn) { + dispose(); + px = rpx; + ++*(pn = rpn); + } + } // share +}; // shared_ptr + +template + inline bool operator==(const shared_ptr& a, const shared_ptr& b) + { return a.get() == b.get(); } + +template + inline bool operator!=(const shared_ptr& a, const shared_ptr& b) + { return a.get() != b.get(); } + +// shared_array ------------------------------------------------------------// + +// shared_array extends shared_ptr to arrays. +// The array pointed to is deleted when the last shared_array pointing to it +// is destroyed or reset. + +template class shared_array { + public: + typedef T element_type; + + explicit shared_array(T* p =0) : px(p) { + try { pn = new long(1); } // fix: prevent leak if new throws + catch (...) { delete [] p; throw; } + } + + shared_array(const shared_array& r) : px(r.px) // never throws + { ++*(pn = r.pn); } + + ~shared_array() { dispose(); } + + shared_array& operator=(const shared_array& r) { + if (pn != r.pn) { + dispose(); + px = r.px; + ++*(pn = r.pn); + } + return *this; + } // operator= + + void reset(T* p=0) { + if ( px == p ) return; // fix: self-assignment safe + if (--*pn == 0) { delete [] px; } + else { // allocate new reference counter + try { pn = new long; } // fix: prevent leak if new throws + catch (...) { + ++*pn; // undo effect of --*pn above to meet effects guarantee + delete [] p; + throw; + } // catch + } // allocate new reference counter + *pn = 1; + px = p; + } // reset + + T* get() const { return px; } // never throws + #ifdef BOOST_SMART_PTR_CONVERSION + // get() is safer! Define BOOST_SMART_PTR_CONVERSION at your own risk! + operator T*() const { return px; } // never throws + #else + T& operator[](std::size_t i) const { return px[i]; } // never throws + #endif + + long use_count() const { return *pn; } // never throws + bool unique() const { return *pn == 1; } // never throws + + void swap(shared_array& other) // never throws + { std::swap(px,other.px); std::swap(pn,other.pn); } + + private: + + T* px; // contained pointer + long* pn; // ptr to reference counter + + void dispose() { if (--*pn == 0) { delete [] px; delete pn; } } + +}; // shared_array + +template + inline bool operator==(const shared_array& a, const shared_array& b) + { return a.get() == b.get(); } + +template + inline bool operator!=(const shared_array& a, const shared_array& b) + { return a.get() != b.get(); } + +} // namespace boost + +// specializations for things in namespace std -----------------------------// + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +namespace std { + +// Specialize std::swap to use the fast, non-throwing swap that's provided +// as a member function instead of using the default algorithm which creates +// a temporary and uses assignment. + +template + inline void swap(boost::shared_ptr& a, boost::shared_ptr& b) + { a.swap(b); } + +template + inline void swap(boost::shared_array& a, boost::shared_array& b) + { a.swap(b); } + +// Specialize std::less so we can use shared pointers and arrays as keys in +// associative collections. + +// It's still a controversial question whether this is better than supplying +// a full range of comparison operators (<, >, <=, >=). + +template + struct less< boost::shared_ptr > + : binary_function, boost::shared_ptr, bool> + { + bool operator()(const boost::shared_ptr& a, + const boost::shared_ptr& b) const + { return less()(a.get(),b.get()); } + }; + +template + struct less< boost::shared_array > + : binary_function, boost::shared_array, bool> + { + bool operator()(const boost::shared_array& a, + const boost::shared_array& b) const + { return less()(a.get(),b.get()); } + }; + +} // namespace std + +#endif // ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +#endif // BOOST_SMART_PTR_HPP + + diff --git a/boost/config.guess b/boost/config.guess new file mode 100755 index 0000000000..0ce538bb85 --- /dev/null +++ b/boost/config.guess @@ -0,0 +1,1183 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 +# Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Written by Per Bothner . +# Please send patches to . +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit system type (host/target name). +# +# Only a few systems have been added to this list; please add others +# (but try to keep the structure clean). +# + +# Use $HOST_CC if defined. $CC may point to a cross-compiler +if test x"$CC_FOR_BUILD" = x; then + if test x"$HOST_CC" != x; then + CC_FOR_BUILD="$HOST_CC" + else + if test x"$CC" != x; then + CC_FOR_BUILD="$CC" + else + CC_FOR_BUILD=cc + fi + fi +fi + + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 8/24/94.) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15 + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # Netbsd (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # Determine the machine/vendor (is the vendor relevant). + case "${UNAME_MACHINE}" in + amiga) machine=m68k-cbm ;; + arm32) machine=arm-unknown ;; + atari*) machine=m68k-atari ;; + sun3*) machine=m68k-sun ;; + mac68k) machine=m68k-apple ;; + macppc) machine=powerpc-apple ;; + hp3[0-9][05]) machine=m68k-hp ;; + ibmrt|romp-ibm) machine=romp-ibm ;; + *) machine=${UNAME_MACHINE}-unknown ;; + esac + # The Operating System including object format. + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + # The OS release + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + cat <$dummy.s + .data +\$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text + .globl main + .align 4 + .ent main +main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `./$dummy` in + 0-0) + UNAME_MACHINE="alpha" + ;; + 1-0) + UNAME_MACHINE="alphaev5" + ;; + 1-1) + UNAME_MACHINE="alphaev56" + ;; + 1-101) + UNAME_MACHINE="alphapca56" + ;; + 2-303) + UNAME_MACHINE="alphaev6" + ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; + esac + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-cbm-sysv4 + exit 0;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + arc64:OpenBSD:*:*) + echo mips64el-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hkmips:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + atari*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + sun3*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy \ + && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i?86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:4) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` + if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=4.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + rm -f $dummy.c $dummy + esac + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i?86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + hppa*:OpenBSD:*:*) + echo hppa-unknown-openbsd + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*X-MP:*:*:*) + echo xmp-cray-unicos + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY-2:*:*:*) + echo cray2-cray-unicos + exit 0 ;; + F300:UNIX_System_V:*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + F301:UNIX_System_V:*:*) + echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + i?86:BSD/386:*:* | i?86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i386-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + *:Linux:*:*) + + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + ld_help_string=`cd /; ld --help 2>&1` + ld_supported_emulations=`echo $ld_help_string \ + | sed -ne '/supported emulations:/!d + s/[ ][ ]*/ /g + s/.*supported emulations: *// + s/ .*// + p'` + case "$ld_supported_emulations" in + *ia64) + echo "${UNAME_MACHINE}-unknown-linux" + exit 0 + ;; + i?86linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 + ;; + elf_i?86) + echo "${UNAME_MACHINE}-pc-linux" + exit 0 + ;; + i?86coff) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 + ;; + sparclinux) + echo "${UNAME_MACHINE}-unknown-linux-gnuaout" + exit 0 + ;; + armlinux) + echo "${UNAME_MACHINE}-unknown-linux-gnuaout" + exit 0 + ;; + elf32arm*) + echo "${UNAME_MACHINE}-unknown-linux-gnuoldld" + exit 0 + ;; + armelf_linux*) + echo "${UNAME_MACHINE}-unknown-linux-gnu" + exit 0 + ;; + m68klinux) + echo "${UNAME_MACHINE}-unknown-linux-gnuaout" + exit 0 + ;; + elf32ppc | elf32ppclinux) + # Determine Lib Version + cat >$dummy.c < +#if defined(__GLIBC__) +extern char __libc_version[]; +extern char __libc_release[]; +#endif +main(argc, argv) + int argc; + char *argv[]; +{ +#if defined(__GLIBC__) + printf("%s %s\n", __libc_version, __libc_release); +#else + printf("unkown\n"); +#endif + return 0; +} +EOF + LIBC="" + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null + if test "$?" = 0 ; then + ./$dummy | grep 1\.99 > /dev/null + if test "$?" = 0 ; then + LIBC="libc1" + fi + fi + rm -f $dummy.c $dummy + echo powerpc-unknown-linux-gnu${LIBC} + exit 0 + ;; + esac + + if test "${UNAME_MACHINE}" = "alpha" ; then + cat <$dummy.s + .data + \$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text + .globl main + .align 4 + .ent main + main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + LIBC="" + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `./$dummy` in + 0-0) + UNAME_MACHINE="alpha" + ;; + 1-0) + UNAME_MACHINE="alphaev5" + ;; + 1-1) + UNAME_MACHINE="alphaev56" + ;; + 1-101) + UNAME_MACHINE="alphapca56" + ;; + 2-303) + UNAME_MACHINE="alphaev6" + ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; + esac + + objdump --private-headers $dummy | \ + grep ld.so.1 > /dev/null + if test "$?" = 0 ; then + LIBC="libc1" + fi + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 + elif test "${UNAME_MACHINE}" = "mips" ; then + cat >$dummy.c < /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif +#ifdef __MIPSEB__ + printf ("%s-unknown-linux-gnu\n", argv[1]); +#endif +#ifdef __MIPSEL__ + printf ("%sel-unknown-linux-gnu\n", argv[1]); +#endif + return 0; +} +EOF + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + elif test "${UNAME_MACHINE}" = "s390"; then + echo s390-ibm-linux && exit 0 + else + # Either a pre-BFD a.out linker (linux-gnuoldld) + # or one that does not give us useful --help. + # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. + # If ld does not provide *any* "supported emulations:" + # that means it is gnuoldld. + echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:" + test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 + + case "${UNAME_MACHINE}" in + i?86) + VENDOR=pc; + ;; + *) + VENDOR=unknown; + ;; + esac + # Determine whether the default compiler is a.out or elf + cat >$dummy.c < +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif +#ifdef __ELF__ +# ifdef __GLIBC__ +# if __GLIBC__ >= 2 + printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); +# else + printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); +# endif +# else + printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); +# endif +#else + printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); +#endif + return 0; +} +EOF + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + fi ;; +# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions +# are messed up and put the nodename in both sysname and nodename. + i?86:DYNIX/ptx:4*:*) + echo i386-sequent-sysv4 + exit 0 ;; + i?86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i?86:*:5:7*) + # Fixed at (any) Pentium or better + UNAME_MACHINE=i586 + if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then + echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} + fi + exit 0 ;; + i?86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + i?86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:*:6*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + echo `uname -p`-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + if test "${UNAME_MACHINE}" = "x86pc"; then + UNAME_MACHINE=pc + fi + echo `uname -p`-${UNAME_MACHINE}-nto-qnx + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-W:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +#if !defined (ultrix) + printf ("vax-dec-bsd\n"); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0 +rm -f $dummy.c $dummy + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +#echo '(Unable to guess system type)' 1>&2 + +exit 1 diff --git a/boost/config.sub b/boost/config.sub new file mode 100755 index 0000000000..c8e77851e6 --- /dev/null +++ b/boost/config.sub @@ -0,0 +1,1268 @@ +#! /bin/sh +# Configuration validation subroutine script, version 1.1. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 +# Free Software Foundation, Inc. +# +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Written by Per Bothner . +# Please send patches to . +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +if [ x$1 = x ] +then + echo Configuration name missing. 1>&2 + echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 + echo "or $0 ALIAS" 1>&2 + echo where ALIAS is a recognized configuration type. 1>&2 + exit 1 +fi + +# First pass through any local machine types. +case $1 in + *local*) + echo $1 + exit 0 + ;; + *) + ;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ + | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \ + | 580 | i960 | h8300 \ + | x86 | ppcbe | mipsbe | mipsle | shbe | shle | armbe | armle \ + | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ + | hppa64 \ + | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \ + | alphaev6[78] \ + | we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \ + | 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \ + | mips64orion | mips64orionel | mipstx39 | mipstx39el \ + | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ + | mips64vr5000 | miprs64vr5000el | mcore \ + | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \ + | thumb | d10v | fr30 | avr) + basic_machine=$basic_machine-unknown + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i[34567]86) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + # FIXME: clean up the formatting here. + vax-* | tahoe-* | i[34567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ + | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ + | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ + | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ + | xmp-* | ymp-* \ + | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* | armbe-* | armle-* \ + | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \ + | hppa2.0n-* | hppa64-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \ + | alphaev6[78]-* \ + | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ + | clipper-* | orion-* \ + | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ + | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \ + | mips64el-* | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ + | mipstx39-* | mipstx39el-* | mcore-* \ + | f301-* | armv*-* | s390-* | sv1-* | t3e-* \ + | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ + | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* \ + | bs2000-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-cbm + ;; + amigaos | amigados) + basic_machine=m68k-cbm + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-cbm + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | ymp) + basic_machine=ymp-cray + os=-unicos + ;; + cray2) + basic_machine=cray2-cray + os=-unicos + ;; + [ctj]90-cray) + basic_machine=c90-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i[34567]86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i[34567]86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i[34567]86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i[34567]86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + i386-go32 | go32) + basic_machine=i386-unknown + os=-go32 + ;; + i386-mingw32 | mingw32) + basic_machine=i386-unknown + os=-mingw32 + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mipsel*-linux*) + basic_machine=mipsel-unknown + os=-linux-gnu + ;; + mips*-linux*) + basic_machine=mips-unknown + os=-linux-gnu + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + msdos) + basic_machine=i386-unknown + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexen) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86) + basic_machine=i686-pc + ;; + pentiumii | pentium2) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexen-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=rs6000-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sparclite-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=t3e-cray + os=-unicos + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xmp) + basic_machine=xmp-cray + os=-unicos + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + mips) + if [ x$os = x-linux-gnu ]; then + basic_machine=mips-unknown + else + basic_machine=mips-mips + fi + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sparc | sparcv9) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + c4x*) + basic_machine=c4x-none + os=-coff + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i[34567]86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto*) + os=-nto-qnx + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -*MiNT) + os=-mint + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f301-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -*MiNT) + vendor=atari + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os diff --git a/boost/configure.in b/boost/configure.in new file mode 100644 index 0000000000..e962d8a570 --- /dev/null +++ b/boost/configure.in @@ -0,0 +1,1765 @@ +dnl Process with autoconf to generate configure script -*- sh -*- + +AC_INIT(boost/config.hpp) +AC_PREREQ(2.13) dnl We want to use autoconf 2.13 +AM_CONFIG_HEADER(boost/config.h) + +dnl This is a trick to make autoheader do the right thing +dnl AM_CONFIG_HEADER(boost/config.h) + +AC_CANONICAL_SYSTEM +AC_VALIDATE_CACHE_SYSTEM_TYPE + +AM_INIT_AUTOMAKE(boost, 0.1lyx) + +### Check for programs +AC_PROG_MAKE_SET +AC_PROG_INSTALL + +# Work around a problem in automake 1.4: when invoking install-strip, +# INSTALL_PROGRAM is changed to 'install -s', and since +# INSTALL_SCRIPT==INSTALL_PROGRAM, we get errors with fileutils-4.0 +# which returns an error condition when stripping fails. +INSTALL_SCRIPT='${INSTALL}' + +### we will also need a C compiler to compile GNU gettext +AC_PROG_CC + +### check for special systems +AC_ISC_POSIX +AC_AIX + +### Check for program extensions (.exe or nothing) +AC_EXEEXT + +### Check for a C++ compiler +AC_LANG_CPLUSPLUS +AC_PROG_CXX +AC_PROG_CXXCPP +AC_DISABLE_SHARED +AC_LIBTOOL_WIN32_DLL +AM_PROG_LIBTOOL + +#################################################### +#################################################### +#################################################### + +AC_DEFINE(BOOST_RE_AUTO_CONFIGURE, []) +dnl Disable any caching here +define([AC_CACHE_LOAD], )dnl +define([AC_CACHE_SAVE], )dnl + +AC_MSG_RESULT(*** $0: regex++ configuration utility ***) +if test "${CXXFLAGS}" = ""; then +AC_MSG_RESULT(* Note: for best reliability - try \"CXXFLAGS=-treat_warnings_as_errors\" $0 ) +AC_MSG_RESULT(* Please don't forget specifying typical CXXFLAGS you'll be using - ) +AC_MSG_RESULT(* such as that enabling exceptions handling, etc. ) +AC_MSG_RESULT(* Add option forcing instantiation of all templates to CXXFLAGS if possible. ) +AC_MSG_RESULT(* Add option enabling merging of template instances between translation units) +AC_MSG_RESULT(* to CXXFLAGS if possible. ) +fi +AC_MSG_RESULT(Please stand by while exploring compiler capabilities...) +AC_MSG_RESULT(Be patient - this could take some time...) +AC_MSG_RESULT(***) + +AC_ARG_ENABLE(extension,[--enable-extension=], +[ +case "$enableval" in + no) AC_MSG_RESULT(Info :.cpp used as extension for tests) + ac_ext=cpp + ;; + *) AC_MSG_RESULT(Argument : .$enableval used as extension) + ac_ext=$enableval +esac +], +[AC_MSG_RESULT(Info : .cpp used as extension for tests) + ac_ext=cpp +] +) + +AC_ARG_ENABLE(sizeof-short, [--enable-sizeof-short=], [], [enable_sizeof_short=2]) +AC_ARG_ENABLE(sizeof-int, [--enable-sizeof-int=], [], [enable_sizeof_int=4]) +AC_ARG_ENABLE(sizeof-long, [--enable-sizeof-long=], [], [enable_sizeof_long=4]) +AC_ARG_ENABLE(force-cross, [--enable-force-cross forces cross compile mode]) + + +# Save that, as it is being redefined several times +use_ac_ext=$ac_ext + +AC_LANG_CPLUSPLUS +ac_ext=$use_ac_ext + +AC_MSG_CHECKING(for object file extention) +cat > "xyqtcz.$ac_ext" << EOF + +int main() +{ +} + +EOF + +if eval "$CXX $CXXFLAGS -c xyqtcz.$ac_ext"; then +rm -f "xyqtcz.$ac_ext" +ac_obj_ext=`find xyqtcz.* | sed 's/xyqtcz\(.*\)/\1/g'` +AC_MSG_RESULT(yes - $ac_obj_ext) +rm -f "xyqtcz$ac_obj_ext" + +else + +AC_MSG_RESULT(no - could not create or find object file, defaulting to .o) +rm -f "xyqtcz.$ac_ext" +ac_obj_ext='.o' + +fi + +AC_MSG_CHECKING(for executable file extention) +ac_exe_ext="" +for file in /bin/sh.* +do + +if test -x "$file"; then +ac_exe_ext=`echo "$file" | sed 's/\/bin\/sh\(.*\)/\1/g'` +fi + +done + +AC_MSG_RESULT(yes - $ac_exe_ext) +AC_SUBST(ac_exe_ext) +AC_SUBST(ac_obj_ext) + + +# +# determine machine word sizes +# and set BOOST_RE_INT32 to be the +# equivalent of intfast32_t in +# +if test "$enable_force_cross" = "yes"; then +cross_compiling="yes" +echo forced cross compilation mode turned on +fi + +AC_CHECK_SIZEOF(short,"$enable_sizeof_short") +ac_ext=$use_ac_ext +AC_CHECK_SIZEOF(int,"$enable_sizeof_int") +ac_ext=$use_ac_ext +AC_CHECK_SIZEOF(long,"$enable_sizeof_long") +ac_ext=$use_ac_ext + +AC_DEFINE_UNQUOTED(BOOST_RE_SIZEOF_SHORT, [$ac_cv_sizeof_short]) +AC_DEFINE_UNQUOTED(BOOST_RE_SIZEOF_INT, [$ac_cv_sizeof_int]) +AC_DEFINE_UNQUOTED(BOOST_RE_SIZEOF_LONG, [$ac_cv_sizeof_long]) + + +if test "$ac_cv_sizeof_int" -lt 4; then + if test "$ac_cv_sizeof_long" -ge 4; then + AC_DEFINE(BOOST_RE_INT32_LONG) + else + AC_MSG_ERROR(Cannot find any 32-bit integer type for your compiler) + fi + ac_ext=$use_ac_ext +fi +ac_ext=$use_ac_ext + + +ac_ext=$use_ac_ext + +dnl checking for compiler capabilities +AC_MSG_CHECKING(for basic template compatibility) +AC_TRY_LINK( [ +template +struct binary_function { + typedef Arg1 first_argument_type; + typedef Arg2 second_argument_type; + typedef Result result_type; +}; +template +struct plus : public binary_function { + T operator()(const T& x, const T& y) const; +}; + +// +// non-inline +// link will fail if template is not instantiated +// +template +T plus::operator()(const T& x, const T& y) const +{ return x + y; } + +plus p; +], +[ +// check member function is actually instantiated +int i, j, k; +i = p(k, j); +], +[ac_cv_compat="yes"], +[AC_MSG_ERROR(Your compiler won't be able to compile this implementation. Sorry.) + ac_cv_compat="no"] +) +AC_MSG_RESULT($ac_cv_compat) + +AC_MSG_CHECKING(for exception support) +AC_TRY_COMPILE( +[ +#include + +int f1()throw() +{ + return 23; +} + +void do_throw() +{ + throw (int)25; +} +], +[ + try + { + f1(); + do_throw(); + } + catch(int i) + { + } + catch(...) + { + } +], +[AC_MSG_RESULT(yes)], +[AC_MSG_RESULT(no) +AC_MSG_ERROR(Sorry, without exception handling you can't compile this library)]) + + +AC_ARG_ENABLE(mutable, [--disable-mutable turns off mutable support]) +if test "$enable_mutable" = "no"; then +AC_DEFINE(BOOST_RE_NO_MUTABLE, []) +else + +AC_MSG_CHECKING(for mutable keyword) +AC_TRY_COMPILE( +[ +#include + +class foo +{ + mutable int val; + public: + foo(int i) : val(i) {} + void set(int i)const; +}; + +void foo::set(int i)const +{ + val = i; +} +], +[ + const foo f(4); + f.set(3); +], +[AC_MSG_RESULT(yes)], +[AC_DEFINE(BOOST_RE_NO_MUTABLE, []) AC_MSG_RESULT(no)]) +fi + +AC_MSG_CHECKING(for default template parameter support) +AC_TRY_COMPILE( +[ +#include + +template +struct foo +{ + T val; + U alt; +}; +], +[ + foo f1; + foo f2; + foo f3; + foo f4; +], +[AC_MSG_RESULT(yes)], +[AC_MSG_ERROR(Sorry: you can't compile this library)]) + +AC_MSG_CHECKING(for derived default template parameter support) +AC_TRY_COMPILE( +[ +#include + +template +class inner +{ +public: + typedef T inner_type; +}; + +template > +struct foo +{ + T val; + U alt; +}; +], +[ + foo > f1; + foo > f2; + foo f3; + foo f4; +], +[AC_MSG_RESULT(yes)], +[AC_MSG_ERROR(Sorry, you can't compile this library)]) + + +AC_MSG_CHECKING([for function template partial ordering]) +AC_TRY_COMPILE( +[ +#include + +template +struct dummy{}; + +struct dummy2 +{ + int result()const { return 1; } +}; + +template +int foo(const T& t) +{ return t.result(); } + +template +int foo(const dummy& ) +{ return 0; } + +], +[ + dummy d; + dummy2 d2; + int i = foo(d); + i = foo(d2); +], +[AC_MSG_RESULT(yes)], +[AC_DEFINE(BOOST_RE_NO_PARTIAL_FUNC_SPEC, []) AC_MSG_RESULT(no)]) + +AC_MSG_CHECKING([for template friend functions]) +AC_TRY_COMPILE( +[ +#include + +template +void foo(T2 t); + +template +struct dummy +{ + template friend void foo(T2); +private: + void foo2(); + void foo3()const; +}; + +template +void foo(T2 t) +{ + dummy d1; + d1.foo2(); + d1.foo3(); + dummy d2; + d2.foo2(); + d2.foo3(); +} + + +], +[ + foo(3); + foo(2.345); +], +[AC_MSG_RESULT(yes)], +[AC_DEFINE(BOOST_RE_NO_TEMPLATE_FRIEND, []) AC_MSG_RESULT(no)]) + + + +AC_ARG_ENABLE(ms-windows, [--disable-ms-windows turns off native MS Windows support (when available)]) +AC_ARG_ENABLE(threads, [--disable-threads turns off multi-threading support (when available)]) +if test "$enable_ms_windows" != "no"; then + +AC_MSG_CHECKING(for MS Windows) +AC_TRY_COMPILE( +[ +#include + +#if defined(__GNUC__) && (__GNUC_MINOR__ == 95) && (__GNUC__ == 2) +#error can't mix STL code with due to bug in gcc2.95.x +#endif + + +], +[ + int i = GetVersion(); +], +[iswin="true" +AC_DEFINE(BOOST_RE_PLATFORM_WINDOWS, []) +AC_MSG_RESULT(yes)], +[AC_MSG_RESULT(no) +enable_ms_windows="no"] +) +fi + +if test "$enable_ms_windows" != "no"; then +dnl Ok check for Win32, then linkage: +AC_MSG_CHECKING(for MS Win32) +AC_TRY_COMPILE( +[ +#include + +CRITICAL_SECTION cs; +], +[ + InitializeCriticalSection(&cs); + EnterCriticalSection(&cs); + LeaveCriticalSection(&cs); + DeleteCriticalSection(&cs); +], +[AC_MSG_RESULT(yes)], +[AC_MSG_RESULT(no) +enable_ms_windows="no"] +) +fi + +if test "$enable_ms_windows" != "no"; then + +if test "$CXX" != "cl"; then +AC_CHECK_LIB(user32, main, [LIBS="$LIBS -luser32"], []) +AC_CHECK_LIB(kernel32, main, [LIBS="$LIBS -lkernel32"], []) +fi + +AC_TRY_LINK( +[ +#include + +CRITICAL_SECTION cs; +], +[ + InitializeCriticalSection(&cs); + EnterCriticalSection(&cs); + LeaveCriticalSection(&cs); + DeleteCriticalSection(&cs); + HeapAlloc(0, 0, 20); + CharLower((LPTSTR)0); + LoadString(0, 0, 0, 0); +], +[ +if test "enable_threads" != "no"; then +# turn on threading support: +AC_MSG_CHECKING(for mult-thread support) +AC_MSG_RESULT("yes") +AC_DEFINE(BOOST_RE_THREADS, []) +AC_DEFINE(BOOST_RE_PLATFORM_W32, []) +fi +], +[ +# bu**er, windows is present but we can't link +AC_MSG_WARN([ + MS Win32 seems to be present, but we can't link, + or find the default library names for kernal32.dll + and user32.dll. + $0 is disabling MS Windows support, re-run $0 with + the environment variable "LIBS" set to the library + files required to re-enable Win32 support.]) +enable_ms_windows="no" +] +) + + +fi + + +if test "$iswin" != "true"; then + +AC_MSG_CHECKING(for MS DOS) +AC_TRY_COMPILE( +[ +#include +], +[ + int i = _doserrno; +], +[AC_DEFINE(BOOST_RE_PLATFORM_DOS, []) AC_MSG_RESULT(yes)], +[AC_MSG_RESULT(no)]) + +fi + + +AC_MSG_CHECKING(for bool support) +AC_TRY_COMPILE( +[ +], +[ + bool i = true; +], +[AC_MSG_RESULT(yes)], +[AC_DEFINE(BOOST_RE_NO_BOOL,[]) +AC_MSG_RESULT(no)]) + + +AC_ARG_ENABLE(wstring, [--disable-wstring turns off wide character string support]) + +if test "$enable_wstring" = "no"; then +AC_DEFINE(BOOST_RE_NO_WCHAR_H, []) +else + +AC_MSG_CHECKING(for ) +AC_TRY_LINK( +[ +#include +], +[ +], +[AC_MSG_RESULT(yes)], +[AC_DEFINE(BOOST_RE_NO_WCHAR_H,[]) +AC_MSG_RESULT(no)] +) +fi + +if test "$enable_wstring" = "no"; then +AC_DEFINE(BOOST_RE_NO_WCTYPE_H, []) +else + +AC_MSG_CHECKING(for ) +AC_TRY_LINK( +[ +#include +], +[ +], +[AC_MSG_RESULT(yes)], +[AC_DEFINE(BOOST_RE_NO_WCTYPE_H,[]) +AC_MSG_RESULT(no)] +) +fi + + +if test "$enable_wstring" = "no"; then +AC_DEFINE(BOOST_RE_NO_WCSTRING, []) +else + +AC_MSG_CHECKING(for wide string functions) +AC_TRY_LINK( +[ +#include "confdefs.h" +#ifndef BOOST_RE_NO_WCHAR_H +#include +#endif +#ifndef BOOST_RE_NO_WCTYPE_H +#include +#endif +#include +#include +#include +#include +#include +template class std::basic_string; +], +[ + using namespace std; + wchar_t c[50]; + char d[50]; + wcscpy(c, L"abcd"); + wcscmp(L"", L""); + wcslen(L""); + wcsxfrm(0, L"", 0); + wcstombs(d, L"", 0); + mbstowcs(c, "", 0); + iswlower(L'c'); +], +[AC_MSG_RESULT(yes)] +enable_wstring="yes", +[AC_DEFINE(BOOST_RE_NO_WCSTRING,[]) +AC_MSG_RESULT(no)] +enable_wstring="no") +fi + +if test "$enable_wstring" != "no"; then +AC_MSG_CHECKING(for swprintf support) +AC_TRY_LINK( +[ +#include "confdefs.h" +#ifndef BOOST_RE_NO_WCHAR_H +#include +#endif +#ifndef BOOST_RE_NO_WCTYPE_H +#include +#endif +#include +#include +], +[ + wchar_t c[50]; + swprintf(c, 50, L"abcd"); +], +[AC_MSG_RESULT(yes)], +[AC_DEFINE(BOOST_RE_NO_SWPRINTF,[]) +AC_MSG_RESULT(no)] +enable_swprintf="no") +fi + + +AC_ARG_ENABLE(member-templates, [--disable-member-templates turns off member template class and function support]) +if test "$enable_member_templates" = "no"; then +AC_DEFINE(BOOST_RE_NO_MEMBER_TEMPLATES, []) +else + +AC_MSG_CHECKING(for member template classes and functions) +AC_TRY_COMPILE( +[ + +template +class alloc +{ +public: + void* allocate(int); + void deallocate(void*); + alloc(); + alloc(const alloc&); + template + alloc(const alloc&) {} + alloc& operator=(const alloc&); + template + alloc& operator=(const alloc&) + { return *this; } + + template + struct rebind + { + typedef alloc other; + }; +}; + +], +[ + alloc ia; + alloc da(ia); + alloc fa; + fa.allocate(5); + fa = ia; +], +[AC_MSG_RESULT(yes)], +[AC_DEFINE(BOOST_RE_NO_MEMBER_TEMPLATES,[]) +AC_MSG_RESULT(no)]) +fi + + +AC_ARG_ENABLE(template-returns, [--disable-template-returns turns off support for templates specialised by return type]) +if test "$enable_template_returns" = "no"; then +AC_DEFINE(BOOST_RE_NO_TEMPLATE_RETURNS, []) +else + +AC_MSG_CHECKING(for parameterised function returns) +AC_TRY_COMPILE( +[ +template +T coerse(int i) +{ return T(i); } +], +[ + double d = coerse(5); + int i = coerse(3); +], +[AC_MSG_RESULT(yes)], +[AC_DEFINE(BOOST_RE_NO_TEMPLATE_RETURNS,[]) +AC_MSG_RESULT(no)]) +fi + + +AC_ARG_ENABLE(int64, [--disable-int64 turns off support for 64-bit integer types]) +if test "$enable_int64" = "no"; then +AC_DEFINE(BOOST_RE_INT64_T_0) +else + +AC_MSG_CHECKING(for 64-bit integral type) + +if test "$ac_cv_sizeof_short" -eq 8; then +AC_DEFINE(BOOST_RE_INT64_T_1) +AC_MSG_RESULT(yes - short) +have_int64="true" +fi +if test "$ac_cv_sizeof_int" -eq 8 && test "$have_int64" != "true"; then +AC_DEFINE(BOOST_RE_INT64_T_2) +AC_MSG_RESULT(yes - int) +have_int64="true" +fi +if test "$ac_cv_sizeof_long" -eq 8 && test "$have_int64" != "true"; then +AC_DEFINE(BOOST_RE_INT64_T_3) +AC_MSG_RESULT(yes - long) +have_int64="true" +fi +if test "$have_int64" != "true"; then +AC_TRY_COMPILE( +[ +#include + +int64_t i = INT64_C(0x100000000); +], +[ +], +[AC_MSG_RESULT(yes - int64_t) +have_int64="true" +AC_DEFINE(BOOST_RE_INT64_T_4) +], +[]) +fi + +if test "$have_int64" != "true"; then + +AC_TRY_COMPILE( +[ +#include + +long long i = 0x100000000LL; +], +[ +], +[AC_MSG_RESULT(yes - long long) +have_int64="true" +AC_DEFINE(BOOST_RE_INT64_T_5) +], +[]) + +fi + +if test "$have_int64" != "true"; then + +AC_TRY_COMPILE( +[ +#include + +__int64 i = 0x100000000i64; +], +[ +], +[AC_MSG_RESULT(yes - __int64) +have_int64="true" +AC_DEFINE(BOOST_RE_INT64_T_6) +], +[]) +fi +if test "$have_int64" != "true"; then +AC_DEFINE(BOOST_RE_INT64_T,0) +AC_MSG_RESULT(no) +fi +fi + + +AC_ARG_ENABLE(messages, [--disable-messages turns off support for POSIX message categories, when available.]) +if test "$enable_messages" = "no" || test "$enable_ms_windows" != "no"; then +AC_DEFINE(BOOST_RE_NO_CAT, []) +else + +AC_CHECK_LIB(nl_types, catopen) +AC_CHECK_LIB(posix, catopen) + +AC_MSG_CHECKING(for POSIX message categories) +AC_TRY_LINK( +[ +#include + +nl_catd message_cat = (nl_catd)-1; +], +[ + message_cat = catopen("some_name", 0); + catclose(message_cat); +], +[AC_MSG_RESULT(yes)], +[AC_DEFINE(BOOST_RE_NO_CAT,[]) +AC_MSG_RESULT(no)]) + +fi + +if test "$enable_threads" != "no" && test "$enable_ms_windows" = "no"; then + +AC_CHECK_LIB(pthread, pthread_mutex_init) +AC_CHECK_LIB(posix, pthread_mutex_init) + +AC_MSG_CHECKING(for POSIX threads) +AC_TRY_LINK( +[ +#include + +pthread_mutex_t m; + +], +[ + pthread_mutex_init(&m, NULL); + pthread_mutex_lock(&m); + pthread_mutex_unlock(&m); + pthread_mutex_destroy(&m); +], +[AC_MSG_RESULT(yes) +AC_DEFINE(BOOST_RE_THREADS, [])], +[AC_MSG_RESULT(no)]) + +fi + + +AC_ARG_ENABLE(nested-template-prefix, [--disable-nested-template-prefix turns off use of \"template\" as the nested template class access specifier.]) +if test "$enable_nested_template_prefix" = "no" || test "$enable_member_templates" = "no"; then +AC_DEFINE(BOOST_RE_NESTED_TEMPLATE_DECL, []) +else + +AC_MSG_CHECKING(for template nested class access) +AC_TRY_COMPILE( +[ +template +class alloc +{ +public: + void* allocate(int); + void deallocate(void*); + alloc(); + alloc(const alloc&); + template + alloc(const alloc&) {} + alloc& operator=(const alloc&); + template + alloc& operator=(const alloc&) + { return *this; } + + template + struct rebind + { + typedef alloc other; + }; +}; + +], +[ + alloc ia; + alloc da(ia); + alloc fa; + fa.allocate(5); + fa = ia; + alloc::template rebind::other da2(ia); +], +[ +AC_MSG_RESULT(yes) +AC_DEFINE(BOOST_RE_NESTED_TEMPLATE_DECL,template) +], +[ +AC_DEFINE(BOOST_RE_NESTED_TEMPLATE_DECL,[]) +AC_MSG_RESULT(no) +]) + +fi + +AC_MSG_CHECKING(for explicit template instantiation) +AC_TRY_COMPILE( +[ +#include "confdefs.h" +#include + +template +class factorial +{ +public: + factorial(); + T operator()(T); +}; + +template +factorial::factorial() +{ +} + +template +T factorial::operator()(T t) +{ + T result = 1; + for(T i = 1; i <= t; ++i) + { + result *= i; + } + return result; +} + +template class factorial; +template class factorial; +], +[ +], +[ +AC_MSG_RESULT(yes) +], +[ +AC_DEFINE(BOOST_RE_NO_TEMPLATE_INST,[]) +AC_MSG_RESULT(no) +]) + + +AC_ARG_ENABLE(fastcall, [--disable-fastcall turns off use __fastcall and __stdcall.]) +if test "$enable_fastcall" = "no" || test "$enable_ms_windows" != "no"; then +AC_DEFINE(BOOST_RE_CALL, []) +AC_DEFINE(BOOST_RE_CCALL, []) +else + +AC_MSG_CHECKING(for __fastcall and __stdcall) +AC_TRY_COMPILE( +[ +void __fastcall f1(int) +{ +} + +void __stdcall f2(int) +{ +} + +], +[ + f1(2); + f2(3); +], +[AC_MSG_RESULT(yes) +AC_DEFINE(BOOST_RE_CALL, [__fastcall]) +AC_DEFINE(BOOST_RE_CCALL, [__stdcall]) +], +[AC_DEFINE(BOOST_RE_CALL, []) +AC_DEFINE(BOOST_RE_CCALL, []) +AC_MSG_RESULT(no)]) + +fi + +# move on to STL options: + + +AC_MSG_CHECKING(for standard library namespace) +AC_TRY_COMPILE( +[ +#include +#include +#include +#include "confdefs.h" + +namespace jm{ + +struct dummy{}; + +}; // namespace + +jm::dummy d; + +std::list v; + +], +[ +], +[AC_MSG_RESULT(yes - std) +have_std_namespace="yes" +], +[AC_MSG_RESULT(no - either STL is not present or in a non-standard namespace.) +AC_MSG_ERROR([Sorry, you can't compile this library unless the standard library is in namespace std.])]) + +AC_MSG_CHECKING(for ) +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +class bad_expression : public std::exception +{ + unsigned int code; +public: + bad_expression(unsigned int err) : code(err) {} + bad_expression(const bad_expression& e) : std::exception(e), code(e.code) {} + bad_expression& operator=(const bad_expression& e) + { + std::exception::operator=(e); + code = e.code; + return *this; + } + virtual const char* what()const throw(); +}; + + +std::exception e; +std::bad_exception e3; +], +[ +], +[AC_MSG_RESULT(yes) +], +[AC_MSG_RESULT(no) +AC_DEFINE(BOOST_RE_NO_EXCEPTION_H, []) +]) + +AC_MSG_CHECKING(for ) +AC_TRY_COMPILE( +[ +#include + +], +[ +], +[AC_MSG_RESULT(yes) +], +[AC_MSG_RESULT(no) +AC_DEFINE(BOOST_RE_NO_ITERATOR_H, []) +]) + +AC_MSG_CHECKING(for ) +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +], +[ +], +[AC_MSG_RESULT(yes) +], +[AC_MSG_RESULT(no) +need_algo="yes" +]) + +if test "$enable_stl" != "no" && test "$need_algo" = "yes"; then +AC_MSG_CHECKING(for ) +AC_TRY_COMPILE( +[ +#include + +], +[ +], +[AC_MSG_RESULT(yes) +AC_DEFINE(BOOST_RE_USE_ALGO, []) +], +[AC_MSG_RESULT(no - disabling STL support) +AC_DEFINE(BOOST_RE_NO_STL, []) +AC_DEFINE(BOOST_RE_NO_EXCEPTION_H, []) +AC_DEFINE(BOOST_RE_NO_ITERATOR_H, []) +AC_DEFINE(BOOST_RE_NO_MEMORY_H, []) +AC_DEFINE(BOOST_RE_NO_LOCALE_H, []) +AC_DEFINE(BOOST_RE_NO_STRING_H, []) +enable_stl="no" +]) + +fi + +AC_MSG_CHECKING(for ) +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +std::allocator a; +std::allocator d(a); + +typedef std::allocator alloc_type; + +alloc_type::BOOST_RE_NESTED_TEMPLATE_DECL rebind::other o(a); +], +[ +], +[AC_MSG_RESULT(yes) +], +[AC_MSG_RESULT(no) +AC_DEFINE(BOOST_RE_NO_MEMORY_H, []) +]) + + +if test "$enable_stl" != "no"; then +AC_MSG_CHECKING(for ) +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +std::string a; +//std::wstring ws; + +], +[ +], +[AC_MSG_RESULT(yes) +], +[AC_MSG_RESULT(no) +AC_MSG_ERROR(Sorry: you can't compile this library without ) +]) + +fi + +if test "$enable_stl" != "no"; then +AC_MSG_CHECKING(for std::basic_string default arguments) +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +std::basic_string s1; +std::basic_string s2; + +], +[ +], +[AC_MSG_RESULT(yes) +], +[AC_MSG_RESULT(no) +AC_DEFINE(BOOST_RE_NO_STRING_DEF_ARGS, []) +]) + +fi + +ac_have_locale='no' +if test "$enable_stl" != "no"; then +AC_MSG_CHECKING(for ) +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +std::locale l; +], +[ +], +[AC_MSG_RESULT(yes) +ac_have_locale='yes' +], +[AC_MSG_RESULT(no) +AC_DEFINE(BOOST_RE_NO_LOCALE_H, []) +]) + +fi + +if test "$enable_stl" != "no"; then +AC_MSG_CHECKING(for ) +AC_TRY_COMPILE( +[ +#include +#include +#include "confdefs.h" + +], +[ + std::locale l; + std::cout.imbue(l); + std::cout << "some text" << std::endl; +], +[AC_MSG_RESULT(yes) +], +[AC_MSG_RESULT(no) +AC_DEFINE(BOOST_RE_OLD_IOSTREAM, []) +]) + +fi + +AC_MSG_CHECKING(for std::distance) +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +], +[ + int i, *j, *k; + i = std::distance(j, k); +], +[AC_MSG_RESULT(yes) +AC_DEFINE(BOOST_RE_DISTANCE_T_1) +have_dist="yes" +], +[]) + +if test "$enable_stl" != "no" && test "$have_dist" != "yes"; then +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +], +[ + int i, *j, *k; + std::distance(j, k, i); +], +[AC_MSG_RESULT(yes) +AC_DEFINE(BOOST_RE_DISTANCE_T_2) +have_dist="yes" +], +[AC_MSG_RESULT(no) +AC_DEFINE(BOOST_RE_DISTANCE_T_0) +have_dist="yes"]) + +fi + +if test "$enable_stl" != "no" && test "$have_si" != "yes"; then +AC_MSG_CHECKING(for standard iterator syntax) +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +], +[ + std::iterator oi; + std::iterator ii; + std::iterator fi; + std::iterator bi; + std::iterator ri; +], +[AC_MSG_RESULT(yes) +AC_DEFINE(BOOST_RE_ITERATOR_T_1) +have_si="yes" +have_oi="yes" +have_ii="yes" +have_fi="yes" +have_bi="yes" +have_ri="yes" +], +[]) + +fi + +if test "$enable_stl" != "no" && test "$have_si" != "yes"; then +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +], +[ + std::iterator oi; + std::iterator ii; + std::iterator fi; + std::iterator bi; + std::iterator ri; +], +[AC_MSG_RESULT(yes) +AC_DEFINE(BOOST_RE_ITERATOR_T_2) +have_si="yes" +have_oi="yes" +have_ii="yes" +have_fi="yes" +have_bi="yes" +have_ri="yes" +], +[AC_MSG_RESULT(no)]) +AC_DEFINE(BOOST_RE_ITERATOR_T_0) + +fi + + +if test "$have_oi" != "yes"; then +AC_MSG_CHECKING(for output iterator syntax) +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +], +[ + std::output_iterator oi; +], +[AC_MSG_RESULT(yes) +AC_DEFINE(BOOST_RE_OI_T_3) +have_oi="yes" +], +[AC_MSG_RESULT(no) +AC_DEFINE(BOOST_RE_OI_T_0) +have_oi="yes"]) + +fi + +if test "$enable_stl" != "no" && test "$have_ii" != "yes"; then +AC_MSG_CHECKING(for input iterator syntax) +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +], +[ + std::input_iterator oi; +], +[AC_MSG_RESULT(yes) +AC_DEFINE(BOOST_RE_II_T_3) +have_ii="yes" +], +[]) + +fi + +if test "$enable_stl" != "no" && test "$have_ii" != "yes"; then +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +], +[ + std::input_iterator oi; +], +[AC_MSG_RESULT(yes) +AC_DEFINE(BOOST_RE_II_T_4) +have_ii="yes" +], +[AC_MSG_RESULT(no) +AC_DEFINE(BOOST_RE_II_T_0) +have_ii="yes"]) + +fi + +if test "$enable_stl" != "no" && test "$have_fi" != "yes"; then +AC_MSG_CHECKING(for forward iterator syntax) +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +], +[ + std::forward_iterator oi; +], +[AC_MSG_RESULT(yes) +AC_DEFINE(BOOST_RE_FI_T_3) +have_fi="yes" +], +[AC_MSG_RESULT(no) +AC_DEFINE(BOOST_RE_FI_T_0) +have_fi="yes"]) + +fi + +if test "$enable_stl" != "no" && test "$have_bi" != "yes"; then +AC_MSG_CHECKING(for bidirectional iterator syntax) +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +], +[ + std::bidirectional_iterator oi; +], +[AC_MSG_RESULT(yes) +AC_DEFINE(BOOST_RE_BI_T_) +have_bi="yes" +], +[AC_MSG_RESULT(no) +AC_DEFINE(BOOST_RE_BI_T_0) +have_bi="yes"]) + +fi + +if test "$enable_stl" != "no" && test "$have_ri" != "yes"; then +AC_MSG_CHECKING(for random access iterator syntax) +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +], +[ + std::random_access_iterator oi; +], +[AC_MSG_RESULT(yes) +AC_DEFINE(BOOST_RE_RI_T_3) +have_ri="yes" +], +[AC_MSG_RESULT(no) +AC_DEFINE(BOOST_RE_RI_T_0) +have_ri="yes"]) + +fi + +if test "$enable_stl" != "no"; then +AC_MSG_CHECKING(for output iterator assignment) +AC_TRY_COMPILE( +[ +#include "confdefs.h" +#include +#ifdef BOOST_RE_OLD_IOSTREAM +#include +std::ostream_iterator a(cout); +std::ostream_iterator b(cout); +#else +#include +std::ostream_iterator a(std::cout); +std::ostream_iterator b(std::cout); +#endif + +#include +#if !defined(BOOST_RE_NO_TRICKY_DEFAULT_PARAM) && !defined(BOOST_RE_NO_DEFAULT_PARAM) +typedef std::list list_type; +#else +typedef std::list list_type; +#endif + +list_type v; + +std:: back_insert_iterator c(v); +std:: back_insert_iterator d(v); + +], +[ + a = b; + c = d; +], +[AC_MSG_RESULT(yes) +], +[AC_MSG_RESULT(no) +AC_DEFINE(BOOST_RE_NO_OI_ASSIGN, []) +]) + +fi + + + + + +# +# generate include dependencies +# +#ac_all_h="" +#ac_all_dep="" +#for file in ../../boost/re_detail/*.hpp +#do +# if test "$file" != '../../boost/re_detail/*.hpp'; then +# ac_all_h="$ac_all_h ../$file" +# ac_all_dep="$ac_all_dep $file" +# fi +#done +#echo "$ac_all_h" + +# +# generate source dependencies +# +#ac_all_o="" +#ac_rules="" +#ac_all_cpp="" +#cat ./lib/makefile.org > ./lib/makefile.in +#for file in src/*.cpp src/*.c +#do +# if test "$file" != 'src/*.cpp' && test "$file" != 'src/*.c'; then +# dnl echo source dependency found "$file" +# ac_all_dep="$ac_all_dep $file" +# ac_all_cpp="$ac_all_cpp $file" +# root=`echo "$file" | sed 's/src\/\(.*\)\..*/\1/g'` +# dnl echo root file name is "$root" +# ac_all_o="$ac_all_o $root$ac_obj_ext" +# echo >> ./lib/makefile.in +# echo >> ./lib/makefile.in +# echo "$root$ac_obj_ext"': $(ALL_H) '"../$file" >> ./lib/makefile.in +# echo ' $(CPP) $(CPP_PROJ)'" ../$file" >> ./lib/makefile.in +# echo ' $(AR) -rc lib$(LIBNAME).a'" $root$ac_obj_ext" >> ./lib/makefile.in +# fi +#done + +#echo "$ac_rules" >> ./lib/makefile.in + +#AC_SUBST(ac_all_o) +#AC_SUBST(ac_all_h) +#AC_SUBST(ac_all_cpp) +#AC_SUBST(ac_all_dep) + +#ac_regress="$ac_regress r1$ac_exe_ext" + +#if test "$enable_wstring" != "no"; then +#ac_regress="$ac_regress r2$ac_exe_ext" +#fi + +#AC_SUBST(ac_regress) + +if test "$enable_ms_windows" = "no"; then +AC_DEFINE(BOOST_RE_NO_W32, []) +fi + + +# +# OK final test for possible link time problems: +# +cat > conf2.h << EOF + +#include "confdefs.h" +#include + +template +class factorial +{ +public: + factorial(); + T operator()(T); +}; + +template +factorial::factorial() +{ +} + +template +T factorial::operator()(T t) +{ + T result = 1; + for(T i = 1; i <= t; ++i) + { + result *= i; + } + return result; +} + +int conf2_test(); + + +EOF + +cat > conf2.cpp << EOF + +#include "conf2.h" + +int conf2_test() +{ + factorial f; + return f(8); +} + +EOF + +old_libs="$LIBS" + +LIBS="conf2.cpp $old_libs" + +AC_MSG_CHECKING(for link time template merging) +AC_TRY_LINK( +[ +#include "conf2.h" +], +[ + factorial g; + g(5); + conf2_test(); +], +[AC_MSG_RESULT(yes)], +[AC_DEFINE(BOOST_RE_NO_TEMPLATE_MERGE, []) +AC_MSG_RESULT(no) +AC_MSG_RESULT([ Warning - $0 has determined that your compiler can not merge]) +AC_MSG_RESULT([ template instances, you may have problems linking to libregex++.a - ]) +AC_MSG_RESULT([ see the FAQ for further details.]) +] +) + +if eval "$CXX $CXXFLAGS -c conf2.cpp" && eval "ar -rc libconf2.a conf2$ac_obj_ext"; then +LIBS="-L./ -lconf2 $old_libs" + +AC_MSG_CHECKING(for link time template merging from archive files) +AC_TRY_LINK( +[ +#include "conf2.h" +], +[ + factorial g; + g(5); + conf2_test(); +], +[AC_MSG_RESULT(yes)], +[AC_DEFINE(BOOST_RE_NO_TEMPLATE_MERGE_A, []) +AC_MSG_RESULT(no) +AC_MSG_RESULT([ Warning - $0 has determined that your compiler can not merge ]) +AC_MSG_RESULT([ template instances, if these are located inside an archive file,]) +AC_MSG_RESULT([ you may have problems linking to libregex++.a - see the FAQ for]) +AC_MSG_RESULT([ further details.]) +] +) + +else + +AC_MSG_RESULT(Unable to create library archive, library may not be fully configured.) + +fi + + +# +# cleanup +# +rm -f conf2.h +rm -f conf2.cpp +rm -f "conf2$ac_obj_ext" +rm -f libconf2.a +LIBS="$old_libs" + +cat > conf2.h << EOF + +#include "confdefs.h" +#include + +template +class factorial +{ +public: + factorial(); + T operator()(T); +}; + +template +factorial::factorial() +{ +} + +template +T factorial::operator()(T t) +{ + T result = 1; + switch(t) + { + case 2: + for(T i = 1; i <= 2; ++i) + { + result *= i; + } + return result; + case 3: + for(T i = 1; i <= 3; ++i) + { + result *= i; + } + return result; + case 4: + for(T i = 1; i <= 4; ++i) + { + result *= i; + } + return result; + case 5: + for(T i = 1; i <= 5; ++i) + { + result *= i; + } + return result; + case 6: + for(T i = 1; i <= 6; ++i) + { + result *= i; + } + return result; + case 7: + for(T i = 1; i <= 7; ++i) + { + result *= i; + } + return result; + default: + for(T i = 1; i <= t; ++i) + { + result *= i; + } + return result; + } + return 0; +} + +int conf2_test(); + + +EOF + +cat > conf2.cpp << EOF + +#include "conf2.h" + +int conf2_test() +{ + factorial f; + return f(8); +} + +EOF + +old_libs="$LIBS" + +LIBS="conf2.cpp $old_libs" + +AC_MSG_CHECKING(for link time template merging of switch statements) +AC_TRY_LINK( +[ +#include "conf2.h" +], +[ + factorial g; + g(5); + conf2_test(); +], +[AC_MSG_RESULT(yes)], +[AC_DEFINE(BOOST_RE_NO_TEMPLATE_SWITCH_MERGE, []) +AC_MSG_RESULT(no) +AC_MSG_RESULT([ Warning - $0 has determined that your compiler can not merge]) +AC_MSG_RESULT([ template instances, if those instances contain switch statements, ]) +AC_MSG_RESULT([ you may have problems linking to libregex++.a - ]) +AC_MSG_RESULT([ see the FAQ for further details.]) +] +) + +# +# cleanup +# +rm -f conf2.h +rm -f conf2.cpp +LIBS="$old_libs" + + + +AC_DEFINE(BOOST_RE_AUTO_CONF) + +#AC_MSG_RESULT(***) +#AC_MSG_RESULT($0: setting up headers...) +#AC_MSG_RESULT(***) +#AC_OUTPUT(lib/makefile demo/jgrep/makefile demo/timer/makefile demo/regress/makefile makefile) +#AC_MSG_RESULT(***) +#AC_MSG_RESULT($0: regex++ package tuned for use with \"${CXX}\" compiler.) +#AC_MSG_RESULT($0: To restore original settings - copy jm_opt.in to ../../boost/re_detail/regex_options.hpp) +#AC_MSG_RESULT(***) + +#post processing cleanup: +#sed 's%^[ ]*#[ ]*undef[ ][ ]*\(.*\)[ ]*$%/* #define \1 */%' ../../boost/re_detail/regex_options.hpp > jm_opt.out +#cat jm_opt.out > ../../boost/re_detail/regex_options.hpp +#sed 's%\(#[ ]*\)undef[ ]%\1define %' ../../boost/re_detail/regex_options.hpp > jm_opt.out +#cat jm_opt.out > ../../boost/re_detail/regex_options.hpp +#rm -f jm_opt.out + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +#################################################### +#################################################### +#################################################### + +### Finish the work. +AC_OUTPUT([Makefile \ + libs/Makefile \ + libs/regex/Makefile \ + libs/regex/src/Makefile \ +], []) + + diff --git a/boost/install-sh b/boost/install-sh new file mode 100755 index 0000000000..e9de23842d --- /dev/null +++ b/boost/install-sh @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/boost/ltconfig b/boost/ltconfig new file mode 100755 index 0000000000..c14d83c169 --- /dev/null +++ b/boost/ltconfig @@ -0,0 +1,3114 @@ +#! /bin/sh + +# ltconfig - Create a system-specific libtool. +# Copyright (C) 1996-1999 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# A lot of this script is taken from autoconf-2.10. + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} +echo=echo +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec "$SHELL" "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null`} + case X$UNAME in + *-DOS) PATH_SEPARATOR=';' ;; + *) PATH_SEPARATOR=':' ;; + esac +fi + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +if test "X${echo_test_string+set}" != Xset; then + # find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if (echo_test_string="`eval $cmd`") 2>/dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null; then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" != 'X\t' || + test "X`($echo "$echo_test_string") 2>/dev/null`" != X"$echo_test_string"; then + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for dir in $PATH /usr/ucb; do + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + test "X`($dir/echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + test "X`(print -r "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running ltconfig again with it. + ORIGINAL_CONFIG_SHELL="${CONFIG_SHELL-/bin/sh}" + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"} + else + # Try using printf. + echo='printf "%s\n"' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + test "X`($echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + # Cool, printf works + : + elif test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && + test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + CONFIG_SHELL="$ORIGINAL_CONFIG_SHELL" + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL $0 --fallback-echo" + elif test "X`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && + test "X`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + echo="$CONFIG_SHELL $0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null; then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "$0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec "${ORIGINAL_CONFIG_SHELL}" "$0" ${1+"$@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# The name of this program. +progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'` + +# Constants: +PROGRAM=ltconfig +PACKAGE=libtool +VERSION=1.3.5 +TIMESTAMP=" (1.385.2.206 2000/05/27 11:12:27)" +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +rm="rm -f" + +help="Try \`$progname --help' for more information." + +# Global variables: +default_ofile=libtool +can_build_shared=yes +enable_shared=yes +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +enable_static=yes +enable_fast_install=yes +enable_dlopen=unknown +enable_win32_dll=no +ltmain= +silent= +srcdir= +ac_config_guess= +ac_config_sub= +host= +nonopt= +ofile="$default_ofile" +verify_host=yes +with_gcc=no +with_gnu_ld=no +need_locks=yes +ac_ext=c +objext=o +libext=a +exeext= +cache_file= + +old_AR="$AR" +old_CC="$CC" +old_CFLAGS="$CFLAGS" +old_CPPFLAGS="$CPPFLAGS" +old_LDFLAGS="$LDFLAGS" +old_LD="$LD" +old_LN_S="$LN_S" +old_LIBS="$LIBS" +old_NM="$NM" +old_RANLIB="$RANLIB" +old_DLLTOOL="$DLLTOOL" +old_OBJDUMP="$OBJDUMP" +old_AS="$AS" + +# Parse the command line options. +args= +prev= +for option +do + case "$option" in + -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + eval "$prev=\$option" + prev= + continue + fi + + case "$option" in + --help) cat <&2 + echo "$help" 1>&2 + exit 1 + ;; + + *) + if test -z "$ltmain"; then + ltmain="$option" + elif test -z "$host"; then +# This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1 +# if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then +# echo "$progname: warning \`$option' is not a valid host type" 1>&2 +# fi + host="$option" + else + echo "$progname: too many arguments" 1>&2 + echo "$help" 1>&2 + exit 1 + fi ;; + esac +done + +if test -z "$ltmain"; then + echo "$progname: you must specify a LTMAIN file" 1>&2 + echo "$help" 1>&2 + exit 1 +fi + +if test ! -f "$ltmain"; then + echo "$progname: \`$ltmain' does not exist" 1>&2 + echo "$help" 1>&2 + exit 1 +fi + +# Quote any args containing shell metacharacters. +ltconfig_args= +for arg +do + case "$arg" in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ltconfig_args="$ltconfig_args '$arg'" ;; + *) ltconfig_args="$ltconfig_args $arg" ;; + esac +done + +# A relevant subset of AC_INIT. + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 5 compiler messages saved in config.log +# 6 checking for... messages and results +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>>./config.log + +# NLS nuisances. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +if test "X${LC_ALL+set}" = Xset; then LC_ALL=C; export LC_ALL; fi +if test "X${LANG+set}" = Xset; then LANG=C; export LANG; fi + +if test -n "$cache_file" && test -r "$cache_file"; then + echo "loading cache $cache_file within ltconfig" + . $cache_file +fi + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + +if test -z "$srcdir"; then + # Assume the source directory is the same one as the path to LTMAIN. + srcdir=`$echo "X$ltmain" | $Xsed -e 's%/[^/]*$%%'` + test "$srcdir" = "$ltmain" && srcdir=. +fi + +trap "$rm conftest*; exit 1" 1 2 15 +if test "$verify_host" = yes; then + # Check for config.guess and config.sub. + ac_aux_dir= + for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/config.guess; then + ac_aux_dir=$ac_dir + break + fi + done + if test -z "$ac_aux_dir"; then + echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2 + echo "$help" 1>&2 + exit 1 + fi + ac_config_guess=$ac_aux_dir/config.guess + ac_config_sub=$ac_aux_dir/config.sub + + # Make sure we can run config.sub. + if $SHELL $ac_config_sub sun4 >/dev/null 2>&1; then : + else + echo "$progname: cannot run $ac_config_sub" 1>&2 + echo "$help" 1>&2 + exit 1 + fi + + echo $ac_n "checking host system type""... $ac_c" 1>&6 + + host_alias=$host + case "$host_alias" in + "") + if host_alias=`$SHELL $ac_config_guess`; then : + else + echo "$progname: cannot guess host type; you must specify one" 1>&2 + echo "$help" 1>&2 + exit 1 + fi ;; + esac + host=`$SHELL $ac_config_sub $host_alias` + echo "$ac_t$host" 1>&6 + + # Make sure the host verified. + test -z "$host" && exit 1 + +elif test -z "$host"; then + echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2 + echo "$help" 1>&2 + exit 1 +else + host_alias=$host +fi + +# Transform linux* to *-*-linux-gnu*, to support old configure scripts. +case "$host_os" in +linux-gnu*) ;; +linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` +esac + +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +case "$host_os" in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR cru $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +# Set a sane default for `AR'. +test -z "$AR" && AR=ar + +# Set a sane default for `OBJDUMP'. +test -z "$OBJDUMP" && OBJDUMP=objdump + +# If RANLIB is not set, then run the test. +if test "${RANLIB+set}" != "set"; then + result=no + + echo $ac_n "checking for ranlib... $ac_c" 1>&6 + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/ranlib || test -f $dir/ranlib$ac_exeext; then + RANLIB="ranlib" + result="ranlib" + break + fi + done + IFS="$save_ifs" + + echo "$ac_t$result" 1>&6 +fi + +if test -n "$RANLIB"; then + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" +fi + +# Set sane defaults for `DLLTOOL', `OBJDUMP', and `AS', used on cygwin. +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$AS" && AS=as + +# Check to see if we are using GCC. +if test "$with_gcc" != yes || test -z "$CC"; then + # If CC is not set, then try to find GCC or a usable CC. + if test -z "$CC"; then + echo $ac_n "checking for gcc... $ac_c" 1>&6 + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/gcc || test -f $dir/gcc$ac_exeext; then + CC="gcc" + break + fi + done + IFS="$save_ifs" + + if test -n "$CC"; then + echo "$ac_t$CC" 1>&6 + else + echo "$ac_t"no 1>&6 + fi + fi + + # Not "gcc", so try "cc", rejecting "/usr/ucb/cc". + if test -z "$CC"; then + echo $ac_n "checking for cc... $ac_c" 1>&6 + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + cc_rejected=no + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/cc || test -f $dir/cc$ac_exeext; then + if test "$dir/cc" = "/usr/ucb/cc"; then + cc_rejected=yes + continue + fi + CC="cc" + break + fi + done + IFS="$save_ifs" + if test $cc_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same name, so the bogon will be chosen + # first if we set CC to just the name; use the full file name. + shift + set dummy "$dir/cc" "$@" + shift + CC="$@" + fi + fi + + if test -n "$CC"; then + echo "$ac_t$CC" 1>&6 + else + echo "$ac_t"no 1>&6 + fi + + if test -z "$CC"; then + echo "$progname: error: no acceptable cc found in \$PATH" 1>&2 + exit 1 + fi + fi + + # Now see if the compiler is really GCC. + with_gcc=no + echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6 + echo "$progname:581: checking whether we are using GNU C" >&5 + + $rm conftest.c + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + with_gcc=yes + fi + $rm conftest.c + echo "$ac_t$with_gcc" 1>&6 +fi + +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="$2" + +echo $ac_n "checking for object suffix... $ac_c" 1>&6 +$rm conftest* +echo 'int i = 1;' > conftest.c +echo "$progname:603: checking for object suffix" >& 5 +if { (eval echo $progname:604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then + # Append any warnings to the config.log. + cat conftest.err 1>&5 + + for ac_file in conftest.*; do + case $ac_file in + *.c) ;; + *) objext=`echo $ac_file | sed -e s/conftest.//` ;; + esac + done +else + cat conftest.err 1>&5 + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 +fi +$rm conftest* +echo "$ac_t$objext" 1>&6 + +echo $ac_n "checking for executable suffix... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_cv_exeext="no" + $rm conftest* + echo 'main () { return 0; }' > conftest.c + echo "$progname:629: checking for executable suffix" >& 5 + if { (eval echo $progname:630: \"$ac_link\") 1>&5; (eval $ac_link) 2>conftest.err; }; then + # Append any warnings to the config.log. + cat conftest.err 1>&5 + + for ac_file in conftest.*; do + case $ac_file in + *.c | *.err | *.$objext ) ;; + *) ac_cv_exeext=.`echo $ac_file | sed -e s/conftest.//` ;; + esac + done + else + cat conftest.err 1>&5 + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 + fi + $rm conftest* +fi +if test "X$ac_cv_exeext" = Xno; then + exeext="" +else + exeext="$ac_cv_exeext" +fi +echo "$ac_t$ac_cv_exeext" 1>&6 + +echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6 +pic_flag= +special_shlib_compile_flags= +wl= +link_static_flag= +no_builtin_flag= + +if test "$with_gcc" = yes; then + wl='-Wl,' + link_static_flag='-static' + + case "$host_os" in + beos* | irix5* | irix6* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + aix*) + # Below there is a dirty hack to force normal static linking with -ldl + # The problem is because libdl dynamically linked with both libc and + # libC (AIX C++ library), which obviously doesn't included in libraries + # list by gcc. This cause undefined symbols with -static flags. + # This hack allows C programs to be linked with "-static -ldl", but + # we not sure about C++ programs. + link_static_flag="$link_static_flag ${wl}-lC" + ;; + cygwin* | mingw* | os2*) + # We can build DLLs from non-PIC. + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + pic_flag='-m68020 -resident32 -malways-restore-a4' + ;; + sysv4*MP*) + if test -d /usr/nec; then + pic_flag=-Kconform_pic + fi + ;; + *) + pic_flag='-fPIC' + ;; + esac +else + # PORTME Check for PIC flags for the system compiler. + case "$host_os" in + aix3* | aix4*) + # All AIX code is PIC. + link_static_flag='-bnso -bI:/lib/syscalls.exp' + ;; + + hpux9* | hpux10* | hpux11*) + # Is there a better link_static_flag that works with the bundled CC? + wl='-Wl,' + link_static_flag="${wl}-a ${wl}archive" + pic_flag='+Z' + ;; + + irix5* | irix6*) + wl='-Wl,' + link_static_flag='-non_shared' + # PIC (with -KPIC) is the default. + ;; + + cygwin* | mingw* | os2*) + # We can build DLLs from non-PIC. + ;; + + osf3* | osf4* | osf5*) + # All OSF/1 code is PIC. + wl='-Wl,' + link_static_flag='-non_shared' + ;; + + sco3.2v5*) + pic_flag='-Kpic' + link_static_flag='-dn' + special_shlib_compile_flags='-belf' + ;; + + solaris*) + pic_flag='-KPIC' + link_static_flag='-Bstatic' + wl='-Wl,' + ;; + + sunos4*) + pic_flag='-PIC' + link_static_flag='-Bstatic' + wl='-Qoption ld ' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + pic_flag='-KPIC' + link_static_flag='-Bstatic' + wl='-Wl,' + ;; + + uts4*) + pic_flag='-pic' + link_static_flag='-Bstatic' + ;; + sysv4*MP*) + if test -d /usr/nec ;then + pic_flag='-Kconform_pic' + link_static_flag='-Bstatic' + fi + ;; + *) + can_build_shared=no + ;; + esac +fi + +if test -n "$pic_flag"; then + echo "$ac_t$pic_flag" 1>&6 + + # Check to make sure the pic_flag actually works. + echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6 + $rm conftest* + echo "int some_variable = 0;" > conftest.c + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $pic_flag -DPIC" + echo "$progname:776: checking if $compiler PIC flag $pic_flag works" >&5 + if { (eval echo $progname:777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then + # Append any warnings to the config.log. + cat conftest.err 1>&5 + + case "$host_os" in + hpux9* | hpux10* | hpux11*) + # On HP-UX, both CC and GCC only warn that PIC is supported... then they + # create non-PIC objects. So, if there were any warnings, we assume that + # PIC is not supported. + if test -s conftest.err; then + echo "$ac_t"no 1>&6 + can_build_shared=no + pic_flag= + else + echo "$ac_t"yes 1>&6 + pic_flag=" $pic_flag" + fi + ;; + *) + echo "$ac_t"yes 1>&6 + pic_flag=" $pic_flag" + ;; + esac + else + # Append any errors to the config.log. + cat conftest.err 1>&5 + can_build_shared=no + pic_flag= + echo "$ac_t"no 1>&6 + fi + CFLAGS="$save_CFLAGS" + $rm conftest* +else + echo "$ac_t"none 1>&6 +fi + +# Check to see if options -o and -c are simultaneously supported by compiler +echo $ac_n "checking if $compiler supports -c -o file.o... $ac_c" 1>&6 +$rm -r conftest 2>/dev/null +mkdir conftest +cd conftest +$rm conftest* +echo "int some_variable = 0;" > conftest.c +mkdir out +# According to Tom Tromey, Ian Lance Taylor reported there are C compilers +# that will create temporary files in the current directory regardless of +# the output directory. Thus, making CWD read-only will cause this test +# to fail, enabling locking or at least warning the user not to do parallel +# builds. +chmod -w . +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -o out/conftest2.o" +echo "$progname:829: checking if $compiler supports -c -o file.o" >&5 +if { (eval echo $progname:830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.o; then + + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then + echo "$ac_t"no 1>&6 + compiler_c_o=no + else + echo "$ac_t"yes 1>&6 + compiler_c_o=yes + fi +else + # Append any errors to the config.log. + cat out/conftest.err 1>&5 + compiler_c_o=no + echo "$ac_t"no 1>&6 +fi +CFLAGS="$save_CFLAGS" +chmod u+w . +$rm conftest* out/* +rmdir out +cd .. +rmdir conftest +$rm -r conftest 2>/dev/null + +if test x"$compiler_c_o" = x"yes"; then + # Check to see if we can write to a .lo + echo $ac_n "checking if $compiler supports -c -o file.lo... $ac_c" 1>&6 + $rm conftest* + echo "int some_variable = 0;" > conftest.c + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -c -o conftest.lo" + echo "$progname:862: checking if $compiler supports -c -o file.lo" >&5 +if { (eval echo $progname:863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.lo; then + + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + echo "$ac_t"no 1>&6 + compiler_o_lo=no + else + echo "$ac_t"yes 1>&6 + compiler_o_lo=yes + fi + else + # Append any errors to the config.log. + cat conftest.err 1>&5 + compiler_o_lo=no + echo "$ac_t"no 1>&6 + fi + CFLAGS="$save_CFLAGS" + $rm conftest* +else + compiler_o_lo=no +fi + +# Check to see if we can do hard links to lock some files if needed +hard_links="nottested" +if test "$compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo $ac_n "checking if we can lock with hard links... $ac_c" 1>&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$ac_t$hard_links" 1>&6 + $rm conftest* + if test "$hard_links" = no; then + echo "*** WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2 + need_locks=warn + fi +else + need_locks=no +fi + +if test "$with_gcc" = yes; then + # Check to see if options -fno-rtti -fno-exceptions are supported by compiler + echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions ... $ac_c" 1>&6 + $rm conftest* + echo "int some_variable = 0;" > conftest.c + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.c" + echo "$progname:914: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 + if { (eval echo $progname:915: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then + + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + echo "$ac_t"no 1>&6 + compiler_rtti_exceptions=no + else + echo "$ac_t"yes 1>&6 + compiler_rtti_exceptions=yes + fi + else + # Append any errors to the config.log. + cat conftest.err 1>&5 + compiler_rtti_exceptions=no + echo "$ac_t"no 1>&6 + fi + CFLAGS="$save_CFLAGS" + $rm conftest* + + if test "$compiler_rtti_exceptions" = "yes"; then + no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' + else + no_builtin_flag=' -fno-builtin' + fi + +fi + +# Check for any special shared library compilation flags. +if test -n "$special_shlib_compile_flags"; then + echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2 + if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$special_shlib_compile_flags[ ]" >/dev/null; then : + else + echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2 + can_build_shared=no + fi +fi + +echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6 +$rm conftest* +echo 'main(){return(0);}' > conftest.c +save_LDFLAGS="$LDFLAGS" +LDFLAGS="$LDFLAGS $link_static_flag" +echo "$progname:958: checking if $compiler static flag $link_static_flag works" >&5 +if { (eval echo $progname:959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + echo "$ac_t$link_static_flag" 1>&6 +else + echo "$ac_t"none 1>&6 + link_static_flag= +fi +LDFLAGS="$save_LDFLAGS" +$rm conftest* + +if test -z "$LN_S"; then + # Check to see if we can use ln -s, or we need hard links. + echo $ac_n "checking whether ln -s works... $ac_c" 1>&6 + $rm conftest.dat + if ln -s X conftest.dat 2>/dev/null; then + $rm conftest.dat + LN_S="ln -s" + else + LN_S=ln + fi + if test "$LN_S" = "ln -s"; then + echo "$ac_t"yes 1>&6 + else + echo "$ac_t"no 1>&6 + fi +fi + +# Make sure LD is an absolute path. +if test -z "$LD"; then + ac_prog=ld + if test "$with_gcc" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6 + echo "$progname:991: checking for ld used by GCC" >&5 + ac_prog=`($CC -print-prog-name=ld) 2>&5` + case "$ac_prog" in + # Accept absolute paths. + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we are not using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac + elif test "$with_gnu_ld" = yes; then + echo $ac_n "checking for GNU ld... $ac_c" 1>&6 + echo "$progname:1015: checking for GNU ld" >&5 + else + echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 + echo "$progname:1018: checking for non-GNU ld" >&5 + fi + + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" + fi + + if test -n "$LD"; then + echo "$ac_t$LD" 1>&6 + else + echo "$ac_t"no 1>&6 + fi + + if test -z "$LD"; then + echo "$progname: error: no acceptable ld found in \$PATH" 1>&2 + exit 1 + fi +fi + +# Check to see if it really is or is not GNU ld. +echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6 +# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + with_gnu_ld=yes +else + with_gnu_ld=no +fi +echo "$ac_t$with_gnu_ld" 1>&6 + +# See if the linker supports building shared libraries. +echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6 + +allow_undefined_flag= +no_undefined_flag= +need_lib_prefix=unknown +need_version=unknown +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +archive_cmds= +archive_expsym_cmds= +old_archive_from_new_cmds= +export_dynamic_flag_spec= +whole_archive_flag_spec= +thread_safe_flag_spec= +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +hardcode_shlibpath_var=unsupported +runpath_var= +always_export_symbols=no +export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' +# include_expsyms should be a list of space-separated symbols to be *always* +# included in the symbol list +include_expsyms= +# exclude_expsyms can be an egrep regular expression of symbols to exclude +# it will be wrapped by ` (' and `)$', so one must not match beginning or +# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', +# as well as any symbol that contains `d'. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" +# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out +# platforms (ab)use it in PIC code, but their linkers get confused if +# the symbol is explicitly referenced. Since portable code cannot +# rely on this symbol name, it's probably fine to never include it in +# preloaded symbol tables. + +case "$host_os" in +cygwin* | mingw*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$with_gcc" != yes; then + with_gnu_ld=no + fi + ;; + +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case "$host_os" in + aix3* | aix4*) + # On AIX, the GNU linker is very broken + ld_shlibs=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + ;; + + amigaos*) + archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=yes + + # Extract the symbol export list from an `--export-all' def file, + # then regenerate the def file from the symbol export list, so that + # the compiled dll only exports the symbol export list. + # Be careful not to strip the DATA tag left by newer dlltools. + export_symbols_cmds='test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ + test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~ + $DLLTOOL --export-all --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def $objdir/$soname-def $objdir/$soname-ltdll.$objext $libobjs $convenience~ + sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $objdir/$soname-def > $export_symbols' + + # If DATA tags from a recent dlltool are present, honour them! + archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~ + _lt_hint=1; + cat $export_symbols | while read symbol; do + set dummy \$symbol; + case \$# in + 2) echo " \$2 @ \$_lt_hint ; " >> $objdir/$soname-def;; + *) echo " \$2 @ \$_lt_hint \$3 ; " >> $objdir/$soname-def;; + esac; + _lt_hint=`expr 1 + \$_lt_hint`; + done~ + test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ + test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~ + $CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ + $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ + $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts' + + old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a' + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + archive_cmds='$LD -Bshareable $libobjs $deplibs $linkopts -o $lib' + # can we support soname and/or expsyms with a.out? -oliva + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linkopts' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + case $host_os in + cygwin* | mingw*) + # dlltool doesn't understand --whole-archive et. al. + whole_archive_flag_spec= + ;; + *) + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + ;; + esac + fi +else + # PORTME fill in a description of your system's linker (not GNU ld) + case "$host_os" in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $objdir/$soname $libobjs $deplibs $linkopts -bE:$export_symbols -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$with_gcc" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4*) + hardcode_libdir_flag_spec='${wl}-b ${wl}nolibpath ${wl}-b ${wl}libpath:$libdir:/usr/lib:/lib' + hardcode_libdir_separator=':' + if test "$with_gcc" = yes; then + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + shared_flag='-shared' + else + shared_flag='${wl}-bM:SRE' + hardcode_direct=yes + fi + allow_undefined_flag=' ${wl}-berok' + archive_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bexpall ${wl}-bnoentry${allow_undefined_flag}' + archive_expsym_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}' + case "$host_os" in aix4.[01]|aix4.[01].*) + # According to Greg Wooledge, -bexpall is only supported from AIX 4.2 on + always_export_symbols=yes ;; + esac + ;; + + amigaos*) + archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + cygwin* | mingw*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $linkopts `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs' + fix_srcfile_path='`cygpath -w $srcfile`' + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9* | hpux10* | hpux11*) + case "$host_os" in + hpux9*) archive_cmds='$rm $objdir/$soname~$LD -b +b $install_libdir -o $objdir/$soname $libobjs $deplibs $linkopts~test $objdir/$soname = $lib || mv $objdir/$soname $lib' ;; + *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linkopts' ;; + esac + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_minus_L=yes # Not in the search PATH, but as the default + # location of the library. + export_dynamic_flag_spec='${wl}-E' + ;; + + irix5* | irix6*) + if test "$with_gcc" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + archive_cmds='$LD -shared $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linkopts' # ELF + fi + hardcode_libdir_flag_spec='${wl}-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + openbsd*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp $libobjs >> $objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $linkopts $objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def' + ;; + + osf3*) + if test "$with_gcc" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # As osf3* with the addition of the -msym flag + if test "$with_gcc" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + rhapsody*) + archive_cmds='$CC -bundle -undefined suppress -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flags_spec='-L$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + sco3.2v5*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case "$host_os" in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $linkopts' + else + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linkopts' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + unixware7*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac +fi +echo "$ac_t$ld_shlibs" 1>&6 +test "$ld_shlibs" = no && can_build_shared=no + +if test -z "$NM"; then + echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6 + case "$NM" in + [\\/]* | [A-Za-z]:[\\/]*) ;; # Let the user override the test with a path. + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for ac_dir in $PATH /usr/ucb /usr/ccs/bin /bin; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + NM="$ac_dir/nm -B" + break + elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + NM="$ac_dir/nm -p" + break + else + NM=${NM="$ac_dir/nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$NM" && NM=nm + ;; + esac + echo "$ac_t$NM" 1>&6 +fi + +# Check for command to grab the raw symbol name followed by C symbol from nm. +echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6 + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" + +# Define system-specific variables. +case "$host_os" in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw*) + symcode='[ABCDGISTW]' + ;; +hpux*) # Its linker distinguishes data from code symbols + global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'" + ;; +irix*) + symcode='[BCDEGRST]' + ;; +solaris*) + symcode='[BDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then + symcode='[ABCDGISTW]' +fi + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. + global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode\)[ ][ ]*\($ac_symprfx\)$sympat$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + $rm conftest* + cat > conftest.c <&5 + if { (eval echo $progname:1654: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then + # Now try to grab the symbols. + nlist=conftest.nm + if { echo "$progname:1657: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then + + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if egrep ' nm_test_var$' "$nlist" >/dev/null; then + if egrep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.c +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$global_symbol_to_cdecl"' < "$nlist" >> conftest.c' + + cat <> conftest.c +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[] = +{ +EOF + sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.c + cat <<\EOF >> conftest.c + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$objext conftstm.$objext + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="conftstm.$objext" + CFLAGS="$CFLAGS$no_builtin_flag" + if { (eval echo $progname:1709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + pipe_works=yes + else + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 + fi + LIBS="$save_LIBS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 + fi + $rm conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + global_symbol_pipe= + fi +done +if test "$pipe_works" = yes; then + echo "${ac_t}ok" 1>&6 +else + echo "${ac_t}failed" 1>&6 +fi + +if test -z "$global_symbol_pipe"; then + global_symbol_to_cdecl= +fi + +# Check hardcoding attributes. +echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6 +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var"; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$hardcode_shlibpath_var" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +echo "$ac_t$hardcode_action" 1>&6 + + +reload_flag= +reload_cmds='$LD$reload_flag -o $output$reload_objs' +echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6 +# PORTME Some linkers may need a different reload flag. +reload_flag='-r' +echo "$ac_t$reload_flag" 1>&6 +test -n "$reload_flag" && reload_flag=" $reload_flag" + +# PORTME Fill in your ld.so characteristics +library_names_spec= +libname_spec='lib$name' +soname_spec= +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +file_magic_cmd= +file_magic_test_file= +deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [regex]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given egrep regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. +echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6 +case "$host_os" in +aix3*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}.so$major' + ;; + +aix4*) + version_type=linux + # AIX has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + # We preserve .a as extension for shared libraries though AIX4.2 + # and later linker supports .so + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.a' + shlibpath_var=LIBPATH + deplibs_check_method=pass_all + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}.so' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + deplibs_check_method=pass_all + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + file_magic_cmd=/usr/bin/file + file_magic_test_file=/shlib/libc.so + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + export_dynamic_flag_spec=-rdynamic + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw*) + version_type=windows + need_version=no + need_lib_prefix=no + if test "$with_gcc" = yes; then + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.a' + else + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' + fi + dynamic_linker='Win32 ld.exe' + deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + file_magic_cmd='${OBJDUMP} -f' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case "$version_type" in + freebsd-elf*) + deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' + file_magic_cmd=/usr/bin/file + file_magic_test_file=`echo /usr/lib/libc.so*` + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + deplibs_check_method=unknown + library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case "$host_os" in + freebsd2* | freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + dynamic_linker="$host_os dld.sl" + version_type=sunos + need_lib_prefix=no + need_version=no + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' + soname_spec='${libname}${release}.sl$major' + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + case "$host_os" in + hpux10.20*) + # TODO: Does this work for hpux-11 too? + deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + file_magic_cmd=/usr/bin/file + file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +irix5* | irix6*) + version_type=irix + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}.so.$major' + library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major ${libname}${release}.so $libname.so' + case "$host_os" in + irix5*) + libsuff= shlibsuff= + # this will be overridden with pass_all, but let us keep it just in case + deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case "$LD" in # libtool.m4 will add one of these switches to LD + *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + file_magic_cmd=/usr/bin/file + file_magic_test_file=`echo /lib${libsuff}/libc.so*` + deplibs_check_method='pass_all' + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux-gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + deplibs_check_method=pass_all + + if test -f /lib/ld.so.1; then + dynamic_linker='GNU ld.so' + else + # Only the GNU ld.so supports shared libraries on MkLinux. + case "$host_cpu" in + powerpc*) dynamic_linker=no ;; + *) dynamic_linker='Linux ld.so' ;; + esac + fi + ;; + +netbsd*) + version_type=sunos + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' + soname_spec='${libname}${release}.so$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + ;; + +openbsd*) + version_type=sunos + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + need_version=no + fi + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + ;; + +os2*) + libname_spec='$name' + need_lib_prefix=no + library_names_spec='$libname.dll $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_version=no + soname_spec='${libname}${release}.so' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + shlibpath_var=LD_LIBRARY_PATH + # this will be overridden with pass_all, but let us keep it just in case + deplibs_check_method='file_magic COFF format alpha shared library' + file_magic_cmd=/usr/bin/file + file_magic_test_file=/shlib/libc.so + deplibs_check_method='pass_all' + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rhapsody*) + version_type=sunos + library_names_spec='${libname}.so' + soname_spec='${libname}.so' + shlibpath_var=DYLD_LIBRARY_PATH + deplibs_check_method=pass_all + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + deplibs_check_method="file_magic ELF [0-9][0-9]-bit [LM]SB dynamic lib" + file_magic_cmd=/usr/bin/file + file_magic_test_file=/lib/libc.so + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + case "$host_vendor" in + sequent) + file_magic_cmd='/bin/file' + deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + ncr) + deplibs_check_method='pass_all' + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + file_magic_cmd=/usr/bin/file + file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + esac + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' + soname_spec='$libname.so.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$ac_t$dynamic_linker" 1>&6 +test "$dynamic_linker" = no && can_build_shared=no + +# Report the final consequences. +echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6 + +# Only try to build win32 dlls if AC_LIBTOOL_WIN32_DLL was used in +# configure.in, otherwise build static only libraries. +case "$host_os" in +cygwin* | mingw* | os2*) + if test x$can_build_shared = xyes; then + test x$enable_win32_dll = xno && can_build_shared=no + echo "checking if package supports dlls... $can_build_shared" 1>&6 + fi +;; +esac + +if test -n "$file_magic_test_file" && test -n "$file_magic_cmd"; then + case "$deplibs_check_method" in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac +fi + +echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4*) + test "$enable_shared" = yes && enable_static=no + ;; +esac + +echo "$ac_t$enable_shared" 1>&6 + +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes + +echo "checking whether to build static libraries... $enable_static" 1>&6 + +if test "$hardcode_action" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +echo $ac_n "checking for objdir... $ac_c" 1>&6 +rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + objdir=_libs +fi +rmdir .libs 2>/dev/null +echo "$ac_t$objdir" 1>&6 + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else +if eval "test \"`echo '$''{'lt_cv_dlopen'+set}'`\" != set"; then + lt_cv_dlopen=no lt_cv_dlopen_libs= +echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 +echo "$progname:2248: checking for dlopen in -ldl" >&5 +ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldl $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for dlopen""... $ac_c" 1>&6 +echo "$progname:2288: checking for dlopen" >&5 +if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_dlopen) || defined (__stub___dlopen) +choke me +#else +dlopen(); +#endif + +; return 0; } +EOF +if { (eval echo $progname:2318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_dlopen=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_dlopen=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="dlopen" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6 +echo "$progname:2335: checking for dld_link in -ldld" >&5 +ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldld $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for shl_load""... $ac_c" 1>&6 +echo "$progname:2375: checking for shl_load" >&5 +if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char shl_load(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_shl_load) || defined (__stub___shl_load) +choke me +#else +shl_load(); +#endif + +; return 0; } +EOF +if { (eval echo $progname:2405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_shl_load=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_shl_load=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="shl_load" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6 +echo "$progname:2423: checking for shl_load in -ldld" >&5 +ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldld $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" +else + echo "$ac_t""no" 1>&6 +fi + + +fi + + +fi + + +fi + + +fi + +fi + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + fi + + case "$lt_cv_dlopen" in + dlopen) +for ac_hdr in dlfcn.h; do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "$progname:2488: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int fnord = 0; +EOF +ac_try="$ac_compile >/dev/null 2>conftest.out" +{ (eval echo $progname:2498: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi +done + + if test "x$ac_cv_header_dlfcn_h" = xyes; then + CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + fi + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6 +echo "$progname:2526: checking whether a program can dlopen itself" >&5 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + lt_cv_dlopen_self=cross + else + cat > conftest.c < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LTDL_GLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LTDL_GLOBAL DL_GLOBAL +# else +# define LTDL_GLOBAL 0 +# endif +#endif + +/* We may have to define LTDL_LAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LTDL_LAZY_OR_NOW +# ifdef RTLD_LAZY +# define LTDL_LAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LTDL_LAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LTDL_LAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LTDL_LAZY_OR_NOW DL_NOW +# else +# define LTDL_LAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +fnord() { int i=42;} +main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); + if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); + if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } + +EOF +if { (eval echo $progname:2580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + lt_cv_dlopen_self=yes +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + lt_cv_dlopen_self=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$lt_cv_dlopen_self" 1>&6 + + if test "$lt_cv_dlopen_self" = yes; then + LDFLAGS="$LDFLAGS $link_static_flag" + echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6 +echo "$progname:2599: checking whether a statically linked program can dlopen itself" >&5 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + lt_cv_dlopen_self_static=cross + else + cat > conftest.c < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LTDL_GLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LTDL_GLOBAL DL_GLOBAL +# else +# define LTDL_GLOBAL 0 +# endif +#endif + +/* We may have to define LTDL_LAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LTDL_LAZY_OR_NOW +# ifdef RTLD_LAZY +# define LTDL_LAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LTDL_LAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LTDL_LAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LTDL_LAZY_OR_NOW DL_NOW +# else +# define LTDL_LAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +fnord() { int i=42;} +main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); + if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); + if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } + +EOF +if { (eval echo $progname:2653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + lt_cv_dlopen_self_static=yes +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + lt_cv_dlopen_self_static=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6 +fi + ;; + esac + + case "$lt_cv_dlopen_self" in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case "$lt_cv_dlopen_self_static" in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + +# Copy echo and quote the copy, instead of the original, because it is +# used later. +ltecho="$echo" +if test "X$ltecho" = "X$CONFIG_SHELL $0 --fallback-echo"; then + ltecho="$CONFIG_SHELL \$0 --fallback-echo" +fi +LTSHELL="$SHELL" + +LTCONFIG_VERSION="$VERSION" + +# Only quote variables if we're using ltmain.sh. +case "$ltmain" in +*.sh) + # Now quote all the things that may contain metacharacters. + for var in ltecho old_CC old_CFLAGS old_CPPFLAGS \ + old_LD old_LDFLAGS old_LIBS \ + old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS \ + AR CC LD LN_S NM LTSHELL LTCONFIG_VERSION \ + reload_flag reload_cmds wl \ + pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ + thread_safe_flag_spec whole_archive_flag_spec libname_spec \ + library_names_spec soname_spec \ + RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ + old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds postuninstall_cmds \ + file_magic_cmd export_symbols_cmds deplibs_check_method allow_undefined_flag no_undefined_flag \ + finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ + hardcode_libdir_flag_spec hardcode_libdir_separator \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do + + case "$var" in + reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case "$ltecho" in + *'\$0 --fallback-echo"') + ltecho=`$echo "X$ltecho" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + + trap "$rm \"$ofile\"; exit 1" 1 2 15 + echo "creating $ofile" + $rm "$ofile" + cat < "$ofile" +#! $SHELL + +# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh. +# +# Copyright (C) 1996-1999 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="sed -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +### BEGIN LIBTOOL CONFIG +EOF + cfgfile="$ofile" + ;; + +*) + # Double-quote the variables that need it (for aesthetics). + for var in old_CC old_CFLAGS old_CPPFLAGS \ + old_LD old_LDFLAGS old_LIBS \ + old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS; do + eval "$var=\\\"\$var\\\"" + done + + # Just create a config file. + cfgfile="$ofile.cfg" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + echo "creating $cfgfile" + $rm "$cfgfile" + cat < "$cfgfile" +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Libtool configuration file. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +EOF + ;; +esac + +cat <> "$cfgfile" +# Libtool was configured as follows, on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# CC=$old_CC CFLAGS=$old_CFLAGS CPPFLAGS=$old_CPPFLAGS \\ +# LD=$old_LD LDFLAGS=$old_LDFLAGS LIBS=$old_LIBS \\ +# NM=$old_NM RANLIB=$old_RANLIB LN_S=$old_LN_S \\ +# DLLTOOL=$old_DLLTOOL OBJDUMP=$old_OBJDUMP AS=$old_AS \\ +# $0$ltconfig_args +# +# Compiler and other test output produced by $progname, useful for +# debugging $progname, is in ./config.log if it exists. + +# The version of $progname that generated this script. +LTCONFIG_VERSION=$LTCONFIG_VERSION + +# Shell to use when invoking shell scripts. +SHELL=$LTSHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$ltecho + +# The archiver. +AR=$AR + +# The default C compiler. +CC=$CC + +# The linker used to build libraries. +LD=$LD + +# Whether we need hard or soft links. +LN_S=$LN_S + +# A BSD-compatible nm program. +NM=$NM + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$reload_flag +reload_cmds=$reload_cmds + +# How to pass a linker flag through the compiler. +wl=$wl + +# Object file suffix (normally "o"). +objext="$objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$pic_flag + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$compiler_c_o + +# Can we write directly to a .lo ? +compiler_o_lo=$compiler_o_lo + +# Must we lock files when doing compilation ? +need_locks=$need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$link_static_flag + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$no_builtin_flag + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$whole_archive_flag_spec + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$thread_safe_flag_spec + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$RANLIB +old_archive_cmds=$old_archive_cmds +old_postinstall_cmds=$old_postinstall_cmds +old_postuninstall_cmds=$old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$old_archive_from_new_cmds + +# Commands used to build and install a shared archive. +archive_cmds=$archive_cmds +archive_expsym_cmds=$archive_expsym_cmds +postinstall_cmds=$postinstall_cmds +postuninstall_cmds=$postuninstall_cmds + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$allow_undefined_flag + +# Flag that forces no undefined symbols. +no_undefined_flag=$no_undefined_flag + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$global_symbol_to_cdecl + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$hardcode_libdir_separator + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$export_symbols_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$include_expsyms + +EOF + +case "$ltmain" in +*.sh) + echo '### END LIBTOOL CONFIG' >> "$ofile" + echo >> "$ofile" + case "$host_os" in + aix3*) + cat <<\EOF >> "$ofile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + # Append the ltmain.sh script. + sed '$q' "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1) + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + + chmod +x "$ofile" + ;; + +*) + # Compile the libtool program. + echo "FIXME: would compile $ltmain" + ;; +esac + +test -n "$cache_file" || exit 0 + +# AC_CACHE_SAVE +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +exit 0 + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/boost/ltmain.sh b/boost/ltmain.sh new file mode 100644 index 0000000000..251394b4d4 --- /dev/null +++ b/boost/ltmain.sh @@ -0,0 +1,4028 @@ +# ltmain.sh - Provide generalized library-building support services. +# NOTE: Changing this file will not affect anything until you rerun ltconfig. +# +# Copyright (C) 1996-1999 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Check that we have a working $echo. +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell, and then maybe $echo will work. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 +fi + +if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + echo "$modename: not configured to build any kind of library" 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 +fi + +# Global variables. +mode=$default_mode +nonopt= +prev= +prevopt= +run= +show="$echo" +show_help= +execute_dlfiles= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" + +# Parse our command line options once, thoroughly. +while test $# -gt 0 +do + arg="$1" + shift + + case "$arg" in + -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case "$prev" in + execute_dlfiles) + eval "$prev=\"\$$prev \$arg\"" + ;; + *) + eval "$prev=\$arg" + ;; + esac + + prev= + prevopt= + continue + fi + + # Have we seen a non-optional argument yet? + case "$arg" in + --help) + show_help=yes + ;; + + --version) + echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + exit 0 + ;; + + --config) + sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0 + exit 0 + ;; + + --debug) + echo "$progname: enabling shell trace mode" + set -x + ;; + + --dry-run | -n) + run=: + ;; + + --features) + echo "host: $host" + if test "$build_libtool_libs" = yes; then + echo "enable shared libraries" + else + echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + echo "enable static libraries" + else + echo "disable static libraries" + fi + exit 0 + ;; + + --finish) mode="finish" ;; + + --mode) prevopt="--mode" prev=mode ;; + --mode=*) mode="$optarg" ;; + + --quiet | --silent) + show=: + ;; + + -dlopen) + prevopt="-dlopen" + prev=execute_dlfiles + ;; + + -*) + $echo "$modename: unrecognized option \`$arg'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + + *) + nonopt="$arg" + break + ;; + esac +done + +if test -n "$prevopt"; then + $echo "$modename: option \`$prevopt' requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 +fi + +if test -z "$show_help"; then + + # Infer the operation mode. + if test -z "$mode"; then + case "$nonopt" in + *cc | *++ | gcc* | *-gcc*) + mode=link + for arg + do + case "$arg" in + -c) + mode=compile + break + ;; + esac + done + ;; + *db | *dbx | *strace | *truss) + mode=execute + ;; + *install*|cp|mv) + mode=install + ;; + *rm) + mode=uninstall + ;; + *) + # If we have no mode, but dlfiles were specified, then do execute mode. + test -n "$execute_dlfiles" && mode=execute + + # Just use the default operation mode. + if test -z "$mode"; then + if test -n "$nonopt"; then + $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 + else + $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 + fi + fi + ;; + esac + fi + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + $echo "$modename: unrecognized option \`-dlopen'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$modename --help --mode=$mode' for more information." + + # These modes are in order of execution frequency so that they run quickly. + case "$mode" in + # libtool compile mode + compile) + modename="$modename: compile" + # Get the compilation command and the source file. + base_compile= + lastarg= + srcfile="$nonopt" + suppress_output= + + user_target=no + for arg + do + # Accept any command-line options. + case "$arg" in + -o) + if test "$user_target" != "no"; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit 1 + fi + user_target=next + ;; + + -static) + build_old_libs=yes + continue + ;; + esac + + case "$user_target" in + next) + # The next one is the -o target name + user_target=yes + continue + ;; + yes) + # We got the output file + user_target=set + libobj="$arg" + continue + ;; + esac + + # Accept the current argument as the source file. + lastarg="$srcfile" + srcfile="$arg" + + # Aesthetically quote the previous argument. + + # Backslashify any backslashes, double quotes, and dollar signs. + # These are the only characters that are still specially + # interpreted inside of double-quoted scrings. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly in scan + # sets, so we specify it separately. + case "$lastarg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + lastarg="\"$lastarg\"" + ;; + esac + + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + done + + case "$user_target" in + set) + ;; + no) + # Get the name of the library object. + libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + *) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit 1 + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSfmso]' + case "$libobj" in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case "$libobj" in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit 1 + ;; + esac + + if test -z "$base_compile"; then + $echo "$modename: you must specify a compilation command" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $libobj" + else + removelist="$libobj" + fi + + $run $rm $removelist + trap "$run $rm $removelist; exit 1" 1 2 15 + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext} + lockfile="$output_obj.lock" + removelist="$removelist $output_obj $lockfile" + trap "$run $rm $removelist; exit 1" 1 2 15 + else + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until ln "$0" "$lockfile" 2>/dev/null; do + $show "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + echo "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + echo $srcfile > "$lockfile" + fi + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + + # Only build a PIC object if we are building libtool libraries. + if test "$build_libtool_libs" = yes; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + # All platforms use -DPIC, to notify preprocessed assembler code. + command="$base_compile $srcfile $pic_flag -DPIC" + if test "$build_old_libs" = yes; then + lo_libobj="$libobj" + dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$libobj"; then + dir="$objdir" + else + dir="$dir/$objdir" + fi + libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + + if test -d "$dir"; then + $show "$rm $libobj" + $run $rm $libobj + else + $show "$mkdir $dir" + $run $mkdir $dir + status=$? + if test $status -ne 0 && test ! -d $dir; then + exit $status + fi + fi + fi + if test "$compiler_o_lo" = yes; then + output_obj="$libobj" + command="$command -o $output_obj" + elif test "$compiler_c_o" = yes; then + output_obj="$obj" + command="$command -o $output_obj" + fi + + $run $rm "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + test -n "$output_obj" && $run $rm $removelist + exit 1 + fi + + if test "$need_locks" = warn && + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + + # Just move the object if needed, then go on to compile the next one + if test x"$output_obj" != x"$libobj"; then + $show "$mv $output_obj $libobj" + if $run $mv $output_obj $libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # If we have no pic_flag, then copy the object into place and finish. + if test -z "$pic_flag" && test "$build_old_libs" = yes; then + # Rename the .lo from within objdir to obj + if test -f $obj; then + $show $rm $obj + $run $rm $obj + fi + + $show "$mv $libobj $obj" + if $run $mv $libobj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"` + libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + # Now arrange that obj and lo_libobj become the same file + $show "(cd $xdir && $LN_S $baseobj $libobj)" + if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then + exit 0 + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Allow error messages only from the first compilation. + suppress_output=' >/dev/null 2>&1' + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + command="$base_compile $srcfile" + if test "$compiler_c_o" = yes; then + command="$command -o $obj" + output_obj="$obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + command="$command$suppress_output" + $run $rm "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + $run $rm $removelist + exit 1 + fi + + if test "$need_locks" = warn && + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + + # Just move the object if needed + if test x"$output_obj" != x"$obj"; then + $show "$mv $output_obj $obj" + if $run $mv $output_obj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Create an invalid libtool object if no PIC, so that we do not + # accidentally link it into a program. + if test "$build_libtool_libs" != yes; then + $show "echo timestamp > $libobj" + $run eval "echo timestamp > \$libobj" || exit $? + else + # Move the .lo from within objdir + $show "$mv $libobj $lo_libobj" + if $run $mv $libobj $lo_libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + fi + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + $rm "$lockfile" + fi + + exit 0 + ;; + + # libtool link mode + link) + modename="$modename: link" + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # which system we are compiling for in order to pass an extra + # flag for every libtool invokation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll which has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + + # This is a source program that is used to create dlls on Windows + # Don't remove nor modify the starting and closing comments +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include +# #undef WIN32_LEAN_AND_MEAN +# #include +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ + # This is a source program that is used to create import libraries + # on Windows for dlls which lack them. Don't remove nor modify the + # starting and closing comments +# /* impgen.c starts here */ +# /* Copyright (C) 1999 Free Software Foundation, Inc. +# +# This file is part of GNU libtool. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# */ +# +# #include /* for printf() */ +# #include /* for open(), lseek(), read() */ +# #include /* for O_RDONLY, O_BINARY */ +# #include /* for strdup() */ +# +# static unsigned int +# pe_get16 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[2]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 2); +# return b[0] + (b[1]<<8); +# } +# +# static unsigned int +# pe_get32 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[4]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 4); +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# static unsigned int +# pe_as32 (ptr) +# void *ptr; +# { +# unsigned char *b = ptr; +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# int +# main (argc, argv) +# int argc; +# char *argv[]; +# { +# int dll; +# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; +# unsigned long export_rva, export_size, nsections, secptr, expptr; +# unsigned long name_rvas, nexp; +# unsigned char *expdata, *erva; +# char *filename, *dll_name; +# +# filename = argv[1]; +# +# dll = open(filename, O_RDONLY|O_BINARY); +# if (!dll) +# return 1; +# +# dll_name = filename; +# +# for (i=0; filename[i]; i++) +# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') +# dll_name = filename + i +1; +# +# pe_header_offset = pe_get32 (dll, 0x3c); +# opthdr_ofs = pe_header_offset + 4 + 20; +# num_entries = pe_get32 (dll, opthdr_ofs + 92); +# +# if (num_entries < 1) /* no exports */ +# return 1; +# +# export_rva = pe_get32 (dll, opthdr_ofs + 96); +# export_size = pe_get32 (dll, opthdr_ofs + 100); +# nsections = pe_get16 (dll, pe_header_offset + 4 +2); +# secptr = (pe_header_offset + 4 + 20 + +# pe_get16 (dll, pe_header_offset + 4 + 16)); +# +# expptr = 0; +# for (i = 0; i < nsections; i++) +# { +# char sname[8]; +# unsigned long secptr1 = secptr + 40 * i; +# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); +# unsigned long vsize = pe_get32 (dll, secptr1 + 16); +# unsigned long fptr = pe_get32 (dll, secptr1 + 20); +# lseek(dll, secptr1, SEEK_SET); +# read(dll, sname, 8); +# if (vaddr <= export_rva && vaddr+vsize > export_rva) +# { +# expptr = fptr + (export_rva - vaddr); +# if (export_rva + export_size > vaddr + vsize) +# export_size = vsize - (export_rva - vaddr); +# break; +# } +# } +# +# expdata = (unsigned char*)malloc(export_size); +# lseek (dll, expptr, SEEK_SET); +# read (dll, expdata, export_size); +# erva = expdata - export_rva; +# +# nexp = pe_as32 (expdata+24); +# name_rvas = pe_as32 (expdata+32); +# +# printf ("EXPORTS\n"); +# for (i = 0; i&2 + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + else + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + fi + build_libtool_libs=no + build_old_libs=yes + prefer_static_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test $# -gt 0; do + arg="$1" + shift + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case "$prev" in + output) + compile_command="$compile_command @OUTPUT@" + finalize_command="$finalize_command @OUTPUT@" + ;; + esac + + case "$prev" in + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + compile_command="$compile_command @SYMFILE@" + finalize_command="$finalize_command @SYMFILE@" + preload=yes + fi + case "$arg" in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi + prev= + ;; + esac + ;; + expsyms) + export_symbols="$arg" + if test ! -f "$arg"; then + $echo "$modename: symbol file \`$arg' does not exist" + exit 1 + fi + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case "$arg" in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi + + prevarg="$arg" + + case "$arg" in + -all-static) + if test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 + continue + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: not more than one -exported-symbols argument allowed" + exit 1 + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -L*) + dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` + # We need an absolute path. + case "$dir" in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + absdir="$dir" + fi + dir="$absdir" + ;; + esac + case " $deplibs " in + *" $arg "*) ;; + *) deplibs="$deplibs $arg";; + esac + case " $lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir";; + esac + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2*) + dllsearchdir=`cd "$dir" && pwd || echo "$dir"` + case ":$dllsearchpath:" in + ::) dllsearchpath="$dllsearchdir";; + *":$dllsearchdir:"*) ;; + *) dllsearchpath="$dllsearchpath:$dllsearchdir";; + esac + ;; + esac + ;; + + -l*) + if test "$arg" = "-lc"; then + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) + # These systems don't actually have c library (as such) + continue + ;; + esac + elif test "$arg" = "-lm"; then + case "$host" in + *-*-cygwin* | *-*-beos*) + # These systems don't actually have math library (as such) + continue + ;; + esac + fi + deplibs="$deplibs $arg" + ;; + + -module) + module=yes + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -o) prev=output ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` + # We need an absolute path. + case "$dir" in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -static) + # If we have no pic_flag, then this is the same as -all-static. + if test -z "$pic_flag" && test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + # Some other compiler flag. + -* | +*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + ;; + + *.o | *.obj | *.a | *.lib) + # A standard object. + objs="$objs $arg" + ;; + + *.lo) + # A library object. + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` + prev= + fi + libobjs="$libobjs $arg" + ;; + + *.la) + # A libtool-controlled library. + + dlname= + libdir= + library_names= + old_library= + + # Check to see that this really is a libtool archive. + if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2 + exit 1 + fi + + # If the library was installed with an old release of libtool, + # it will not redefine variable installed. + installed=yes + + # Read the .la file + # If there is no directory component, then add one. + case "$arg" in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + + if test -z "$linklib"; then + $echo "$modename: cannot find name of link library for \`$arg'" 1>&2 + exit 1 + fi + + # Find the relevant object directory and library name. + name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'` + + if test "X$installed" = Xyes; then + dir="$libdir" + else + dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$arg"; then + dir="$objdir" + else + dir="$dir/$objdir" + fi + fi + + if test -n "$dependency_libs"; then + # Extract -R and -L from dependency_libs + temp_deplibs= + for deplib in $dependency_libs; do + case "$deplib" in + -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'` + case " $rpath $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + -L*) case "$compile_command $temp_deplibs " in + *" $deplib "*) ;; + *) temp_deplibs="$temp_deplibs $deplib";; + esac + temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'` + case " $lib_search_path " in + *" $temp_dir "*) ;; + *) lib_search_path="$lib_search_path $temp_dir";; + esac + ;; + *) temp_deplibs="$temp_deplibs $deplib";; + esac + done + dependency_libs="$temp_deplibs" + fi + + if test -z "$libdir"; then + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $dir/$old_library" + old_convenience="$old_convenience $dir/$old_library" + deplibs="$deplibs$dependency_libs" + compile_command="$compile_command $dir/$old_library$dependency_libs" + finalize_command="$finalize_command $dir/$old_library$dependency_libs" + continue + fi + + # This library was specified with -dlopen. + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking statically, + # we need to preload. + prev=dlprefiles + else + # We should not create a dependency on this library, but we + # may need any libraries it requires. + compile_command="$compile_command$dependency_libs" + finalize_command="$finalize_command$dependency_libs" + prev= + continue + fi + fi + + # The library was specified with -dlpreopen. + if test "$prev" = dlprefiles; then + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + dlprefiles="$dlprefiles $dir/$old_library" + else + dlprefiles="$dlprefiles $dir/$linklib" + fi + prev= + fi + + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + link_against_libtool_libs="$link_against_libtool_libs $arg" + if test -n "$shlibpath_var"; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi + + # We need an absolute path. + case "$dir" in + [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + absdir="$dir" + fi + ;; + esac + + # This is the magic to use -rpath. + # Skip directories that are in the system default run-time + # search path, unless they have been requested with -R. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + + lib_linked=yes + case "$hardcode_action" in + immediate | unsupported) + if test "$hardcode_direct" = no; then + compile_command="$compile_command $dir/$linklib" + deplibs="$deplibs $dir/$linklib" + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2*) + dllsearchdir=`cd "$dir" && pwd || echo "$dir"` + if test -n "$dllsearchpath"; then + dllsearchpath="$dllsearchpath:$dllsearchdir" + else + dllsearchpath="$dllsearchdir" + fi + ;; + esac + elif test "$hardcode_minus_L" = no; then + case "$host" in + *-*-sunos*) + compile_shlibpath="$compile_shlibpath$dir:" + ;; + esac + case "$compile_command " in + *" -L$dir "*) ;; + *) compile_command="$compile_command -L$dir";; + esac + compile_command="$compile_command -l$name" + deplibs="$deplibs -L$dir -l$name" + elif test "$hardcode_shlibpath_var" = no; then + case ":$compile_shlibpath:" in + *":$dir:"*) ;; + *) compile_shlibpath="$compile_shlibpath$dir:";; + esac + compile_command="$compile_command -l$name" + deplibs="$deplibs -l$name" + else + lib_linked=no + fi + ;; + + relink) + if test "$hardcode_direct" = yes; then + compile_command="$compile_command $absdir/$linklib" + deplibs="$deplibs $absdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + case "$compile_command " in + *" -L$absdir "*) ;; + *) compile_command="$compile_command -L$absdir";; + esac + compile_command="$compile_command -l$name" + deplibs="$deplibs -L$absdir -l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case ":$compile_shlibpath:" in + *":$absdir:"*) ;; + *) compile_shlibpath="$compile_shlibpath$absdir:";; + esac + compile_command="$compile_command -l$name" + deplibs="$deplibs -l$name" + else + lib_linked=no + fi + ;; + + *) + lib_linked=no + ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit 1 + fi + + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + finalize_command="$finalize_command $libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + case "$finalize_command " in + *" -L$libdir "*) ;; + *) finalize_command="$finalize_command -L$libdir";; + esac + finalize_command="$finalize_command -l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case ":$finalize_shlibpath:" in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:";; + esac + finalize_command="$finalize_command -l$name" + else + # We cannot seem to hardcode it, guess we'll fake it. + case "$finalize_command " in + *" -L$dir "*) ;; + *) finalize_command="$finalize_command -L$libdir";; + esac + finalize_command="$finalize_command -l$name" + fi + else + # Transform directly to old archives if we don't build new libraries. + if test -n "$pic_flag" && test -z "$old_library"; then + $echo "$modename: cannot find static library for \`$arg'" 1>&2 + exit 1 + fi + + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_command="$compile_command $dir/$linklib" + finalize_command="$finalize_command $dir/$linklib" + else + case "$compile_command " in + *" -L$dir "*) ;; + *) compile_command="$compile_command -L$dir";; + esac + compile_command="$compile_command -l$name" + case "$finalize_command " in + *" -L$dir "*) ;; + *) finalize_command="$finalize_command -L$dir";; + esac + finalize_command="$finalize_command -l$name" + fi + fi + + # Add in any libraries that this one depends upon. + compile_command="$compile_command$dependency_libs" + finalize_command="$finalize_command$dependency_libs" + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + ;; + esac + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + done + + if test -n "$prev"; then + $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` + libobjs_save="$libobjs" + + case "$output" in + "") + $echo "$modename: you must specify an output file" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + + *.a | *.lib) + if test -n "$link_against_libtool_libs"; then + $echo "$modename: error: cannot link libtool libraries into archives" 1>&2 + exit 1 + fi + + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 + fi + + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 + fi + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + ;; + + *.la) + # Make sure we only generate libraries of the form `libNAME.la'. + case "$outputname" in + lib*) + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval libname=\"$libname_spec\" + ;; + *) + if test "$module" = no; then + $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval libname=\"$libname_spec\" + else + libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + fi + ;; + esac + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + + if test -n "$objs"; then + $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1 + exit 1 + fi + + # How the heck are we supposed to write a wrapper for a shared library? + if test -n "$link_against_libtool_libs"; then + $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2 + exit 1 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2 + fi + + set dummy $rpath + if test $# -gt 2; then + $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 + fi + install_libdir="$2" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + libext=al + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + dependency_libs="$deplibs" + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 + fi + else + + # Parse the version information argument. + IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + IFS="$save_ifs" + + if test -n "$8"; then + $echo "$modename: too many parameters to \`-version-info'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + current="$2" + revision="$3" + age="$4" + + # Check that each of the things are valid numbers. + case "$current" in + [0-9]*) ;; + *) + $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case "$revision" in + [0-9]*) ;; + *) + $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case "$age" in + [0-9]*) ;; + *) + $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + if test $age -gt $current; then + $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case "$version_type" in + none) ;; + + irix) + major=`expr $current - $age + 1` + versuffix="$major.$revision" + verstring="sgi$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test $loop != 0; do + iface=`expr $revision - $loop` + loop=`expr $loop - 1` + verstring="sgi$major.$iface:$verstring" + done + ;; + + linux) + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + ;; + + osf) + major=`expr $current - $age` + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test $loop != 0; do + iface=`expr $current - $loop` + loop=`expr $loop - 1` + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current"; + ;; + + windows) + # Like Linux, but with '-' rather than '.', since we only + # want one extension on Windows 95. + major=`expr $current - $age` + versuffix="-$major-$age-$revision" + ;; + + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + verstring="0.0" + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + + dependency_libs="$deplibs" + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody*) + # rhapsody is a little odd... + deplibs="$deplibs -framework System" + ;; + *) + # Add libc to deplibs on all other systems. + deplibs="$deplibs -lc" + ;; + esac + fi + + # Create the output directory, or remove our outputs if we need to. + if test -d $output_objdir; then + $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" + $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* + else + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + status=$? + if test $status -ne 0 && test ! -d $output_objdir; then + exit $status + fi + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + if test "$build_libtool_libs" = yes; then + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case "$deplibs_check_method" in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behaviour. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $rm conftest.c + cat > conftest.c </dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null \ + | grep " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | sed 's/.* -> //'` + case "$potliblink" in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ + | sed 10q \ + | egrep "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + echo "*** Warning: This library needs some functionality provided by $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | + grep . >/dev/null; then + echo + if test "X$deplibs_check_method" = "Xnone"; then + echo "*** Warning: inter-library dependencies are not supported in this platform." + else + echo "*** Warning: inter-library dependencies are not known to be supported." + fi + echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + echo "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + # Get the real and link names of the library. + eval library_names=\"$library_names_spec\" + set dummy $library_names + realname="$2" + shift; shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + lib="$output_objdir/$realname" + for link + do + linknames="$linknames $link" + done + + # Ensure that we have .o objects for linkers which dislike .lo + # (e.g. aix) in case we are running --disable-static + for obj in $libobjs; do + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + if test ! -f $xdir/$oldobj; then + $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" + $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? + fi + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + eval cmds=\"$export_symbols_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + if test -n "$export_symbols_regex"; then + $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$mv \"${export_symbols}T\" \"$export_symbols\"" + $run eval '$mv "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' + fi + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case "$xlib" in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linkopts="$linkopts $flag" + fi + + # Do each of the archive commands. + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval cmds=\"$archive_expsym_cmds\" + else + eval cmds=\"$archive_cmds\" + fi + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + *.lo | *.o | *.obj) + if test -n "$link_against_libtool_libs"; then + $echo "$modename: error: cannot link libtool libraries into objects" 1>&2 + exit 1 + fi + + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 + fi + + case "$output" in + *.lo) + if test -n "$objs"; then + $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 + exit 1 + fi + libobj="$output" + obj=`$echo "X$output" | $Xsed -e "$lo2o"` + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $run $rm $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${obj}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case "$xlib" in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + + # Create the old-style object. + reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" + + output="$obj" + eval cmds=\"$reload_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + $show "echo timestamp > $libobj" + $run eval "echo timestamp > $libobj" || exit $? + exit 0 + fi + + if test -n "$pic_flag"; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + eval cmds=\"$reload_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + else + # Just create a symlink. + $show $rm $libobj + $run $rm $libobj + xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$libobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + $show "(cd $xdir && $LN_S $oldobj $baseobj)" + $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? + fi + + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + ;; + + # Anything else should be a program. + *) + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 + fi + + if test "$preload" = yes; then + if test "$dlopen" = unknown && test "$dlopen_self" = unknown && + test "$dlopen_self_static" = unknown; then + $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." + fi + fi + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$compile_rpath " in + *" $libdir "*) ;; + *) compile_rpath="$compile_rpath $libdir" ;; + esac + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + + # Create the binary in the object directory, then wrap it. + if test ! -d $output_objdir; then + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + status=$? + if test $status -ne 0 && test ! -d $output_objdir; then + exit $status + fi + fi + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + dlsyms= + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + dlsyms="${outputname}S.c" + else + $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 + fi + fi + + if test -n "$dlsyms"; then + case "$dlsyms" in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${outputname}.nm" + + $show "$rm $nlist ${nlist}S ${nlist}T" + $run $rm "$nlist" "${nlist}S" "${nlist}T" + + # Parse the name list into a source file. + $show "creating $output_objdir/$dlsyms" + + test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ +/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ +/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* Prevent the only kind of declaration conflicts we can make. */ +#define lt_preloaded_symbols some_other_symbol + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + $show "generating symbol list for \`$output'" + + test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for arg in $progfiles; do + $show "extracting global C symbols from \`$arg'" + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + if test -n "$export_symbols_regex"; then + $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$output.exp" + $run $rm $export_symbols + $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + else + $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' + $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' + $run eval 'mv "$nlist"T "$nlist"' + fi + fi + + for arg in $dlprefiles; do + $show "extracting global C symbols from \`$arg'" + name=`echo "$arg" | sed -e 's%^.*/%%'` + $run eval 'echo ": $name " >> "$nlist"' + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -z "$run"; then + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $mv "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then + : + else + grep -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' + else + echo '/* NONE */' >> "$output_objdir/$dlsyms" + fi + + $echo >> "$output_objdir/$dlsyms" "\ + +#undef lt_preloaded_symbols + +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[] = +{\ +" + + sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \ + -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \ + < "$nlist" >> "$output_objdir/$dlsyms" + + $echo >> "$output_objdir/$dlsyms" "\ + {0, (lt_ptr_t) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + fi + + pic_flag_for_symtable= + case "$host" in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; + esac;; + *-*-hpux*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DPIC";; + esac + esac + + # Now compile the dynamic symbol file. + $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + + # Clean up the generated files. + $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" + $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" + + # Transform the symbol file into the correct name. + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + ;; + *) + $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 + exit 1 + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi + + if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then + # Replace the output file specification. + compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + $show "$link_command" + $run eval "$link_command" + status=$? + + # Delete the generated files. + if test -n "$dlsyms"; then + $show "$rm $output_objdir/${outputname}S.${objext}" + $run $rm "$output_objdir/${outputname}S.${objext}" + fi + + exit $status + fi + + if test -n "$shlibpath_var"; then + # We should set the shlibpath_var + rpath= + for dir in $temp_rpath; do + case "$dir" in + [\\/]* | [A-Za-z]:[\\/]*) + # Absolute path. + rpath="$rpath$dir:" + ;; + *) + # Relative path: add a thisdir entry. + rpath="$rpath\$thisdir/$dir:" + ;; + esac + done + temp_rpath="$rpath" + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 + $echo "$modename: \`$output' will be relinked during installation" 1>&2 + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname + + $show "$link_command" + $run eval "$link_command" || exit $? + + # Now create the wrapper script. + $show "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $echo for shipping. + if test "X$echo" = "X$SHELL $0 --fallback-echo"; then + case "$0" in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; + *) qecho="$SHELL `pwd`/$0 --fallback-echo";; + esac + qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` + fi + + # Only actually do things if our run command is non-null. + if test -z "$run"; then + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) output=`echo $output|sed 's,.exe$,,'` ;; + esac + $rm $output + trap "$rm $output; exit 1" 1 2 15 + + $echo > $output "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variable: + link_against_libtool_libs='$link_against_libtool_libs' +else + # When we are sourced in execute mode, \$file and \$echo are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + echo=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$echo works! + : + else + # Restart under the correct shell, and then maybe \$echo will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $echo >> $output "\ + + # Find the directory that this script lives in. + thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` + done + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + echo >> $output "\ + program=lt-'$outputname' + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || \\ + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $mkdir \"\$progdir\" + else + $rm \"\$progdir/\$file\" + fi" + + echo >> $output "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if (cd \"\$thisdir\" && eval \$relink_command); then : + else + $rm \"\$progdir/\$file\" + exit 1 + fi + fi + + $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $rm \"\$progdir/\$program\"; + $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $rm \"\$progdir/\$file\" + fi" + else + echo >> $output "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + echo >> $output "\ + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $echo >> $output "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $echo >> $output "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $echo >> $output "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # win32 systems need to use the prog path for dll + # lookup to work + *-*-cygwin*) + $echo >> $output "\ + exec \$progdir/\$program \${1+\"\$@\"} +" + ;; + + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2*) + $echo >> $output "\ + exec \$progdir\\\\\$program \${1+\"\$@\"} +" + ;; + + *) + $echo >> $output "\ + # Export the path to the program. + PATH=\"\$progdir:\$PATH\" + export PATH + + exec \$program \${1+\"\$@\"} +" + ;; + esac + $echo >> $output "\ + \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" + exit 1 + fi + else + # The program doesn't exist. + \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 + \$echo \"This script is just a wrapper for \$program.\" 1>&2 + echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" + chmod +x $output + fi + exit 0 + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + # Add in members from convenience archives. + for xlib in $addlibs; do + # Extract the objects. + case "$xlib" in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` + done + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + eval cmds=\"$old_archive_from_new_cmds\" + else + # Ensure that we have .o objects in place in case we decided + # not to build a shared library, and have fallen back to building + # static libs even though --disable-static was passed! + for oldobj in $oldobjs; do + if test ! -f $oldobj; then + xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$oldobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` + obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + $show "(cd $xdir && ${LN_S} $obj $baseobj)" + $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? + fi + done + + eval cmds=\"$old_archive_cmds\" + fi + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$generated"; then + $show "${rm}r$generated" + $run ${rm}r$generated + fi + + # Now create the libtool archive. + case "$output" in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + $show "creating $output" + + if test -n "$xrpath"; then + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + done + dependency_libs="$temp_xrpath $dependency_libs" + fi + + # Only create the output if not a dry run. + if test -z "$run"; then + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + fi + $rm $output + $echo > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$dlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Directory that this library needs to be installed in: +libdir='$install_libdir'\ +" + done + fi + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" + $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $? + ;; + esac + exit 0 + ;; + + # libtool install mode + install) + modename="$modename: install" + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then + # Aesthetically quote it. + arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$arg " + arg="$1" + shift + else + install_prog= + arg="$nonopt" + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog$arg" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest="$arg" + continue + fi + + case "$arg" in + -d) isdir=yes ;; + -f) prev="-f" ;; + -g) prev="-g" ;; + -m) prev="-m" ;; + -o) prev="-o" ;; + -s) + stripme=" -s" + continue + ;; + -*) ;; + + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest="$arg" + continue + fi + ;; + esac + + # Aesthetically quote the argument. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog $arg" + done + + if test -z "$install_prog"; then + $echo "$modename: you must specify an install program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -n "$prev"; then + $echo "$modename: the \`$prev' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -z "$files"; then + if test -z "$dest"; then + $echo "$modename: no file or destination specified" 1>&2 + else + $echo "$modename: you must specify a destination" 1>&2 + fi + $echo "$help" 1>&2 + exit 1 + fi + + # Strip any trailing slash from the destination. + dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` + test "X$destdir" = "X$dest" && destdir=. + destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` + + # Not a directory, so check to see that there is only one file specified. + set dummy $files + if test $# -gt 2; then + $echo "$modename: \`$dest' is not a directory" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + fi + case "$destdir" in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case "$file" in + *.lo) ;; + *) + $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case "$file" in + *.a | *.lib) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + library_names= + old_library= + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/" + test "X$dir" = "X$file/" && dir= + dir="$dir$objdir" + + # See the names of the shared library. + set dummy $library_names + if test -n "$2"; then + realname="$2" + shift + shift + + # Install the shared library and build the symlinks. + $show "$install_prog $dir/$realname $destdir/$realname" + $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $? + + if test $# -gt 0; then + # Delete the old symlinks, and create new ones. + for linkname + do + if test "$linkname" != "$realname"; then + $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + fi + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + eval cmds=\"$postinstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Install the pseudo-library for information purposes. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + instname="$dir/$name"i + $show "$install_prog $instname $destdir/$name" + $run eval "$install_prog $instname $destdir/$name" || exit $? + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case "$destfile" in + *.lo) + staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` + ;; + *.o | *.obj) + staticdest="$destfile" + destfile= + ;; + *) + $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + + # Install the libtool object if requested. + if test -n "$destfile"; then + $show "$install_prog $file $destfile" + $run eval "$install_prog $file $destfile" || exit $? + fi + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` + + $show "$install_prog $staticobj $staticdest" + $run eval "$install_prog \$staticobj \$staticdest" || exit $? + fi + exit 0 + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Do a test to see if this is really a libtool program. + if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + link_against_libtool_libs= + relink_command= + + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Check the variables that should have been set. + if test -z "$link_against_libtool_libs"; then + $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 + exit 1 + fi + + finalize=yes + for lib in $link_against_libtool_libs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + # If there is no directory component, then add one. + case "$lib" in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + fi + libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`" + if test -n "$libdir" && test ! -f "$libfile"; then + $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 + finalize=no + fi + done + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + if test "$finalize" = yes && test -z "$run"; then + tmpdir="/tmp" + test -n "$TMPDIR" && tmpdir="$TMPDIR" + tmpdir=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null` + if test $? = 0 ; then : + else + tmpdir="$tmpdir/libtool-$$" + fi + if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : + else + $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 + continue + fi + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + ${rm}r "$tmpdir" + continue + fi + file="$outputname" + else + $echo "$modename: warning: cannot relink \`$file'" 1>&2 + fi + else + # Install the binary that we compiled earlier. + file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + $show "$install_prog$stripme $file $destfile" + $run eval "$install_prog\$stripme \$file \$destfile" || exit $? + test -n "$outputname" && ${rm}r "$tmpdir" + ;; + esac + done + + for file in $staticlibs; do + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + $show "$install_prog $file $oldlib" + $run eval "$install_prog \$file \$oldlib" || exit $? + + # Do each command in the postinstall commands. + eval cmds=\"$old_postinstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$future_libdirs"; then + $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 + fi + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + test -n "$run" && current_libdirs=" -n$current_libdirs" + exec $SHELL $0 --finish$current_libdirs + exit 1 + fi + + exit 0 + ;; + + # libtool finish mode + finish) + modename="$modename: finish" + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + eval cmds=\"$finish_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || admincmds="$admincmds + $cmd" + done + IFS="$save_ifs" + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $run eval "$cmds" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + test "$show" = : && exit 0 + + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + echo " $libdir" + done + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use \`-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the \`$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + echo " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + echo " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + echo + echo "See any operating system documentation about shared libraries for" + echo "more information, such as the ld(1) and ld.so(8) manual pages." + echo "----------------------------------------------------------------------" + exit 0 + ;; + + # libtool execute mode + execute) + modename="$modename: execute" + + # The first argument is the command name. + cmd="$nonopt" + if test -z "$cmd"; then + $echo "$modename: you must specify a COMMAND" 1>&2 + $echo "$help" + exit 1 + fi + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + if test ! -f "$file"; then + $echo "$modename: \`$file' is not a file" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + dir= + case "$file" in + *.la) + # Check to see that this really is a libtool archive. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Read the libtool library. + dlname= + library_names= + + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" + continue + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 + exit 1 + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + ;; + + *) + $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case "$file" in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` + args="$args \"$file\"" + done + + if test -z "$run"; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved enviroment variables + if test "${save_LC_ALL+set}" = set; then + LC_ALL="$save_LC_ALL"; export LC_ALL + fi + if test "${save_LANG+set}" = set; then + LANG="$save_LANG"; export LANG + fi + + # Now actually exec the command. + eval "exec \$cmd$args" + + $echo "$modename: cannot exec \$cmd$args" + exit 1 + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" + fi + $echo "$cmd$args" + exit 0 + fi + ;; + + # libtool uninstall mode + uninstall) + modename="$modename: uninstall" + rm="$nonopt" + files= + + for arg + do + case "$arg" in + -*) rm="$rm $arg" ;; + *) files="$files $arg" ;; + esac + done + + if test -z "$rm"; then + $echo "$modename: you must specify an RM program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + for file in $files; do + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + rmfiles="$file" + + case "$name" in + *.la) + # Possibly a libtool archive, so verify it. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + . $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $dir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library" + + $show "$rm $rmfiles" + $run $rm $rmfiles + + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + eval cmds=\"$postuninstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + done + IFS="$save_ifs" + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + eval cmds=\"$old_postuninstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + done + IFS="$save_ifs" + fi + + # FIXME: should reinstall the best remaining shared library. + fi + ;; + + *.lo) + if test "$build_old_libs" = yes; then + oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` + rmfiles="$rmfiles $dir/$oldobj" + fi + $show "$rm $rmfiles" + $run $rm $rmfiles + ;; + + *) + $show "$rm $rmfiles" + $run $rm $rmfiles + ;; + esac + done + exit 0 + ;; + + "") + $echo "$modename: you must specify a MODE" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 + ;; + esac + + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 +fi # test -z "$show_help" + +# We need to display help for each of the modes. +case "$mode" in +"") $echo \ +"Usage: $modename [OPTION]... [MODE-ARG]... + +Provide generalized library-building support services. + + --config show all configuration variables + --debug enable verbose shell tracing +-n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --finish same as \`--mode=finish' + --help display this help message and exit + --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] + --quiet same as \`--silent' + --silent don't print informational messages + --version print version information + +MODE must be one of the following: + + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for +a more detailed description of MODE." + exit 0 + ;; + +compile) + $echo \ +"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -static always build a \`.o' file suitable for static linking + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + +execute) + $echo \ +"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + +finish) + $echo \ +"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + +install) + $echo \ +"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + +link) + $echo \ +"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -static do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + +uninstall) + $echo \ +"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + +*) + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; +esac + +echo +$echo "Try \`$modename --help' for more information about other modes." + +exit 0 + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/boost/missing b/boost/missing new file mode 100755 index 0000000000..7789652e87 --- /dev/null +++ b/boost/missing @@ -0,0 +1,190 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997 Free Software Foundation, Inc. +# Franc,ois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing - GNU libit 0.0" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`configure.in'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`configure.in'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`configure.in'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/boost/mkinstalldirs b/boost/mkinstalldirs new file mode 100755 index 0000000000..e1a670b1e6 --- /dev/null +++ b/boost/mkinstalldirs @@ -0,0 +1,40 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + +# $Id: mkinstalldirs,v 1.1 2001/02/12 14:44:52 larsbj Exp $ + +errstatus=0 + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/config/boost.m4 b/config/boost.m4 new file mode 100644 index 0000000000..aef4b3729c --- /dev/null +++ b/config/boost.m4 @@ -0,0 +1,25 @@ + +dnl AC_VALIDATE_CACHE_SYSTEM_TYPE[(cmd)] +dnl if the cache file is inconsistent with the current host, +dnl target and build system types, execute CMD or print a default +dnl error message. +AC_DEFUN(AC_VALIDATE_CACHE_SYSTEM_TYPE, [ + AC_REQUIRE([AC_CANONICAL_SYSTEM]) + AC_MSG_CHECKING([config.cache system type]) + if { test x"${ac_cv_host_system_type+set}" = x"set" && + test x"$ac_cv_host_system_type" != x"$host"; } || + { test x"${ac_cv_build_system_type+set}" = x"set" && + test x"$ac_cv_build_system_type" != x"$build"; } || + { test x"${ac_cv_target_system_type+set}" = x"set" && + test x"$ac_cv_target_system_type" != x"$target"; }; then + AC_MSG_RESULT([different]) + ifelse($#, 1, [$1], + [AC_MSG_ERROR(["you must remove config.cache and restart configure"])]) + else + AC_MSG_RESULT([same]) + fi + ac_cv_host_system_type="$host" + ac_cv_build_system_type="$build" + ac_cv_target_system_type="$target" +]) + diff --git a/po/POTFILES.in b/po/POTFILES.in index 97ee17de5f..7739bbbcca 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -65,16 +65,11 @@ src/frontends/kde/tabcreatedlg.C src/frontends/kde/tocdlg.C src/frontends/kde/urldlg.C src/frontends/qt2/FormCopyright.C -src/frontends/qt2/FormParagraph.C -src/frontends/qt2/FormPrint.C -src/frontends/qt2/FormTabularCreate.C -src/frontends/qt2/paragraphdlgimpl.C -src/frontends/qt2/tabularcreatedlgimpl.C src/frontends/xforms/FormBase.h -src/frontends/xforms/FormBibitem.C src/frontends/xforms/form_bibitem.C -src/frontends/xforms/FormBibtex.C +src/frontends/xforms/FormBibitem.C src/frontends/xforms/form_bibtex.C +src/frontends/xforms/FormBibtex.C src/frontends/xforms/form_browser.C src/frontends/xforms/form_citation.C src/frontends/xforms/FormCitation.C @@ -86,6 +81,8 @@ src/frontends/xforms/form_error.C src/frontends/xforms/FormError.C src/frontends/xforms/form_graphics.C src/frontends/xforms/FormGraphics.C +src/frontends/xforms/form_include.C +src/frontends/xforms/FormInclude.C src/frontends/xforms/form_index.C src/frontends/xforms/FormIndex.C src/frontends/xforms/FormInset.h @@ -98,6 +95,7 @@ src/frontends/xforms/form_print.C src/frontends/xforms/FormPrint.C src/frontends/xforms/form_ref.C src/frontends/xforms/FormRef.C +src/frontends/xforms/FormSplash.C src/frontends/xforms/form_tabular.C src/frontends/xforms/FormTabular.C src/frontends/xforms/form_tabular_create.C