1dnl Process this file with autoconf to produce a configure script.
2AC_INIT([Biloba], [0.9.3])
3
4AC_CONFIG_SRCDIR([src/main.c])
5
6AC_CANONICAL_SYSTEM
7
8AM_INIT_AUTOMAKE
9
10dnl Version of SDL required
11SDL_VERSION=1.1.6
12
13dnl Check for tools
14
15AC_PROG_CC
16
17dnl Check for compiler environment
18
19AC_C_CONST
20
21dnl Figure out which math library to use
22MINGW32=no
23case "$target" in
24    *-*-cygwin* | *-*-mingw32*)
25        MATHLIB=""
26        SYS_GL_LIBS="-lopengl32"
27	LIBS="-lws2_32"
28	MINGW32=yes
29        ;;
30    *-*-beos*)
31        MATHLIB=""
32        SYS_GL_LIBS="-lGL"
33        ;;
34    *-*-aix*)
35        if test x$ac_cv_prog_gcc = xyes; then
36            CFLAGS="-mthreads"
37	fi
38        ;;
39    *)
40        MATHLIB="-lm"
41        AC_PATH_X
42        AC_PATH_XTRA
43        if test x$have_x = xyes; then
44            CFLAGS="$CFLAGS $X_CFLAGS"
45            SYS_GL_LIBS="$X_LIBS -lGL"
46        else
47            SYS_GL_LIBS="-lGL"
48        fi
49        ;;
50esac
51AC_SUBST(MATHLIB)
52
53dnl Check for SDL
54
55AM_PATH_SDL($SDL_VERSION,
56            :,
57	    AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
58)
59CFLAGS="$CFLAGS $SDL_CFLAGS"
60LIBS="$LIBS $SDL_LIBS"
61
62AC_CHECK_LIB(SDL_image,
63	     IMG_Load,
64	     have_SDL_image=yes,
65             AC_MSG_ERROR([*** SDL-Image not found!]))
66AC_CHECK_HEADER(SDL/SDL_image.h, , AC_MSG_ERROR([*** SDL-Image devel files not found!]))
67
68AC_CHECK_LIB(SDL_mixer,
69	     Mix_OpenAudio,
70	     have_SDL_mixer=yes,
71             AC_MSG_ERROR([*** SDL-Mixer not found!]))
72AC_CHECK_HEADER(SDL/SDL_mixer.h, , AC_MSG_ERROR([*** SDL-mixer devel files not found!]))
73
74AC_ARG_VAR(WINDRES, [Windows Resource compiler tool path])
75AC_PATH_TOOL(WINDRES,windres,
76	[AC_MSG_WARN(Could not find a windres tool in your PATH.)]
77)
78AC_SUBST(WINDRES)
79
80AC_ARG_ENABLE(maemo,
81        [  --enable-maemo   build for the Maemo platform [default=no]],
82        [ac_cv_enable_maemo=$enableval], [ac_cv_enable_maemo=no])
83
84AM_CONDITIONAL(MAEMO, test "x$ac_cv_enable_maemo" = "xyes")
85
86# Be paranoid
87CFLAGS="$CFLAGS -Wall"
88dnl Checks for header files
89AC_STDC_HEADERS
90
91AM_CONDITIONAL(MINGW32, test x$MINGW32 = xyes)
92
93# Finally create all the generated files
94AC_OUTPUT([Makefile
95	   src/Makefile
96	   res/Makefile
97	   res/common/Makefile
98	   res/en/Makefile
99	   res/fr/Makefile
100	   res/es/Makefile
101	   res/snd/Makefile
102	   biloba.nsi])
103