1dnl Process this file with autoconf to produce a configure script.
2AC_INIT(Makefile.am)
3
4AC_CANONICAL_TARGET
5AC_USE_SYSTEM_EXTENSIONS
6
7AM_CONFIG_HEADER(config.h)
8AM_INIT_AUTOMAKE(lmarbles,1.0.8)
9
10dnl Checks for programs.
11AC_PROG_CC
12AC_PROG_RANLIB
13AC_EXEEXT
14AC_CANONICAL_HOST
15
16dnl check for libraries
17AC_CHECK_LIB(m, main,, AC_MSG_ERROR(lib math is needed))
18
19dnl check SDL version
20AM_PATH_SDL(1.0.0,, AC_MSG_ERROR(lib SDL is needed))
21CFLAGS="$CFLAGS $SDL_CFLAGS"
22LIBS="$LIBS $SDL_LIBS"
23AM_PATH_SDL(1.1.5, CFLAGS="$CFLAGS -DSDL_1_1_5",)
24
25dnl check sound
26sound_flag="-DSOUND"
27mixer_flag="-lSDL_mixer"
28AC_ARG_ENABLE( sound,
29[  --disable-sound         Disables sound], sound_flag=""; mixer_flag="")
30
31dnl check if SDL_mixer's installed
32dnl if not: clear sound_flag and mixer_flag
33AC_CHECK_LIB(SDL_mixer, main,
34AC_MSG_RESULT("SDL_Mixer found"),
35AC_MSG_RESULT("SDL_Mixer NOT found: Audio disabled"); sound_flag=""; mixer_flag="")
36
37AC_SUBST(sound_flag)
38AC_SUBST(mixer_flag)
39
40dnl check ascii-flag
41ascii_flag=""
42AC_ARG_ENABLE( ascii,
43[  --enable-ascii          Enables 'save as ascii' option (for big-endian)], ascii_flag="-DASCII")
44AC_SUBST(ascii_flag)
45
46dnl installation & prefix path
47inst_dir="$datadir/lmarbles"
48prf_dir=$localstatedir
49
50dnl check if installation was disabled
51AC_ARG_ENABLE( install,
52[  --disable-install       No installation. Played from the source directory.],
53inst_dir="." prf_dir=".")
54
55inst_flag="-DSRC_DIR=\\\"$inst_dir\\\""
56prf_flag="-DPRF_DIR=\\\"$prf_dir\\\""
57
58AC_SUBST(inst_flag)
59AC_SUBST(prf_flag)
60AC_SUBST(inst_dir)
61AC_SUBST(prf_dir)
62
63case "$host" in
64        *-mingw32)
65                win32="yes"
66                win32_inst_script="`pwd -W`/installer.iss"
67                arch_flag="-march=i586"
68                win32_deps="lmarblesres.o" ;;
69        *)
70                win32="no"
71                win32_inst_script=""
72                arch_flag=""
73                win32_deps="" ;;
74esac
75
76AC_SUBST(win32_deps)
77AC_SUBST(arch_flag)
78
79if test "x$win32" = xyes; then
80	AC_PROG_AWK
81dnl	AC_PROG_STRIP
82dnl	AC_PROG_ISCC
83	AC_SUBST(win32_inst_script)
84fi
85
86appname="LMarbles"
87AC_SUBST(appname)
88
89AC_OUTPUT(Makefile src/Makefile)
90