Minor PNG fix in configure script. Updates to macosxbuild for universal builds.
[synfig.git] / synfig-core / trunk / config / configure.ac
1 i# $Header: /opt/voria/cvs/synfig/config/configure.ac,v 1.10 2005/03/24 21:07:24 darco Exp $
2
3 # -- I N I T --------------------------------------------------
4
5 . $srcdir/config/build.cfg 
6
7 AC_INIT(@PACKAGE_NAME@,@PACKAGE_VERSION@,@PACKAGE_BUGREPORT@,@PACKAGE_TARNAME@)
8 AC_REVISION
9
10 AC_CONFIG_AUX_DIR(config)
11 AM_CONFIG_HEADER(config.h)
12 AC_CANONICAL_HOST
13 dnl AC_CANONICAL_TARGET
14
15 AM_INIT_AUTOMAKE
16 AM_MAINTAINER_MODE
17
18 AC_LIBLTDL_INSTALLABLE
19 AC_SUBST(INCLTDL)
20 AC_SUBST(LIBLTDL)
21
22 API_VERSION=@API_VERSION@
23
24
25 AC_DEFINE(LT_SCOPE,[extern],[LibLTDL is linked staticly])       
26
27
28
29
30 # -- V A R I A B L E S ----------------------------------------
31
32 SVN_REPOSITORY=@SVN_REPOSITORY@
33 AC_SUBST(SVN_REPOSITORY)
34
35 # -- P R O G R A M S ------------------------------------------
36
37 AC_PROG_CC
38 AC_PROG_CXX
39 AC_PROG_CPP
40 AC_PROG_CXXCPP
41 AC_PROG_INSTALL
42
43 AC_LANG_CPLUSPLUS
44
45
46 # -- A R G U M E N T S ----------------------------------------
47
48
49 AC_ARG_TIMELIMIT
50 AC_ARG_DEBUG
51 AC_ARG_OPTIMIZATION
52 AC_ARG_WARNINGS
53 AC_ARG_PROFILING
54 AC_ARG_PROFILE_ARCS
55 AC_ARG_BRANCH_PROBABILITIES
56 dnl AC_ARG_LICENSE_KEY
57
58 AC_ARG_ENABLE(g5opt,[
59   --enable-g5opt           enable optimizations specific to G5 proc],[
60 #       CXXFLAGS="$CXXFLAGS -fastf -fPIC"
61 #       CFLAGS="$CFLAGS -fastf -fPIC"
62         CXXFLAGS="$CXXFLAGS -mtune=G5 -falign-loops=32"
63         CFLAGS="$CFLAGS -mtune=G5"
64 ],
65 [
66         true
67 ])
68
69 #MINGW_FLAGS="-mno-cygwin"
70
71 AC_WIN32_QUIRKS
72
73 # If we are in debug mode, use the debugging version of the
74 # Microsoft Visual C Runtime Library
75 #if [[ $debug = "yes" ]] ; then {
76 #       WIN32_DEBUG_LIBRARY="msvcr70d"
77 #       WIN32_DEBUG_LIBRARY="msvcrtd"
78 #       LIBTOOL_PATCH_SED="$LIBTOOL_PATCH_SED
79 #               s/-lmsvcrt/-l$WIN32_DEBUG_LIBRARY/g;
80 #       ";
81 #} ; fi
82
83 AC_LIBTOOL_WIN32_DLL
84 AC_LIBTOOL_DLOPEN
85 AC_DISABLE_STATIC
86 AC_ENABLE_SHARED
87 AC_PROG_LIBTOOL
88 AC_SUBST(LIBTOOL_DEPS)
89 AC_LIBTOOL_PATCH
90
91 #if [[ "$LIBTOOL_PATCH_SED""x" != "x" ]] ; then {
92 #       printf "Patching libtool... "
93 #       cat libtool | sed "$LIBTOOL_PATCH_SED" > libtool2
94 #       rm libtool
95 #       mv libtool2 libtool
96 #       chmod +x libtool
97 #       AC_MSG_RESULT([patched])
98 #} fi ;
99
100
101 dnl
102 dnl dynamic linker
103 dnl
104 AC_CHECK_LIB(c, dlopen,
105         DYNAMIC_LD_LIBS="",
106         AC_CHECK_LIB(
107                 dl,
108                 dlopen,
109         DYNAMIC_LD_LIBS="-ldl",
110             DYNAMIC_LD_LIBS=""
111         )
112 )
113
114 AC_SUBST(DYNAMIC_LD_LIBS)
115
116 AC_ARG_ENABLE(half,[
117   --enable-half           Use OpenEXR's "half" type for color],[
118         use_openexr_half=$enableval
119 ],
120 [
121         use_openexr_half="no"
122 ])
123
124
125
126 AC_ARG_ENABLE(layer-profiling,[
127   --enable-layer-profiling       Enable layer profiling],[
128         use_layerprofiling=$enableval
129 ],
130 [
131         use_layerprofiling="no"
132 ])
133 if test $use_layerprofiling = "yes" ; then {
134         AC_DEFINE(SYNFIG_PROFILE_LAYERS,[1],[enable layer profiling])   
135 } ; fi
136
137
138
139
140 AC_ARG_WITH(imagemagick,[
141   --without-imagemagick   Disable support for ImageMagick],[
142 ],[
143     AC_CHECK_PROG([imagemagick_convert],[convert],[yes],[no])
144     with_imagemagick=$imagemagick_convert
145 ])
146 if test $with_imagemagick = "no" ; then {
147         AM_CONDITIONAL(WITH_IMAGEMAGICK,false)
148 } else {
149         AM_CONDITIONAL(WITH_IMAGEMAGICK,true)
150 } ; fi
151
152
153
154
155
156 AC_ARG_WITH(ffmpeg,[
157   --without-ffmpeg        Disable support for FFMPEG],[
158 ],[
159         with_ffmpeg="yes"
160 ])
161 if test $with_ffmpeg = "no" ; then {
162         AM_CONDITIONAL(WITH_FFMPEG,false)
163 } else {
164         AM_CONDITIONAL(WITH_FFMPEG,true)
165 } ; fi
166
167
168
169
170 AC_ARG_WITH(vimage,[
171   --with-vimage        Enable support for apple vImage],[
172 ],[
173         with_vimage="no"
174 ])
175 if test $with_vimage = "no" ; then {
176         AM_CONDITIONAL(WITH_VIMAGE,false)
177 } else {
178         AM_CONDITIONAL(WITH_VIMAGE,true)
179         AC_DEFINE(HAS_VIMAGE,[1],[enable apple vImage])
180         VIMAGE_LIBS="-Wc,-framework -Wc,Accelerate"
181
182 } ; fi
183
184
185
186 AC_ARG_WITH(libdv,[
187   --without-libdv         Disable support for libdv],[
188 ],[
189         with_libdv="yes"
190 ])
191 if test $with_libdv = "no" ; then {
192         AM_CONDITIONAL(WITH_LIBDV,false)
193 } else {
194         AM_CONDITIONAL(WITH_LIBDV,true)
195 } ; fi
196
197
198
199
200
201 AC_ARG_WITH(libavcodec,[
202   --with-libavcodec         Enable support for libavcodec (Default=auto)],[
203 ],[
204         AC_CHECK_LIB(avcodec, avcodec_find_encoder,[
205                 with_libavcodec="yes"
206         ],[
207                 with_libavcodec="no"
208         ])
209 ])
210 if test $with_libavcodec = "no" ; then {
211         AM_CONDITIONAL(WITH_LIBAVCODEC,false)
212 } else {
213         AM_CONDITIONAL(WITH_LIBAVCODEC,true)
214 } ; fi
215
216
217
218
219
220 # FREETYPE2 CHECK--------------------
221
222 AC_ARG_WITH(freetype,[
223   --without-freetype         disable support for freetype (Default=auto)],[
224 ],[
225         with_freetype="yes"
226 ])
227
228
229 if test $with_freetype != "no" ; then {
230         PKG_CHECK_MODULES(FREETYPE, xft freetype2 fontconfig,[
231                 with_freetype="yes"
232         ],[
233                 PKG_CHECK_MODULES(FREETYPE, freetype2 fontconfig,[
234                         with_freetype="yes"
235                 ],[
236                         with_freetype="no"
237                 ])
238         ])
239 #       AC_CHECK_FT2(,[
240 #               with_freetype="yes"
241 #       ],[
242 #               with_freetype="no"
243 #       ])      
244 } ; fi
245
246 if test $with_freetype = "no" ; then {
247         AM_CONDITIONAL(WITH_FREETYPE,false)
248 } else {
249         AM_CONDITIONAL(WITH_FREETYPE,true)
250 } ; fi
251
252
253
254
255
256
257 # OPENEXR CHECK------------------------
258 AC_ARG_WITH(openexr,[
259   --without-openexr        Disable support for ILM's OpenEXR],[
260 ],[
261         with_openexr="yes"
262 ])
263 if test $with_openexr = "yes" ; then {
264         PKG_CHECK_MODULES(OPENEXR, OpenEXR,[
265                 CONFIG_DEPS="$CONFIG_DEPS OpenEXR"
266         
267                 AC_DEFINE(HAVE_OPENEXR,[], [ Define if OpenEXR is available ] )
268                 AM_CONDITIONAL(WITH_OPENEXR,true)
269         ],
270         [
271                 with_openexr="no"
272         ])
273 } ; fi
274 if test $with_openexr = "no" ; then {
275         AM_CONDITIONAL(WITH_OPENEXR,false)
276         use_openexr_half="no"
277 } ; fi
278 if test $use_openexr_half = yes ; then {
279         AC_MSG_RESULT([ ** Using OpenEXR Half.])
280         CONFIG_CFLAGS="$CONFIG_CFLAGS -DUSE_HALF_TYPE"
281 } ; fi
282
283
284
285
286
287 # -- L I B R A R I E S ----------------------------------------
288
289 AC_LIB_LTDL
290
291 PKG_CHECK_MODULES(ETL, ETL,,[
292         AC_MSG_ERROR([ ** You need to install the ETL.])
293 ])
294 CONFIG_DEPS="$CONFIG_DEPS ETL"
295
296
297 PKG_CHECK_MODULES(LIBXMLPP, libxml++-2.6,[
298         CONFIG_DEPS="$CONFIG_DEPS libxml++-2.6"
299 ],[
300         PKG_CHECK_MODULES(LIBXMLPP, libxml++-1.0,[
301                 CONFIG_DEPS="$CONFIG_DEPS libxml++-1.0"
302         ],[
303                 AC_MSG_ERROR([ ** You need to install libxml++, either verison 2.6 or 1.0.])
304         ])
305 ])
306
307 PKG_CHECK_MODULES(LIBSIGC, [sigc++-2.0],,[
308         AC_MSG_ERROR([ ** libsigc++-2.0 not found. It is required. You should really install it.])
309 dnl     PKG_CHECK_MODULES(LIBSIGC, [sigc++-1.2],,[
310 dnl             AC_MSG_ERROR([ ** At least libsigc++-1.2 is required.])
311 dnl     ])
312 ])
313 CONFIG_DEPS="$CONFIG_DEPS sigc++-2.0"
314
315 dnl PKG_CHECK_MODULES(GLIB, glib-2.0,[GLIB="yes"],[GLIB="no"])
316
317
318
319
320
321 TARGET_TIF="yes"
322 TARGET_PNG="yes"
323 TARGET_JPEG="yes"
324
325 if test "$TARGET_TIF" != "disabled" ; then
326 AC_CHECK_LIB(tiff, TIFFClose,[
327         TIF_LIBS="-ltiff"
328         AC_DEFINE(HAVE_LIBTIFF,[], [ Define if TIFF library is available ] )
329         AC_SUBST(TIF_LIBS)
330         AM_CONDITIONAL(HAVE_LIBTIFF,true)
331 ],[
332         AC_MSG_RESULT([ *** TIFF Output target disabled])
333         TARGET_TIF="no"
334         AM_CONDITIONAL(HAVE_LIBTIFF,false)
335 ])
336 fi
337
338 AC_CHECK_LIB(png, png_write_row,[
339         PNG_LIBS="-lpng"
340         AC_DEFINE(HAVE_LIBPNG,[], [ Define if PNG library is available ] )
341         AC_SUBST(PNG_LIBS)
342         AM_CONDITIONAL(HAVE_LIBPNG,true)
343 ],[
344         AC_CHECK_LIB(png12, png_write_row,[
345         PNG_LIBS="-lpng12"
346         AC_DEFINE(HAVE_LIBPNG,[])
347         AC_SUBST(PNG_LIBS)
348         AM_CONDITIONAL(HAVE_LIBPNG,true)
349         ],[
350                 AC_MSG_RESULT([ *** PNG Output target disabled])
351                 TARGET_PNG="no"
352                 AM_CONDITIONAL(HAVE_LIBPNG,false)
353         ],[-lz -L${exec_prefix}/lib])
354 ],[-lz -L${exec_prefix}/lib])
355
356 AC_CHECK_LIB(jpeg, main,[
357         JPEG_LIBS="-ljpeg"
358         AC_DEFINE(HAVE_LIBJPEG,[], [ Define if JPEG library is available ] )
359         AC_SUBST(JPEG_LIBS)
360         AM_CONDITIONAL(HAVE_LIBJPEG,true)
361 ],[
362         AC_MSG_RESULT([ *** JPEG Output target disabled])
363         TARGET_JPEG="no"
364         AM_CONDITIONAL(HAVE_LIBJPEG,false)
365 ],[-L${exec_prefix}/lib])
366
367
368 dnl AC_CHECK_HEADERS(jpeglib.h,[],[
369 dnl     AC_MSG_RESULT([ *** JPEG Output target disabled])
370 dnl     TARGET_JPEG="no"
371 dnl     AM_CONDITIONAL(HAVE_LIBJPEG,false)
372 dnl ])
373
374
375
376 MODULE_DIR='${libdir}/synfig/modules'
377 moduledir=$libdir/synfig/modules
378 AC_SUBST(MODULE_DIR)
379 SYNFIGLIB_DIR=$libdir/synfig
380 AC_SUBST(SYNFIGLIB_DIR)
381
382
383
384
385
386 CXXFLAGS="$CXXFLAGS -fpermissive"
387
388 AC_CHECK_HEADERS(signal.h termios.h sys/errno.h)
389
390
391 case "$host" in
392         *mingw* | *cygwin*)
393                 AM_CONDITIONAL(WIN32_PKG, true)
394                 AM_CONDITIONAL(MACOSX_PKG, false)
395         ;;
396         *darwin*)
397                 AM_CONDITIONAL(WIN32_PKG, false)
398                 AM_CONDITIONAL(MACOSX_PKG, true)
399         ;;
400         *)
401                 AM_CONDITIONAL(WIN32_PKG, false)
402                 AM_CONDITIONAL(MACOSX_PKG, false)
403         ;;
404 esac
405                 
406                 
407
408 # -- H E A D E R S --------------------------------------------
409
410 # -- T Y P E S & S T R U C T S --------------------------------
411
412 # -- F U N C T I O N S ----------------------------------------
413
414 dnl AC_CHECK_FUNCS([floor pow sqrt],[],[
415 dnl     AC_MSG_ERROR([ ** Could not find proper math functions.])
416 dnl ])
417
418 AC_CHECK_FUNCS([fork])
419 AC_CHECK_FUNCS([kill])
420 AC_CHECK_FUNCS([pipe])
421
422 AC_CHECK_FUNCS(
423         [isnan],
424         [],
425         [
426                 AC_CHECK_FUNCS(
427                         [_isnan]
428                 )
429         ]
430 )
431
432 AC_CHECK_FUNCS(
433         [isnanf],
434         [],
435         [
436                 AC_CHECK_FUNCS(
437                         [_isnanf]
438                 )
439         ]
440 )
441
442 AC_CHECK_FUNCS(
443         [floorl],
444         [],
445         [
446                 AC_CHECK_FUNCS(
447                         [_floorl]
448                 )
449         ]
450 )
451
452 AC_CHECK_LIB([pthread],[pthread_create])
453
454 # -- O U T P U T ----------------------------------------------
455
456 AC_SUBST(CFLAGS)
457 AC_SUBST(CXXFLAGS)
458 AC_SUBST(CPPFLAGS)
459 AC_SUBST(LDFLAGS)
460
461 VERSION_MAJ=@VERSION_MAJ@
462 VERSION_MIN=@VERSION_MIN@
463 VERSION_REV=@VERSION_REV@
464 AC_SUBST(VERSION_MAJ)
465 AC_SUBST(VERSION_MIN)
466 AC_SUBST(VERSION_REV)
467
468 dnl AC_CONFIG_SUBDIRS(libltdl)
469
470 CONFIG_LIBS="-lsynfig"
471 CONFIG_CFLAGS="$CONFIG_CFLAGS"
472 AC_SUBST(CONFIG_LIBS)
473 AC_SUBST(CONFIG_CFLAGS)
474 AC_SUBST(CONFIG_DEPS)
475 AC_SUBST(ETL_CFLAGS)
476
477 SYNFIG_LIBS="$VIMAGE_LIBS $LIBXMLPP_LIBS $ETL_LIBS $LIBSIGC_LIBS"
478 SYNFIG_CFLAGS="$LIBXMLPP_CFLAGS $ETL_CFLAGS $LIBSIGC_CFLAGS $CONFIG_CFLAGS -DSYNFIG_NO_DEPRECATED"
479
480 CONFIG_CFLAGS="`echo $CONFIG_CFLAGS | sed s/-mno-cygwin//g | sed s/-mwindows//g`"
481 SYNFIG_CFLAGS="`echo $SYNFIG_CFLAGS | sed s/-mno-cygwin//g | sed s/-mwindows//g`"
482 SYNFIG_LIBS="`echo $SYNFIG_LIBS | sed s/-mno-cygwin//g | sed s/-mwindows//g`"
483
484 AC_SUBST(LIBADD_DL)
485
486 AC_SUBST(SYNFIG_LIBS)
487 AC_SUBST(SYNFIG_CFLAGS)
488 AC_SUBST(API_VERSION)
489
490 synfigincludedir=$includedir/synfig-@API_VERSION@
491 AC_SUBST(synfigincludedir)
492
493 [(
494         [ -d libltdl ] || mkdir libltdl;
495         cd libltdl;
496         
497         echo
498         echo pwd: `pwd`
499         echo ../$srcdir/libltdl/configure $ac_configure_args "'--srcdir="../$srcdir/libltdl"'" --with-auxdir=../$srcdir/config "'CFLAGS=$CFLAGS'" "'LDFLAGS=$LDFLAGS'" "'CC=$CC'" "'CPP=$CPP'" "'CPPFLAGS=$CPPFLAGS'" --disable-shared --enable-static
500         echo ../$srcdir/libltdl/configure $ac_configure_args "'--srcdir="../$srcdir/libltdl"'" --with-auxdir=../$srcdir/config "'CFLAGS=$CFLAGS'" "'LDFLAGS=$LDFLAGS'" "'CC=$CC'" "'CPP=$CPP'" "'CPPFLAGS=$CPPFLAGS'" --disable-shared --enable-static | sh
501         
502 )]
503
504 AC_OUTPUT(
505 synfig-config
506 @PACKAGE_TARNAME@.pc
507 Makefile
508 src/Makefile
509 src/synfig/Makefile
510 src/modules/Makefile
511 src/modules/mod_filter/Makefile
512 src/modules/mod_bmp/Makefile
513 src/modules/mod_gif/Makefile
514 src/modules/mod_ppm/Makefile
515 src/modules/mod_png/Makefile
516 src/modules/mod_jpeg/Makefile
517 src/modules/lyr_std/Makefile
518 src/modules/mod_geometry/Makefile
519 src/modules/mod_gradient/Makefile
520 src/modules/mod_noise/Makefile
521 src/modules/lyr_freetype/Makefile
522 src/modules/mod_ffmpeg/Makefile
523 src/modules/mod_dv/Makefile
524 src/modules/mod_imagemagick/Makefile
525 src/modules/mod_openexr/Makefile
526 src/modules/mod_libavcodec/Makefile
527 src/modules/mod_yuv420p/Makefile
528 src/modules/mod_particle/Makefile
529 src/tool/Makefile
530 src/modules/synfig_modules.cfg
531 examples/Makefile
532 win32inst.nsi
533 pkg-info/macosx/synfig-core.info
534 dnl src/modules/trgt_mpg/Makefile
535 dnl src/modules/mptr_mplayer/Makefile
536 )
537
538 # -- S U M M A R Y --------------------------------------------
539
540 echo "
541 $PACKAGE_NAME v.$VERSION
542 Configuration Summary
543 - - - - - -
544
545 Install Prefix -------------------> $prefix
546 Module directory -----------------> $moduledir
547 Build Platform -------------------> $build
548 Host Platform --------------------> $host
549 Time Limit -----------------------> $death_time
550 Arc Profiling --------------------> $profile_arcs
551 GProf Profiling ------------------> $profiling
552 Debug Mode -----------------------> $debug ($debug_flags)
553 Optimization ---------------------> $optimization
554 PNG output target support --------> $TARGET_PNG
555 TIFF output target support -------> $TARGET_TIF
556 JPEG output target support -------> $TARGET_JPEG
557 ETL_CFLAGS -----------------------> $ETL_CFLAGS
558 FreeType2 ------------------------> $with_freetype
559 libavcodec -----------------------> $with_libavcodec
560 vImage ---------------------------> $with_vimage
561 GLib -----------------------------> $GLIB
562 ImageMagick ----------------------> $with_imagemagick
563 FFMPEG ---------------------------> $with_ffmpeg
564 libdv ----------------------------> $with_libdv
565 OpenEXR --------------------------> $with_openexr
566 Using OpenEXR's \"half\" type ------> $use_openexr_half
567
568 "'$'"CXX ------------------------------> '$CXX'
569 "'$'"CXXFLAGS -------------------------> '$CXXFLAGS'
570 "'$'"SYNFIG_LIBS -----------------------> '$SYNFIG_LIBS'
571 "'$'"LIBXMLPP_LIBS --------------------> '$LIBXMLPP_LIBS'
572 "'$'"ETL_LIBS -------------------------> '$ETL_LIBS'
573 "'$'"LIBSIGC_LIBS ---------------------> '$LIBSIGC_LIBS'
574 "'$'"SYNFIG_CFLAGS ---------------------> '$SYNFIG_CFLAGS'
575 "'$'"LIBADD_DL ------------------------> '$LIBADD_DL'
576 "