-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure.in
219 lines (196 loc) · 6.87 KB
/
configure.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# Process this file with autoconf to produce a configure script.
AC_INIT(AUTHORS)
AC_CANONICAL_TARGET
# The AM_INIT_AUTOMAKE macro tells automake the name and version number
# of the software package so it can generate rules for building a source
# archive.
AM_INIT_AUTOMAKE(fillets-ng, 1.0.1)
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_RANLIB
###################################################
# Check for libm
AC_CHECK_LIB(m, sin, LIBS="$LIBS -lm")
###################################################
# Test FriBidi
PKG_CHECK_MODULES(FRIBIDI, fribidi, [have_fribidi="yes"], [have_fribidi="no"])
AC_SUBST(FRIBIDI_CFLAGS)
AC_SUBST(FRIBIDI_LIBS)
if test "x$have_fribidi" = xyes; then
AC_DEFINE(HAVE_FRIBIDI)
fi
###################################################
# Check for lua and define LUA_CFLAGS and LUA_LIBS
dnl ---- lua check ------------- (stolen from Stratagus)
AC_ARG_WITH(lua, [ --with-lua=PFX Prefix where Lua is installed],
LUAPFX="$withval", LUAPFX="")
if test "x$LUAPFX" != x ; then
LUA_CFLAGS="-I$LUAPFX"
LUA_LIBS="-L$LUAPFX -llua -llualib"
else
dnl Debian, and possibly other systems, include this script...
AC_CHECK_PROGS(LUACONFIG, [lua-config lua-config50 lua-config5.0], "")
if test "x$LUACONFIG" != x; then
LUA_CFLAGS="`[$LUACONFIG --include]`"
LUA_LIBS="`[$LUACONFIG --static]`"
else dnl ...otherwise, attempt to guess
PKG_CHECK_MODULES(LUA, lua, [], [
LUA_CFLAGS=""
LUA_LIBS=""
AC_CHECK_LIB(lua, lua_setfenv, LUA_LIBS="$LUA_LIBS -llua",
[AC_CHECK_LIB(lua50, lua_setfenv, LUA_LIBS="$LUA_LIBS -llua50",
[AC_CHECK_LIB(lua5.0, lua_setfenv, LUA_LIBS="$LUA_LIBS -llua5.0",
[AC_MSG_ERROR([*** Lua5 is required.
Try --with-lua=PREFIX
You can download lua from http://www.lua.org])],
$LUA_LIBS)], $LUA_LIBS)], $LUA_LIBS)
AC_CHECK_LIB(lualib, luaopen_base, LUA_LIBS="$LUA_LIBS -llualib",
[AC_CHECK_LIB(lualib50, luaopen_base, LUA_LIBS="$LUA_LIBS -llualib50",
[AC_CHECK_LIB(lualib5.0, luaopen_base, LUA_LIBS="$LUA_LIBS -llualib5.0",
[AC_MSG_ERROR([*** Lualib5 is required.
You can download lua from http://www.lua.org])],
$LUA_LIBS)], $LUA_LIBS)], $LUA_LIBS)
])
fi
fi
AC_SUBST(LUA_CFLAGS)
AC_SUBST(LUA_LIBS)
dnl ---- end of lua check ------
###################################################
# Check for SDL, and define SDL_CFLAGS and SDL_LIBS
SDL_VERSION=1.2.0
AM_PATH_SDL($SDL_VERSION,
:, [AC_MSG_ERROR([*** library SDL-devel version $SDL_VERSION not found!])]
)
###################################################
# Checks for C libraries.
# SDL_mixer
AC_CHECK_LIB([SDL_mixer], [Mix_OpenAudio],
SDL_LIBS="-lSDL_mixer $SDL_LIBS",
[AC_MSG_ERROR([*** SDL_mixer-devel library not found!])],
$SDL_CFLAGS $SDL_LIBS
)
# SDL_image
AC_CHECK_LIB([SDL_image], [IMG_Load],
SDL_LIBS="-lSDL_image $SDL_LIBS",
[AC_MSG_ERROR([*** SDL_image-devel library not found!])],
$SDL_CFLAGS $SDL_LIBS
)
# SDL_ttf
AC_CHECK_LIB([SDL_ttf], [TTF_OpenFont],
SDL_LIBS="-lSDL_ttf $SDL_LIBS",
[AC_MSG_ERROR([*** SDL_ttf-devel library not found!])],
$SDL_CFLAGS $SDL_LIBS
)
###################################################
# Test X11
X_LIBS=""
have_x11="no"
AC_ARG_WITH(X,
[AC_HELP_STRING([--with-x],[enable X window manager support [default=detect]])],
[with_x11=$withval],[with_x11="maybe"])
if test "x$with_x11" != "xno" ; then
AC_CHECK_LIB([X11], [Xutf8TextListToTextProperty], [with_x11="yes"], [with_x11="no"])
if test "x$with_x11" != "xno" ; then
OLD_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $SDL_CFLAGS"
AC_TRY_COMPILE([
#include "SDL.h"
#include "SDL_syswm.h"
#include <X11/Xutil.h>
], [
SDL_SysWMinfo info;
info.subsystem = SDL_SYSWM_X11;
], [have_x11="yes"], [have_x11="no"])
CPPFLAGS="$OLD_CPPFLAGS"
if test "x$have_x11" = xyes; then
AC_DEFINE(HAVE_X11)
X_LIBS="-lX11"
fi
fi
fi
AC_SUBST(X_LIBS)
###################################################
# enable C++ language
AC_LANG(C++)
###################################################
# Checks for C++ libraries.
# boost_filesystem, only need for nonPOSIX systems
AC_ARG_WITH(boost, [ --with-boost=PFX Prefix where boost is installed],
BOOSTPFX="$withval", BOOSTPFX="")
if test "x$BOOSTPFX" != x ; then
BOOST_LIBS="-lboost_filesystem"
if test "x$BOOSTPFX" != xyes ; then
BOOST_CFLAGS="-I$BOOSTPFX"
BOOST_LIBS="-L$BOOSTPFX $BOOST_LIBS"
fi
fi
AM_CONDITIONAL(WITH_BOOST, test "x$BOOSTPFX" != x)
AC_SUBST(BOOST_CFLAGS)
AC_SUBST(BOOST_LIBS)
###################################################
# Check for SMPEG
AC_CHECK_LIB([smpeg], [SMPEG_new], [have_smpeg="yes"], [have_smpeg="no"],
$SDL_LIBS)
if test "x$have_smpeg" = xyes; then
SDL_LIBS="-lsmpeg $SDL_LIBS"
AC_DEFINE(HAVE_SMPEG)
fi
###################################################
# Check for windres for win32 icon.
case "$target" in
*-mingw32*)
AC_CHECK_PROGS(WINDRES, [i386-mingw32msvc-windres i586-mingw32msvc-windres], "")
AM_CONDITIONAL(HAVE_WINDRES, test "x$WINDRES" != x)
AC_SUBST(WINDRES)
have_windres="yes"
;;
*)
WINDRES=""
AM_CONDITIONAL(HAVE_WINDRES, false)
have_windres="no"
;;
esac
###################################################
# Mung up datadir if need be
if test "${datadir}" = '${datarootdir}' ; then
datadir='${datarootdir}/games/${PACKAGE}'
fi
###################################################
# Debug on/off
AC_ARG_ENABLE(debug,
[ --enable-debug Print debug messages],
[case "${enableval}" in
yes) debug=true ;;
no) debug=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
esac],[debug=false]
)
CXXFLAGS="$CXXFLAGS -Wall -W -Wpointer-arith -Wcast-qual \
-Wcast-align -Woverloaded-virtual \
-Wconversion -Wshadow"
if test "x$debug" = "xtrue"; then
CXXFLAGS="$CXXFLAGS -pedantic -ansi -pipe -g3 -O0"
fi
###################################################
AC_OUTPUT([
Makefile
src/Makefile
src/SDL_gfx/Makefile
src/gengine/Makefile
src/effect/Makefile
src/widget/Makefile
src/plan/Makefile
src/option/Makefile
src/state/Makefile
src/level/Makefile
src/menu/Makefile
src/game/Makefile
])
AC_MSG_RESULT([
Fish Fillets NG are now configured.
Checked components: X11=$have_x11, WINDRES=$have_windres, FRIBIDI=$have_fribidi, SMPEG=$have_smpeg
You can now run make.
])