dnl Process this file with autoconf to produce a configure script. AC_INIT(fib.c) AC_CONFIG_HEADER(config.h) dnl Checks for programs. dnl AC_PROG_CC dnl AC_PROG_CC shoves in -g by default, i *really* hate this so here goes... dnl ill shove in the autoconf def of AC_PROG_CC verbatim and remove the -g dnl stuff dnl autoconf stuff begins here AC_DEFUN(AC_PROG_CC_NO_G, [AC_BEFORE([$0], [AC_PROG_CPP])dnl AC_CHECK_PROG(CC, gcc, gcc) if test -z "$CC"; then AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) fi AC_PROG_CC_WORKS AC_PROG_CC_GNU dnl exec suffix for DOSish OSes, autoconf-2.13 required. if test "$GCC" = yes; then GCC=yes dnl Check whether -g works, even if CFLAGS is set, in case the package dnl plays around with CFLAGS (such as to build both debugging and dnl normal versions of a library), tasteless as that idea is. ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= dnl C Begin dnl AC_PROG_CC_G dnl C End if test "$ac_test_CFLAGS" = set; then CFLAGS="$ac_save_CFLAGS" dnl C Begin dnl elif test $ac_cv_prog_cc_g = yes; then dnl CFLAGS="-g -O2" dnl C End else CFLAGS="-O2" fi else GCC= test "${CFLAGS+set}" = set dnl C Begin dnl || CFLAGS="-g" dnl C End fi ]) dnl autoconf stuff ends here AC_PROG_CC_NO_G AC_PROG_MAKE_SET AC_PROG_INSTALL dnl AC_PROG_RANLIB # Tests for Windows AC_CYGWIN AC_EXEEXT AC_OBJEXT AC_MINGW32 # End Tests for Windows # Configure libtool #AM_ENABLE_SHARED(no) #AM_ENABLE_STATIC(no) AC_LIBTOOL_WIN32_DLL AM_PROG_LIBTOOL #end libtool stuff AC_HEADER_STDC dnl AC_HEADER_SYS_WAIT dnl AC_TYPE_SIGNAL dnl AC_FUNC_WAIT3 AC_CHECK_HEADERS(fcntl.h io.h sys/file.h sys/ioctl.h unistd.h) CFLAGS="$CFLAGS $X_CFLAGS" dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST dnl LDFLAGS="$LDFLAGS -lm" dnl exporter support dnl ======================================================= EXPORTER= AC_ARG_WITH(exporter, [ --with-exporter Enable the exporter --without-exporter Disable the exporter], if test x$withval = xno; then EXPORTER= else EXPORTER=BEXPORTER fi ) AC_SUBST(EXPORTER) _cppflags=$CPPFLAGS _ldflags=$LDFLAGS dnl zlib support dnl ======================================================= AC_ARG_WITH(zlib, [ --with-zlib=DIR use libz in DIR],[ if test "$withval" != "no"; then ZLIB_DIR=$withval CPPFLAGS="$CPPFLAGS -I$withval/include" LDFLAGS="$LDFLAGS -L$withval/lib" fi ]) AC_CHECK_HEADER(zlib.h, AC_CHECK_LIB(z, gzread,[ AC_DEFINE(HAVE_ZLIB) HAVE_ZLIB=1 if test "x$ZLIB_DIR" != "x"; then ZLIB_CFLAGS="-I$ZLIB_DIR/include" ZLIB_LIBS="-L$ZLIB_DIR/lib -lz" else ZLIB_LIBS="-lz" fi], AC_CHECK_LIB(gz, gzread,[ AC_DEFINE(HAVE_ZLIB) HAVE_ZLIB=1 if test "x$ZLIB_DIR" != "x"; then ZLIB_CFLAGS="-I$ZLIB_DIR/include" ZLIB_LIBS="-L$ZLIB_DIR/lib -lz" else ZLIB_LIBS="-lz" fi]))) #AC_CHECK_HEADER(libxml/parser.h, # AC_CHECK_LIB(xml, xmlParseDocument,[ # AC_DEFINE(HAVE_LIBXML2) # HAVE_LIBXML2=1 # LIBXML2_LIBS="-lxml" ])) AC_PATH_PROG(GLIB_CONFIG, glib-config, , [$PATH]) if test -n "$GLIB_CONFIG"; then AC_DEFINE(HAVE_GLIB) HAVE_GLIB=1 GLIB_CFLAGS=`$GLIB_CONFIG --cflags` GLIB_LIBS=`$GLIB_CONFIG --libs` fi CPPFLAGS=$_cppflags LDFLAGS=$_ldflags AC_SUBST(LIBXML2_LIBS) AC_SUBST(HAVE_LIBXML2) AC_SUBST(GLIB_LIBS) AC_SUBST(GLIB_CFLAGS) AC_SUBST(HAVE_GLIB) AC_SUBST(ZLIB_CFLAGS) AC_SUBST(ZLIB_LIBS) dnl system png support dnl ======================================================== _cppflags=${CPPFLAGS} _ldflags=${LDFLAGS} AC_ARG_WITH(png, [ --with-png=DIR use png library in DIR],[ if test "$withval" != "no"; then PNG_DIR=$withval CPPFLAGS="$CPPFLAGS -I$withval/include" if test "x$ZLIB_CFLAGS" != "x"; then CPPFLAGS="$CPPFLAGS $ZLIB_CFLAGS" fi LDFLAGS="$LDFLAGS -L$withval/lib" fi ]) AC_CHECK_HEADER(png.h, AC_CHECK_HEADER(pngconf.h, AC_CHECK_LIB(png, png_free,[ AC_DEFINE(HasPNG) if test "x$PNG_DIR" != "x"; then PNG_CFLAGS="-I$PNG_DIR/include" PNG_LIBS="-L$PNG_DIR/lib -lpng" else PNG_LIBS="-lpng" fi],[ AC_CHECK_LIB(png, png_free,[ AC_DEFINE(HasPNG) if test "x$PNG_DIR" != "x"; then PNG_CFLAGS="-I$PNG_DIR/include" PNG_LIBS="-L$PNG_DIR/lib -lpng" else PNG_LIBS="-lpng" fi], , $ZLIB_LIBS -lm)]))) CPPFLAGS=$_cppflags LDFLAGS=$_ldflags AC_SUBST(PNG_CFLAGS) AC_SUBST(PNG_LIBS) AC_CHECK_HEADER(malloc.h, [ AC_DEFINE(HAVE_MALLOC_H) HAVE_MALLOC_H=1 ], no_malloc_h=yes) dnl system libwmf support dnl ======================================================== dnl Check for libwmf-0.2.1 or higher _cppflags=$CPPFLAGS _ldflags=$LDFLAGS have_libwmf=no AC_ARG_WITH(libwmf,[ --with-libwmf=DIR use libwmf(2) in DIR],[ if [ test "x$withval" != "xno" ]; then if [ test "x$withval" != "xyes" ]; then LIBWMF_DIR=$withval fi search_for_libwmf=yes else search_for_libwmf=no fi ],[ search_for_libwmf=no ]) if [ test $search_for_libwmf != no ]; then if [ test -n "$LIBWMF_DIR" ]; then AC_PATH_PROG(LIBWMF_CONFIG,libwmf-config, ,[$LIBWMF_DIR/bin:$PATH]) else AC_PATH_PROG(LIBWMF_CONFIG,libwmf-config) fi if [ test -n "$LIBWMF_CONFIG" ]; then libwmf_cflags=`$LIBWMF_CONFIG --cflags` libwmf_libs=`$LIBWMF_CONFIG --libs` else AC_MSG_ERROR(* * * unable to find libwmf-config; unable to continue * * *) fi CPPFLAGS="$CPPFLAGS $libwmf_cflags" LDFLAGS="$LDFLAGS $libwmf_libs" AC_CHECK_HEADER(libwmf/api.h,[ AC_CHECK_LIB(wmf,wmf_stream_create,have_libwmf=yes,[ AC_MSG_ERROR(* * * libwmf >= 0.2.1 required * * *) ]) ]) if [ test $have_libwmf != no]; then AC_DEFINE(HAVE_LIBWMF) WMF_CFLAGS="$libwmf_cflags" WMF_LIBS="$libwmf_libs" fi fi CPPFLAGS=$_cppflags LDFLAGS=$_ldflags AC_SUBST(WMF_LIBS) AC_SUBST(WMF_CFLAGS) dnl test for iconv dnl ======================================================== _cppflags=${CPPFLAGS} _ldflags=${LDFLAGS} have_iconv=no use_peer_libiconv=no check_for_libiconv=yes default_to_libiconv=yes AC_ARG_WITH(libiconv,[ --with-libiconv[=DIR] use libiconv [in DIR]],[ if [ test "$withval" = "no" ]; then check_for_libiconv=no elif [ test "$withval" != "yes" ]; then check_for_libiconv=yes LIBICONV_DIR=$withval fi ],default_to_libiconv=no) dnl use --with-peer-iconv to get libiconv from the peer directory dnl AC_ARG_WITH(peer-iconv,[ --with-peer-iconv use libiconv from peer directory ],[ if test "$withval" != "no"; then use_peer_libiconv=$withval if [ test -d ../libiconv ]; then check_for_libiconv=yes default_to_libiconv=yes LIBICONV_DIR="../libiconv" fi fi ]) dnl first search for system iconv dnl if [ test "$default_to_libiconv" = "no" ]; then AC_CHECK_FUNC(iconv,[ AC_CHECK_HEADER(iconv.h,[ have_iconv=sys check_for_libiconv=no ],[ AC_MSG_ERROR(* * * I found system iconv but can't find iconv.h header! * * *) ]) ]) fi dnl then search for libiconv dnl if [ test "$check_for_libiconv" = "yes" ]; then if [ test "x$LIBICONV_DIR" != "x" ]; then if [ test "$use_peer_libiconv" != "no" ]; then ICONV_CFLAGS="-I$LIBICONV_DIR/include" ICONV_LIBS="-L$LIBICONV_DIR/lib/.libs -liconv" else ICONV_CFLAGS="-I$LIBICONV_DIR/include" ICONV_LIBS="-L$LIBICONV_DIR/lib -liconv" fi else ICONV_CFLAGS="" ICONV_LIBS="-liconv" fi CPPFLAGS="${CPPFLAGS} $ICONV_CFLAGS" LDFLAGS="${LDFLAGS} $ICONV_LIBS" if [ test "$use_peer_libiconv" = "abi" ]; then dnl if configure is called with --with-peer-iconv=abi dnl then assume that iconv exists and will be linked eventually dnl AC_CHECK_HEADER(iconv.h,have_iconv=abi) else AC_CHECK_HEADER(iconv.h,[ AC_CHECK_LIB(iconv,iconv_open,[ have_iconv=iconv ],[ AC_CHECK_LIB(iconv,libiconv_open,[ have_iconv=libiconv ],[ AC_MSG_ERROR(* * * I found iconv.h header but no working library! * * *) ]) ]) ]) fi fi if [ test "$have_iconv" = "no" ]; then AC_MSG_ERROR(* * * iconv is required: ftp://ftp.gnu.org/pub/gnu/libiconv * * *) fi AC_LANG_CPLUSPLUS AC_MSG_CHECKING(need for const in iconv) AC_TRY_COMPILE([ #include ],[ iconv_t handle; size_t ib; size_t ob; const char* in = 0; char* out = 0; iconv (handle,const_cast(&in),&ib,&out,&ob); ],[ AC_MSG_RESULT(no) ],[ AC_MSG_RESULT(yes) AC_DEFINE(ICONV_REQUIRES_CONST) ]) AC_LANG_C AC_SUBST(ICONV_CFLAGS) AC_SUBST(ICONV_LIBS) CPPFLAGS=$_cppflags LDFLAGS=$_ldflags dnl end of iconv dnl ======================================================== dnl ======================================================== dnl test for imagemagick dnl test for the existence of the MagickConfig program, dnl if its not there then we dont have imagemagick, if it dnl is there then we still have to do a big dance to get dnl something to link against it as it does not provide all dnl the information that we need to compile against it dnl first try it raw, maybe the author will have fixed it dnl by now, then try it with the prefix attached, and then dnl try it with the X varient of that, and then try it with dnl both. _cppflags=$CPPFLAGS _ldflags=$LDFLAGS AC_ARG_WITH(Magick, [ --with-Magick=DIR use Magick in DIR],[ if test "$withval" != "no"; then MAGICK_DIR=$withval CPPFLAGS="$CPPFLAGS -I$withval/include" LDFLAGS="$LDFLAGS -L$withval/lib" fi ]) if test -n "$MAGICK_DIR"; then AC_PATH_PROG(MAGICK_CONFIG, Magick-config, , [$MAGICK_DIR:$MAGICK_DIR/bin:$PATH]) else AC_PATH_PROG(MAGICK_CONFIG, Magick-config) fi if test -n "$MAGICK_CONFIG"; then m_cppflags=`$MAGICK_CONFIG --cppflags` m_ldflags=`$MAGICK_CONFIG --ldflags` CPPFLAGS="$CPPFLAGS $m_cppflags" LDFLAGS="$LDFLAGS $m_ldflags" AC_CHECK_HEADER(magick/magick.h, AC_CHECK_LIB(Magick, GetImageInfo,[ MAGICK_CFLAGS=$m_cppflags MAGICK_LIBS=$m_ldflags MAGICK="BMAGICK" MAGICKOBJS="\$(RMAGICKOBJS)"])) fi if test -z "$MAGICK"; then MAGICK="BMAGICK" MAGICK_CFLAGS="-I./magick" MAGICK_LIBS="" MAGICKOBJS="\$(RMAGICKOBJS)" fi CPPFLAGS=$_cppflags LDFLAGS=$_ldflags AC_SUBST(MAGICK_CFLAGS) AC_SUBST(MAGICK_LIBS) AC_SUBST(MAGICK) AC_SUBST(MAGICKOBJS) dnl ======================================================== dnl begin of possible optimization tests dnl read notes/optimization AC_CHECK_SIZEOF(char,1) AC_CHECK_SIZEOF(short,2) AC_CHECK_SIZEOF(int,4) AC_CHECK_SIZEOF(long,4) if [test "$SIZEOF_CHAR" != "1" ]; then if [test "$SIZEOF_SHORT" != "2" ]; then if [test "$SIZEOF_INT" != "4" ]; then AC_DEFINE(MATCHED_TYPE) fi fi fi if [ test "$cross_compiling" != "yes" ]; then AC_C_BIGENDIAN dnl here we will know the endianness if [ test "$ac_cv_c_bigendian" = "no" ]; then AC_DEFINE(XML_BYTE_ORDER,12) else if [ test "$ac_cv_c_bigendian" = "yes" ]; then AC_DEFINE(XML_BYTE_ORDER,21) fi fi else dnl here we will not know the endianness, so we will dnl go with the mechanism that works everywhere AC_DEFINE(WORDS_BIGENDIAN) fi dnl given matched types and little endian we can read types larger dnl than a byte with fread and avoid byteswapping dnl at some later stage we will have a test to see if the compiler can dnl get rid of holes, for the moment we will assume only that we can dnl do it if we have __GNUC__ defined dnl end of possible optimization tests dnl check for getopt AC_CHECK_FUNC(getopt_long, , [LIBOBJS="$LIBOBJS getopt1.o getopt.o"]) dnl check for strerror AC_CHECK_FUNC(strerror, , [LIBOBJS="$LIBOBJS strerror.o"]) dnl check for strcasecmp AC_CHECK_FUNC(strcasecmp, , [LIBOBJS="$LIBOBJS strcasecmp.o"]) AC_EGREP_HEADER(strcasecmp,string.h,,AC_DEFINE(DEFINE_STRCASECMP)) dnl check for memcpy, if not there we'll use bcopy AC_CHECK_FUNCS(memcpy) dnl check for mmap AC_FUNC_MMAP AC_SUBST(LIBOBJS) AC_OUTPUT( Makefile wvAbw wvHtml wvLatex wvCleanLatex wvText wvWml oledecod/Makefile libole2/Makefile glib-wv/Makefile expat/Makefile expat/xmltok/Makefile expat/xmlparse/Makefile exporter/Makefile iconv/Makefile magick/Makefile ) if [ test $have_libwmf != yes ]; then AC_MSG_WARN(libwv will not have wmf to png support: see README) fi if test -z "$HAVE_ZLIB"; then AC_MSG_WARN(Could not find zlib library or some of its components: libwv *will* build but will not be able to decompress most wmf files: see README) fi