| 1 | dnl Process this file with autoconf to produce a configure script. | 1 | dnl Process this file with autoconf to produce a configure script. | 
| 2 | AC_INIT(psiconv) | 2 | AC_INIT | 
|  |  | 3 | AC_CONFIG_SRCDIR([lib/psiconv]) | 
| 3 | AM_INIT_AUTOMAKE(psiconv,0.5.0) | 4 | AM_INIT_AUTOMAKE(psiconv,0.9.8) | 
| 4 |  | 5 |  | 
| 5 | AM_CONFIG_HEADER(config.h) | 6 | AM_CONFIG_HEADER(config.h) | 
| 6 |  | 7 |  | 
| 7 | dnl Checks for programs. | 8 | dnl Checks for programs. | 
| 8 | AM_PROG_LIBTOOL | 9 | AM_PROG_LIBTOOL | 
| 9 |  | 10 |  | 
|  |  | 11 | dnl This is stolen from gnome-libs-1.0.14 | 
|  |  | 12 | AC_ARG_ENABLE(compile-warnings, | 
|  |  | 13 | [  --enable-compile-warnings=[no/minimum/yes]       Turn on compiler warnings.], | 
|  |  | 14 | ,enable_compile_warnings=minimum) | 
|  |  | 15 |  | 
|  |  | 16 | AC_MSG_CHECKING(what warning flags to pass to the C compiler) | 
|  |  | 17 | warnCFLAGS= | 
|  |  | 18 | if test "x$GCC" != xyes; then | 
|  |  | 19 | enable_compile_warnings=no | 
|  |  | 20 | fi | 
|  |  | 21 | if test "x$enable_compile_warnings" != "xno"; then | 
|  |  | 22 | if test "x$GCC" = "xyes"; then | 
|  |  | 23 | case " $CFLAGS " in | 
|  |  | 24 | *[\ \	]-Wall[\ \	]*) ;; | 
|  |  | 25 | *) warnCFLAGS="-Wall -Wunused" ;; | 
|  |  | 26 | esac | 
|  |  | 27 |  | 
|  |  | 28 | ## -W is not all that useful.  And it cannot be controlled | 
|  |  | 29 | ## with individual -Wno-xxx flags, unlike -Wall | 
|  |  | 30 | if test "x$enable_compile_warnings" = "xyes"; then | 
|  |  | 31 | warnCFLAGS="$warnCFLAGS -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith" | 
|  |  | 32 | fi | 
|  |  | 33 | fi | 
|  |  | 34 | fi | 
|  |  | 35 | AC_MSG_RESULT($warnCFLAGS) | 
|  |  | 36 |  | 
|  |  | 37 | AC_ARG_ENABLE(iso-c, | 
|  |  | 38 | [  --enable-iso-c          Try to warn if code is not ISO C ],, | 
|  |  | 39 | enable_iso_c=no) | 
|  |  | 40 |  | 
|  |  | 41 | AC_MSG_CHECKING(what language compliance flags to pass to the C compiler) | 
|  |  | 42 | complCFLAGS= | 
|  |  | 43 | if test "x$enable_iso_c" != "xno"; then | 
|  |  | 44 | if test "x$GCC" = "xyes"; then | 
|  |  | 45 | case " $CFLAGS " in | 
|  |  | 46 | *[\ \	]-ansi[\ \	]*) ;; | 
|  |  | 47 | *) complCFLAGS="$complCFLAGS -ansi" ;; | 
|  |  | 48 | esac | 
|  |  | 49 |  | 
|  |  | 50 | case " $CFLAGS " in | 
|  |  | 51 | *[\ \	]-pedantic[\ \	]*) ;; | 
|  |  | 52 | *) complCFLAGS="$complCFLAGS -pedantic" ;; | 
|  |  | 53 | esac | 
|  |  | 54 | fi | 
|  |  | 55 | fi | 
|  |  | 56 | AC_MSG_RESULT($complCFLAGS) | 
|  |  | 57 | if test "x$cflags_set" != "xyes"; then | 
|  |  | 58 | CFLAGS="$CFLAGS $warnCFLAGS $complCFLAGS" | 
|  |  | 59 | cflags_set=yes | 
|  |  | 60 | AC_SUBST(cflags_set) | 
|  |  | 61 | fi | 
|  |  | 62 |  | 
|  |  | 63 |  | 
| 10 | dnl Checks for libraries. | 64 | dnl Checks for libraries. | 
|  |  | 65 | AC_ARG_WITH(imagemagick, | 
|  |  | 66 | [  --with-imagemagick      enable ImageMagick (default = yes)], | 
|  |  | 67 | [IMAGEMAGICK=$withval], | 
|  |  | 68 | [IMAGEMAGICK='yes']) | 
|  |  | 69 | if test x"$IMAGEMAGICK" != xno ; then | 
|  |  | 70 | AC_CHECK_PROG(IMAGEMAGICK,Magick-config,yes,no) | 
|  |  | 71 | if test x"$IMAGEMAGICK" != xno ; then | 
|  |  | 72 | CFLAGS_OLD="$CFLAGS" | 
|  |  | 73 | CPPFLAGS_OLD="$CPPFLAGS" | 
|  |  | 74 | LDFLAGS_OLD="$LDFLAGS" | 
|  |  | 75 | LIBS_OLD="$LIBS" | 
|  |  | 76 | CFLAGS="$CFLAGS `Magick-config --cflags`" | 
|  |  | 77 | CPPFLAGS="$CPPFLAGS `Magick-config --cppflags`" | 
|  |  | 78 | LDFLAGS="$LDFLAGS `Magick-config --ldflags`" | 
|  |  | 79 | LIBS="$LIBS `Magick-config --libs`" | 
|  |  | 80 |  | 
|  |  | 81 |  | 
|  |  | 82 | AC_MSG_CHECKING(whether GetMagickInfo works and which API to use) | 
|  |  | 83 | AC_TRY_RUN([ #include <stdio.h> | 
|  |  | 84 | #include <stdlib.h> | 
|  |  | 85 | #include <time.h> | 
|  |  | 86 | #include <magick/api.h> | 
|  |  | 87 | int main(void) { | 
|  |  | 88 | unsigned long number_formats; | 
|  |  | 89 | ExceptionInfo exception; | 
|  |  | 90 | GetExceptionInfo(&exception); | 
|  |  | 91 | OpenModules(&exception); | 
|  |  | 92 | GetMagickInfoList("*",&number_formats,&exception); | 
|  |  | 93 | return number_formats == 0; }], | 
|  |  | 94 | IMAGEMAGICK=4,IMAGEMAGICK=no,IMAGEMAGICK=no) | 
|  |  | 95 | if test x"$IMAGEMAGICK" = xno ; then | 
|  |  | 96 | AC_TRY_RUN([ #include <stdio.h> | 
|  |  | 97 | #include <stdlib.h> | 
|  |  | 98 | #include <time.h> | 
|  |  | 99 | #include <magick/api.h> | 
|  |  | 100 | int main(void) { | 
|  |  | 101 | unsigned long number_formats; | 
|  |  | 102 | ExceptionInfo exception; | 
|  |  | 103 | GetExceptionInfo(&exception); | 
|  |  | 104 | OpenModules(&exception); | 
|  |  | 105 | GetMagickInfoList("*",&number_formats); | 
|  |  | 106 | return number_formats == 0; }], | 
|  |  | 107 | IMAGEMAGICK=3,IMAGEMAGICK=no,IMAGEMAGICK=no) | 
|  |  | 108 | fi | 
|  |  | 109 | if test x"$IMAGEMAGICK" = xno ; then | 
|  |  | 110 | AC_TRY_RUN([ #include <stdio.h> | 
|  |  | 111 | #include <stdlib.h> | 
|  |  | 112 | #include <time.h> | 
|  |  | 113 | #include <magick/api.h> | 
|  |  | 114 | int main(void) { ExceptionInfo exception; | 
|  |  | 115 | GetExceptionInfo(&exception); | 
|  |  | 116 | OpenModules(&exception); | 
|  |  | 117 | return (NULL ==  GetMagickInfo(NULL,&exception)); }], | 
|  |  | 118 | IMAGEMAGICK=2,IMAGEMAGICK=no,IMAGEMAGICK=no) | 
|  |  | 119 | fi | 
|  |  | 120 | if test x"$IMAGEMAGICK" = xno ; then | 
|  |  | 121 | AC_TRY_RUN([ #include <magick/magick.h> | 
|  |  | 122 | int main(void) { ExceptionInfo exception; | 
|  |  | 123 | GetExceptionInfo(&exception); | 
|  |  | 124 | OpenModules(&exception); | 
|  |  | 125 | return (NULL ==  GetMagickInfo(NULL,&exception)); }], | 
|  |  | 126 | IMAGEMAGICK=1,IMAGEMAGICK=no,IMAGEMAGICK=no) | 
|  |  | 127 | fi | 
|  |  | 128 | AC_MSG_RESULT("Version $IMAGEMAGICK") | 
|  |  | 129 | LDFLAGS="$LDFLAGS_OLD" | 
|  |  | 130 | LIBS="$LIBS_OLD" | 
|  |  | 131 | dnl Note: CFLAGS can't be set for single directories, so we propagate them | 
|  |  | 132 | if test x"$IMAGEMAGICK" = xno ; then | 
|  |  | 133 | CFLAGS="$CFLAGS_OLD" | 
|  |  | 134 | CPPFLAGS="$CPPFLAGS_OLD" | 
|  |  | 135 | fi | 
|  |  | 136 | fi | 
|  |  | 137 | fi | 
|  |  | 138 | if test x"$IMAGEMAGICK" != xno ; then | 
|  |  | 139 | LIB_MAGICK="`Magick-config --libs` `Magick-config --ldflags`" | 
|  |  | 140 | AC_DEFINE(IMAGEMAGICK, 1 ,[ImageMagick availability]) | 
|  |  | 141 | AC_DEFINE_UNQUOTED(IMAGEMAGICK_API, $IMAGEMAGICK, [ImageMagick API version]) | 
|  |  | 142 | else | 
|  |  | 143 | LIB_MAGICK= | 
|  |  | 144 | fi | 
|  |  | 145 | AC_SUBST(LIB_MAGICK) | 
| 11 |  | 146 |  | 
| 12 | dnl Checks for header files. | 147 | dnl Checks for header files. | 
| 13 | AC_HEADER_STDC | 148 | AC_HEADER_STDC | 
| 14 | AC_CHECK_HEADERS(unistd.h) | 149 | AC_CHECK_HEADERS(unistd.h) | 
| 15 |  | 150 |  | 
| … |  | … |  | 
| 31 | AC_MSG_RESULT(char) | 166 | AC_MSG_RESULT(char) | 
| 32 | elif test $ac_cv_sizeof_short -ge 1 ; then | 167 | elif test $ac_cv_sizeof_short -ge 1 ; then | 
| 33 | INT_8_BIT=short | 168 | INT_8_BIT=short | 
| 34 | AC_MSG_RESULT(short) | 169 | AC_MSG_RESULT(short) | 
| 35 | elif test $ac_cv_sizeof_int -ge 1 ; then | 170 | elif test $ac_cv_sizeof_int -ge 1 ; then | 
| 36 | INT_8_BIT=int |  |  | 
| 37 | AC_MSG_RESULT(int) | 171 | AC_MSG_RESULT(int) | 
| 38 | elif test $ac_cv_sizeof_long -ge 1 ; then | 172 | elif test $ac_cv_sizeof_long -ge 1 ; then | 
| 39 | INT_8_BIT=long | 173 | INT_8_BIT=long | 
| 40 | AC_MSG_RESULT(long) | 174 | AC_MSG_RESULT(long) | 
| 41 | else | 175 | else | 
| … |  | … |  | 
| 80 | AC_SUBST(INT_16_BIT) | 214 | AC_SUBST(INT_16_BIT) | 
| 81 | AC_SUBST(INT_32_BIT) | 215 | AC_SUBST(INT_32_BIT) | 
| 82 |  | 216 |  | 
| 83 | dnl Checks for library functions. | 217 | dnl Checks for library functions. | 
| 84 | AC_FUNC_VPRINTF | 218 | AC_FUNC_VPRINTF | 
| 85 | AC_CHECK_FUNCS(strdup) |  |  | 
| 86 | AC_REPLACE_FUNCS(strdup) | 219 | AC_REPLACE_FUNCS(strdup) | 
|  |  | 220 | AC_CHECK_FUNC(getopt_long,getopt=yes,getopt=no) | 
|  |  | 221 | if test $getopt = no; then | 
|  |  | 222 | AC_LIBOBJ([getopt]) | 
|  |  | 223 | AC_LIBOBJ([getopt1]) | 
|  |  | 224 | fi | 
|  |  | 225 |  | 
|  |  | 226 | AC_ARG_ENABLE(dmalloc, | 
|  |  | 227 | [  --enable-dmalloc        Enable dmalloc for developers (default:off)], | 
|  |  | 228 | [case "${enableval}" in | 
|  |  | 229 | yes) dmalloc=yes ;; | 
|  |  | 230 | no)  dmalloc=no ;; | 
|  |  | 231 | *)  AC_MSG_ERROR(bad value ${enableval} for --enable-dmalloc) ;; | 
|  |  | 232 | esac],[dmalloc=false]) | 
|  |  | 233 | if test x"$dmalloc" = xyes; then | 
|  |  | 234 | AC_CHECK_LIB(dmalloc,malloc,dmalloc=yes,dmalloc=no) | 
|  |  | 235 | fi | 
|  |  | 236 | if test x"$dmalloc" = xyes; then | 
|  |  | 237 | AC_CHECK_HEADER(dmalloc.h,dmalloc=yes,dmalloc=no) | 
|  |  | 238 | fi | 
|  |  | 239 | if test x"$dmalloc" = xyes ; then | 
|  |  | 240 | LIB_DMALLOC=-ldmalloc | 
|  |  | 241 | AC_DEFINE(DMALLOC,1,[DMalloc availability]) | 
|  |  | 242 | else | 
|  |  | 243 | LIB_DMALLOC= | 
|  |  | 244 | fi | 
|  |  | 245 | AC_SUBST(LIB_DMALLOC) | 
| 87 |  | 246 |  | 
| 88 | dnl With and without functions | 247 | dnl With and without functions | 
| 89 | AC_ARG_ENABLE(html-docs, | 248 | AC_ARG_ENABLE(xhtml-docs, | 
| 90 | [  --disable-html-docs     Disable generation of HTML 3.2 docs (default: on)], | 249 | [  --disable-xhtml-docs    Disable generation of XHTML docs (default: on)], | 
| 91 | [case "${enableval}" in | 250 | [case "${enableval}" in | 
| 92 | yes) htmldocs=true ;; | 251 | yes) xhtmldocs=true ;; | 
| 93 | no)  htmldocs=false ;; | 252 | no)  xhtmldocs=false ;; | 
| 94 | *)  AC_MSG_ERROR(bad value ${enableval} for --enable-html-docs) ;; | 253 | *)  AC_MSG_ERROR(bad value ${enableval} for --enable-xhtml-docs) ;; | 
| 95 | esac],[htmldocs=true]) | 254 | esac],[xhtmldocs=true]) | 
| 96 | AM_CONDITIONAL(HTMLDOCS,test x$htmldocs = xtrue) | 255 | AM_CONDITIONAL(XHTMLDOCS,test x$xhtmldocs = xtrue) | 
| 97 |  | 256 |  | 
| 98 | AC_ARG_ENABLE(html4-docs, | 257 | AC_ARG_ENABLE(html4-docs, | 
| 99 | [  --enable-html4-docs     Enable generation of HTML 4 docs (default: off)], | 258 | [  --enable-html4-docs     Enable generation of HTML 4 docs (default: off)], | 
| 100 | [case "${enableval}" in | 259 | [case "${enableval}" in | 
| 101 | yes) html4docs=true ;; | 260 | yes) html4docs=true ;; | 
| … |  | … |  | 
| 111 | no)  asciidocs=false ;; | 270 | no)  asciidocs=false ;; | 
| 112 | *)  AC_MSG_ERROR(bad value ${enableval} for --enable-ascii-docs) ;; | 271 | *)  AC_MSG_ERROR(bad value ${enableval} for --enable-ascii-docs) ;; | 
| 113 | esac],[asciidocs=false]) | 272 | esac],[asciidocs=false]) | 
| 114 | AM_CONDITIONAL(ASCIIDOCS,test x$asciidocs = xtrue) | 273 | AM_CONDITIONAL(ASCIIDOCS,test x$asciidocs = xtrue) | 
| 115 |  | 274 |  | 
| 116 | AC_OUTPUT([Makefile compat/Makefile lib/Makefile psiconv/Makefile lib/general.h formats/Makefile docs/Makefile]) | 275 | AC_ARG_WITH(etcdir, | 
|  |  | 276 | [  --with-etcdir=DIR       Set configfile dir (default: SYSCONFDIR/psiconv)], | 
|  |  | 277 | [PSICONVETCDIR=${withval}], | 
|  |  | 278 | [PSICONVETCDIR=${sysconfdir}/psiconv]) | 
|  |  | 279 | AC_SUBST(PSICONVETCDIR) | 
|  |  | 280 |  | 
|  |  | 281 | AC_ARG_WITH(imagemagick, | 
|  |  | 282 | [  --with-imagemagick      enable ImageMagick (default = yes)], | 
|  |  | 283 | [IMAGEMAGICK=$withval], | 
|  |  | 284 | [IMAGEMAGICK='yes']) | 
|  |  | 285 |  | 
|  |  | 286 | 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 examples/Makefile]) | 
|  |  | 287 | AC_OUTPUT |