forked from sergiomb2/pinball
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
249 lines (199 loc) · 7.84 KB
/
configure.ac
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
dnl # -*- Autoconf -*-
dnl # Process this file with autoconf 2.53 to produce a configure script.
dnl init autoconf and automake
AC_INIT(pinball, 0.3.4.1)
AC_CONFIG_HEADERS(pinconfig.h)
LT_CONFIG_LTDL_DIR([libltdl])
AC_CONFIG_AUX_DIR([libltdl/config])
AC_CONFIG_MACRO_DIR([libltdl/m4])
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE
dnl # Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_PROG_MKDIR_P
AM_GNU_GETTEXT([external])
#For rhel6 but rhel6 doesn't have SDL2
#AM_GNU_GETTEXT_VERSION(0.17)
AM_GNU_GETTEXT_VERSION(0.19.8)
dnl this is a c++ program
dnl CFLAGS="-g -W -Wall -O2"
dnl CXXFLAGS="-g -W -Wall -O2"
AC_ARG_WITH(cflags,
[ --with-cflags=CFLAGS use CFLAGS as compile time arguments.],
[CFLAGS=$with_cflags; export CFLAGS])
AC_ARG_WITH(cxxflags,
[ --with-cxxflags=CXXFLAGS use CXXFLAGS as compile time arguments.],
[CXXFLAGS=$with_cxxflags; export CXXFLAGS])
AC_LIBTOOL_DLOPEN
LTDL_INIT
dnl *******************************************
dnl PATHS AND DIRS ****************************
dnl data dirs, fuck I hate autoconf, spent 4 hours getting this right, had to
dnl steal it from xine and even that took a couple of hours
if test "x$prefix" = xNONE; then
prefix="${ac_default_prefix}"
fi
if test "x$exec_prefix" = xNONE; then
exec_prefix="$prefix"
fi
EM_DATADIR="$datadir/$PACKAGE_NAME"
AC_SUBST(EM_DATADIR)
eval EM_DATAPATH=`eval echo "$EM_DATADIR"`
AC_DEFINE_UNQUOTED(EM_DATADIR, "$EM_DATAPATH", [The data dir /usr/local/share/pinball])
EM_LIBDIR="$libdir/$PACKAGE_NAME"
AC_SUBST(EM_LIBDIR)
eval EM_LIBPATH=`eval echo "$EM_LIBDIR"`
AC_DEFINE_UNQUOTED(EM_LIBDIR, "$EM_LIBPATH", [The library or plugin dir /usr/local/lib/pinball])
dnl special fix for rpmbuild, I hate rpmbuild even more than I hate autoconf
AC_ARG_WITH(buildroot-prefix, [ --with-buildroot-prefix=PFX Only used when building packages], buildroot_prefix="$withval", buildroot_prefix="")
if test x"$buildroot_prefix" != "x"; then
EM_BUILD_ROOT=$buildroot_prefix
else
EM_BUILD_ROOT="/"
fi
AC_SUBST(EM_BUILD_ROOT)
AC_ARG_WITH(localization-prefix, [ --with-localization-prefix=PFX Install localization files in PFX (/usr/share/locale)], localization_prefix="$withval", localization_prefix="")
if test x"$localization_prefix" != "x"; then
EM_LOCALIZATION_DIR=$localization_prefix
else
EM_LOCALIZATION_DIR="/usr/share/locale"
fi
dnl EM_LOCALIZATION_DIR="/usr/share/locale"
AC_SUBST(EM_LOCALIZATION_DIR)
eval EM_LOCALIZATION_PATH=`eval echo "$EM_LOCALIZATION_DIR"`
AC_DEFINE_UNQUOTED(EM_LOCALIZATION_DIR, "$EM_LOCALIZATION_PATH", [Localization directory])
AC_ARG_ENABLE(libtest, [ --disable-libtest SDL2_image _mixer libtest work around ], , enable_libtest=yes)
dnl *******************************************
dnl SDL version ********************
dnl *******************************************
dnl OPENGL ************************************
dnl Figure out which math and GL library to use
case "$target" in
*-*-cygwin* | *-*-mingw32*)
MATHLIB=""
SYS_GL_LIBS="-lopengl32"
;;
*-*-beos*)
MATHLIB=""
SYS_GL_LIBS="-lGL"
;;
*-*-darwin*)
MATHLIB=""
SYS_GL_LIBS=""
;;
*-*-aix*)
if test x$ac_cv_prog_gcc = xyes; then
CFLAGS="-mthreads"
fi
SYS_GL_LIBS=""
;;
*)
MATHLIB="-lm"
AC_PATH_X
AC_PATH_XTRA
if test x$have_x = xyes; then
CFLAGS="$CFLAGS $X_CFLAGS"
SYS_GL_LIBS="$X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS -lGL -lGLU"
else
SYS_GL_LIBS="-lGL -lGLU"
fi
;;
esac
AC_SUBST(MATHLIB)
dnl Check for OpenGL
AC_MSG_CHECKING(for OpenGL support)
AC_TRY_COMPILE([
#ifdef WIN32
# define WINAPI
#endif
#if defined(__APPLE__) && defined(__MACH__)
# include <OpenGL/gl.h>
#else
# include <GL/gl.h>
#endif
], , , AC_MSG_ERROR([*** OpenGL not found on system!]))
AC_MSG_RESULT(yes)
GL_LIBS="$SYS_GL_LIBS"
AC_SUBST(GL_LIBS)
LIBS="$GL_LIBS $LIBS"
dnl *******************************************
dnl SDL ***************************************
AM_PATH_SDL2(2.0, : , AC_MSG_ERROR([*** SDL version 2.0 not found! Make sure you have the development package of SDL installed - (www.libsdl.org) - or try to use the --with-sdl-prefix option]))
CFLAGS="$CFLAGS $SDL_CFLAGS"
CPPFLAGS="$CPPFLAGS $SDL_CFLAGS"
LIBS="$LIBS $SDL_LIBS"
dnl SDL_image *********************************
AC_ARG_WITH(sdlimage-prefix, [ --with-sdlimage-prefix=PFX prefix where SDL_image library is installed], sdlimage_prefix="$withval", sdlimage_prefix="")
if test x"$sdlimage_prefix" != "x"; then
SDLIMAGE_LIB="-L$sdlimage_prefix/lib"
SDLIMAGE_CFLAGS="-I$sdlimage_prefix/include"
LDFLAGS="$SDLIMAGE_LIB $LDFLAGS"
CPPFLAGS="$CPPFLAGS $SDLIMAGE_CFLAGS"
CFLAGS="$CFLAGS $SDLIMAGE_CFLAGS"
fi
if test x"$enable_libtest" = x"yes"; then
AC_CHECK_LIB(SDL2_image, IMG_Load, : ,AC_MSG_ERROR([*** libSDL2_image not found! Make sure you have the development package of SDL2_image installed - (www.libsdl.org) - or try to use the --with-sdlimage-prefix option]), )
fi
LIBS="$LIBS -lSDL2_image"
dnl SDL_mixer **********************************
AC_ARG_WITH(sdlmixer-prefix, [ --with-sdlmixer-prefix=PFX prefix where SDL_mixer library is installed], sdlmixer_prefix="$withval", sdlmixer_prefix="")
if test x"$sdlmixer_prefix" != "x"; then
SDLMIXER_LIB="-L$sdlmixer_prefix/lib"
SDLMIXER_CFLAGS="-I$sdlmixer_prefix/include"
LDFLAGS="$SDLMIXER_LIB $LDFLAGS"
CPPLAGS="$CPPFLAGS $SDLMIXER_CFLAGS"
CFLAGS="$CFLAGS $SDLMIXER_CFLAGS"
fi
if test x"enable_libtest" = x"yes"; then
AC_CHECK_LIB(SDL2_mixer, Mix_OpenAudio, : ,AC_MSG_ERROR([*** libSDL2_mixer not found. Make sure you have the development package of SDL2_mixer installed - (www.libsdl.org) - or try to use --with-sdlmixer-prefix option]), )
fi
LIBS="$LIBS -lSDL2_mixer"
dnl End SDL *************************
dnl ********************************************
dnl CPP_UNIT ***********************************
AC_ARG_WITH(unittest, [ --with-unittest Try to use unitest], use_unittest="yes", use_unittest="no")
if test x"$use_unittest" = "xyes"; then
AM_PATH_CPPUNIT(1.8.0, [
AC_DEFINE(EM_UNIT_TEST, [1], [Shall we compile unittests])
CPPFLAGS="$CPPFLAGS $CPPUNIT_CFLAGS"
CFLAGS="$CFLAGS $CPPUNIT_CFLAGS"
LIBS="$LIBS $CPPUNIT_LIBS"
], AC_MSG_ERROR([*** CppUnit was not found. No unit testing.]))
fi
dnl ********************************************
dnl HEADERS ************************************
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(sys/stat.h, : ,AC_MSG_ERROR([*** Header sys/stat.h not found. Not able to save config]))
AC_CHECK_HEADERS(sys/types.h, : ,AC_MSG_ERROR([*** Header sys/types.h not found. Not able to save config]))
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_INLINE
# Checks for library functions.
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([getcwd gettimeofday memset mkdir pow sqrt strchr strrchr strstr])
dnl ********************************************
dnl Debug and Config ***************************
AC_ARG_WITH(debug, [ --with-debug Compile debug version], use_debug="yes", use_debug="no")
if test x"$use_debug" = "xyes"; then
AC_DEFINE(EM_DEBUG, [1], [Shall we use debug features such as profiling and keyboard ball steering])
fi
AC_DEFINE(EM_USE_SOURCE_SPECULAR, [1], [Specular])
dnl AC_DEFINE(EM_USE_FAST_FLOAT2INT)
dnl AC_DEFINE(EM_DEBUG_COLLISION)
AC_DEFINE(EM_USE_QUADTREE, [1], [Quadtree instead of octtree])
AC_DEFINE(EM_USE_SHARED_COLOR, [1], [One color per vertex])
dnl AC_SUBST(pkglibdir)
dnl AC_SUBST(pkgincludedir)
AC_CONFIG_FILES([Makefile addon/Makefile base/Makefile data/Makefile
src/Makefile test/Makefile pinball-config
data/tux/Makefile data/professor/Makefile data/hurd/Makefile
data/gnu/Makefile data/professor2/Makefile data/locale/Makefile.in
])
AC_OUTPUT