--- psiconv/trunk/configure.in 1999/10/27 14:29:40 19 +++ psiconv/trunk/configure.in 2004/04/29 22:14:09 253 @@ -1,26 +1,117 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT(psiconv) -AM_INIT_AUTOMAKE(psiconv,0.5.0a) +AC_INIT +AC_CONFIG_SRCDIR([lib/psiconv]) +AM_INIT_AUTOMAKE(psiconv,0.9.6) AM_CONFIG_HEADER(config.h) dnl Checks for programs. AM_PROG_LIBTOOL +dnl This is stolen from gnome-libs-1.0.14 +AC_ARG_ENABLE(compile-warnings, +[ --enable-compile-warnings=[no/minimum/yes] Turn on compiler warnings.], +,enable_compile_warnings=minimum) + +AC_MSG_CHECKING(what warning flags to pass to the C compiler) +warnCFLAGS= +if test "x$GCC" != xyes; then + enable_compile_warnings=no +fi +if test "x$enable_compile_warnings" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CFLAGS " in + *[\ \ ]-Wall[\ \ ]*) ;; + *) warnCFLAGS="-Wall -Wunused" ;; + esac + + ## -W is not all that useful. And it cannot be controlled + ## with individual -Wno-xxx flags, unlike -Wall + if test "x$enable_compile_warnings" = "xyes"; then + warnCFLAGS="$warnCFLAGS -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith" + fi + fi +fi +AC_MSG_RESULT($warnCFLAGS) + +AC_ARG_ENABLE(iso-c, + [ --enable-iso-c Try to warn if code is not ISO C ],, + enable_iso_c=no) + +AC_MSG_CHECKING(what language compliance flags to pass to the C compiler) +complCFLAGS= +if test "x$enable_iso_c" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CFLAGS " in + *[\ \ ]-ansi[\ \ ]*) ;; + *) complCFLAGS="$complCFLAGS -ansi" ;; + esac + + case " $CFLAGS " in + *[\ \ ]-pedantic[\ \ ]*) ;; + *) complCFLAGS="$complCFLAGS -pedantic" ;; + esac + fi +fi +AC_MSG_RESULT($complCFLAGS) +if test "x$cflags_set" != "xyes"; then + CFLAGS="$CFLAGS $warnCFLAGS $complCFLAGS" + cflags_set=yes + AC_SUBST(cflags_set) +fi + + dnl Checks for libraries. AC_ARG_WITH(imagemagick, [ --with-imagemagick enable ImageMagick (default = yes)], [IMAGEMAGICK=$withval], [IMAGEMAGICK='yes']) if test x"$IMAGEMAGICK" != xno ; then - AC_CHECK_LIB(Magick,MagickWarning,IMAGEMAGICK=yes,IMAGEMAGICK=no) - if test x"$IMAGEMAGICK" = xno ; then - AC_MSG_WARN(ImageMagick support disabled!) + AC_CHECK_PROG(IMAGEMAGICK,Magick-config,yes,no) + if test x"$IMAGEMAGICK" != xno ; then + CFLAGS_OLD="$CFLAGS" + CPPFLAGS_OLD="$CPPFLAGS" + LDFLAGS_OLD="$LDFLAGS" + LIBS_OLD="$LIBS" + CFLAGS="$CFLAGS `Magick-config --cflags`" + CPPFLAGS="$CPPFLAGS `Magick-config --cppflags`" + LDFLAGS="$LDFLAGS `Magick-config --ldflags`" + LIBS="$LIBS `Magick-config --libs`" + + + AC_MSG_CHECKING(whether GetMagickInfo works and which API to use) + AC_TRY_RUN([ #include + #include + #include + int main(void) { ExceptionInfo exception; + GetExceptionInfo(&exception); + OpenModules(&exception); + return (NULL == GetMagickInfo(NULL,&exception)); }], + IMAGEMAGICK=new,IMAGEMAGICK=no,IMAGEMAGICK=no) + if test x"$IMAGEMAGICK" = xno ; then + AC_TRY_RUN([ #include + int main(void) { ExceptionInfo exception; + GetExceptionInfo(&exception); + OpenModules(&exception); + return (NULL == GetMagickInfo(NULL,&exception)); }], + IMAGEMAGICK=old,IMAGEMAGICK=no,IMAGEMAGICK=no) + fi + AC_MSG_RESULT($IMAGEMAGICK) + LDFLAGS="$LDFLAGS_OLD" + LIBS="$LIBS_OLD" +dnl Note: CFLAGS can't be set for single directories, so we propagate them + if test x"$IMAGEMAGICK" = xno ; then + CFLAGS="$CFLAGS_OLD" + CPPFLAGS="$CPPFLAGS_OLD" + fi fi fi -if test x"$IMAGEMAGICK" = xyes ; then - LIB_MAGICK=-lMagick - AC_DEFINE(IMAGEMAGICK) +if test x"$IMAGEMAGICK" != xno ; then + LIB_MAGICK="`Magick-config --libs` `Magick-config --ldflags`" + AC_DEFINE(IMAGEMAGICK,1,[ImageMagick availability]) + if test x"$IMAGEMAGICK" = xold ; then + AC_DEFINE(IMAGEMAGICK_OLD,1,[ImageMagick old API version]) + fi else LIB_MAGICK= fi @@ -50,7 +141,6 @@ INT_8_BIT=short AC_MSG_RESULT(short) elif test $ac_cv_sizeof_int -ge 1 ; then - INT_8_BIT=int AC_MSG_RESULT(int) elif test $ac_cv_sizeof_long -ge 1 ; then INT_8_BIT=long @@ -99,18 +189,43 @@ dnl Checks for library functions. AC_FUNC_VPRINTF -AC_CHECK_FUNCS(strdup) AC_REPLACE_FUNCS(strdup) +AC_CHECK_FUNC(getopt_long,getopt=yes,getopt=no) +if test $getopt = no; then + AC_LIBOBJ([getopt]) + AC_LIBOBJ([getopt1]) +fi + +AC_ARG_ENABLE(dmalloc, +[ --enable-dmalloc Enable dmalloc for developers (default:off)], +[case "${enableval}" in + yes) dmalloc=yes ;; + no) dmalloc=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-dmalloc) ;; +esac],[dmalloc=false]) +if test x"$dmalloc" = xyes; then + AC_CHECK_LIB(dmalloc,malloc,dmalloc=yes,dmalloc=no) +fi +if test x"$dmalloc" = xyes; then +AC_CHECK_HEADER(dmalloc.h,dmalloc=yes,dmalloc=no) +fi +if test x"$dmalloc" = xyes ; then + LIB_DMALLOC=-ldmalloc + AC_DEFINE(DMALLOC,1,[DMalloc availability]) +else + LIB_DMALLOC= +fi +AC_SUBST(LIB_DMALLOC) dnl With and without functions -AC_ARG_ENABLE(html-docs, -[ --disable-html-docs Disable generation of HTML 3.2 docs (default: on)], +AC_ARG_ENABLE(xhtml-docs, +[ --disable-xhtml-docs Disable generation of XHTML docs (default: on)], [case "${enableval}" in - yes) htmldocs=true ;; - no) htmldocs=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-html-docs) ;; -esac],[htmldocs=true]) -AM_CONDITIONAL(HTMLDOCS,test x$htmldocs = xtrue) + yes) xhtmldocs=true ;; + no) xhtmldocs=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-xhtml-docs) ;; +esac],[xhtmldocs=true]) +AM_CONDITIONAL(XHTMLDOCS,test x$xhtmldocs = xtrue) AC_ARG_ENABLE(html4-docs, [ --enable-html4-docs Enable generation of HTML 4 docs (default: off)], @@ -130,65 +245,16 @@ esac],[asciidocs=false]) AM_CONDITIONAL(ASCIIDOCS,test x$asciidocs = xtrue) -AC_ARG_ENABLE(rtf-docs, -[ --enable-rtf-docs Enable generation of RTF docs (default: off)], -[case "${enableval}" in - yes) rtfdocs=true ;; - no) rtfdocs=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-rtf-docs) ;; -esac],[rtfdocs=false]) -AM_CONDITIONAL(RTFDOCS,test x$rtfdocs = xtrue) - -dnl This is stolen from gnome-libs-1.0.14 -AC_ARG_ENABLE(compile-warnings, -[ --enable-compile-warnings=[no/minimum/yes] Turn on compiler warnings.], -,enable_compile_warnings=minimum) - -AC_MSG_CHECKING(what warning flags to pass to the C compiler) -warnCFLAGS= -if test "x$GCC" != xyes; then - enable_compile_warnings=no -fi -if test "x$enable_compile_warnings" != "xno"; then - if test "x$GCC" = "xyes"; then - case " $CFLAGS " in - *[\ \ ]-Wall[\ \ ]*) ;; - *) warnCFLAGS="-Wall -Wunused" ;; - esac - - ## -W is not all that useful. And it cannot be controlled - ## with individual -Wno-xxx flags, unlike -Wall - if test "x$enable_compile_warnings" = "xyes"; then - warnCFLAGS="$warnCFLAGS -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith" - fi - fi -fi -AC_MSG_RESULT($warnCFLAGS) - -AC_ARG_ENABLE(iso-c, - [ --enable-iso-c Try to warn if code is not ISO C ],, - enable_iso_c=no) +AC_ARG_WITH(etcdir, + [ --with-etcdir=DIR Set configfile dir (default: SYSCONFDIR/psiconv)], + [PSICONVETCDIR=${withval}], + [PSICONVETCDIR=${sysconfdir}/psiconv]) +AC_SUBST(PSICONVETCDIR) -AC_MSG_CHECKING(what language compliance flags to pass to the C compiler) -complCFLAGS= -if test "x$enable_iso_c" != "xno"; then - if test "x$GCC" = "xyes"; then - case " $CFLAGS " in - *[\ \ ]-ansi[\ \ ]*) ;; - *) complCFLAGS="$complCFLAGS -ansi" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-pedantic[\ \ ]*) ;; - *) complCFLAGS="$complCFLAGS -pedantic" ;; - esac - fi -fi -AC_MSG_RESULT($complCFLAGS) -if test "x$cflags_set" != "xyes"; then - CFLAGS="$CFLAGS $warnCFLAGS $complCFLAGS" - cflags_set=yes - AC_SUBST(cflags_set) -fi +AC_ARG_WITH(imagemagick, + [ --with-imagemagick enable ImageMagick (default = yes)], + [IMAGEMAGICK=$withval], + [IMAGEMAGICK='yes']) -AC_OUTPUT([Makefile compat/Makefile lib/Makefile psiconv/Makefile lib/general.h formats/Makefile docs/Makefile]) +AC_CONFIG_FILES([Makefile compat/Makefile lib/Makefile lib/psiconv/Makefile program/Makefile program/psiconv/Makefile program/psiconv-config/Makefile program/psiconv-config/psiconv-config program/psiconv-config/psiconv-config.man lib/psiconv/general.h formats/Makefile docs/Makefile program/extra/Makefile etc/Makefile]) +AC_OUTPUT