Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
blob: 0b42aa735ee3a10c0707f6e02394b9649400a1fe (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
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
AC_INIT(configure.in)

AM_CONFIG_HEADER(src/config.h)
AM_INIT_AUTOMAKE(osirion, 0.1)

AC_LANG_CPLUSPLUS
AC_PROG_CXX
AM_PROG_LIBTOOL

dnl KDE_FIND_PATH(programm-name, variable-name, list of directories,
dnl     if-not-found, test-parameter)
AC_DEFUN([KDE_FIND_PATH],
[
   AC_MSG_CHECKING([for $1])
   if test -n "$$2"; then
        kde_cv_path="$$2";
   else
        kde_cache=`echo $1 | sed 'y%./+-%__p_%'`

        AC_CACHE_VAL(kde_cv_path_$kde_cache,
        [
        kde_cv_path="NONE"
        dirs="$3"
        kde_save_IFS=$IFS
        IFS=':'
        for dir in $PATH; do
          dirs="$dirs $dir"
        done
        IFS=$kde_save_IFS

        for dir in $dirs; do
          if test -x "$dir/$1"; then
            if test -n "$5"
            then
              evalstr="$dir/$1 $5 2>&1 "
              if eval $evalstr; then
                kde_cv_path="$dir/$1"
                break
              fi
            else
                kde_cv_path="$dir/$1"
                break
            fi
          fi
        done

        eval "kde_cv_path_$kde_cache=$kde_cv_path"

        ])

      eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\""

   fi

   if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then
      AC_MSG_RESULT(not found)
      $4
   else
      AC_MSG_RESULT($kde_cv_path)
      $2=$kde_cv_path

   fi
])

AC_MSG_CHECKING([host type])
case "$host" in
        *-*-mingw*)
                HOST_LIBS="-lws2_32 -lz"
                HOST_GL_LIBS="-lopengl32 -lglu32"
		HOST_AL_LIBS="-lOpenAL32"
		ICON_CLIENT="osirion-res.o"
		ICON_SERVER="osiriond-res.o"
                AC_MSG_RESULT(win32)
                ;;
        *)
                HOST_LIBS="-lz"
                HOST_GL_LIBS="-lGL -lGLU"
		HOST_AL_LIBS="-lopenal"
		ICON_CLIENT=""
		ICON_SERVER=""
                AC_MSG_RESULT(generic unix)
                ;;
esac
AC_SUBST(HOST_LIBS)
AC_SUBST(ICON_CLIENT)
AC_SUBST(ICON_SERVER)

