1 AC_INIT(wxOil/camelot.cpp)
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
16 # Process command line arguments
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")
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"
64 # Note mysteriously we still use --enable-debug to control build flags even when static enabled
65 if test "$StaticEnable" = "yes"; then
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])
76 AC_MSG_RESULT([Version OK])
79 # Test for GCC and version
81 PrecompileEnable="yes"
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"
97 AC_MSG_RESULT([gcc < 3.4.0, PreCompiled headers disabled])
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"
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"
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
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
130 AC_CHECK_SIZEOF(void*)
131 AC_CHECK_SIZEOF(long long)
132 AC_CHECK_SIZEOF(long)
134 AC_CHECK_SIZEOF(short)
135 AC_CHECK_SIZEOF(__int64)
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
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
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\\\""
173 AC_REQUIRE([AC_PROG_AWK])
174 AC_MSG_CHECKING([wxWidgets version])
175 if wxversion=`$WXCONFIG --version`; then
176 AC_MSG_RESULT([$wxversion])
178 AC_MSG_RESULT([not found])
179 AC_MSG_ERROR([wxWidgets is required. Try --with-wx-config.])
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
200 AC_MSG_CHECKING([wxWidgets GTK usage])
201 if echo $WX_CPPFLAGS | grep -q '__WXGTK__' ; then
203 AC_MSG_RESULT([found])
204 PKG_CHECK_MODULES(GTK, [gtk+-2.0])
206 AC_MSG_RESULT([not found])
209 if test "$InternationalEnable" = "yes"; then
210 AC_MSG_CHECKING([wxWidgets wxrc utility])
211 WXRC="`$WXCONFIG --utility=wxrc`"
213 if test "$WXRC" = "" ; then
214 AC_MSG_RESULT([not found, disabling international build])
216 InternationalEnable="no"
219 AC_MSG_RESULT([found])
224 AC_MSG_ERROR([wxWidgets 2.6.3 or newer is required])
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
242 AC_REQUIRE([AC_PROG_AWK])
243 AC_MSG_CHECKING([libxml2 version])
244 if xml2version=`$XML2CONFIG --version`; then
245 AC_MSG_RESULT([$xml2version])
247 AC_MSG_RESULT([not found])
248 AC_MSG_ERROR([libxml2 is required. Try --with-xml2-config.])
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`"
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
277 # In wxGTK builds we need Pango and FreeType for font rendering
280 AC_MSG_CHECKING([freetype version])
281 if ftversion=`$FTCONFIG --version`; then
282 AC_MSG_RESULT([$ftversion])
284 AC_MSG_RESULT([not found])
285 AC_MSG_ERROR([freetype is required. Try --with-freetype-config.])
288 if test $WX_GTK = "yes"; then
289 # GTK build, so call FTTEST function to test for FreeType
291 FT_CFLAGS="`$FTCONFIG --cflags`"
293 # check for the Pango package
295 PKG_CHECK_MODULES(PANGOX, pangox,
297 PANGO_CFLAGS="$PANGOX_CFLAGS"
303 if test PkgError = "yes"; then
304 AC_MSG_ERROR([pangox library not found])
307 # non-GTK build, i.e., MacOS, so Pango and FreeType are not required
313 if test `echo $srcdir | cut -c1` != "/"; then
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"
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])
355 AC_MSG_RESULT([Darwin ld])
358 AC_MSG_RESULT([GNU ld])
364 if test "$InternationalEnable" = "yes" ; then
365 # These two macros must be left aligned in order for autoreconf to
367 AM_GNU_GETTEXT([external])
368 AM_GNU_GETTEXT_VERSION([0.14.3])
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
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"
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)
407 AC_SUBST(XARALANGUAGE)
412 AC_SUBST(LIBXML2_LIBS)
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)