Bugfix : Zooming works correct, no more errors on screen.
[xara-cairo.git] / configure.in
bloba1f5cc839f9813d36f265dcc4c343ee6654ede09
1 AC_INIT(wxOil/camelot.cpp)
2 AC_CANONICAL_TARGET
3 AM_INIT_AUTOMAKE(XaraLX, 0.7)
5 AC_PREFIX_PROGRAM( pkg-config )
7 # BinReloc sets CFLAGS and CXXFLAGS, so we have to undo this
8 inCFLAGS=$CFLAGS
9 inCXXFLAGS=$CXXFLAGS
11 AM_BINRELOC
13 CFLAGS=$inCFLAGS
14 CXXFLAGS=$inCXXFLAGS
16 # Process command line arguments
18 AC_ARG_ENABLE(debug,
19               AS_HELP_STRING([--enable-debug],
20                              [Enable debug information and checks]),
21               DebugEnable="$enableval", DebugEnable="no")
23 AC_ARG_ENABLE(static-exec,
24               AS_HELP_STRING([--enable-static-exec],
25                              [Enable build of a static executable]),
26               StaticEnable="$enableval", StaticEnable="no")
28 AC_ARG_ENABLE(international,
29               AS_HELP_STRING([--disable-international],
30                              [Disable building of international resources]),
31               InternationalEnable="$enableval", InternationalEnable="yes")
33 AC_ARG_ENABLE(svnversion,
34               AS_HELP_STRING([--disable-svnversion],
35                              [Disable svn versioning]),
36               SvnVersionEnable="$enableval", SvnVersionEnable="yes")
38 AC_ARG_ENABLE(xarlib,
39               AS_HELP_STRING([--enable-xarlib],
40                              [Enable build of the xarlib filter library]),
41               XarLibEnable="$enableval", XarLibEnable="no")
43 # Note that as each filter is a separate package, if you got your code from svn you will need to
44 # do "autoreconf -f -i" in filters/SVGFilter (and all the others); the tarballs should be OK
45 AC_ARG_ENABLE(filters,
46               AS_HELP_STRING([--enable-filters],
47                              [Enable build of the filters]),
48               FiltersEnable="$enableval", FiltersEnable="no")
50 OPT_FLAGS34="-fno-strict-aliasing"
51 WARN_FLAGS34="-Wstrict-aliasing=2"
53 # Sort out compile lags
54 if test "$DebugEnable" = "yes"; then
55         DEBUG_FLAGS="-ggdb -D_DEBUG"
56         OPT_FLAGS="-O0"
57         WARN_FLAGS=""
58 else
59         DEBUG_FLAGS=""
60         OPT_FLAGS="-O3"
61         WARN_FLAGS=""
64 # Note mysteriously we still use --enable-debug to control build flags even when static enabled
65 if test "$StaticEnable" = "yes"; then
66         DebugEnable="no"
69 # Check that AUTOMAKE is new enough
70 AutomakeVersion=`automake --version | awk '{ if($3 ~ /automake\)/) print $4}'`
71 AC_MSG_CHECKING([Automake ($AutomakeVersion)])
72 AutomakeVersion=`echo $AutomakeVersion | $AWK 'BEGIN { FS = "."; } { printf "% d", ($1 * 1000 + $2) * 1000 + $3;}'`
73 if test "$AutomakeVersion" -lt 1009000; then
74         AC_MSG_ERROR([Version 1.9.0 or later of AUTOMAKE is needed])
75 else
76         AC_MSG_RESULT([Version OK])
79 # Test for GCC and version
80 GccVersion=0
81 PrecompileEnable="yes"
83 AC_PROG_CXX
84 AC_PROG_INSTALL
86 AC_MSG_CHECKING([Compiler])
87 if test $ac_compiler_gnu = "yes"; then
88         GccVersion=`$CXX -v 2>&1 | $AWK '{ if ($2 ~ /version/) print $3 }'`
89         GccVersion=`echo $GccVersion | $AWK 'BEGIN { FS = "."; } { printf "% d", ($1 * 1000 + $2) * 1000 + $3;}'`
91         if test -n "$GccVersion" && test "$GccVersion" -ge 3004000; then
92                 AC_MSG_RESULT([gcc >= 3.4.0, PreCompiled headers enabled])
93                 WARN_FLAGS="$WARNFLAGS $WARN_FLAGS34"
94                 OPT_FLAGS="$OPT_FLAGS $OPT_FLAGS34"
95                 PrecompileEnable="yes"
96         else
97                 AC_MSG_RESULT([gcc < 3.4.0, PreCompiled headers disabled])
98                 PrecompileEnable="no"
99         fi
100 else
101         AC_MSG_RESULT([non-gcc, PreCompiled headers disabled])
102         PrecompileEnable="no"
105 # Setup our build flags (if not set by user)
106 if test -z "$CFLAGS"; then
107         CFLAGS="-Wall -Wno-unknown-pragmas -g -fexceptions $OPT_FLAGS $WARN_FLAGS $DEBUG_FLAGS"
108 else
109         CFLAGS="-Wall -Wno-unknown-pragmas -g -fexceptions $OPT_FLAGS $WARN_FLAGS $DEBUG_FLAGS $CFLAGS"
111 if test -z "$CXXFLAGS"; then
112         CXXFLAGS="-Wall -Wno-unknown-pragmas -g -fexceptions $OPT_FLAGS $WARN_FLAGS $DEBUG_FLAGS"
113 else
114         CXXFLAGS="-Wall -Wno-unknown-pragmas -g -fexceptions $OPT_FLAGS $WARN_FLAGS $DEBUG_FLAGS $CXXFLAGS"
117 # Set language - this should be taken from a configure option
118 # Note this MUST be in ISO8859-1 form
120 # Stop automake directly including stuff
121 XRCINCLUDE=include
123 # Disable generation of shared libtool libraries - that's libXar. Note this has NOTHING to
124 # do with static-exec (the executables)
125 # We don't need dlopen right now and it's not supported on Darwin
126 # AC_LIBTOOL_DLOPEN
127 AC_PROG_RANLIB
129 AC_C_BIGENDIAN
130 AC_CHECK_SIZEOF(void*)
131 AC_CHECK_SIZEOF(long long)
132 AC_CHECK_SIZEOF(long)
133 AC_CHECK_SIZEOF(int)
134 AC_CHECK_SIZEOF(short)
135 AC_CHECK_SIZEOF(__int64)
138 WXCONFIG=wx-config
139 AC_ARG_WITH(wx-config,
140 [[  --with-wx-config=FILE   Use the given path to wx-config when determining
141                             wxWidgets configuration; defaults to "wx-config"]],
143     if test "$withval" != "yes" -a "$withval" != ""; then
144         WXCONFIG=$withval
145     fi
148 XARALANGUAGE=EN
149 AC_ARG_WITH(language,
150 [[  --with-language=LANG    Use ISO8859-1 country code LANG for resource
151                             language; defaults to "EN"]],
153     if test "$withval" != "yes" -a "$withval" != ""; then
154         XARALANGUAGE=$withval
155     fi
158 RESOURCE_DIR_DEFINE=
159 AC_ARG_WITH(resource-dir,
160 [[  --with-resource-dir=DIR The absoulte path to root of resource directory
161                             structure; defaults to using binreloc before 
162                             falling back to /usr/share/xaralx]],
164     if test "$withval" != "yes" -a "$withval" != ""; then
165         RESOURCE_DIR_DEFINE="-DRESOURCE_DIR=\\\"$withval\\\""
166     fi
169 wxversion=0
171 AC_DEFUN([WXTEST],
173         AC_REQUIRE([AC_PROG_AWK])
174         AC_MSG_CHECKING([wxWidgets version])
175         if wxversion=`$WXCONFIG --version`; then
176                 AC_MSG_RESULT([$wxversion])
177         else
178                 AC_MSG_RESULT([not found])
179                 AC_MSG_ERROR([wxWidgets is required. Try --with-wx-config.])
180         fi])
182 # Call WXTEST func
183 WXTEST
185 GTK_CFLAGS=""
186 GTK_LIBS=""
188 HAVE_WXRC="no"
189 WXRC=""
190 # Verify minimus requires
191 vers=`echo $wxversion | $AWK 'BEGIN { FS = "."; } { printf "% d", ($1 * 1000 + $2) * 1000 + $3;}'`
192 if test -n "$vers" && test "$vers" -ge 2006003; then
193         WX_CPPFLAGS="`$WXCONFIG --static=$StaticEnable --debug=$DebugEnable --unicode=yes --cppflags`"
194         WX_CXXFLAGS="`$WXCONFIG --static=$StaticEnable --debug=$DebugEnable --unicode=yes --cxxflags | sed -e 's/-fno-exceptions//'`"
195         WX_LIBS="`$WXCONFIG --static=$StaticEnable --debug=$DebugEnable --unicode=yes --libs std`"
196         WX_LIBS2="`echo $WX_LIBS | sed -e 's/-pthread//g'`"
198         # See if we are running on GTK
199         WX_GTK="no"
200         AC_MSG_CHECKING([wxWidgets GTK usage])
201         if echo $WX_CPPFLAGS | grep -q '__WXGTK__' ; then 
202                 WX_GTK="yes"
203                 AC_MSG_RESULT([found])
204                 PKG_CHECK_MODULES(GTK, [gtk+-2.0])
205         else
206                 AC_MSG_RESULT([not found])
207         fi
209         if test "$InternationalEnable" = "yes"; then
210                 AC_MSG_CHECKING([wxWidgets wxrc utility])
211                 WXRC="`$WXCONFIG --utility=wxrc`"
212         
213                 if test "$WXRC" = "" ; then
214                         AC_MSG_RESULT([not found, disabling international build])
215                         HAVE_WXRC="no"
216                         InternationalEnable="no"
217                 else
218                         HAVE_WXRC="yes"
219                         AC_MSG_RESULT([found])
220                 fi
221         fi
223 else
224         AC_MSG_ERROR([wxWidgets 2.6.3 or newer is required])
227 # Test for libxml2
228 XML2CONFIG=xml2-config
229 AC_ARG_WITH(xml2-config,
230 [[  --with-xml2-config=FILE Use the given path to xml2-config when determining
231                             libxml2 configuration; defaults to "xml2-config"]],
233     if test "$withval" != "yes" -a "$withval" != ""; then
234         XML2CONFIG=$withval
235     fi
238 xml2version=0
240 AC_DEFUN([XML2TEST],
242         AC_REQUIRE([AC_PROG_AWK])
243         AC_MSG_CHECKING([libxml2 version])
244         if xml2version=`$XML2CONFIG --version`; then
245                 AC_MSG_RESULT([$xml2version])
246         else
247                 AC_MSG_RESULT([not found])
248                 AC_MSG_ERROR([libxml2 is required. Try --with-xml2-config.])
249         fi
252 # Call XML2TEST func
253 XML2TEST
255 # check libxml2 version
256 xml2version=`echo $xml2version | $AWK 'BEGIN { FS = "."; } { printf "% d", ($1 * 1000 + $2) * 1000 + $3;}'`
257 if test -z "$xml2version" || test "$xml2version" -lt 2006000; then
258         AC_MSG_ERROR([libxml2 2.6 or newer is required])
261 LIBXML2_CFLAGS="`$XML2CONFIG --cflags`"
262 LIBXML2_LIBS="`$XML2CONFIG --libs`"
264 # Define FTCONFIG
265 FTCONFIG=freetype-config
266 AC_ARG_WITH(freetype-config,
267 [[  --with-freetype-config=FILE   Use the given path to freetype-config when determining
268                                   freetype configuration; defaults to "freetype-config"]],
270     if test "$withval" != "yes" -a "$withval" != ""; then
271         FTCONFIG=$withval
272     fi
275 ftversion=0
277 # In wxGTK builds we need Pango and FreeType for font rendering
278 AC_DEFUN([FTTEST],
280         AC_MSG_CHECKING([freetype version])
281         if ftversion=`$FTCONFIG --version`; then
282                 AC_MSG_RESULT([$ftversion])
283         else
284                 AC_MSG_RESULT([not found])
285                 AC_MSG_ERROR([freetype is required. Try --with-freetype-config.])
286         fi])
288 if test $WX_GTK = "yes"; then
289         # GTK build, so call FTTEST function to test for FreeType
290         FTTEST
291         FT_CFLAGS="`$FTCONFIG --cflags`"
293         # check for the Pango package
294         PkgError="no"
295         PKG_CHECK_MODULES(PANGOX, pangox,
296                           [
297                                 PANGO_CFLAGS="$PANGOX_CFLAGS"
298                           ],
299                           [
300                                 PkgError="yes"
301                           ]
302                           )
303         if test PkgError = "yes"; then
304                 AC_MSG_ERROR([pangox library not found])
305         fi
306 else
307         # non-GTK build, i.e., MacOS, so Pango and FreeType are not required
308         FT_CFLAGS=""
309         PANGO_CFLAGS=""
312 TOPDIR=$srcdir;
313 if test `echo $srcdir | cut -c1` != "/"; then
314         TOPDIR="../$srcdir";
317 if test "$StaticEnable" = "yes"; then
318         CPPFLAGS="$CPPFLAGS -static -static-libgcc"
319         CXXFLAGS="$CXXFLAGS -static -static-libgcc"
320         if test "$PrecompileEnable" = "yes"; then
321                 CPPFLAGS="$CPPFLAGS -ffunction-sections -fdata-sections"
322                 CXXFLAGS="$CXXFLAGS -ffunction-sections -fdata-sections"
323                 WX_LIBS="$WX_LIBS --gc-sections"
324         fi
326         # Force as much as possible to be statically linked
327         WX_LIBS="`echo $WX_LIBS | sed -e 's/-lXrandr/-Wl,-Bstatic -lXrandr -Wl,-Bdynamic/g'`"
328         WX_LIBS="`echo $WX_LIBS | sed -e 's/-lXext/-Wl,-Bstatic -lXext -Wl,-Bdynamic/g'`"
329         WX_LIBS="`echo $WX_LIBS | sed -e 's/-lXinerama/-Wl,-Bstatic -lXinerama -Wl,-Bdynamic/g'`"
330         WX_LIBS="`echo $WX_LIBS | sed -e 's/-lXxf86vm/-Wl,-Bstatic -lXxf86vm -Wl,-Bdynamic/g'`" 
331         WX_LIBS="`echo $WX_LIBS | sed -e 's/-lXrender/-Wl,-Bstatic -lXrender -Wl,-Bdynamic/g'`" 
332         WX_LIBS="`echo $WX_LIBS | sed -e 's/-lXfixes/-Wl,-Bstatic -lXfixes -Wl,-Bdynamic/g'`"   
333         WX_LIBS="`echo $WX_LIBS | sed -e 's/-lexpat/-Wl,-Bstatic -lexpat -Wl,-Bdynamic/g'`"
334         WX_LIBS="`echo $WX_LIBS | sed -e 's/-ljpeg/-Wl,-Bstatic -ljpeg -Wl,-Bdynamic/g'`"
335         WX_LIBS="`echo $WX_LIBS | sed -e 's/-lpng/-Wl,-Bstatic -lpng -Wl,-Bdynamic/g'`"
336         WX_LIBS="`echo $WX_LIBS | sed -e 's/-ltiff/-Wl,-Bstatic -ltiff -Wl,-Bdynamic/g'`"
337         # These are handled by explicitly linking xml2 (see below)
338         WX_LIBS="`echo $WX_LIBS | sed -e 's/-lxml2//g'`"
339         WX_LIBS="`echo $WX_LIBS | sed -e 's/-lz//g'`"
340         WX_LIBS="`echo $WX_LIBS | sed -e 's/-lm//g'`"
341         WX_LIBS2="`echo $WX_LIBS | sed -e 's/-pthread//g'`"
342         # libxml2 linking needs fix-up too
343         LIBXML2_LIBS="`echo $LIBXML2_LIBS | sed -e 's/-lxml2/-Wl,-Bstatic -lxml2 -Wl,-Bdynamic/g'`"
344         LIBXML2_LIBS="`echo $LIBXML2_LIBS | sed -e 's/-lz/-Wl,-Bstatic -lz -Wl,-Bdynamic/g'`"
345         LIBXML2_LIBS="`echo $LIBXML2_LIBS | sed -e 's/-lm/-Wl,-Bstatic -lm -Wl,-Bdynamic/g'`"
348 # pass the Pango, FreeType and GTK flags (required for wxGTK font rendering)
349 CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS $PANGO_CFLAGS $FT_CFLAGS $GTK_CFLAGS $LIBXML2_CFLAGS $RESOURCE_DIR_DEFINE"
350 CXXFLAGS="$CXXFLAGS $WX_CPPFLAGS $PANGO_CFLAGS $FT_CFLAGS $GTK_CFLAGS $LIBXML2_CFLAGS $RESOURCE_DIR_DEFINE"
352 AC_MSG_CHECKING([Linker])
353 case $host in
354     *-*-darwin*)
355                 AC_MSG_RESULT([Darwin ld])
356         DarwinLink="yes";;
357     *)
358                 AC_MSG_RESULT([GNU ld])
359         DarwinLink="no";;
360 esac
362 PODIR=""
363 BUILDRESFLAGS=""
364 if test "$InternationalEnable" = "yes" ; then
365 # These two macros must be left aligned in order for autoreconf to
366 # find them.
367 AM_GNU_GETTEXT([external])
368 AM_GNU_GETTEXT_VERSION([0.14.3])
369         PODIR=po
370         BUILDRESFLAGS="-i $BUILDRESFLAGS"
373 if test "$SvnVersionEnable" = "yes" ; then
374         BUILDRESFLAGS="-s $BUILDRESFLAGS"
377 # Force XarLibEnable on if we are to build the filters
378 if test "$FiltersEnable" = "yes"; then
379         XarLibEnable="yes"
380         # ensure the filters have a local XarLib
381         export LOCAL_XARLIB_OVERRIDE=yes
382         # Add each filter below here
383         AC_CONFIG_SUBDIRS([filters/SVGFilter])
386 # Do not pass CXXFLAGS, CFLAGS in. This sets up CXXLINK which breaks XARLIB compilation. Instead set
387 XARALXCXXFLAGS="$CXXFLAGS"
388 XARALXCPPFLAGS="$CPPFLAGS"
389 CXXFLAGS=""
390 CPPFLAGS=""
393 AM_CONDITIONAL(PRECOMPILE_ENABLE, [test "$PrecompileEnable" = "yes"])
394 AM_CONDITIONAL(STATIC_ENABLE, [test "$StaticEnable" = "yes"])
395 AM_CONDITIONAL(DARWIN_LINK, [test "$DarwinLink" = "yes"])
396 AM_CONDITIONAL(INTERNATIONAL_ENABLE, [test "$InternationalEnable" = "yes"])
397 AM_CONDITIONAL(SVNVERSION_ENABLE, [test "$SvnVersionEnable" = "yes"])
398 AM_CONDITIONAL(XARLIB_ENABLE, [test "$XarLibEnable" = "yes"])
399 AM_CONDITIONAL(FILTERS_ENABLE, [test "$FiltersEnable" = "yes"])
401 AC_SUBST(XARALXCXXFLAGS)
402 AC_SUBST(XARALXCPPFLAGS)
403 AC_SUBST(TOPDIR)
404 AC_SUBST(WX_LIBS)
405 AC_SUBST(WX_LIBS2)
406 AC_SUBST(XRCINCLUDE)
407 AC_SUBST(XARALANGUAGE)
408 AC_SUBST(WXRC)
409 AC_SUBST(VERSION)
410 AC_SUBST(GTK_CFLAGS)
411 AC_SUBST(GTK_LIBS)
412 AC_SUBST(LIBXML2_LIBS)
413 AC_SUBST(PODIR)
414 AC_SUBST(BUILDRESFLAGS)
416 AC_OUTPUT(Makefile PreComp/Makefile Kernel/Makefile wxOil/Makefile tools/Makefile GDraw/Makefile wxXtra/Makefile xarlib/Makefile xarlib/Xar.pc po/Makefile.in)