dnl dnl "$Id: configure.in,v 1.23.2.35 2002/07/29 16:48:20 mike Exp $" dnl dnl Configuration script for HTMLDOC, an HTML document processing program. dnl dnl Copyright 1997-2002 by Michael Sweet, all rights reserved. dnl dnl HTMLDOC is distributed under the terms of the GNU General Public License dnl which is described in the file "COPYING-2.0". dnl AC_INIT(htmldoc/htmldoc.h) AC_CONFIG_HEADER(config.h) AC_PREFIX_DEFAULT(/usr) 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="" 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(fltk-libs, [ --with-fltk-libs set directory for FLTK library], LDFLAGS="-L$withval $LDFLAGS",) AC_ARG_WITH(fltk-includes, [ --with-fltk-includes set directory for FLTK includes], CFLAGS="-I$withval $CFLAGS" CXXFLAGS="-I$withval $CXXFLAGS" CPPFLAGS="-I$withval $CPPFLAGS",) AC_ARG_WITH(gui, [ --with-gui compile the GUI version of HTMLDOC, default=yes]) AC_ARG_WITH(openssl-libs, [ --with-openssl-libs set directory for OpenSSL library], if test "$withval" = "no"; then USE_SSL=no else LDFLAGS="-L$withval $LDFLAGS" fi,) AC_ARG_WITH(openssl-includes, [ --with-openssl-includes set directory for OpenSSL includes], if test "$withval" = "no"; then USE_SSL=no else CFLAGS="-I$withval $CFLAGS" CXXFLAGS="-I$withval $CXXFLAGS" CPPFLAGS="-I$withval $CPPFLAGS" fi,) 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 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) AC_CHECK_FUNCS(strcasecmp) AC_CHECK_FUNCS(strncasecmp) if test "$uname" = "HP-UX" -a "$uversion" = "1020"; then AC_MSG_WARN(Forcing snprintf emulation for HP-UX...) else AC_CHECK_FUNCS(snprintf) AC_CHECK_FUNCS(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) if test "$uname" != "IRIX"; then AC_CHECK_LIB(socket,socket) AC_CHECK_LIB(nsl,gethostbyaddr) fi dnl Check for OpenSSL libraries... SSLLIBS="" 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. if test "$USE_SSL" != "no"; then for libcrypto in \ "-lcrypto" \ "-lcrypto -lrsaref" \ "-lcrypto -lRSAglue -lrsaref" do AC_CHECK_LIB(ssl,SSL_new, [SSLLIBS="-lssl $libcrypto"],, $libcrypto) if test "x${SSLLIBS}" != "x"; then AC_CHECK_HEADER(openssl/ssl.h,AC_DEFINE(HAVE_LIBSSL)) break fi done fi LIBS="$SAVELIBS $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) GUI="" POST="$FLTKCONFIG --post" else OLDLIBS="$LIBS" AC_PATH_X if test x$with_x != xno; then if test "$x_libraries" = "/usr/lib"; then echo "Ignoring X library directory \"$x_libraries\" requested by configure." x_libraries="NONE" fi if test ! "$x_libraries" = "NONE" -a ! "$x_libraries" = ""; then LDFLAGS="$LDFLAGS -L$x_libraries" if test "$uname" = "SunOS"; then LDFLAGS="$LDFLAGS -R$x_libraries" fi fi if test "$x_includes" = "/usr/include"; then echo "Ignoring X include directory \"$x_includes\" requested by configure." x_includes="NONE" fi if test ! "$x_includes" = "NONE" -a ! "$x_includes" = ""; then CFLAGS="$CFLAGS -I$x_includes" CXXFLAGS="$CXXFLAGS -I$x_includes" fi AC_CHECK_LIB(X11,XOpenDisplay) AC_CHECK_LIB(Xext,XdbeQueryExtension) dnl Check FLTK by itself AC_CHECK_LIB(fltk,numericsort) dnl Check for cached OpenGL library from previous configure... if test "x$ac_cv_lib_GL_glEnable" = xyes; then AC_CHECK_LIB(GL,glEnable) fi dnl Check FLTK + OpenGL to see if that works... if test "$ac_cv_lib_fltk_numericsort" = no; then unset ac_cv_lib_fltk_numericsort AC_CHECK_LIB(GL,glEnable) AC_CHECK_LIB(fltk,numericsort) fi AC_CHECK_LIB(Xpm,XpmCreatePixmapFromData) if test x$ac_cv_lib_fltk_numericsort = xyes; then if test x"$ac_cv_path_FLTKCONFIG" = x; then LIBS="../gui/libgui.a $LIBS" GUI="gui" else GUI="" fi else AC_MSG_WARN(FLTK not available so no GUI will be built.) LIBS="$OLDLIBS" GUI="" fi else AC_MSG_WARN(--without-x specified so no GUI will be built.) LIBS="$OLDLIBS" GUI="" fi fi else GUI="" fi AC_SUBST(GUI) AC_SUBST(POST) LIBS="$NEWLIBS $LIBS" dnl See if we need a .exe extension on executables... AC_EXEEXT dnl Directories for config.h... if test "$prefix" = "NONE"; then prefix=/usr 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 # Starting with GCC 3.0, you must link C++ programs against either # libstdc++ (shared by default), or libsupc++ (always static). If # you care about binary portability between Linux distributions, # you need to either 1) build your own GCC with static C++ libraries # or 2) link using gcc and libsupc++. We choose the latter since # HTMLDOC doesn't (currently) use any of the stdc++ library. # # Also, GCC 3.0.x still has problems compiling some code. You may # or may not have success with it. USE 3.0.x WITH EXTREME CAUTION! # # Previous versions of GCC do not have the reliance on the stdc++ # or g++ libraries, so the extra supc++ library is not needed. case "`$CXX --version`" in 3*) AC_MSG_WARN(GCC 3.0.x is known to produce incorrect code - use with caution!) LIBS="$LIBS -lsupc++" ;; 3.1*) LIBS="$LIBS -lsupc++" ;; esac CXX="$CC" # Set optimization flags... if test -z "$OPTIM"; then if test "$uname" = "HP-UX"; then # ZLIB has trouble with GCC 2.95 and -O2... OPTIM="-O1" else OPTIM="-O2 -fforce-mem -fforce-addr -fcaller-saves" fi fi OPTIM="-Wall $OPTIM" # See if GCC supports -fno-rtti... AC_MSG_CHECKING(if GCC supports -fno-rtti) OLDCFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fno-rtti" AC_TRY_COMPILE(,, OPTIM="$OPTIM -fno-rtti" AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) CFLAGS="$OLDCFLAGS" # See if GCC supports -fno-exceptions... AC_MSG_CHECKING(if GCC supports -fno-exceptions) OLDCFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fno-exceptions" AC_TRY_COMPILE(,, OPTIM="$OPTIM -fno-exceptions" AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) CFLAGS="$OLDCFLAGS" # 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(,, OPTIM="$OPTIM -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" fi OPTIM="$OPTIM +DAportable" ;; SunOS*) # Solaris if test -z "$OPTIM"; then OPTIM="-xO4" fi OPTIM="$OPTIM -xarch=generic" ;; esac fi dnl Generate the top-level Makefile and Makedefs file... AC_OUTPUT(Makedefs Makefile htmldoc.list) dnl dnl End of "$Id: configure.in,v 1.23.2.35 2002/07/29 16:48:20 mike Exp $". dnl