1# configure.in for frontline 2# 3# Author: Masatake YAMATO (jet@gyve.org) 4# 5AC_INIT(fit.c) 6 7# 8# version setting up for Automake 9# 10AUTOTRACE_MAJOR_VERSION=0 11AUTOTRACE_MINOR_VERSION=31 12AUTOTRACE_MICRO_VERSION=1 13AUTOTRACE_VERSION=${AUTOTRACE_MAJOR_VERSION}.${AUTOTRACE_MINOR_VERSION}.${AUTOTRACE_MICRO_VERSION} 14AC_DEFINE_UNQUOTED(AUTOTRACE_VERSION,"$AUTOTRACE_VERSION") 15AC_SUBST(AUTOTRACE_VERSION) 16AM_INIT_AUTOMAKE(autotrace, $AUTOTRACE_VERSION, no-define) 17 18# 19# version setting up for libtool 20# 21LT_CURRENT=3 22LT_REVISION=0 23LT_AGE=0 24dnl AC_SUBST(LT_RELEASE) 25AC_SUBST(LT_CURRENT) 26AC_SUBST(LT_REVISION) 27AC_SUBST(LT_AGE) 28dnl AC_SUBST(LT_CURRENT_MINUS_AGE) 29AC_PROG_CC 30AC_PROG_LIBTOOL 31 32AUTOTRACE_WEB=http://autotrace.sourceforge.net 33AC_DEFINE_UNQUOTED(AUTOTRACE_WEB, "$AUTOTRACE_WEB") 34 35AM_MAINTAINER_MODE 36 37AM_CONFIG_HEADER(config.h) 38 39AC_PROG_CPP 40AC_PROG_RANLIB 41dnl AC_CANONICAL_HOST 42dnl AC_ARG_PROGRAM 43AM_SANITY_CHECK 44AC_PROG_INSTALL 45AC_CHECK_HEADERS(malloc.h) 46 47dnl 48dnl ImageMagick 49dnl 50HAVE_MAGICK=no 51AC_ARG_WITH(magick, 52[ --with-magick compile with maigck(default) 53 --without-magick compile without maigck],,with_magick=yes) 54 55if test $with_magick = yes ; then 56 AC_CHECK_PROG(MAGICK_CONFIG, Magick-config, Magick-config, "") 57 if test "x$MAGICK_CONFIG" = "xMagick-config" ; then 58 CPPFLAGS_BACKUP="$CPPFLAGS" 59 CPPFLAGS=`Magick-config --cppflags` 60 AC_CHECK_HEADER(magick/api.h, 61 magick_header_found=yes, 62 magick_header_found=no) 63 MAGICK_CFLAGS=${CPPFLAGS} 64 CPPFLAGS=${CPPFLAGS_BACKUP} 65 if test "x${magick_header_found}" = xyes ; then 66 MAGICK_LDFLAGS="`Magick-config --ldflags` `Magick-config --libs`" 67 dnl 68 dnl Checking version 69 dnl 70 AC_MSG_CHECKING([ImageMagick - version >= 5.2.1]) 71 dnl Get version and split it into MAJOR, MINOR and MICRO 72 MAGICK_VERSION=`Magick-config --version` 73 changequote(,)dnl 74 MAGICK_MAJOR_VERSION=`echo $MAGICK_VERSION \ 75 | sed -e 's/^\([0-9]*\).[0-9]*.[0-9]*$/\1/'` 76 MAGICK_MINOR_VERSION=`echo $MAGICK_VERSION \ 77 | sed -e 's/^[0-9]*.\([0-9]*\).[0-9]*$/\1/'` 78 MAGICK_MICRO_VERSION=`echo $MAGICK_VERSION \ 79 | sed -e 's/^[0-9]*.[0-9]*.\([0-9]*\)$/\1/'` 80 changequote([,])dnl 81 MAGICK_MAJOR_VERSION_CHECK=`expr $MAGICK_MAJOR_VERSION \>= 5` 82 MAGICK_MINOR_VERSION_CHECK=`expr $MAGICK_MINOR_VERSION \>= 2` 83 dnl I don't consider ImageMagick 6.x. 84 if test "$MAGICK_VERSION" = "5.2.0" \ 85 || test "$MAGICK_MAJOR_VERSION_CHECK" = 0 \ 86 || test "$MAGICK_MINOR_VERSION_CHECK" = 0 ; then 87 AC_MSG_RESULT(no($MAGICK_VERSION)) 88 AC_MSG_WARN([*** Version 5.2.1 or higher is required. ***]) 89 AC_MSG_WARN([*** ImageMagick input handler is disabled. ***]) 90 else 91 AC_MSG_RESULT(yes($MAGICK_VERSION)) 92 AC_SUBST(MAGICK_CFLAGS) 93 AC_SUBST(MAGICK_LDFLAGS) 94 HAVE_MAGICK=yes 95 AC_DEFINE(HAVE_MAGICK) 96 fi 97 else 98 AC_MSG_WARN([*** Magick-config is found but magick/api.h is not found in $MAGICK_CFLAGS ***]) 99 AC_MSG_WARN([*** Check Magick-config. ***]) 100 AC_MSG_WARN([*** ImageMagick input handler is disabled. ***]) 101 fi 102 else 103 AC_MSG_WARN([*** Magick-config is not found. ***]) 104 AC_MSG_WARN([*** ImageMagick input handler is disabled. ***]) 105 fi 106fi 107AM_CONDITIONAL(HAVE_MAGICK, test $HAVE_MAGICK = yes) 108 109dnl 110dnl libMagick.la sanity check 111dnl 112dnl It seems that libMagick.la in RedHat 7.2 is broken. 113dnl libMagick.la refers /usr/lib/libxml2.la. However, 114dnl /usr/lib/libxml2.la is not existed. Therefore linking 115dnl against libMagick.la is failed. 116dnl 117libMagick_la_path= 118libMagick_la_sanity=yes 119 120dnl Stage one: finding libMagick.la 121if test $HAVE_MAGICK = yes && test $enable_shared = yes; then 122 for f in $MAGICK_LDFLAGS; do 123 case ${f} in 124 -L*) 125 f=`echo $f | sed -e 's/-L//'` 126 if test -f ${f}/libMagick.la; then 127 libMagick_la_path="${f}/libMagick.la" 128 fi;; 129 esac 130 done 131fi 132 133dnl Stage two: Check internal of libMagick.la 134if test -n "${libMagick_la_path}"; then 135 AC_MSG_CHECKING([Sanity of libMagick.la]) 136 dnl libdir is defined in libMagick.al. 137 dnl Don't use the value. 138 libdir_backup=${libdir} 139 . ${libMagick_la_path} 140 libdir=${libdir_backup} 141 for elt in ${dependency_libs}; do 142 case ${elt} in 143 *.la ) 144 if test ! -f ${elt}; then 145 if test ${libMagick_la_sanity} = yes; then 146 AC_MSG_RESULT([broken]) 147 libMagick_la_sanity=no 148 fi 149 AC_MSG_WARN([Cannot find $elt refereed in ${libMagick_la_path}]) 150 fi;; 151 esac 152 done 153 if test ${libMagick_la_sanity} = yes; then 154 AC_MSG_RESULT([ok]) 155 else 156 AC_MSG_WARN([*** Building will be failed at link time.]) 157 AC_MSG_WARN([*** To avoid this failure, don't link libMagick.so: Run ./configure --without-magick]) 158 fi 159fi 160 161dnl 162dnl LIBPNG 163dnl 164 165dnl Test for zlib (from gimp-1.1.29) 166HAVE_ZLIB=no 167AC_CHECK_LIB(z, gzsetparams, 168 [AC_CHECK_HEADER(zlib.h, 169 HAVE_ZLIB=yes, 170 AC_MSG_WARN(*** ZLIB header files not found: PNG Input will be disabled. ***))], 171 AC_MSG_WARN(*** ZLIB library files not found: PNG Input will be disabled. ***)) 172 173dnl Test for libpng 174HAVE_LIBPNG_STAGE1=no 175AC_CHECK_LIB(png, png_get_image_width, 176 HAVE_LIBPNG_STAGE1=yes ,,-lz -lm) 177 178HAVE_LIBPNG=no 179if test "x$HAVE_LIBPNG_STAGE1" = "xyes" ; then 180 AC_CHECK_LIB(png, png_read_png, 181 HAVE_LIBPNG=yes ,,-lz -lm) 182 if test "x$HAVE_LIBPNG" = "xyes" ; then 183 LIBPNG_LDFLAGS="-lpng -lz -lm" 184 AC_SUBST(LIBPNG_LDFLAGS) 185 AC_DEFINE(HAVE_LIBPNG) 186 else 187 AC_MSG_WARN([*** libpng exists but cannot find png_read_png in the libpng. ***]) 188 AC_MSG_WARN([*** libpng might be old. ***]) 189 AC_MSG_WARN([*** You need libpng 1.0.6 or higher. ***]) 190 AC_MSG_WARN([*** Png input handler is disabled. ***]) 191 fi 192else 193 AC_MSG_WARN([*** Cannot find libpng. ***]) 194 AC_MSG_WARN([*** Png input handler is disabled. ***]) 195fi 196AM_CONDITIONAL(HAVE_LIBPNG, test $HAVE_LIBPNG = yes) 197 198dnl 199dnl LIBMING(LIBSWF) 200dnl 201HAVE_LIBSWF=no 202 203AC_CHECK_HEADER(ming.h, 204 swf_header_found=yes, 205 swf_header_found=no) 206if test "${swf_header_found}" = yes ; then 207 AC_CHECK_LIB(ming, Ming_init, 208 HAVE_LIBSWF=yes,,-lm) 209 if test "$HAVE_LIBSWF" = "yes" ; then 210 LIBSWF_LDFLAGS="-lming -lm" 211 AC_SUBST(LIBSWF_LDFLAGS) 212 AC_DEFINE(HAVE_LIBSWF) 213 else 214 AC_MSG_WARN([*** Cannot find libming. ***]) 215 AC_MSG_WARN([*** SWF output is disabled. ***]) 216 fi 217else 218 AC_MSG_WARN([*** Cannot find ming.h. ***]) 219 AC_MSG_WARN([*** SWF output is disabled. ***]) 220fi 221AM_CONDITIONAL(HAVE_LIBSWF, test x$HAVE_LIBSWF = xyes) 222 223dnl 224dnl Suppressing linker warning 225dnl 226dnl On MacOS X(Darwin), getopt related symbols are defined 227dnl in /usr/lib/libm.dylib. They are conflicted with symbols 228dnl defined in getopt* of autotrace. To avoid warning-messages 229dnl about this confliction, "-multiply_defined suppress" is 230dnl passed to ld if autotrace is built on Darwin. 231dnl 232dnl BTW, Is getopt mathematical function? 233dnl 234dnl libm.dylib on Darwin problem is reported by 235dnl Martin Kerscher <kerscher@theorie.physik.uni-muenchen.de> 236dnl 237AC_MSG_CHECKING([whether the host is Darwin]) 238case $host_os in 239 darwin*) LDFLAGS="-Xlinker -multiply_defined -Xlinker suppress ${LDFLAGS}" 240 AC_MSG_RESULT([yes]) 241 AC_MSG_WARN([linker messages that warns symbols are multiply defined 242are suppressed]) 243 ;; 244 *) 245 AC_MSG_RESULT([no]) 246 ;; 247esac 248 249dnl 250dnl pstoedit library 251dnl 252HAVE_LIBPSTOEDIT=no 253HAVE_LIBPSTOEDIT_320=no 254HAVE_LIBPSTOEDIT_321=no 255LIBPSTOEDIT_CFLAGS= 256LIBPSTOEDIT_LIBS= 257LIBPSTOEDIT_EXTRA_LIBS= 258 259AC_ARG_WITH(pstoedit, 260[ --with-pstoedit link with pstoedit library(default) 261 --without-pstoedit link without pstoedit library],,with_pstoedit=yes) 262if test "x${with_pstoedit}" = xyes; then 263dnl 264dnl 265dnl 266AC_PROG_CXX 267dnl Standard C++ library and C++ Runtime 268dnl --- WORKAROUND for pstoedit 3.32.0 269CXX_RUNTIME_LIB= 270CXX_STD_LIB= 271if test x"$GXX" = xyes; then 272 AC_CHECK_LIB(g++,main,CXX_RUNTIME_LIB=-lg++) 273 AC_CHECK_LIB(stdc++,main,CXX_STD_LIB=-lstdc++,,${CXX_RUNTIME_LIB}) 274fi 275AC_MSG_CHECKING([for C++ runtime]) 276LIBPSTOEDIT_EXTRA_LIBS="${CXX_STD_LIB} ${CXX_RUNTIME_LIB}" 277AC_MSG_RESULT([${CXX_STD_LIB} ${CXX_RUNTIME_LIB}]) 278dnl dl library 279dnl --- WORKAROUND for pstoedit 3.32.0 280LIBLD_LDFLAGS= 281AC_CHECK_LIB(dl,main,[LIBLD_LDFLAGS=-ldl]) 282if test "x${LIBLD_LDFLAGS}" != x; then 283 LIBPSTOEDIT_EXTRA_LIBS="${LIBPSTOEDIT_EXTRA_LIBS} ${LIBLD_LDFLAGS}" 284fi 285 286echo '*** Checking pstoedit existence TWICE(if needed) ***' 287echo '*** This is the 1st check ***' 288AM_PATH_PSTOEDIT(3.32.1,HAVE_LIBPSTOEDIT_321=yes) 289if test ${HAVE_LIBPSTOEDIT_321} != yes; then 290 echo '*** The 1st check is failed. ***' 291 LIBS_BAKCUP=$LIBS 292 LIBS="$LIBS ${LIBPSTOEDIT_EXTRA_LIBS}" 293 echo '*** This is the 2nd check ***' 294 AM_PATH_PSTOEDIT(3.32.0,HAVE_LIBPSTOEDIT_320=yes) 295 LIBS=${LIBS_BAKCUP} 296 297 if test ${HAVE_LIBPSTOEDIT_320} = yes; then 298 echo '*** The 2nd check is passed. ***' 299 HAVE_LIBPSTOEDIT=yes 300 AC_DEFINE(HAVE_LIBPSTOEDIT) 301 LIBPSTOEDIT_LIBS="${PSTOEDIT_LIBS} ${LIBPSTOEDIT_EXTRA_LIBS}" 302 LIBPSTOEDIT_CFLAGS="${PSTOEDIT_CFLAGS}" 303 else 304 echo '*** The 2nd check is failed. ***' 305 fi 306else 307 echo '*** The 1st check is passed. ***' 308 HAVE_LIBPSTOEDIT=yes 309 AC_DEFINE(HAVE_LIBPSTOEDIT) 310 LIBPSTOEDIT_LIBS="${PSTOEDIT_LIBS} ${LIBPSTOEDIT_EXTRA_LIBS}" 311 LIBPSTOEDIT_CFLAGS="${PSTOEDIT_CFLAGS}" 312fi 313 314if test ${HAVE_LIBPSTOEDIT} = yes; then 315 AC_CHECK_FUNCS([mkstemp]) 316 echo '*** pstoedit output functions are enabled. ***' 317 echo '*** However, these are experimental functions in autotrace. ***' 318 echo '*** If you get an error in building time about pstoedit, ***' 319 echo '*** you can run configure with --without-pstoedit option again. ***' 320else 321 AC_MSG_WARN([ 322*** Cannot find libpstoedit. *** 323*** Output functions using libpstoedit are disabled ***]) 324fi 325dnl 326dnl 327dnl 328else 329AC_MSG_WARN([pstoedit output functions are disabled from command line.]) 330fi 331AC_SUBST(LIBPSTOEDIT_CFLAGS) 332AC_SUBST(LIBPSTOEDIT_LIBS) 333AM_CONDITIONAL(HAVE_LIBPSTOEDIT, test x$HAVE_LIBPSTOEDIT = xyes) 334 335dnl 336dnl Vender's cc(not gcc) 337dnl 338dnl if test "x$CC" = xcc ; then 339dnl case host in 340dnl mips-sgi-irix*) 341dnl # Peter Cucka <pcucka at anim.dreamworks.com> wrote: 342dnl # > Should I use -Ofast instead of -O2? 343dnl # -Ofast selects optimizations that maximize speed, at the expense of 344dnl # size, compile time, and, in some cases, floating point accuracy. 345dnl # Compiled with -Ofast, AutoTrace runs about twice as fast as with -O2, 346dnl # or even -O3, on the two machines (admittedly not a very extensive 347dnl # sample) on which I've tested it. I'd recommend using -Ofast, but 348dnl # it's not necessary. 349dnl CFLAGS=-Ofast 350dnl ;; 351dnl *) 352dnl ;; 353dnl esac 354dnl fi 355 356AC_OUTPUT([Makefile autotrace-config autotrace.pc autotrace.spec], 357[chmod a+x autotrace-config]) 358 359echo " 360 361Configuration: 362 imagemagick output support: $HAVE_MAGICK 363 libpng output support: $HAVE_LIBPNG 364 swf output support by ming: $HAVE_LIBSWF 365 pstoedit output support: $HAVE_LIBPSTOEDIT 366 367" 368