# # "$Id: configure.in 1493 2006-06-07 18:20:49Z mike $" # # Configuration script for HTMLDOC, an HTML document processing program. # # Copyright 1997-2006 by Easy Software Products. # # These coded instructions, statements, and computer programs are the # property of Easy Software Products and are protected by Federal # copyright law. Distribution and use rights are outlined in the file # "COPYING.txt" which should have been included with this file. If this # file is missing or damaged please contact Easy Software Products # at: # # Attn: ESP Licensing Information # Easy Software Products # 44141 Airport View Drive, Suite 204 # Hollywood, Maryland 20636 USA # # Voice: (301) 373-9600 # EMail: info@easysw.com # WWW: http://www.easysw.com # AC_INIT(htmldoc/htmldoc.h) AC_CONFIG_HEADER(config.h) AC_PREFIX_DEFAULT(/usr) dnl Define the version number... SVERSION="1.8.27" NVERSION=10802600 AC_SUBST(SVERSION) AC_SUBST(NVERSION) AC_DEFINE_UNQUOTED(SVERSION, "$SVERSION") dnl Get the operating system and version number... uname=`uname` uversion=`uname -r | sed -e '1,$s/[[^0-9]]//g'` if test "$uname" = "IRIX64"; then uname="IRIX" fi dnl Clear the debugging options unless the user asks for them... OPTIM="${OPTIM:=}" AC_SUBST(OPTIM) CFLAGS="${CFLAGS:=}" CXXFLAGS="${CXXFLAGS:=}" LDFLAGS="${LDFLAGS:=}" AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging, default=no], [if eval "test x$enable_debug = xyes"; then OPTIM="-g " fi]) AC_ARG_WITH(gui, [ --with-gui compile the GUI version of HTMLDOC, default=yes]) dnl Checks for programs... AC_PROG_AWK AC_PROG_CC AC_PROG_CXX AC_PROG_CPP AC_PROG_RANLIB AC_PATH_PROG(AR,ar) AC_PATH_PROG(CHMOD,chmod) AC_PATH_PROG(CP,cp) AC_PATH_PROG(FLTKCONFIG,fltk-config) AC_PATH_PROG(MV,mv) AC_PATH_PROG(MKDIR,mkdir) AC_PATH_PROG(RM,rm) dnl See if we need a .exe extension on executables... AC_EXEEXT dnl Figure out the correct "ar" command flags... if test "$ac_cv_prog_ranlib" = ":"; then ARFLAGS="crs" else ARFLAGS="cr" fi AC_SUBST(ARFLAGS) dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADER(strings.h, AC_DEFINE(HAVE_STRINGS_H)) AC_CHECK_HEADER(locale.h, AC_DEFINE(HAVE_LOCALE_H)) dnl Checks for string functions. AC_CHECK_FUNCS(strdup strcasecmp strncasecmp strlcat strlcpy) if test "$uname" = "HP-UX" -a "$uversion" = "1020"; then AC_MSG_WARN(Forcing snprintf emulation for HP-UX...) else AC_CHECK_FUNCS(snprintf vsnprintf) fi dnl See if the tm structure has the tm_gmtoff member... AC_MSG_CHECKING(for tm_gmtoff member in tm structure) AC_TRY_COMPILE([#include ],[struct tm t; int o = t.tm_gmtoff;], AC_MSG_RESULT(yes) AC_DEFINE(HAVE_TM_GMTOFF), AC_MSG_RESULT(no)) dnl Check for libraries... LDFLAGS="${LDFLAGS:=}" AC_SUBST(LDFLAGS) AC_CHECK_LIB(m,pow) AC_SEARCH_LIBS(socket, socket) AC_SEARCH_LIBS(gethostbyaddr, nsl) AC_SEARCH_LIBS(getaddrinfo, nsl, AC_DEFINE(HAVE_GETADDRINFO)) AC_SEARCH_LIBS(getnameinfo, nsl, AC_DEFINE(HAVE_GETNAMEINFO)) AC_SEARCH_LIBS(hstrerror, nsl socket resolv, AC_DEFINE(HAVE_HSTRERROR)) dnl Check for largefile support... AC_SYS_LARGEFILE dnl Define largefile options as needed... LARGEFILE="" if test x$enable_largefile != xno; then LARGEFILE="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE" if test $ac_cv_sys_large_files = 1; then LARGEFILE="$LARGEFILE -D_LARGE_FILES" fi if test $ac_cv_sys_file_offset_bits = 64; then LARGEFILE="$LARGEFILE -D_FILE_OFFSET_BITS=64" fi fi AC_SUBST(LARGEFILE) dnl Check for "long long" support... AC_CACHE_CHECK(for long long int, ac_cv_c_long_long, [if test "$GCC" = yes; then ac_cv_c_long_long=yes else AC_TRY_COMPILE(,[long long int i;], ac_cv_c_long_long=yes, ac_cv_c_long_long=no) fi]) if test $ac_cv_c_long_long = yes; then AC_DEFINE(HAVE_LONG_LONG) fi AC_CHECK_FUNC(strtoll, AC_DEFINE(HAVE_STRTOLL)) dnl Check for OpenSSL libraries... AC_ARG_ENABLE(ssl, [ --enable-ssl turn on SSL/TLS support, default=yes]) AC_ARG_ENABLE(openssl, [ --enable-openssl use OpenSSL for SSL/TLS support, default=yes]) AC_ARG_ENABLE(gnutls, [ --enable-gnutls use GNU TLS for SSL/TLS support, default=yes]) AC_ARG_ENABLE(cdsassl, [ --enable-cdsassl use CDSA for SSL/TLS support, default=yes]) AC_ARG_WITH(openssl-libs, [ --with-openssl-libs set directory for OpenSSL library], LDFLAGS="-L$withval $LDFLAGS" DSOFLAGS="-L$withval $DSOFLAGS",) AC_ARG_WITH(openssl-includes, [ --with-openssl-includes set directory for OpenSSL includes], CFLAGS="-I$withval $CFLAGS" CXXFLAGS="-I$withval $CXXFLAGS" CPPFLAGS="-I$withval $CPPFLAGS",) SSLFLAGS="" SSLLIBS="" if test x$enable_ssl != xno; then dnl Check for the OpenSSL library first, which has precedence over dnl CDSA and GNUTLS... if test "x${SSLLIBS}" = "x" -a "x${enable_openssl}" != "xno"; then AC_CHECK_HEADER(openssl/ssl.h, dnl Save the current libraries so the crypto stuff isn't always dnl included... SAVELIBS="$LIBS" dnl Some ELF systems can't resolve all the symbols in libcrypto dnl if libcrypto was linked against RSAREF, and fail to link the dnl test program correctly, even though a correct installation dnl of OpenSSL exists. So we test the linking three times in dnl case the RSAREF libraries are needed. for libcrypto in \ "-lcrypto" \ "-lcrypto -lrsaref" \ "-lcrypto -lRSAglue -lrsaref" do AC_CHECK_LIB(ssl,SSL_new, [SSLFLAGS="-DOPENSSL_DISABLE_OLD_DES_SUPPORT -DOPENSSL_NO_KRB5" SSLLIBS="-lssl $libcrypto" AC_DEFINE(HAVE_SSL) AC_DEFINE(HAVE_LIBSSL)],, $libcrypto) if test "x${SSLLIBS}" != "x"; then break fi done LIBS="$SAVELIBS") fi dnl If OpenSSL wasn't found, look for CDSA... if test "x${SSLLIBS}" = "x" -a "x${enable_cdsassl}" != "xno"; then if test $uname = Darwin; then AC_CHECK_HEADER(Security/SecureTransport.h, [SSLLIBS="-framework CoreFoundation -framework Security" AC_DEFINE(HAVE_SSL) AC_DEFINE(HAVE_CDSASSL)]) fi fi dnl Then look for GNU TLS... if test "x${SSLLIBS}" = "x" -a "x${enable_gnutls}" != "xno"; then AC_CHECK_HEADER(gnutls/gnutls.h, dnl Save the current libraries so the crypto stuff isn't always dnl included... SAVELIBS="$LIBS" TEST_GNUTLS_LIBS=`libgnutls-config --libs` AC_CHECK_LIB(gnutls, gnutls_init, [SSLLIBS=$TEST_GNUTLS_LIBS AC_DEFINE(HAVE_SSL) AC_DEFINE(HAVE_GNUTLS)],, $TEST_GNUTLS_LIBS) LIBS="$SAVELIBS") fi fi AC_SUBST(SSLFLAGS) AC_SUBST(SSLLIBS) dnl Check for image libraries... NEWLIBS="" AC_ARG_ENABLE(localjpeg, [ --enable-localjpeg use local JPEG library, default=auto], [if eval "test x$enable_localjpeg = xyes"; then ac_cv_lib_jpeg_jpeg_CreateCompress=no fi]) AC_CHECK_LIB(jpeg,jpeg_CreateCompress, JPEGINC="" JPEG="" LIBS="-ljpeg $LIBS", JPEGINC="-I../jpeg" JPEG="jpeg" NEWLIBS="../jpeg/libjpeg.a $NEWLIBS") AC_ARG_ENABLE(localzlib, [ --enable-localzlib use local ZLIB library, default=auto], [if eval "test x$enable_localzlib = xyes"; then ac_cv_lib_z_gzgets=no fi]) AC_CHECK_LIB(z,gzgets, ZLIBINC="" ZLIB="" LIBS="-lz $LIBS", ZLIBINC="-I../zlib" ZLIB="zlib" NEWLIBS="../zlib/libz.a $NEWLIBS") AC_ARG_ENABLE(localpng, [ --enable-localpng use local PNG library, default=auto], [if eval "test x$enable_localpng = xyes"; then ac_cv_lib_png_png_set_tRNS_to_alpha=no fi]) AC_CHECK_LIB(png,png_set_tRNS_to_alpha, PNGINC="" PNG="" LIBS="-lpng $LIBS", PNGINC="-I../png" PNG="png" NEWLIBS="../png/libpng.a $NEWLIBS") AC_SUBST(JPEG) AC_SUBST(JPEGINC) AC_SUBST(PNG) AC_SUBST(PNGINC) AC_SUBST(ZLIB) AC_SUBST(ZLIBINC) AC_DEFINE(HAVE_LIBJPEG) AC_DEFINE(HAVE_LIBPNG) AC_DEFINE(HAVE_LIBZ) dnl Check for GUI libraries... POST=: if test "x$with_gui" != xno; then if test "x$FLTKCONFIG" != x; then LIBS="$LIBS `$FLTKCONFIG --use-images --ldflags`" OPTIM="`$FLTKCONFIG --cflags` $OPTIM" AC_DEFINE(HAVE_LIBFLTK) POST="$FLTKCONFIG --post" AC_CHECK_LIB(Xpm,XpmCreatePixmapFromData) else AC_MSG_WARN(FLTK not available so no GUI will be built.) fi fi AC_SUBST(POST) LIBS="$NEWLIBS $LIBS" dnl Directories for config.h... if test "$prefix" = "NONE"; then prefix="/usr" fi if test "$exec_prefix" = "NONE"; then exec_prefix="$prefix" fi if test "$bindir" = "\${exec_prefix}/bin"; then bindir="$exec_prefix/bin" fi AC_DEFINE_UNQUOTED(DOCUMENTATION, "$prefix/share/doc/htmldoc") AC_DEFINE_UNQUOTED(HTML_DATA, "$prefix/share/htmldoc") dnl Update compiler options... if test -n "$GXX"; then dnl Starting with GCC 3.0, you must link C++ programs against either dnl libstdc++ (shared by default), or libsupc++ (always static). If dnl you care about binary portability between Linux distributions, dnl you need to either 1) build your own GCC with static C++ libraries dnl or 2) link using gcc and libsupc++. We choose the latter since dnl CUPS doesn't (currently) use any of the stdc++ library. dnl dnl Also, GCC 3.0.x still has problems compiling some code. You may dnl or may not have success with it. USE 3.0.x WITH EXTREME CAUTION! dnl dnl Previous versions of GCC do not have the reliance on the stdc++ dnl or g++ libraries, so the extra supc++ library is not needed. AC_MSG_CHECKING(if libsupc++ is required) SUPC="`$CXX -print-file-name=libsupc++.a 2>/dev/null`" case "$SUPC" in libsupc++.a*) dnl Library not found, so this is and older GCC... AC_MSG_RESULT(no) ;; *) dnl This is gcc 3.x, and it knows of libsupc++, so we need it LIBS="$LIBS -lsupc++" AC_MSG_RESULT(yes) ;; esac if test "x$uname" != xDarwin; then CXX="$CC" fi dnl Set optimization flags... if test -z "$OPTIM"; then OPTIM="-Os -g" fi dnl Show all standard warnings + unused variables when compiling... OPTIM="-Wall -Wunused -Wno-char-subscripts $OPTIM" dnl The following additional warnings are useful for tracking down problems... # OPTIM="-Wshadow -Wconversion -Winline $OPTIM" dnl See if GCC supports -fno-rtti... AC_MSG_CHECKING(if GCC supports -fno-rtti) OLDCFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fno-rtti" AC_TRY_COMPILE(,, CXXFLAGS="$CXXFLAGS -fno-rtti" AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) CFLAGS="$OLDCFLAGS" dnl See if GCC supports -fno-exceptions... AC_MSG_CHECKING(if GCC supports -fno-exceptions) OLDCFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fno-exceptions" AC_TRY_COMPILE(,, CXXFLAGS="$CXXFLAGS -fno-exceptions" AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) CFLAGS="$OLDCFLAGS" dnl See if we are running Solaris; if so, try the -fpermissive option... if test "$uname" = SunOS; then AC_MSG_CHECKING(if GCC supports -fpermissive) OLDCFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fpermissive" AC_TRY_COMPILE(,, CXXFLAGS="$CXXFLAGS -fpermissive" AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) CFLAGS="$OLDCFLAGS" fi else case $uname in IRIX*) if test -z "$OPTIM"; then if test `uname -r | sed -e '1,$s/\.//g'` -ge 62; then OPTIM="-O3 -OPT:Olimit=5000" else OPTIM="-O2" fi fi ;; HP-UX*) if test -z "$OPTIM"; then OPTIM="+O2 +DAportable" fi ;; SunOS*) dnl Solaris if test -z "$OPTIM"; then OPTIM="-xO4 -xarch=generic" fi ;; UNIX_SV*) dnl NCR SVR4 MP-RAS CXXFLAGS="-Hcppext=cxx $CXXFLAGS" esac fi dnl Set build mode... if test x$enable_debug = xyes; then BUILDMODE="debug" else BUILDMODE="production" fi AC_SUBST(BUILDMODE) dnl Generate the top-level Makefile and Makedefs file... AC_OUTPUT(Makedefs Makefile htmldoc.list desktop/htmldoc.dt desktop/htmldoc.ftr desktop/htmldoc.plist) # # End of "$Id: configure.in 1493 2006-06-07 18:20:49Z mike $". #