# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) AC_INIT([XQilla],[1.0],[]) AC_CONFIG_AUX_DIR(autotools) AC_CANONICAL_TARGET([]) AM_INIT_AUTOMAKE(XQilla, 1.0,) AC_CONFIG_SRCDIR([src/runtime/Result.cpp]) AC_CONFIG_HEADERS([src/config/xqilla_config_unix.h]) # Check debug option AC_MSG_CHECKING(if --enable-debug option specified) AC_ARG_ENABLE(debug, [AS_HELP_STRING(--enable-debug,Build a debugging version.)], [xqilla_cv_debug="$enable_debug"], [xqilla_cv_debug="no"]) AC_MSG_RESULT($xqilla_cv_debug) # Don't override anything if it's already set from the environment. optimize_def="-O" case $host_os in aix4.3.*|aix5*) optimize_def="-O2" CC=${CC-"xlc_r"} CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" LDFLAGS="$LDFLAGS -Wl,-brtl";; bsdi3*) CC=${CC-"shlicc2"} LIBS="$LIBS -lipc";; cygwin*) CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE -D_REENTRANT";; freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" LDFLAGS="$LDFLAGS -pthread";; gnu*|k*bsd*-gnu|linux*) optimize_def="-O2" CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE -D_REENTRANT";; hpux*) CPPFLAGS="$CPPFLAGS -D_REENTRANT";; irix*) optimize_def="-O2" CPPFLAGS="$CPPFLAGS -D_SGI_MP_SOURCE";; mpeix*) CPPFLAGS="$CPPFLAGS -D_POSIX_SOURCE -D_SOCKET_SOURCE" LIBS="$LIBS -lsocket -lsvipc";; osf*) CPPFLAGS="$CPPFLAGS -pthread";; *qnx*) AC_DEFINE(HAVE_QNX) AH_TEMPLATE(HAVE_QNX, [Define to 1 if building on QNX.]);; solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT";; esac # Set CFLAGS/CXXFLAGS. We MUST set the flags before we call autoconf # compiler configuration macros, because if we don't, they set CFLAGS # to no optimization and -g, which isn't what we want. if test "$xqilla_cv_debug" = "yes"; then AC_DEFINE(DEBUG) AH_TEMPLATE(DEBUG, [Define to 1 if you want a debugging version.]) CFLAGS="$CFLAGS -g" CXXFLAGS="$CXXFLAGS -g" else CFLAGS=${CFLAGS-$optimize_def} CXXFLAGS=${CXXFLAGS-"$CFLAGS"} fi # Check Xerces library name AC_MSG_CHECKING([if --with-xerces=DIR option specified]) AC_ARG_WITH(xerces, [AS_HELP_STRING(--with-xerces=DIR,Path of Xerces. [DIR="../xerces-c-src"])], [with_xerces="$withval"], [with_xerces="no"]) AC_MSG_RESULT($with_xerces) if test "$with_xerces" = "no"; then with_xerces="/usr/local" fi if test `ls $with_xerces/lib/libxerces-c.*2[[6-7]].* 2>/dev/null | wc -l` -gt 0 ; then AC_MSG_CHECKING([for Xerces C++ version from source tree]) xerces_version=`ls "$with_xerces"/lib/libxerces-c.*[[0-9]][[0-9]].* | tail -1 | sed 's/.*xerces-c.*\([[0-9]]\)\([[0-9]]\).*/\1.\2/'` AC_MSG_RESULT([$xerces_version]) xerces_lib="$with_xerces/lib" xerces_include="$with_xerces/src" xerces_library="xerces-c" elif test `ls $with_xerces/lib/libxerces-c*2[[6-7]].* 2>/dev/null | wc -l` -gt 0 ; then AC_MSG_CHECKING([for Xerces C++ version from source tree]) xerces_version=`ls "$with_xerces"/lib/libxerces-c*[[0-9]][[0-9]].* | tail -1 | sed 's/.*xerces-c*\([[0-9]]\)\([[0-9]]\).*/\1.\2/'` AC_MSG_RESULT([$xerces_version]) xerces_lib="$with_xerces/lib" xerces_include="$with_xerces/src" xerces_library="xerces-c" else AC_MSG_ERROR([Xerces-C++ is required to build XQuery. $with_xerces not a valid, supported Xerces tree. You must specify the path where Xerces is installed with --with-xerces.]) fi AC_SUBST(xerces_include) AC_SUBST(xerces_lib) # Checks for programs. AC_PROG_CXX AC_PROG_CC AC_PROG_LIBTOOL AC_PROG_CPP AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET #AC_PROG_RANLIB AC_PROG_YACC AM_PROG_LEX # Check for unicode support in flex AC_MSG_CHECKING([unicode support in flex]) flex --help | grep "\-U" > /dev/null if test "$?" -eq "0" then AC_MSG_RESULT([found]) else AC_MSG_WARN([not found. XQilla requires a version of flex supporting the -U (16-bit unicode) flag if you need to rebuild the lexer.]) fi # Set up extra compiler flags for GCC if test "$GXX" = "yes"; then if test "$xqilla_cv_debug" = "yes"; then CXXFLAGS="$CXXFLAGS -Wall -ftemplate-depth-50 ${targetoptions}" CFLAGS="$CFLAGS -Wall ${targetoptions}" else CXXFLAGS="$CXXFLAGS -ftemplate-depth-50 ${targetoptions}" CFLAGS="$CFLAGS ${targetoptions}" fi fi # Checks for libraries. AC_CHECK_LIB(pthread,pthread_create) AC_CHECK_LIB(socket,connect) AC_CHECK_LIB(nsl,gethostbyname) # Checks for header files. AC_FUNC_ALLOCA AC_HEADER_STDC AC_CHECK_HEADERS([limits.h malloc.h stddef.h stdlib.h string.h sys/time.h sys/timeb.h wchar.h]) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL AC_C_CONST AC_C_INLINE AC_TYPE_SIZE_T AC_HEADER_TIME AC_STRUCT_TM AC_CHECK_TYPES([ptrdiff_t]) # Checks for library functions. AC_FUNC_ERROR_AT_LINE AC_FUNC_MKTIME AC_CHECK_FUNCS([floor ftime gettimeofday memmove memset pow sqrt strchr strstr tzset]) AC_CONFIG_FILES([Makefile include/Makefile]) AC_OUTPUT