summaryrefslogtreecommitdiffstats
path: root/configure.in
blob: 6a90748bf112c43a575f8b33e815f02ab9350725 (plain)
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
dnl Process this file with autoconf to produce a configure script.

dnl initialisation
AC_INIT(src/gltron.c)
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE(gltron, 0.70)

AC_PREFIX_DEFAULT("/usr/local")

dnl AM_MAINTAINER_MODE

dnl Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_RANLIB

dnl CFLAGS set-up
CFLAGS="-DSEPARATOR=\"'/'\"" 
dnl CFLAGS="-ansi -pedantic"
dnl CXXFLAGS=""
dnl CPPFLAGS=""

AC_ARG_ENABLE(warn,
AC_HELP_STRING([--enable-warn],[Enable compiler warnings @<:@default=on@:>@]),
	enable_warn=$enableval, enable_warn=yes)
if test "x$enable_warn" = xyes; then
	CFLAGS="$CFLAGS -Wall -Werror"
fi

AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],[Enable debugging @<:@default=off@:>@]),
	enable_debug=$enableval, enable_debug=off)
if test "x$enable_debug" = xyes; then
	CFLAGS="$CFLAGS -g3"
	CXXFLAGS="$CXXFLAGS -g3"
fi

AC_ARG_ENABLE(profile,
AC_HELP_STRING([--enable-profile],[Enable profiling @<:@default=off@:>@]),
	enable_profile=$enableval, enable_profile=off)
if test "x$enable_profile" = xyes; then
	if test "x$GCC" = xyes; then
		CFLAGS="$CFLAGS -pg"
	else
		CFLAGS="$CFLAGS -p"
	fi
fi

AC_ARG_ENABLE(optimize,
AC_HELP_STRING([--enable-optimize=@<:@level@:>@],[Enable optimization @<:@default=s@:>@]),
	enable_optmize=$enableval, enable_optimize=s)
dnl this is always true
if test "x$enable_optimize" ; then
	CFLAGS="$CFLAGS -O$enable_optimize"
	CXXFLAGS="$CXXFLAGS -O$enable_optimize"
fi

dnl library checks
AM_PATH_SDL(1.1.0, CFLAGS="$CFLAGS $SDL_CFLAGS"; CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"; LIBS="$LIBS $SDL_LIBS",
	AC_MSG_ERROR(SDL is not installed))
AC_CHECK_LIB(GL, main,, AC_MSG_ERROR(OpenGL is not installed))
dnl AC_CHECK_LIB(opengl32, main,, AC_MSG_ERROR(OpenGL is not installed))
AC_CHECK_LIB(z, gzopen,, AC_MSG_ERROR(libz is not installed))
AC_CHECK_LIB(png, png_read_info,, AC_MSG_ERROR(libpng is not installed))

dnl local data dir setup
AC_ARG_ENABLE(localdata,
AC_HELP_STRING([--enable-localdata],[Use local data directory @<:@default=no@:>@]),
	CPPFLAGSA="$CPPFLAGSA -DLOCAL_DATA",
	CPPFLAGSA="$CPPFLAGSA -DDATA_DIR=\\\"\$(datadir)/\$(PACKAGE)\\\"")

dnl snapshot dir setup
AC_ARG_WITH(snapshot-dir,
AC_HELP_STRING([--with-snapshot-dir=@<:@path@:>@],[Snapshot directory @<:@default=~@:>@]),
	CPPFLAGSA="$CPPFLAGSA -DSNAP_DIR=\\\"$withval\\\"",
	CPPFLAGSA="$CPPFLAGSA -DSNAP_DIR=\\\"~\\\"")

dnl preferences dir setup
AC_ARG_WITH(preferences-dir,
AC_HELP_STRING([--with-preferences-dir=@<:@path@:>@],[Preferences directory @<:@default=~@:>@]),
	CPPFLAGSA="$CPPFLAGSA -DPREF_DIR=\\\"$withval\\\"",
	CPPFLAGSA="$CPPFLAGSA -DPREF_DIR=\\\"~\\\"")

