Fix 1736536. Integer division isn't good enough when the navigator window is small.
[synfig.git] / synfig-core / trunk / config / configure.ac
1 # $Id$
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 # LIBAVCODEC CHECK--------------------
201
202 AC_ARG_WITH(libavcodec,[
203   --without-libavcodec         disable support for libavcodec (Default=auto)],[
204 ],[
205         with_libavcodec="yes"
206 ])
207
208 if test $with_libavcodec != "no" ; then {
209         PKG_CHECK_MODULES(LIBAVCODEC, [libavcodec libavformat],[],[echo no; with_libavcodec="no"])
210 } ; fi
211 if test $with_libavcodec = "yes" ; then {
212         AC_DEFINE(WITH_LIBAVCODEC,[],[enable libavcodec support])
213         AM_CONDITIONAL(WITH_LIBAVCODEC,true)
214 } else {
215         AM_CONDITIONAL(WITH_LIBAVCODEC,false)
216 } ; fi
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 if test $with_freetype != "no" ; then {
229         PKG_CHECK_MODULES(FREETYPE, freetype2,[
230                 with_freetype="yes"
231         ],[
232                 PKG_CHECK_MODULES(FREETYPE, xft,[
233                         with_freetype="yes"
234                 ],[
235                         with_freetype="no"
236                 ])
237         ])
238 } ; fi
239
240 if test $with_freetype = "no" ; then {
241         AM_CONDITIONAL(WITH_FREETYPE,false)
242 } else {
243         AM_CONDITIONAL(WITH_FREETYPE,true)
244 } ; fi
245
246
247 # FONTCONFIG CHECK--------------------
248
249 AC_ARG_WITH(fontconfig,[
250   --without-fontconfig         disable support for fontconfig (Default=auto)],[
251 ],[
252         with_fontconfig="yes"
253 ])
254
255 if test $with_fontconfig != "no" ; then {
256         PKG_CHECK_MODULES(FONTCONFIG, fontconfig,[
257                 with_fontconfig="yes"
258         ],[
259                 with_fontconfig="no"
260         ])
261 } ; fi
262
263 if test $with_fontconfig = "yes" ; then {
264         AC_DEFINE(WITH_FONTCONFIG,[],[enable fontconfig support])
265         AM_CONDITIONAL(WITH_FONTCONFIG,true)
266 } else {
267         AM_CONDITIONAL(WITH_FONTCONFIG,false)
268 } ; fi
269
270
271 # OPENEXR CHECK------------------------
272 AC_ARG_WITH(openexr,[
273   --without-openexr        Disable support for ILM's OpenEXR],[
274 ],[
275         with_openexr="yes"
276 ])
277 if test $with_openexr = "yes" ; then {
278         PKG_CHECK_MODULES(OPENEXR, OpenEXR,[
279                 CONFIG_DEPS="$CONFIG_DEPS OpenEXR"
280         
281                 AC_DEFINE(HAVE_OPENEXR,[], [ Define if OpenEXR is available ] )
282                 AM_CONDITIONAL(WITH_OPENEXR,true)
283         ],
284         [
285                 with_openexr="no"
286         ])
287 } ; fi
288 if test $with_openexr = "no" ; then {
289         AM_CONDITIONAL(WITH_OPENEXR,false)
290         use_openexr_half="no"
291 } ; fi
292 if test $use_openexr_half = yes ; then {
293         AC_MSG_RESULT([ ** Using OpenEXR Half.])
294         CONFIG_CFLAGS="$CONFIG_CFLAGS -DUSE_HALF_TYPE"
295         OPENEXR_HALF_LIBS="-lHalf"
296 } else {
297         OPENEXR_HALF_LIBS=""
298 } ; fi
299
300
301
302
303
304 # -- L I B R A R I E S ----------------------------------------
305
306 AC_LIB_LTDL
307
308 PKG_CHECK_MODULES(ETL, [ETL >= 0.04.09],,[
309         AC_MSG_ERROR([ ** You need to install the ETL (version 0.04.09 or greater).])
310 ])
311 CONFIG_DEPS="$CONFIG_DEPS ETL"
312
313
314 PKG_CHECK_MODULES(LIBXMLPP, libxml++-2.6,[
315         CONFIG_DEPS="$CONFIG_DEPS libxml++-2.6"
316 ],[
317         PKG_CHECK_MODULES(LIBXMLPP, libxml++-1.0,[
318                 CONFIG_DEPS="$CONFIG_DEPS libxml++-1.0"
319         ],[
320                 AC_MSG_ERROR([ ** You need to install libxml++, either verison 2.6 or 1.0.])
321         ])
322 ])
323
324 PKG_CHECK_MODULES(LIBSIGC, [sigc++-2.0],,[
325         AC_MSG_ERROR([ ** libsigc++-2.0 not found. It is required. You should really install it.])
326 dnl     PKG_CHECK_MODULES(LIBSIGC, [sigc++-1.2],,[
327 dnl             AC_MSG_ERROR([ ** At least libsigc++-1.2 is required.])
328 dnl     ])
329 ])
330 CONFIG_DEPS="$CONFIG_DEPS sigc++-2.0"
331
332 dnl PKG_CHECK_MODULES(GLIB, glib-2.0,[GLIB="yes"],[GLIB="no"])
333
334
335
336
337
338 TARGET_TIF="yes"
339 TARGET_PNG="yes"
340 TARGET_MNG="no"
341 TARGET_JPEG="yes"
342
343 if test "$TARGET_TIF" != "disabled" ; then
344 AC_CHECK_LIB(tiff, TIFFClose,[
345         TIF_LIBS="-ltiff"
346         AC_DEFINE(HAVE_LIBTIFF,[], [ Define if TIFF library is available ] )
347         AC_SUBST(TIF_LIBS)
348         AM_CONDITIONAL(HAVE_LIBTIFF,true)
349 ],[
350         AC_MSG_RESULT([ *** TIFF Output target disabled])
351         TARGET_TIF="no"
352         AM_CONDITIONAL(HAVE_LIBTIFF,false)
353 ])
354 fi
355
356 AC_CHECK_LIB(png, png_write_row,[
357         PNG_LIBS="-lpng"
358         AC_DEFINE(HAVE_LIBPNG,[], [ Define if PNG library is available ] )
359         AC_SUBST(PNG_LIBS)
360         AM_CONDITIONAL(HAVE_LIBPNG,true)
361 ],[
362         AC_CHECK_LIB(png12, png_write_row,[
363         PNG_LIBS="-lpng12"
364         AC_DEFINE(HAVE_LIBPNG,[])
365         AC_SUBST(PNG_LIBS)
366         AM_CONDITIONAL(HAVE_LIBPNG,true)
367         ],[
368                 AC_MSG_RESULT([ *** PNG Output target disabled])
369                 TARGET_PNG="no"
370                 AM_CONDITIONAL(HAVE_LIBPNG,false)
371         ],[-lz -L${exec_prefix}/lib])
372 ],[-lz -L${exec_prefix}/lib])
373
374 #AC_CHECK_LIB(mng, mng_initialize,[
375 #       MNG_LIBS="-lmng -lz"
376 #       AC_DEFINE(HAVE_LIBMNG,[], [ Define if MNG library is available ] )
377 #       AC_SUBST(MNG_LIBS)
378 #       AM_CONDITIONAL(HAVE_LIBMNG,true)
379 #],[
380 #       AC_MSG_RESULT([ *** MNG Output target disabled])
381 #       TARGET_MNG="no"
382 #       AM_CONDITIONAL(HAVE_LIBMNG,false)
383 #],[-lz -L${exec_prefix}/lib])
384
385 AC_CHECK_LIB(jpeg, main,[
386         JPEG_LIBS="-ljpeg"
387         AC_DEFINE(HAVE_LIBJPEG,[], [ Define if JPEG library is available ] )
388         AC_SUBST(JPEG_LIBS)
389         AM_CONDITIONAL(HAVE_LIBJPEG,true)
390 ],[
391         AC_MSG_RESULT([ *** JPEG Output target disabled])
392         TARGET_JPEG="no"
393         AM_CONDITIONAL(HAVE_LIBJPEG,false)
394 ],[-L${exec_prefix}/lib])
395
396
397 dnl AC_CHECK_HEADERS(jpeglib.h,[],[
398 dnl     AC_MSG_RESULT([ *** JPEG Output target disabled])
399 dnl     TARGET_JPEG="no"
400 dnl     AM_CONDITIONAL(HAVE_LIBJPEG,false)
401 dnl ])
402
403
404
405 MODULE_DIR='${libdir}/synfig/modules'
406 moduledir=$libdir/synfig/modules
407 AC_SUBST(MODULE_DIR)
408 SYNFIGLIB_DIR=$libdir/synfig
409 AC_SUBST(SYNFIGLIB_DIR)
410
411
412
413
414
415 CXXFLAGS="$CXXFLAGS -fpermissive"
416
417 AC_CHECK_HEADERS(signal.h termios.h sys/errno.h)
418
419
420 case "$host" in
421         *mingw* | *cygwin*)
422                 AM_CONDITIONAL(WIN32_PKG, true)
423                 AM_CONDITIONAL(MACOSX_PKG, false)
424         ;;
425         *darwin*)
426                 AM_CONDITIONAL(WIN32_PKG, false)
427                 AM_CONDITIONAL(MACOSX_PKG, true)
428         ;;
429         *)
430                 AM_CONDITIONAL(WIN32_PKG, false)
431                 AM_CONDITIONAL(MACOSX_PKG, false)
432         ;;
433 esac
434                 
435                 
436
437 # -- H E A D E R S --------------------------------------------
438
439 # -- T Y P E S & S T R U C T S --------------------------------
440
441 # -- F U N C T I O N S ----------------------------------------
442
443 dnl AC_CHECK_FUNCS([floor pow sqrt],[],[
444 dnl     AC_MSG_ERROR([ ** Could not find proper math functions.])
445 dnl ])
446
447 AC_CHECK_FUNCS([fork])
448 AC_CHECK_FUNCS([kill])
449 AC_CHECK_FUNCS([pipe])
450
451 AC_CHECK_FUNCS(
452         [isnan],
453         [],
454         [
455                 AC_CHECK_FUNCS(
456                         [_isnan]
457                 )
458         ]
459 )
460
461 AC_CHECK_FUNCS(
462         [isnanf],
463         [],
464         [
465                 AC_CHECK_FUNCS(
466                         [_isnanf]
467                 )
468         ]
469 )
470
471 AC_CHECK_FUNCS(
472         [floorl],
473         [],
474         [
475                 AC_CHECK_FUNCS(
476                         [_floorl]
477                 )
478         ]
479 )
480
481 AC_CHECK_LIB([pthread],[pthread_create])
482
483 # -- O U T P U T ----------------------------------------------
484
485 AC_SUBST(CFLAGS)
486 AC_SUBST(CXXFLAGS)
487 AC_SUBST(CPPFLAGS)
488 AC_SUBST(LDFLAGS)
489
490 VERSION_MAJ=@VERSION_MAJ@
491 VERSION_MIN=@VERSION_MIN@
492 VERSION_REV=@VERSION_REV@
493 AC_SUBST(VERSION_MAJ)
494 AC_SUBST(VERSION_MIN)
495 AC_SUBST(VERSION_REV)
496
497 dnl AC_CONFIG_SUBDIRS(libltdl)
498
499 CONFIG_LIBS="-lsynfig"
500 CONFIG_CFLAGS="$CONFIG_CFLAGS"
501 AC_SUBST(CONFIG_LIBS)
502 AC_SUBST(CONFIG_CFLAGS)
503 AC_SUBST(CONFIG_DEPS)
504 AC_SUBST(ETL_CFLAGS)
505
506 SYNFIG_LIBS="$VIMAGE_LIBS $LIBXMLPP_LIBS $ETL_LIBS $LIBSIGC_LIBS"
507 SYNFIG_CFLAGS="$LIBXMLPP_CFLAGS $ETL_CFLAGS $LIBSIGC_CFLAGS $CONFIG_CFLAGS -DSYNFIG_NO_DEPRECATED"
508
509 CONFIG_CFLAGS="`echo $CONFIG_CFLAGS | sed s/-mno-cygwin//g | sed s/-mwindows//g`"
510 SYNFIG_CFLAGS="`echo $SYNFIG_CFLAGS | sed s/-mno-cygwin//g | sed s/-mwindows//g`"
511 SYNFIG_LIBS="`echo $SYNFIG_LIBS | sed s/-mno-cygwin//g | sed s/-mwindows//g`"
512
513 AC_SUBST(LIBADD_DL)
514
515 AC_SUBST(SYNFIG_LIBS)
516 AC_SUBST(SYNFIG_CFLAGS)
517 AC_SUBST(OPENEXR_HALF_LIBS)
518
519 AC_SUBST(API_VERSION)
520
521 synfigincludedir=$includedir/synfig-@API_VERSION@
522 AC_SUBST(synfigincludedir)
523
524 [(
525         [ -d libltdl ] || mkdir libltdl;
526         cd libltdl;
527         
528         echo
529         echo pwd: `pwd`
530         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
531         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
532         
533 )]
534
535 # src/modules/mod_mng/Makefile
536
537 AC_OUTPUT(
538 synfig-config
539 @PACKAGE_TARNAME@.pc
540 Makefile
541 src/Makefile
542 src/synfig/Makefile
543 src/modules/Makefile
544 src/modules/mod_filter/Makefile
545 src/modules/mod_bmp/Makefile
546 src/modules/mod_gif/Makefile
547 src/modules/mod_ppm/Makefile
548 src/modules/mod_png/Makefile
549 src/modules/mod_jpeg/Makefile
550 src/modules/lyr_std/Makefile
551 src/modules/mod_geometry/Makefile
552 src/modules/mod_gradient/Makefile
553 src/modules/mod_noise/Makefile
554 src/modules/lyr_freetype/Makefile
555 src/modules/mod_ffmpeg/Makefile
556 src/modules/mod_dv/Makefile
557 src/modules/mod_imagemagick/Makefile
558 src/modules/mod_openexr/Makefile
559 src/modules/mod_libavcodec/Makefile
560 src/modules/mod_yuv420p/Makefile
561 src/modules/mod_particle/Makefile
562 src/tool/Makefile
563 src/modules/synfig_modules.cfg
564 examples/walk/Makefile
565 examples/Makefile
566 win32inst.nsi
567 pkg-info/macosx/synfig-core.info
568 dnl src/modules/trgt_mpg/Makefile
569 dnl src/modules/mptr_mplayer/Makefile
570 )
571
572 # -- S U M M A R Y --------------------------------------------
573
574 echo "
575 $PACKAGE_NAME v.$VERSION
576 Configuration Summary
577 - - - - - -
578
579 Install Prefix -------------------> $prefix
580 Module directory -----------------> $moduledir
581 Build Platform -------------------> $build
582 Host Platform --------------------> $host
583 Time Limit -----------------------> $death_time
584 Arc Profiling --------------------> $profile_arcs
585 GProf Profiling ------------------> $profiling
586 Debug Mode -----------------------> $debug ($debug_flags)
587 Optimization ---------------------> $optimization
588 PNG output target support --------> $TARGET_PNG
589 MNG output target support --------> $TARGET_MNG
590 TIFF output target support -------> $TARGET_TIF
591 JPEG output target support -------> $TARGET_JPEG
592 ETL_CFLAGS -----------------------> $ETL_CFLAGS
593 FreeType2 ------------------------> $with_freetype
594 fontconfig -----------------------> $with_fontconfig
595 libavcodec -----------------------> $with_libavcodec
596 vImage ---------------------------> $with_vimage
597 ImageMagick ----------------------> $with_imagemagick
598 FFMPEG ---------------------------> $with_ffmpeg
599 libdv ----------------------------> $with_libdv
600 OpenEXR --------------------------> $with_openexr
601 Using OpenEXR's \"half\" type ------> $use_openexr_half
602
603 "'$'"CXX -----------------------------> '$CXX'
604 "'$'"CXXFLAGS ------------------------> '$CXXFLAGS'
605 "'$'"SYNFIG_LIBS ---------------------> '$SYNFIG_LIBS'
606 "'$'"LIBXMLPP_LIBS -------------------> '$LIBXMLPP_LIBS'
607 "'$'"ETL_LIBS ------------------------> '$ETL_LIBS'
608 "'$'"LIBSIGC_LIBS --------------------> '$LIBSIGC_LIBS'
609 "'$'"SYNFIG_CFLAGS -------------------> '$SYNFIG_CFLAGS'
610 "'$'"LIBADD_DL -----------------------> '$LIBADD_DL'
611 "