XQuilla/configure.in

287 lines
11 KiB
Text
Raw Normal View History

2020-02-17 21:05:20 +00:00
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
2020-02-17 21:15:56 +00:00
AC_INIT([XQilla],[2.1.3],[])
2020-02-17 21:05:20 +00:00
AC_CONFIG_AUX_DIR(autotools)
AC_CANONICAL_TARGET([])
2020-02-17 21:15:56 +00:00
AM_INIT_AUTOMAKE(XQilla, 2.1.3,)
2020-02-17 21:05:20 +00:00
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*)
2020-02-17 21:13:50 +00:00
CPPFLAGS="$CPPFLAGS -D_REENTRANT"
LIBS="$LIBS -lm";;
2020-02-17 21:05:20 +00:00
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
2020-02-17 21:13:50 +00:00
AH_TEMPLATE(HAVE_XERCES3, [Define to 1 if the Xerces-C library used is version 3 or later.])
2020-02-17 21:05:20 +00:00
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
2020-02-17 21:11:31 +00:00
if test `ls $with_xerces/lib/libxerces-c.*2[[6-8]].* 2>/dev/null | wc -l` -gt 0 ; then
2020-02-17 21:05:20 +00:00
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"
2020-02-17 21:13:50 +00:00
xerces_include_dir="$with_xerces/src"
xerces_include="-I$with_xerces/src"
2020-02-17 21:11:31 +00:00
elif test `ls $with_xerces/lib/libxerces-c*2[[6-8]].* 2>/dev/null | wc -l` -gt 0 ; then
2020-02-17 21:05:20 +00:00
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"
2020-02-17 21:13:50 +00:00
xerces_include_dir="$with_xerces/src"
xerces_include="-I$with_xerces/src"
elif test `ls $with_xerces/obj/libxerces-c.* 2>/dev/null | wc -l` -gt 0 ; then
AC_MSG_CHECKING([for Xerces C++ version from source tree])
AC_MSG_RESULT(3.0+)
AC_DEFINE(HAVE_XERCES3)
xerces_lib="$with_xerces/lib"
if test `ls $with_xerces/src/xercesc/util/PlatformUtils.hpp 2>/dev/null | wc -l` -gt 0 ; then
xerces_include_dir="$with_xerces/src"
xerces_include="-I$with_xerces/src"
elif test `ls $with_xerces/../src/xercesc/util/PlatformUtils.hpp 2>/dev/null | wc -l` -gt 0 ; then
xerces_include_dir="$with_xerces/../src"
xerces_include="-I$with_xerces/../src -I$with_xerces/src"
else
xerces_include_dir="$with_xerces/src"
xerces_include="-I$with_xerces/src"
AC_MSG_WARN([Cannot find the Xerces-C source directory - you will have to manually configure $xerces_include.])
fi
2020-02-17 21:05:20 +00:00
else
2020-02-17 21:13:50 +00:00
AC_MSG_ERROR([The Xerces-C source is required to build XQilla. $with_xerces is not a valid, compiled source tree for Xerces-C. You must specify the path where Xerces is installed with --with-xerces.])
2020-02-17 21:05:20 +00:00
fi
AC_SUBST(xerces_include)
2020-02-17 21:13:50 +00:00
AC_SUBST(xerces_include_dir)
2020-02-17 21:05:20 +00:00
AC_SUBST(xerces_lib)
2020-02-17 21:13:50 +00:00
# Check for the BinInputStream::getContentType() method
AH_TEMPLATE(HAVE_GETCONTENTTYPE, [Define to 1 if the Xerces-C library supports the BinInputStream::getContentType() method.])
CPPFLAGS_BKUP="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $xerces_include"
AC_LANG_PUSH(C++)
AC_TRY_COMPILE([#include<xercesc/util/BinMemInputStream.hpp>],
[XERCES_CPP_NAMESPACE_QUALIFIER BinMemInputStream(0, 0).getContentType();],
[ac_found_getcontenttype="yes"], [ac_found_getcontenttype="no"])
AC_LANG_POP(C++)
CPPFLAGS="$CPPFLAGS_BKUP"
AC_MSG_CHECKING([if the Xerces-C library supports the BinInputStream::getContentType() method])
AC_MSG_RESULT($ac_found_getcontenttype)
if test "$ac_found_getcontenttype" = yes
then
AC_DEFINE(HAVE_GETCONTENTTYPE)
else
2020-02-17 21:15:56 +00:00
AC_MSG_WARN([XQilla will build with reduced functionality. To change this apply xqilla/src/xercesc_content_type.patch to Xerces-C 2.8.])
2020-02-17 21:13:50 +00:00
fi
# Check for the RegularExpression::allMatches() method
AH_TEMPLATE(HAVE_ALLMATCHES, [Define to 1 if the Xerces-C library supports the RegularExpression::allMatches() method.])
CPPFLAGS_BKUP="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $xerces_include"
AC_LANG_PUSH(C++)
AC_TRY_COMPILE([#include<xercesc/util/regx/RegularExpression.hpp>],
[XERCES_CPP_NAMESPACE_QUALIFIER RegularExpression(".*").allMatches(0, 0, 0, 0);],
[ac_found_allmatches="yes"], [ac_found_allmatches="no"])
AC_LANG_POP(C++)
CPPFLAGS="$CPPFLAGS_BKUP"
AC_MSG_CHECKING([if the Xerces-C library supports the RegularExpression::allMatches() method])
AC_MSG_RESULT($ac_found_allmatches)
if test "$ac_found_allmatches" = yes
then
AC_DEFINE(HAVE_ALLMATCHES)
else
2020-02-17 21:15:56 +00:00
AC_MSG_WARN([XQilla will build with reduced functionality. To change this apply xqilla/src/xercesc_regex.patch to Xerces-C 2.8.])
2020-02-17 21:13:50 +00:00
fi
2020-02-17 21:12:51 +00:00
# Check if the FAXPP library is present
AH_TEMPLATE(HAVE_FAXPP, [Define to 1 if the FAXPP library is present.])
AC_MSG_CHECKING([if --with-faxpp=DIR option specified])
AC_ARG_WITH(faxpp,
[AS_HELP_STRING(--with-faxpp=DIR,Path of FAXPP. [DIR="/usr/local"])],
2020-02-17 21:13:50 +00:00
[with_faxpp="$withval"], [with_faxpp="/usr/local"])
2020-02-17 21:12:51 +00:00
AC_MSG_RESULT($with_faxpp)
2020-02-17 21:13:50 +00:00
if test "$with_faxpp" != "no"; then
AC_MSG_CHECKING([if the FAXPP library is present])
if test `ls $with_faxpp/lib/libfaxpp.* 2>/dev/null | wc -l` -gt 0 ; then
2020-02-17 21:12:51 +00:00
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_FAXPP)
faxpp_lib="-L$with_faxpp/lib -R$with_faxpp/lib"
faxpp_library="-lfaxpp"
faxpp_include="-I$with_faxpp/include"
2020-02-17 21:13:50 +00:00
elif test `ls $with_faxpp/libfaxpp.* 2>/dev/null | wc -l` -gt 0 ; then
2020-02-17 21:12:51 +00:00
if test `ls $with_faxpp/include/faxpp/parser.h 2>/dev/null | wc -l` -gt 0 ; then
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_FAXPP)
faxpp_lib="-L$with_faxpp -R$with_faxpp"
faxpp_library="-lfaxpp"
faxpp_include="-I$with_faxpp/include"
elif test `ls $with_faxpp/../include/faxpp/parser.h 2>/dev/null | wc -l` -gt 0 ; then
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_FAXPP)
faxpp_lib="-L$with_faxpp -R$with_faxpp"
faxpp_library="-lfaxpp"
faxpp_include="-I$with_faxpp/../include"
fi
2020-02-17 21:13:50 +00:00
else
2020-02-17 21:12:51 +00:00
AC_MSG_RESULT([no])
faxpp_lib=""
faxpp_library=""
faxpp_include=""
2020-02-17 21:13:50 +00:00
fi
2020-02-17 21:12:51 +00:00
fi
AC_SUBST(faxpp_include)
AC_SUBST(faxpp_lib)
AC_SUBST(faxpp_library)
2020-02-17 21:13:50 +00:00
# Check if the HTML Tidy library is present
AH_TEMPLATE(HAVE_LIBTIDY, [Define to 1 if the HTML Tidy library is present.])
AC_MSG_CHECKING([if --with-tidy=DIR option specified])
AC_ARG_WITH(tidy,
[AS_HELP_STRING(--with-tidy=DIR,Path of the HTML Tidy library. [DIR="/usr"])],
[with_tidy="$withval"], [with_tidy="/usr"])
AC_MSG_RESULT($with_tidy)
if test "$with_tidy" != "no"; then
AC_MSG_CHECKING([if the HTML Tidy library is present])
if test `ls $with_tidy/lib/libtidy.* 2>/dev/null | wc -l` -gt 0 ; then
if test `ls $with_tidy/include/tidy/tidy.h 2>/dev/null | wc -l` -gt 0 ; then
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_LIBTIDY)
tidy_lib="-L$with_tidy/lib -R$with_tidy/lib"
tidy_library="-ltidy"
tidy_include="-I$with_tidy/include/tidy"
elif test `ls $with_tidy/include/tidy.h 2>/dev/null | wc -l` -gt 0 ; then
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_LIBTIDY)
tidy_lib="-L$with_tidy/lib -R$with_tidy/lib"
tidy_library="-ltidy"
tidy_include="-I$with_tidy/include"
else
AC_MSG_RESULT([no])
tidy_lib=""
tidy_library=""
tidy_include=""
fi
else
AC_MSG_RESULT([no])
tidy_lib=""
tidy_library=""
tidy_include=""
fi
fi
AC_SUBST(tidy_include)
AC_SUBST(tidy_lib)
AC_SUBST(tidy_library)
2020-02-17 21:05:20 +00:00
# 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
2020-02-17 21:13:50 +00:00
AC_PROG_RANLIB
2020-02-17 21:05:20 +00:00
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
2020-02-17 21:13:50 +00:00
AC_CHECK_FUNCS([floor ftime gettimeofday memmove memset pow sqrt strchr strstr tzset localtime_r])
2020-02-17 21:05:20 +00:00
AC_CONFIG_FILES([Makefile include/Makefile])
AC_OUTPUT