source: trunk/configure.ac @ 629

Last change on this file since 629 was 629, checked in by sam, 10 years ago

Clean up configure.ac from useless variables.

File size: 3.8 KB
Line 
1# $Id$
2
3AC_INIT(lolengine, 0.0)
4AC_PREREQ(2.50)
5AC_CONFIG_AUX_DIR(.auto)
6AC_CANONICAL_SYSTEM
7AM_INIT_AUTOMAKE([no-define tar-ustar])
8dnl AM_MAINTAINER_MODE
9
10AM_CONFIG_HEADER(config.h)
11
12AM_PROG_CC_C_O
13AC_PROG_CPP
14AC_PROG_CXX
15AC_PROG_CXXCPP
16AC_PROG_RANLIB
17
18AC_LIBTOOL_WIN32_DLL
19AM_PROG_LIBTOOL
20AC_LIBTOOL_CXX
21
22AC_C_CONST
23AC_C_INLINE
24
25dnl Ensure an error is thrown if pkg-config M4 files are not found.
26m4_pattern_allow([^PKG_CONFIG_LIBDIR$])
27m4_pattern_forbid([^PKG_CHECK_MODULES$])
28m4_pattern_forbid([^PKG_PROG_PKG_CONFIG$])
29
30dnl Do not use PKG_CONFIG_LIBDIR when cross-compiling.
31if test "${build}" != "${host}" -a "${PKG_CONFIG_LIBDIR}" = ""; then
32  export PKG_CONFIG_LIBDIR=/dev/null
33fi
34
35dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
36dnl now otherwise it might be set in an obscure if statement. Same thing for
37dnl PKG_PROG_PKG_CONFIG which needs to be called first.
38AC_EGREP_CPP(yes, foo)
39PKG_PROG_PKG_CONFIG()
40
41dnl conditional builds
42AC_ARG_ENABLE(debug,
43  [  --enable-debug          build debug versions of the game (default no)])
44AC_ARG_ENABLE(release,
45  [  --enable-release        build final release of the game (default no)])
46
47AC_CHECK_HEADERS(stdio.h stdarg.h inttypes.h endian.h stdint.h getopt.h)
48
49if test "${enable_debug}" = "yes"; then
50  AC_DEFINE(_DEBUG, 1, Define to 1 to activate debug)
51fi
52
53# Optimizations
54CXXFLAGS="${CXXFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
55# Code qui fait des warnings == code de porc == deux baffes dans ta gueule
56CXXFLAGS="${CXXFLAGS} -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow -Wsign-compare"
57
58AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
59
60# Use SDL?
61ac_cv_my_have_sdl="yes"
62save_CPPFLAGS="${CPPFLAGS}"
63AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
64if test "${SDL_CONFIG}" != "no"; then
65  CPPFLAGS="${CPPFLAGS} `sdl-config --cflags`"
66fi
67AC_CHECK_HEADERS(SDL_image.h,
68 [:],[ac_cv_my_have_sdl="no"])
69AC_CHECK_HEADERS(SDL_mixer.h,
70 [:],[ac_cv_my_have_sdl="no"])
71CPPFLAGS="${save_CPPFLAGS}"
72if test "${ac_cv_my_have_sdl}" != "no"; then
73  AC_DEFINE(USE_SDL, 1, Define to 1 to use SDL_image)
74fi
75AM_CONDITIONAL(USE_SDL, test "${ac_cv_my_have_sdl}" = "yes")
76
77if test "${ac_cv_my_have_sdl}" = "no"; then
78  AC_MSG_ERROR([[One of SDL, SDL_Image or SDL_Mixer not found]])
79fi
80
81
82dnl Use libcaca? (required for font generation)
83ac_cv_my_have_caca="no"
84PKG_CHECK_MODULES(CACA, caca >= 0.99.beta17, [ac_cv_my_have_caca="yes"], [:])
85if test "${ac_cv_my_have_caca}" != "no"; then
86  AC_DEFINE(USE_CACA, 1, Define to 1 to use libcaca)
87fi
88AM_CONDITIONAL(USE_CACA, test "${ac_cv_my_have_caca}" != "no")
89
90
91dnl Use libpipi? (required for video recording)
92ac_cv_my_have_pipi="no"
93PKG_CHECK_MODULES(PIPI, pipi, [ac_cv_my_have_pipi="yes"], [:])
94if test "${ac_cv_my_have_pipi}" != "no"; then
95  AC_DEFINE(USE_PIPI, 1, Define to 1 to use libpipi)
96fi
97AM_CONDITIONAL(USE_PIPI, test "${ac_cv_my_have_pipi}" != "no")
98
99
100dnl Use GTK+? (required for the deushax editor)
101ac_cv_my_have_gtkgl="no"
102PKG_CHECK_MODULES(GTK, gtk+-2.0, [ac_cv_my_have_gtkgl="yes"], [:])
103PKG_CHECK_MODULES(GTKGL, gtkgl-2.0, [:], [ac_cv_my_have_gtkgl="no"])
104if test "${ac_cv_my_have_gtkgl}" != "no"; then
105  AC_DEFINE(USE_GTKGL, 1, Define to 1 to use GtkGl)
106fi
107AM_CONDITIONAL(USE_GTKGL, test "${ac_cv_my_have_gtkgl}" != "no")
108
109# How to use the Lol Engine inside this tree
110LOL_CFLAGS="$LOL_CFLAGS -I \$(top_srcdir)/src `pkg-config --cflags sdl gl SDL_image`"
111LOL_LIBS="$LOL_LIBS `pkg-config --libs sdl gl SDL_image` -lSDL_mixer"
112
113if test "${enable_release}" = "yes"; then
114  AC_DEFINE(FINAL_RELEASE, 1, Define to 1 to activate final release)
115fi
116
117AC_SUBST(MATH_LIBS)
118AC_SUBST(LOL_CFLAGS)
119AC_SUBST(LOL_LIBS)
120
121AC_CONFIG_FILES([
122  Makefile
123  src/Makefile
124  monsterz/Makefile
125  deushax/Makefile
126  tools/Makefile
127  art/Makefile
128  art/test/Makefile
129  gfx/Makefile
130  gfx/font/Makefile
131  maps/Makefile
132])
133
134AC_OUTPUT
135
Note: See TracBrowser for help on using the repository browser.