File: configure.ac

package info (click to toggle)
opencity 0.0.6.5stable-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 13,348 kB
  • sloc: cpp: 26,622; sh: 11,267; xml: 4,453; ansic: 587; makefile: 521
file content (279 lines) | stat: -rw-r--r-- 9,842 bytes parent folder | download | duplicates (2)
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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
dnl ===========================================================================
dnl Process this file with autoconf to produce a configure script.
dnl $Id: configure.ac 469 2015-03-15 18:16:39Z neoneurone $
dnl ===========================================================================

AC_INIT(OpenCity, 0.0.6.5stable)
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR(src/main.cpp)
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
AC_CONFIG_HEADERS([config.h])


AM_INIT_AUTOMAKE([1.7 dist-bzip2 subdir-objects])
AM_BINRELOC


dnl ===========================================================================
dnl We need ranlib to build index for accelerating symbols searching
dnl in archive files.
dnl ===========================================================================
dnl libtoolize: `AC_PROG_RANLIB' is rendered obsolete by `LT_INIT'
dnl AC_PROG_RANLIB


dnl ===========================================================================
dnl We use libtool to build convenience libraries
dnl ===========================================================================
LT_INIT
AC_PROG_LIBTOOL


dnl ===========================================================================
dnl We use install to install the program
dnl ===========================================================================
AC_PROG_INSTALL


dnl ===========================================================================
dnl Check for pkg-config
dnl ===========================================================================
AC_PATH_PROGS([PACKAGE_CONFIG], [$host_alias-pkg-config pkg-config], [none])
if test "x$PACKAGE_CONFIG" = "xnone"; then
  AC_MSG_ERROR([*** pkg-config, needed to check for libpng and libxml2 existence has not been found.])
fi

dnl ===========================================================================
dnl Detect the SDL path, with C language
dnl ===========================================================================
SDL_VERSION=1.2.12

AC_LANG_C
AM_PATH_SDL($SDL_VERSION, , AC_MSG_ERROR([SDL version $SDL_VERSION not found]))


dnl ===========================================================================
dnl We are doing checkings for a C++ program
dnl ===========================================================================
dnl CXX=g++ done by AC_PROG_CXX
dnl AC_SUBST(CXX)
dnl Set CPPFLAGS to disable -g -O2 and support the SDL libraries check

AC_PROG_CXX
AC_LANG_CPLUSPLUS

CPPFLAGS="$SDL_CFLAGS"
LIBS="$SDL_LIBS"


dnl Checks for programs.


dnl ===========================================================================
dnl Checks for --disable-sdl-mixer argument
dnl ===========================================================================
AC_ARG_ENABLE(sdl-mixer,
        [  --disable-sdl-mixer     disable SDL_mixer linking])

if test "x$enable_sdl_mixer" = "x"; then
        AC_CHECK_HEADER(SDL_mixer.h, SDL_mixer_h="yes", SDL_mixer_h="no")
        AC_CHECK_LIB(SDL_mixer, Mix_OpenAudio, SDL_mixer_lib="yes", SDL_mixer_lib="no")
        AC_MSG_CHECKING(SDL_mixer support)

        if test "x$SDL_mixer_h" = "xyes"; then
                if test "x$SDL_mixer_lib" = "xyes"; then
						LIBS="$SDL_LIBS -lSDL_mixer"
                        AC_DEFINE(OPENCITY_SDL_MIXER, 1, [SDL_Mixer support])
                        AC_MSG_RESULT(yes)
                else
                        AC_MSG_RESULT([no, found header but not the SDL_mixer library.])
                fi
        else
                AC_MSG_RESULT([no, audio system disabled.])
        fi
fi
AM_CONDITIONAL(OPENCITY_SDL_MIXER, test "x$SDL_mixer_h" = "xyes")


dnl ===========================================================================
dnl Checks for --with-gl-prefix argument
dnl ===========================================================================
AC_ARG_WITH(gl,
        [  --with-gl-prefix=DIR    specify OpenGL prefix (DIR="/usr/X11R6")])

if test "x$with_gl_prefix" = "x"; then
        with_gl_prefix="/usr/X11R6"
fi


dnl ===========================================================================
dnl Checks for --enable-gprof argument
dnl ===========================================================================
AC_ARG_ENABLE(gprof,
        [  --enable-gprof          enable GNU profiling support])

if test "x$enable_gprof" = "xyes"; then
        enable_gprof="-pg"
else
        enable_gprof=""
fi


dnl ===========================================================================
dnl Checks for --enable-gdb argument
dnl ===========================================================================
AC_ARG_ENABLE(gdb,
        [  --enable-gdb            enable GDB support with debugging enabled])

if test "x$enable_gdb" = "xyes"; then
        enable_gdb="-ggdb"
else
        enable_gdb=""
fi


dnl ===========================================================================
dnl Checks for --enable-debug argument
dnl ===========================================================================
AC_ARG_ENABLE(debug,
        [  --enable-debug          enable ALL debugging codes])

if test "x$enable_debug" = "xyes"; then
        enable_debug="$enable_gdb"
else
        enable_debug="-DNDEBUG"
fi


dnl ===========================================================================
dnl Checks for --enable-mingw argument
dnl ===========================================================================
AC_ARG_ENABLE(mingw,
        [  --enable-mingw          enable MinGW32 support])


