Debian Codegraph @

configure.ac

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 dnl ===========================================================================
2 dnl Process this file with autoconf to produce a configure script.
3 dnl $Id: configure.ac 469 2015-03-15 18:16:39Z neoneurone $
4 dnl ===========================================================================
5
6 AC_INIT(OpenCity, 0.0.6.5stable)
7 AC_CONFIG_MACRO_DIR([m4])
8 AC_CONFIG_SRCDIR(src/main.cpp)
9 AC_CANONICAL_BUILD
10 AC_CANONICAL_HOST
11 AC_CANONICAL_TARGET
12 AC_CONFIG_HEADERS([config.h])
13
14
15 AM_INIT_AUTOMAKE([1.7 dist-bzip2 subdir-objects])
16 AM_BINRELOC
17
18
19 dnl ===========================================================================
20 dnl We need ranlib to build index for accelerating symbols searching
21 dnl in archive files.
22 dnl ===========================================================================
23 dnl libtoolize: `AC_PROG_RANLIB' is rendered obsolete by `LT_INIT'
24 dnl AC_PROG_RANLIB
25
26
27 dnl ===========================================================================
28 dnl We use libtool to build convenience libraries
29 dnl ===========================================================================
30 LT_INIT
31 AC_PROG_LIBTOOL
32
33
34 dnl ===========================================================================
35 dnl We use install to install the program
36 dnl ===========================================================================
37 AC_PROG_INSTALL
38
39
40 dnl ===========================================================================
41 dnl Check for pkg-config
42 dnl ===========================================================================
43 AC_PATH_PROGS([PACKAGE_CONFIG], [$host_alias-pkg-config pkg-config], [none])
44 if test "x$PACKAGE_CONFIG" = "xnone"; then
45 AC_MSG_ERROR([*** pkg-config, needed to check for libpng and libxml2 existence has not been found.])
46 fi
47
48 dnl ===========================================================================
49 dnl Detect the SDL path, with C language
50 dnl ===========================================================================
51 SDL_VERSION=1.2.12
52
53 AC_LANG_C
54 AM_PATH_SDL($SDL_VERSION, , AC_MSG_ERROR([SDL version $SDL_VERSION not found]))
55
56
57 dnl ===========================================================================
58 dnl We are doing checkings for a C++ program
59 dnl ===========================================================================
60 dnl CXX=g++ done by AC_PROG_CXX
61 dnl AC_SUBST(CXX)
62 dnl Set CPPFLAGS to disable -g -O2 and support the SDL libraries check
63
64 AC_PROG_CXX
65 AC_LANG_CPLUSPLUS
66
67 CPPFLAGS="$SDL_CFLAGS"
68 LIBS="$SDL_LIBS"
69
70
71 dnl Checks for programs.
72
73
74 dnl ===========================================================================
75 dnl Checks for --disable-sdl-mixer argument
76 dnl ===========================================================================
77 AC_ARG_ENABLE(sdl-mixer,
78 [ --disable-sdl-mixer disable SDL_mixer linking])
79
80 if test "x$enable_sdl_mixer" = "x"; then
81 AC_CHECK_HEADER(SDL_mixer.h, SDL_mixer_h="yes", SDL_mixer_h="no")
82 AC_CHECK_LIB(SDL_mixer, Mix_OpenAudio, SDL_mixer_lib="yes", SDL_mixer_lib="no")
83 AC_MSG_CHECKING(SDL_mixer support)
84
85 if test "x$SDL_mixer_h" = "xyes"; then
86 if test "x$SDL_mixer_lib" = "xyes"; then
87 LIBS="$SDL_LIBS -lSDL_mixer"
88 AC_DEFINE(OPENCITY_SDL_MIXER, 1, [SDL_Mixer support])
89 AC_MSG_RESULT(yes)
90 else
91 AC_MSG_RESULT([no, found header but not the SDL_mixer library.])
92 fi
93 else
94 AC_MSG_RESULT([no, audio system disabled.])
95 fi
96 fi
97 AM_CONDITIONAL(OPENCITY_SDL_MIXER, test "x$SDL_mixer_h" = "xyes")
98
99
100 dnl ===========================================================================
101 dnl Checks for --with-gl-prefix argument
102 dnl ===========================================================================
103 AC_ARG_WITH(gl,
104 [ --with-gl-prefix=DIR specify OpenGL prefix (DIR="/usr/X11R6")])
105
106 if test "x$with_gl_prefix" = "x"; then
107 with_gl_prefix="/usr/X11R6"
108 fi
109
110
111 dnl ===========================================================================
112 dnl Checks for --enable-gprof argument
113 dnl ===========================================================================
114 AC_ARG_ENABLE(gprof,
115 [ --enable-gprof enable GNU profiling support])
116
117 if test "x$enable_gprof" = "xyes"; then
118 enable_gprof="-pg"
119 else
120 enable_gprof=""
121 fi
122
123
124 dnl ===========================================================================
125 dnl Checks for --enable-gdb argument
126 dnl ===========================================================================
127 AC_ARG_ENABLE(gdb,
128 [ --enable-gdb enable GDB support with debugging enabled])
129
130 if test "x$enable_gdb" = "xyes"; then
131 enable_gdb="-ggdb"
132 else
133 enable_gdb=""
134 fi
135
136
137 dnl ===========================================================================
138 dnl Checks for --enable-debug argument
139 dnl ===========================================================================
140 AC_ARG_ENABLE(debug,
141 [ --enable-debug enable ALL debugging codes])
142
143 if test "x$enable_debug" = "xyes"; then
144 enable_debug="$enable_gdb"
145 else
146 enable_debug="-DNDEBUG"
147 fi
148
149
150 dnl ===========================================================================
151 dnl Checks for --enable-mingw argument
152 dnl ===========================================================================
153 AC_ARG_ENABLE(mingw,
154 [ --enable-mingw enable MinGW32 support])
155
156
157 dnl ===========================================================================
158 dnl Checks for libraries.
159 dnl ===========================================================================
160 if test "x$enable_mingw" = "xyes"; then
161 LIBS="-lmingw32 -lSDLmain -mwindows -lglu32 -lopengl32 $LIBS"
162 else
163 AC_CHECK_LIB(GL, glBegin, ,
164 AC_MSG_ERROR([OpenGL library required. See FAQ for more information]))
165 AC_CHECK_LIB(GLU, gluLookAt, ,
166 AC_MSG_ERROR([GLU library required. See FAQ for more information]))
167 fi
168
169 dnl Not worked yet
170 dnl AC_CHECK_HEADERS([SDL_ttf.h SDL_image.h SDL_net.h])
171
172 #AC_CHECK_LIB(SDL_ttf, TTF_Init, ,
173 # AC_MSG_ERROR([SDL_ttf library required. See FAQ for more information]))
174
175
176 AC_CHECK_LIB(SDL_image, IMG_Load, ,
177 AC_MSG_ERROR([SDL_image library required. See FAQ for more information]))
178
179
180 AC_CHECK_LIB(SDL_net, SDLNet_Init, ,
181 AC_MSG_ERROR([SDL_net library required. See FAQ for more information]))
182
183 # Need for viewer, also dependency of SDL_image
184 AC_MSG_CHECKING(for libpng)
185 for PNG in png png12 png13 dummypng; do
186 if $PACKAGE_CONFIG --exists lib$PNG > /dev/null 2>&1 ; then
187 CPPFLAGS="$CPPFLAGS `$PACKAGE_CONFIG --cflags lib$PNG`"
188 LIBS="$LIBS `$PACKAGE_CONFIG --libs lib$PNG`"
189 break
190 fi
191 done
192 if test "$PNG" = "dummypng"; then
193 AC_MSG_ERROR([*** libpng not found])
194 else
195 AC_MSG_RESULT(lib$PNG)
196 fi
197
198
199 dnl ===========================================================================
200 dnl Optional linker --as-needed switch
201 dnl ===========================================================================
202 AC_ARG_ENABLE(as-needed,
203 [ --enable-as-needed link with --as-needed flag])
204
205 if test "x$enable_as_needed" = "xyes"; then
206 enable_as_needed="-Wl,--as-needed"
207 else
208 enable_as_needed=""
209 fi
210
211
212 dnl ===========================================================================
213 dnl Set the compiler and the linker options
214 dnl ===========================================================================
215 dnl Set C / C++ compiler options
216 CPPFLAGS="-Wall -Wmissing-braces -Wparentheses -pedantic-errors $CPPFLAGS"
217
218 dnl Set more C / C++ compiler options
219 CPPFLAGS="-I$with_gl_prefix/include $enable_gprof $enable_debug $CPPFLAGS"
220
221 dnl Set specific C compiler flags
222 CFLAGS="-std=c99 $CFLAGS"
223
224 dnl Set specific C++ compiler flags
225 CXXFLAGS="-std=c++98 $CXXFLAGS"
226
227 dnl Set linker options
228 LDFLAGS="-L$with_gl_prefix/lib $enable_gprof $enable_as_needed $LDFLAGS"
229
230
231 dnl ===========================================================================
232 dnl Checks for header files.
233 dnl Checks for typedefs, structures, and compiler characteristics.
234 dnl Checks for library functions.
235 dnl ===========================================================================
236
237
238 dnl ===========================================================================
239 dnl Output makefiles
240 dnl ===========================================================================
241
242 AC_CONFIG_FILES([config/Makefile])
243 AC_CONFIG_FILES([docs/Makefile])
244 AC_CONFIG_FILES([map/Makefile])
245 AC_CONFIG_FILES([map/heightmap/Makefile])
246 AC_CONFIG_FILES([sound/Makefile])
247 AC_CONFIG_FILES([src/Makefile])
248 AC_CONFIG_FILES([src/binreloc/Makefile])
249 AC_CONFIG_FILES([src/enum/Makefile])
250 AC_CONFIG_FILES([src/framework/Makefile])
251 AC_CONFIG_FILES([src/framework/System/Makefile])
252 AC_CONFIG_FILES([src/framework/System/Information/Makefile])
253 AC_CONFIG_FILES([src/framework/System/Information/Software/Makefile])
254 AC_CONFIG_FILES([src/framework/System/Reflection/Makefile])
255 AC_CONFIG_FILES([src/mapgen/Makefile])
256 AC_CONFIG_FILES([src/mas/Makefile])
257 AC_CONFIG_FILES([src/model/Makefile])
258 AC_CONFIG_FILES([src/networking/Makefile])
259 AC_CONFIG_FILES([src/pngfuncs/Makefile])
260 AC_CONFIG_FILES([src/simulator/Makefile])
261 AC_CONFIG_FILES([src/structure/Makefile])
262 AC_CONFIG_FILES([src/tinyxml/Makefile])
263 AC_CONFIG_FILES([src/tinyxpath/Makefile])
264 AC_CONFIG_FILES([src/triangulation/Makefile])
265 AC_CONFIG_FILES([viewer/Makefile])
266 AC_CONFIG_FILES([Makefile])
267
268
269 AC_OUTPUT
270
271 echo "==============================================================================="
272 echo " Configure has finished."
273 echo " To compile OpenCity, do 'make'"
274 echo " To install OpenCity, do 'make install'"
275 echo " To remove OpenCity, do 'make uninstall'"
276 echo
277 echo " After compiling, to run OpenCity from here without installation, do: "
278 echo " 'src/opencity --data-dir /path/to/share/opencity --conf-dir /path/to/etc/opencity'"
279 echo "==============================================================================="