File: configure.ac

package info (click to toggle)
opencity 0.0.5.1stable-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 12,108 kB
  • ctags: 3,375
  • sloc: cpp: 26,148; xml: 4,180; sh: 3,461; ansic: 646; makefile: 461
file content (226 lines) | stat: -rw-r--r-- 7,629 bytes parent folder | download
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
dnl ===========================================================================
dnl Process this file with autoconf to produce a configure script.
dnl $Id: configure.ac,v 1.22 2006/04/17 09:37:33 neoneurone Exp $
dnl ===========================================================================

AC_INIT(OpenCity, 0.0.5stable)
AC_CONFIG_SRCDIR(src/main.cpp)
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
AC_CONFIG_HEADERS([header.h])


AM_INIT_AUTOMAKE([1.7 dist-bzip2])
AM_BINRELOC


dnl ===========================================================================
dnl We need ranlib to build index for accelerating symbols searching
dnl in archive files.
dnl ===========================================================================
AC_PROG_RANLIB
AC_PROG_INSTALL


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

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 CXXFLAGS to disable -g -O2 and support the SDL libraries check

CXXFLAGS="$SDL_CFLAGS"
LDFLAGS="$LDFLAGS $SDL_LIBS"

AC_PROG_CXX
AC_LANG_CPLUSPLUS


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
                        LDFLAGS="$LDFLAGS -lSDL_mixer"
                        AC_DEFINE(AUDIO_SDL, 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(AUDIO_SDL, 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 Set the compiler and the linker options
dnl ===========================================================================
CXXFLAGS="-Wall -Wmissing-braces -Wparentheses -ansi -pedantic-errors $CXXFLAGS"

CXXFLAGS="-I$with_gl_prefix/include $enable_gprof $enable_debug $CXXFLAGS"

CFLAGS="$CXXFLAGS"

LDFLAGS="-L$with_gl_prefix/lib $enable_gprof $LDFLAGS"


dnl ===========================================================================
dnl Checks for libraries.
dnl ===========================================================================
if test "x$enable_mingw" = "xyes"; then
	LDFLAGS="-lmingw32 -lSDLmain -mwindows -lglu32 -lopengl32 $LDFLAGS"
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_CHECK_LIB(png, png_create_write_struct, ,
        AC_MSG_ERROR([PNG library required. See FAQ for more information]))


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([src/Makefile])
AC_CONFIG_FILES([src/binreloc/Makefile])
AC_CONFIG_FILES([src/enum/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/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 --datadir /path/to/share/opencity --confdir /path/to/etc/opencity'"
echo "==============================================================================="