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