dnl ===========================================================================
dnl Checks for libraries.
dnl ===========================================================================
if test "x$enable_mingw" = "xyes"; then
	LIBS="-lmingw32 -lSDLmain -mwindows -lglu32 -lopengl32 $LIBS"
else
	AC_CHECK_LIB(GL, glBegin, ,
		AC_MSG_ERROR([OpenGL library required. See FAQ for more information]))
	AC_CHECK_LIB(GLU, gluLookAt, ,
		AC_MSG_ERROR([GLU library required. See FAQ for more information]))
fi

dnl Not worked yet
dnl AC_CHECK_HEADERS([SDL_ttf.h SDL_image.h SDL_net.h])

#AC_CHECK_LIB(SDL_ttf, TTF_Init, ,
#        AC_MSG_ERROR([SDL_ttf library required. See FAQ for more information]))


AC_CHECK_LIB(SDL_image, IMG_Load, ,
        AC_MSG_ERROR([SDL_image library required. See FAQ for more information]))


AC_CHECK_LIB(SDL_net, SDLNet_Init, ,
        AC_MSG_ERROR([SDL_net library required. See FAQ for more information]))

# Need for viewer, also dependency of SDL_image
AC_MSG_CHECKING(for libpng)
for PNG in png png12 png13 dummypng; do
	if $PACKAGE_CONFIG --exists lib$PNG > /dev/null 2>&1 ; then
		CPPFLAGS="$CPPFLAGS `$PACKAGE_CONFIG --cflags lib$PNG`"
		LIBS="$LIBS `$PACKAGE_CONFIG --libs lib$PNG`"
	break
	fi
done
if test "$PNG" = "dummypng"; then
	AC_MSG_ERROR([*** libpng not found])
else
	AC_MSG_RESULT(lib$PNG)
fi


dnl ===========================================================================
dnl Optional linker --as-needed switch
dnl ===========================================================================
AC_ARG_ENABLE(as-needed,
        [  --enable-as-needed      link with --as-needed flag])

if test "x$enable_as_needed" = "xyes"; then
        enable_as_needed="-Wl,--as-needed"
else
        enable_as_needed=""
fi


dnl ===========================================================================
dnl Set the compiler and the linker options
dnl ===========================================================================
dnl Set C / C++ compiler options
CPPFLAGS="-Wall -Wmissing-braces -Wparentheses $CPPFLAGS"

dnl Set more C / C++ compiler options
CPPFLAGS="-I$with_gl_prefix/include $enable_gprof $enable_debug $CPPFLAGS"

dnl Set specific C compiler flags
CFLAGS="-std=c99 $CFLAGS"

dnl Set specific C++ compiler flags
CXXFLAGS="-std=c++98 $CXXFLAGS"

dnl Set linker options 
LDFLAGS="-L$with_gl_prefix/lib $enable_gprof $enable_as_needed $LDFLAGS"


dnl ===========================================================================
dnl Checks for header files.
dnl Checks for typedefs, structures, and compiler characteristics.
dnl Checks for library functions.
dnl ===========================================================================


dnl ===========================================================================
dnl Output makefiles
dnl ===========================================================================

AC_CONFIG_FILES([config/Makefile])
AC_CONFIG_FILES([docs/Makefile])
AC_CONFIG_FILES([map/Makefile])
AC_CONFIG_FILES([map/heightmap/Makefile])
AC_CONFIG_FILES([sound/Makefile])
AC_CONFIG_FILES([src/Makefile])
AC_CONFIG_FILES([src/binreloc/Makefile])
AC_CONFIG_FILES([src/enum/Makefile])
AC_CONFIG_FILES([src/framework/Makefile])
AC_CONFIG_FILES([src/framework/System/Makefile])
AC_CONFIG_FILES([src/framework/System/Information/Makefile])
AC_CONFIG_FILES([src/framework/System/Information/Software/Makefile])
AC_CONFIG_FILES([src/framework/System/Reflection/Makefile])
AC_CONFIG_FILES([src/mapgen/Makefile])
AC_CONFIG_FILES([src/mas/Makefile])
AC_CONFIG_FILES([src/model/Makefile])
AC_CONFIG_FILES([src/networking/Makefile])
AC_CONFIG_FILES([src/pngfuncs/Makefile])
AC_CONFIG_FILES([src/simulator/Makefile])
AC_CONFIG_FILES([src/structure/Makefile])
AC_CONFIG_FILES([src/tinyxml/Makefile])
AC_CONFIG_FILES([src/tinyxpath/Makefile])
AC_CONFIG_FILES([src/triangulation/Makefile])
AC_CONFIG_FILES([viewer/Makefile])
AC_CONFIG_FILES([Makefile])


AC_OUTPUT

echo "==============================================================================="
echo "  Configure has finished."
echo "  To compile OpenCity, do 'make'"
echo "  To install OpenCity, do 'make install'"
echo "  To remove OpenCity, do 'make uninstall'"
echo
echo "  After compiling, to run OpenCity from here without installation, do: "
echo "  'src/opencity --data-dir /path/to/share/opencity --conf-dir /path/to/etc/opencity'"
echo "==============================================================================="