dnl sound set-up
AC_ARG_ENABLE(sound,
AC_HELP_STRING([--disable-sound],[Don't compile in sound @<:@default=off@:>@]),
   use_sound=no, use_sound=yes)
if test "x$use_sound" = xyes; then
	AC_CHECK_LIB(smpeg, main,, AC_MSG_WARN(smpeg not found - music playback may not work correctly))
	AC_CHECK_LIB(ogg, main,, AC_MSG_WARN(ogg not found - music playback may not work correctly))
	AC_CHECK_LIB(vorbis, main,, AC_MSG_WARN(vorbis not found - music playback may not work correctly))
	AC_CHECK_LIB(vorbisfile, main,, AC_MSG_WARN(vorbisfile not found - music playback may not work correctly))
	AC_CHECK_LIB(smpeg, main,, AC_MSG_WARN(smpeg not found - music playback may not work correctly))
	AC_CHECK_LIB(mikmod, main,, AC_MSG_WARN(mikmod not found - music playback may not work correctly))
	AC_CHECK_LIB(SDL_sound, Sound_Init,
		LIBS="-lSDL_sound $LIBS";
		SOUND_OBJS="sound.o sound_glue.o Source.o Source3D.o SourceMusic.o SourceSample.o SoundSystem.o SourceCopy.o SourceEngine.o",
		AC_MSG_WARN(SDL_sound not found - disabling sound);
		SOUND_OBJS="sound_stubs.o sound_glue_stubs.o")
	
	AC_SUBST(SOUND_OBJS)
else
	SOUND_OBJS="sound_stubs.o sound_glue_stubs.o"
	AC_SUBST(SOUND_OBJS)
fi

dnl network set-up
AC_ARG_ENABLE(network,
AC_HELP_STRING([--enable-network],[Experimental network mode @<:@default=off@:>@]),
	enable_network=$enableval, enable_network=off)
if test "x$enable_network" = xyes; then
	AC_CHECK_LIB(SDL_net, SDLNet_Init,
	CFLAGS="$CFLAGS -DNETWORK";
	LIBS="$LIBS -lSDL_net";
	NETWORK_OBJS="network.o system_net.o",
	AC_MSG_WARN(SDL_net not found - disabling network))
	AC_SUBST(NETWORK_OBJS)
fi

dnl CXXFLAGS="$CFLAGS"

dnl header checks
AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h)

AC_CHECK_HEADERS(GL/gl.h, have_gl_h=true, have_gl_h=false)
$have_gl_h || {
	AC_CHECK_HEADERS(/usr/X11R6/include/GL/gl.h, includes_in_x=1 have_gl_h=true, have_gl_h=false)
}
$have_gl_h || {
	AC_CHECK_HEADERS(/usr/local/include/GL/gl.h, includes_in_local=1 have_gl_h=true, have_gl_h=false)
}
$have_gl_h || {
	AC_MSG_ERROR(cant find GL headers)
}

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST

dnl Checks for library functions.
AC_CHECK_FUNCS(strstr mkstemp)

CPPFLAGS="$CPPFLAGS $CPPFLAGSA"

AC_OUTPUT([Makefile \
	lua/Makefile \
	lua/include/Makefile \
	lua/src/Makefile \
	lua/src/lib/Makefile \
	nebu/Makefile \
	nebu/include/Makefile \
	nebu/include/audio/Makefile \
	nebu/include/base/Makefile \
	nebu/include/filesystem/Makefile \
	nebu/include/input/Makefile \
	nebu/include/scripting/Makefile \
	nebu/include/video/Makefile \
	nebu/base/Makefile \
	nebu/filesystem/Makefile \
	nebu/scripting/Makefile \
	nebu/input/Makefile \
	nebu/video/Makefile \
	nebu/audio/Makefile
	src/Makefile \
	src/include/Makefile \
	src/include/audio/Makefile \
	src/include/base/Makefile \
	src/include/configuration/Makefile \
	src/include/filesystem/Makefile \
	src/include/game/Makefile \
	src/include/input/Makefile \
	src/include/scripting/Makefile \
	src/include/video/Makefile \
	src/base/Makefile \
	src/filesystem/Makefile \
	src/configuration/Makefile \
	src/audio/Makefile \
	src/video/Makefile \
	src/input/Makefile \
	src/game/Makefile \
	art/Makefile \
	art/default/Makefile \
	data/Makefile \
	music/Makefile \
	scripts/Makefile \
	])