1# Process this file with autoconf to produce a configure script.
2AC_INIT([Amoebax], [0.2.1], [jordi@emma-soft.com])
3AC_COPYRIGHT([Copyright (c) 2006, 2007 Emma's Software.])
4AM_INIT_AUTOMAKE([dist-bzip2])
5AM_CONFIG_HEADER([config.h])
6AM_MAINTAINER_MODE
7
8# Check host.
9AC_CANONICAL_HOST
10case "${host}" in
11    *-apple-darwin*)
12        AC_DEFINE([IS_OSX_HOST], [1], [Set to 1 if you are compiling on an OS X host.])
13        osx_host="yes"
14        ;;
15    *-gp2x*)
16        AC_DEFINE([IS_GP2X_HOST], [1], [Set to 1 if you are compiling on a GP2X host.])
17        gp2x_host="yes"
18        ;;
19    arm-*-mingw32*)
20        AC_DEFINE([IS_WINCE_HOST], [1], [Set to 1 if you are compiling on a Windows CE host.])
21        wince_host="yes"
22        ;;
23    *-*-mingw32* | *-*-cygwin*)
24        AC_DEFINE([IS_WIN32_HOST], [1], [Set to 1 if you are compiling on a Windows host.])
25        win32_host="yes"
26        ;;
27esac
28AM_CONDITIONAL([IS_OSX_HOST], [test "x${osx_host}" = "xyes"])
29AM_CONDITIONAL([IS_GP2X_HOST], [test "x${gp2x_host}" = "xyes"])
30AM_CONDITIONAL([IS_WIN32_HOST], [test "x${win32_host}" = "xyes"])
31AM_CONDITIONAL([IS_WINCE_HOST], [test "x${wince_host}" = "xyes"])
32
33# Parameters
34AC_ARG_ENABLE([debug],
35              AS_HELP_STRING([--enable-debug],
36                             [turn on debugging (default is NO)]))
37if test "x$enable_debug" != "xyes"; then
38    DEBUGFLAGS="-DNDEBUG"
39else
40    DEBUGFLAGS="-DDEBUG"
41fi
42
43# Check for programs.
44AC_PROG_MAKE_SET
45AC_PROG_CXX
46AC_LANG([C++])
47# Support for Objective-C in OS X.
48AC_PROG_OBJC
49AC_SUBST([OBJC])
50AC_SUBST([OBJCFLAGS])
51_AM_DEPENDENCIES([OBJC])
52# Support for resource files in Windows.
53AC_CHECK_TOOL([WINDRES], [windres], [no])
54AM_CONDITIONAL([build_win32_resource], [test "x$WINDRES" != "xno"])
55# Check for WiX files in order to create Windows installer script.
56AC_PATH_PROG([CANDLE], [candle], [no])
57AC_PATH_PROG([LIGHT], [light], [no])
58AM_CONDITIONAL([build_win32_msi], [test "x$CANDLE" != "xno" -a "x$LIGHT" != "xno"])
59# Support for documentation.
60AC_PATH_PROG([DOXYGEN], [doxygen], [no])
61AM_CONDITIONAL(build_reference, [test "x$DOXYGEN" != "xno"])
62
63# Check for header files.
64# Check for libraries.
65AM_BINRELOC
66ES_LIB_SDL([1.2.7], [amoebax_sdl_found="yes"])
67if test "x${amoebax_sdl_found}" != "xyes" ; then
68    AC_MSG_ERROR([SDL library not found.])
69fi
70ES_LIB_SDL_SUBLIB([image], [IMAGE], [amoebax_sdl_image_found="yes"])
71if test "x${amoebax_sdl_image_found}" != "xyes" ; then
72    AC_MSG_ERROR([SDL_image library not found.])
73fi
74ES_LIB_SDL_SUBLIB([mixer], [MIXER], [amoebax_sdl_mixer_found="yes"])
75if test "x${amoebax_sdl_mixer_found}" != "xyes" ; then
76    AC_MSG_ERROR([SDL_mixer library not found.])
77fi
78
79AC_SUBST([SDL_IMAGE_CFLAGS])
80AC_SUBST([SDL_IMAGE_LIBS])
81AC_SUBST([SDL_MIXER_CFLAGS])
82AC_SUBST([SDL_MIXER_LIBS])
83
84# Check for types.
85# Check for structures.
86# Check for compiler characteristics.
87# Check for libraries functions.
88# Check for system services.
89
90# Set the CFLAGS and CXXFLAGS
91CFLAGS="$CFLAGS $DEBUGFLAGS"
92CXXFLAGS="$CXXFLAGS $DEBUGFLAGS"
93
94# Set the right extension for GP2X executable files.
95if test "x${gp2x_host}" = "xyes"; then
96    EXEEXT=".gpe"
97fi
98
99AC_CONFIG_FILES([   \
100Makefile    \
101autopackage/Makefile    \
102autopackage/default.apspec  \
103data/Makefile   \
104data/InfoPlist.strings \
105data/Info.plist \
106data/AmoebaxMain.nib/Makefile   \
107data/dlls/Makefile   \
108data/fonts/Makefile   \
109data/graphics/Makefile   \
110data/graphics/gp2x/Makefile   \
111data/music/Makefile   \
112data/sfx/Makefile   \
113doc/Doxyfile    \
114doc/Makefile    \
115m4/Makefile \
116src/Makefile])
117AC_OUTPUT
118