AC_MSG_CHECKING(whether to abort on compiler warnings)
WARN_CFLAGS=""
AC_ARG_ENABLE(warn,
        AC_HELP_STRING(
                [--disable-warn], [don't abort on compiler warnings]
        ),
        AC_MSG_RESULT(no),
        AC_MSG_RESULT(yes)
        WARN_CFLAGS="$WARN_CFLAGS -Wall -Werror"
)
AC_SUBST(WARN_CFLAGS)


AC_MSG_CHECKING(whether to include debug messages)
AC_ARG_ENABLE(debug_messages,
	AC_HELP_STRING(
		[--disable-debug-messages], [build without extra debug information]
	),
	AC_MSG_RESULT(no),
	AC_MSG_RESULT(yes)
	AC_DEFINE_UNQUOTED(HAVE_DEBUG_MESSAGES, 1, [Defines if debug information is enabled])
)

BUILD_CLIENT=no

AC_ARG_WITH(client,
	AC_HELP_STRING([--without-client], [build the dedicated server only])
)

AC_MSG_CHECKING(whether to build client)

if test "x${with_client}" = xno; then

	AC_MSG_RESULT(no)

else
	AC_MSG_RESULT(yes)

	BUILD_CLIENT=yes
	AC_DEFINE(BUILD_CLIENT, 1, [Define this to build a client])

	AC_CHECK_HEADER(GL/gl.h,
		HAVE_OPENGL=yes
		AC_DEFINE(HAVE_OPENGL, 1, [Define this if you have OpenGL]),
		AC_MSG_WARN([OpenGL include file GL/gl.h not found])
	)
	
	AC_CHECK_HEADER(GL/glext.h,
		HAVE_OPENGL_GLEXT=yes
		AC_DEFINE(HAVE_OPENGL_GLEXT, 1, [Define this if you have OpenGL Extensions]),
		AC_MSG_ERROR([OpenGL include file GL/glext.h not found])
	)
	
	GL_LIBS="$HOST_GL_LIBS"
	
	AC_SUBST(GL_LIBS)
	AC_SUBST(GL_CFLAGS)

	AC_CHECK_HEADER(AL/al.h,
		HAVE_OPENGL=yes
		AC_DEFINE(HAVE_OPENAL, 1, [Define this if you have OpenAL]),
		AC_MSG_ERROR([OpenAL include file AL/al.h not found])
	)
	
	AL_LIBS="$HOST_AL_LIBS"
	AC_SUBST(AL_LIBS)
	
	AC_MSG_CHECKING([looking for SDL])
	KDE_FIND_PATH(sdl-config, LIBSDL_CONFIG, [${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin], [
		AC_MSG_ERROR([SDL not found])
	])
	
	if test -n "$LIBSDL_CONFIG"; then
	LIBSDL_LIBS="`$LIBSDL_CONFIG --libs`"
	LIBSDL_RPATH=
	for args in $LIBSDL_LIBS; do
		case $args in
		-L*)
		LIBSDL_RPATH="$LIBSDL_RPATH $args"
		;;
		esac
	done
	LIBSDL_RPATH=`echo $LIBSDL_RPATH | sed -e "s/-L/-R/g"`
	LIBSDL_CFLAGS="`$LIBSDL_CONFIG --cflags`"
	
	AC_DEFINE_UNQUOTED(HAVE_LIBSDL, 1, [Defines if your system has the LIBSDL library])
	fi
	
	AC_MSG_RESULT($HAVE_LIBSDL)
	
	AC_SUBST(LIBSDL_LIBS)
	AC_SUBST(LIBSDL_CFLAGS)
	AC_SUBST(LIBSDL_RPATH)
fi

CXXFLAGS="-pipe $DEBUG_CFLAGS $WARN_CFLAGS $CXXFLAGS"
AC_SUBST(CXXFLAGS)

dnl ---------------------------------------------------------------
dnl   Installation paths

test "$prefix" = "NONE" && prefix="/opt/games/$PACKAGE"

PACKAGE_PREFIX="$prefix"
PACKAGE_BINDIR="$prefix/bin"
PACKAGE_DATADIR="$prefix/data"
PACKAGE_LIBDIR="$prefix/lib"

AC_DEFINE_UNQUOTED(PACKAGE_PREFIX, "$PACKAGE_PREFIX",
	[Define this to the path where the game will be installed.]
)

AC_DEFINE_UNQUOTED(PACKAGE_BINDIR, "$PACKAGE_BINDIR",
	[Define this to the path containing the game binaries.]
)

AC_DEFINE_UNQUOTED(PACKAGE_DATADIR, "$PACKAGE_DATADIR",
	[Define this to the path containing the game data.]
)

AC_DEFINE_UNQUOTED(PACKAGE_LIBDIR, "$PACKAGE_LIBDIR",
	[Define this to the path containing the game libraries.]
)

dnl ---------------------------------------------------------------
dnl    Write makefiles and config.h

AM_CONDITIONAL(BUILD_CLIENT, test "x$BUILD_CLIENT" = xyes)
AM_CONDITIONAL(BUILD_DEDICATED, test "x$BUILD_CLIENT" = xno)

AC_OUTPUT(Makefile src/Makefile src/audio/Makefile src/auxiliary/Makefile \
	src/client/Makefile src/core/Makefile src/filesystem/Makefile src/game/Makefile \
	src/math/Makefile src/model/Makefile src/render/Makefile src/server/Makefile src/sys/Makefile)

dnl ---------------------------------------------------------------
dnl   Configuration summary

AC_MSG_RESULT([
The Osirion Project $VERSION

Configuration summary:
	platform ........... $host
	flags .............. $CXXFLAGS
	libraries .......... $HOST_LIBS
	build client ....... $BUILD_CLIENT
	opengl ............. $GL_LIBS
	openal ............. $AL_LIBS

Installation directories:
	prefix ............. $PACKAGE_PREFIX
	binaries ........... $PACKAGE_BINDIR
	libraries .......... $PACKAGE_LIBDIR
	data ............... $PACKAGE_DATADIR
])