Schism Tracker
view configure.ac @ 2729:d03801319cb3
make opengl headers optional (for embedded systems) - thanks stuckie
| author | Storlek <storlek@rigelseven.com> |
|---|---|
| date | Fri Jun 18 21:03:04 2010 -0400 (23 months ago) |
| parents | 2bd8b093a168 |
| children | c30b9d5b8116 |
line source
1 dnl Process this file with autoconf to produce a configure script.
3 dnl Schism Tracker - a cross-platform Impulse Tracker clone
4 dnl copyright (c) 2003-2005 Storlek <storlek@rigelseven.com>
5 dnl copyright (c) 2005-2008 Mrs. Brisby <mrs.brisby@nimh.org>
6 dnl copyright (c) 2009 Storlek & Mrs. Brisby
7 dnl copyright (c) 2010 Storlek
8 dnl URL: http://schismtracker.org/
9 dnl
10 dnl This program is free software; you can redistribute it and/or modify
11 dnl it under the terms of the GNU General Public License as published by
12 dnl the Free Software Foundation; either version 2 of the License, or
13 dnl (at your option) any later version.
14 dnl
15 dnl This program is distributed in the hope that it will be useful,
16 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
17 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 dnl GNU General Public License for more details.
19 dnl
20 dnl You should have received a copy of the GNU General Public License
21 dnl along with this program; if not, write to the Free Software
22 dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 dnl 'hg', or a date in the form YYYYMMDD
25 AC_INIT([schismtracker], [hg])
27 AC_CONFIG_SRCDIR([schism/main.c])
29 dnl We'll need machine type later
30 AC_CANONICAL_TARGET([])
31 machtype="$target_cpu"
33 AM_INIT_AUTOMAKE([-Wall subdir-objects])
34 AC_CONFIG_HEADERS([config.h])
36 dnl -----------------------------------------------------------------------
38 dnl Check for standard programs
39 AC_PROG_CC
40 AM_PROG_CC_C_O
41 AC_PROG_CPP
42 AC_PROG_INSTALL
43 AC_PROG_LN_S
44 AC_PROG_CC_C99
46 dnl Necessary for building the internal help.
47 AM_PATH_PYTHON([2.4])
49 dnl We're using C
50 AC_LANG([C])
52 dnl check endianness
53 AC_C_BIGENDIAN
55 dnl Check for SDL libs
56 AM_PATH_SDL(1.2.10, , AC_MSG_ERROR([*** SDL version >= 1.2.10 not found.]))
58 dnl Functions
59 AC_CHECK_FUNCS(strchr memmove strerror strtol strcasecmp strncasecmp strverscmp stricmp strnicmp strptime asprintf vasprintf memcmp mmap socket nice unsetenv dup fnmatch log2 mkstemp)
60 AM_CONDITIONAL([NEED_ASPRINTF], [test "$ac_cv_func_asprintf" = "no"])
61 AM_CONDITIONAL([NEED_VASPRINTF], [test "$ac_cv_func_vasprintf" = "no"])
62 AM_CONDITIONAL([NEED_MEMCMP], [test "$ac_cv_func_memcmp" = "no"])
63 AM_CONDITIONAL([NEED_STRPTIME], [test "$ac_cv_func_strptime" = "no"])
64 AM_CONDITIONAL([NEED_MKSTEMP], [test "$ac_cv_func_mkstemp" = "no"])
66 AM_CONDITIONAL([USE_MMAP], [test "$ac_cv_func_mmap" = "yes"])
68 dnl Headers, typedef crap, et al.
69 AC_HEADER_STDC
70 AC_HEADER_DIRENT
71 AC_HEADER_TIME
72 AC_CHECK_HEADERS(inttypes.h fcntl.h limits.h signal.h unistd.h sys/param.h sys/ioctl.h sys/kd.h linux/fb.h byteswap.h sys/soundcard.h)
73 AM_CONDITIONAL([USE_OSS], [test "$ac_cv_header_sys_soundcard_h" = yes])
75 AC_C_CONST
76 AC_C_INLINE
77 AC_TYPE_OFF_T
78 AC_TYPE_SIZE_T
79 AC_STRUCT_TM
80 LT_LIB_M
81 AC_SUBST(LIBM)
83 dnl -----------------------------------------------------------------------
85 dnl Always use x11 by default unless overriden later per-platform
86 dnl (this is stupid, and only needed because the x11 check is dysfunctional)
87 defaultx11=yes
90 dnl CoreMIDI (Mac OS X)
91 AC_MSG_CHECKING(for CoreAudio/CoreMIDI Framework)
92 if echo "$SDL_LIBS" | grep -- -framework >/dev/null 2>&1; then
93 AC_MSG_RESULT(found)
94 dnl frameworks aren't part of sdl... should be a separate variable
95 SDL_LIBS="$SDL_LIBS -framework CoreAudio -framework CoreMIDI -framework IOKit -framework OpenGL"
96 AC_SUBST(SDL_LIBS)
98 AM_CONDITIONAL([USE_MACOSX], true)
99 AM_CONDITIONAL([am__fastdepOBJC], true)
100 defaultx11=no
101 else
102 AC_MSG_RESULT(not found)
103 AM_CONDITIONAL([USE_MACOSX], false)
104 AM_CONDITIONAL([am__fastdepOBJC], false)
105 fi
108 dnl Windows poop
109 AC_ARG_WITH(windres,
110 [ --with-windres=RSC Name of windres tool (optional)],
111 windres="$withval", windres="")
112 AM_CONDITIONAL([USE_WINDRES], [test "x$windres" != "x"])
114 WINDRES="$windres"
115 AC_SUBST(WINDRES)
117 dnl winmm testing...
118 AC_CHECK_HEADERS(winsock.h winsock2.h windows.h)
119 if test "X$ac_cv_header_windows_h" = "Xyes"; then
120 AM_CONDITIONAL([USE_WIN32], true)
121 SDL_LIBS="$SDL_LIBS -lwinmm"
122 AC_SUBST(SDL_LIBS)
123 defaultx11=no
124 else
125 AM_CONDITIONAL([USE_WIN32], false)
126 fi
129 dnl Wii crap
130 AC_CHECK_LIB(ogc, IOS_ReloadIOS, libogc_found=yes, libogc_found=no, [-mrvl -L${DEVKITPRO}/libogc/lib/wii])
131 if test x"$libogc_found" = "xyes"; then
132 AM_CONDITIONAL([USE_WII], true)
133 wii_machdep="-DGEKKO -mrvl -mcpu=750 -meabi -mhard-float"
134 CFLAGS="$CFLAGS $wii_machdep -I${DEVKITPRO}/libogc/include"
135 LIBS="$LIBS $wii_machdep -L${DEVKITPRO}/libogc/lib/wii"
136 SDL_CFLAGS="$SDL_CFLAGS -I${DEVKITPRO}/libogc/include/SDL"
137 SDL_LIBS="$SDL_LIBS -lSDL -lfat -lwiiuse -lbte -logc -lm -lwiikeyboard"
138 AC_SUBST(CFLAGS)
139 AC_SUBST(LIBS)
140 AC_SUBST(SDL_CFLAGS)
141 AC_SUBST(SDL_LIBS)
142 EXEEXT=.elf
143 AC_SUBST(EXEEXT)
144 defaultx11=no
145 else
146 AM_CONDITIONAL([USE_WII], false)
147 fi
150 dnl should probably have some AC_MSG_CHECKING here, but meh
151 if test "x$defaultx11" = "xno"; then
152 if test "x$with_x" = "x"; then
153 AC_MSG_NOTICE([X11 disabled by default; use --with-x if you really want it])
154 dnl (you don't want it, because it's probably broken anyway)
155 with_x=no
156 fi
157 fi
159 dnl OpenGL crud - it doesn't always exist
160 saved_cppflags=$CPPFLAGS
161 CPPFLAGS="$CPPFLAGS $SDL_CFLAGS"
162 AC_CHECK_HEADER([SDL_opengl.h], [AC_DEFINE([USE_OPENGL], 1, [Define to 1 if SDL's OpenGL works])])
163 CPPFLAGS=$saved_cppflags
165 dnl -----------------------------------------------------------------------
167 saved_libs=$LIBS
168 alsa=no
169 AC_CHECK_LIB(asound, snd_seq_open,[alsa=yes])
170 alsadltrick=no
171 if test "$alsa" = "yes"; then
172 if test "$ac_cv_header_sys_soundcard_h" = "yes"; then
173 alsadltrick=yes
174 LIBS=$saved_libs
175 fi
176 fi
177 AM_CONDITIONAL([USE_ALSA], [test "$alsa" = yes])
178 AM_CONDITIONAL([USE_ALSA_DLTRICK], [test "$alsadltrick" = yes])
181 AC_PATH_XTRA()
182 if test "$no_x" = "yes"; then
183 dnl no X11
184 AM_CONDITIONAL([USE_X11], [false])
185 AM_CONDITIONAL([USE_XV], [false])
186 else
187 AM_CONDITIONAL([USE_X11], [true])
189 SDL_LIBS="$SDL_LIBS -lX11 -lXext"
190 AC_SUBST(SDL_LIBS)
192 LIBS="$LIBS $X_LIBS"
193 AC_SUBST(LIBS)
195 dnl this previously checked X11/extensions/XKB.h, but nothing
196 dnl ever used it (xkb.c still included X11/XKBlib.h even when
197 dnl autoconf reported it as nonexistent -- weird!)
198 AC_CHECK_HEADERS(X11/Xlib.h X11/XKBlib.h)
199 AC_CHECK_LIB(Xv, XvQueryExtension,,,-lX11 -lXext)
200 if test "$ac_cv_lib_Xv_XvQueryExtension" = "yes"; then
201 AC_CHECK_HEADERS(X11/extensions/Xvlib.h,,,[[
202 #include <X11/Xlib.h>
203 ]])
204 if test "$ac_cv_header_X11_extensions_xvlib_h" = "yes"; then
205 SDL_LIBS="$SDL_LIBS -lXv -lXext"
206 AC_SUBST(SDL_LIBS)
207 AM_CONDITIONAL([USE_XV], [true])
208 elif test "$ac_cv_header_X11_extensions_Xvlib_h" = "yes"; then
209 SDL_LIBS="$SDL_LIBS -lXv -lXext"
210 AC_SUBST(SDL_LIBS)
211 AM_CONDITIONAL([USE_XV], [true])
212 else
213 AM_CONDITIONAL([USE_XV], [false])
214 fi
215 else
216 AM_CONDITIONAL([USE_XV], [false])
217 fi
218 fi
220 if test "X$ac_cv_func_socket" = "Xyes"; then
221 dnl free networking
222 AM_CONDITIONAL([USE_NETWORK], true)
223 else
224 AC_CHECK_HEADERS(winsock.h winsock2.h sys/socket.h)
225 if test "x$ac_cv_header_winsock_h" = "xyes"; then
226 AM_CONDITIONAL([USE_NETWORK], true)
227 SDL_LIBS="$SDL_LIBS -lwsock32"
228 AC_SUBST(SDL_LIBS)
229 elif test "x$ac_cv_header_winsock2_h" = "xyes"; then
230 AM_CONDITIONAL([USE_NETWORK], true)
231 SDL_LIBS="$SDL_LIBS -lws2_32"
232 AC_SUBST(SDL_LIBS)
233 elif test "x$ac_cv_header_sys_socket_h" = "xyes"; then
234 AM_CONDITIONAL([USE_NETWORK], true)
235 SDL_LIBS="$SDL_LIBS -lsocket"
236 AC_SUBST(SDL_LIBS)
237 else
238 AM_CONDITIONAL([USE_NETWORK], false)
239 fi
240 fi
242 #AC_CHECK_LIB(kernel32, GetConsoleMode, SDL_LIBS="$SDL_LIBS -Wl,--subsystem,console")
244 dnl wee...
245 dnl this completely sucks...
246 OBJC=$CC
247 OBJCFLAGS=$CFLAGS
248 AC_SUBST(OBJC)
249 AC_SUBST(OBJCFLAGS)
251 dnl -----------------------------------------------------------------------
252 dnl stupid version hack
254 AC_ARG_ENABLE(mercurial,
255 AS_HELP_STRING([--enable-mercurial], [Use Mercurial for version/timestamps]),
256 USE_MERCURIAL=$enableval,
257 USE_MERCURIAL=yes)
259 dnl We want to get the most accurate information of the version possible.
260 dnl If Mercurial is present, 'hg parents' will tell us what version is
261 dnl really being compiled.
263 AC_MSG_CHECKING(for Mercurial)
264 if test x$USE_MERCURIAL = xyes; then
265 hg_dirstate=no
266 if test -e "$ac_abs_confdir"/.hg/dirstate; then
267 if hg --version >/dev/null; then
268 AC_MSG_RESULT(found)
269 hg_dirstate=yes
270 else
271 AC_MSG_RESULT(not found)
272 echo "*** Warning: .hg/dirstate exists, but no 'hg' command in PATH"
273 echo "*** Mercurial version information cannot be compiled in"
274 fi
275 else
276 AC_MSG_RESULT(not found)
277 fi
278 else
279 AC_MSG_RESULT(skipped)
280 fi
282 if test "x$hg_dirstate" = "xyes"; then
283 AM_CONDITIONAL([USE_MERCURIAL], [true])
284 else
285 AM_CONDITIONAL([USE_MERCURIAL], [false])
286 fi
288 dnl -----------------------------------------------------------------------
289 dnl (This ought to be above AC_PROG_CC, but that causes configure to fail
290 dnl when all the insane warnings are are enabled.)
292 AC_ARG_ENABLE(extra-opt,
293 AS_HELP_STRING([--enable-extra-opt], [Add extra optimizations]),
294 ADD_OPT=$enableval,
295 ADD_OPT=no)
297 AC_ARG_ENABLE(all-warnings,
298 AS_HELP_STRING([--enable-all-warnings], [Enable ridiculous compiler warnings]),
299 ADD_WARN=$enableval,
300 ADD_WARN=no)
302 AC_ARG_ENABLE(debug,
303 AS_HELP_STRING([--enable-debug], [Enable debug flags]),
304 ADD_DEBUG=$enableval,
305 ADD_DEBUG=no)
307 AC_ARG_ENABLE(profiling,
308 AS_HELP_STRING([--enable-profiling], [Enable profiling flags (slows things down)]),
309 ADD_PROFILING=$enableval,
310 ADD_PROFILING=no)
312 AC_ARG_ENABLE(ludicrous-mode,
313 AS_HELP_STRING([--enable-ludicrous-mode], [Enable all warnings, and treat as errors]),
314 ADD_LUDICROUS=$enableval,
315 ADD_LUDICROUS=no)
317 dnl place extra optimizations after existing cflags so that they can override
318 dnl override whatever flags might exist by default (-g -O2 usually)
319 if test x$ADD_OPT \!= xno; then
320 ADD_OPT="-g0 -s -O3 -ffast-math -fomit-frame-pointer -fno-exceptions"
321 ADD_OPT="$ADD_OPT -funroll-loops -frerun-cse-after-loop -fno-ident"
322 ADD_OPT="$ADD_OPT -fno-strength-reduce"
323 CFLAGS="$CFLAGS $ADD_OPT"
324 fi
326 if test x$ADD_LUDICROUS \!= xno; then
327 ADD_WARN=yes
328 CFLAGS="$CFLAGS -Werror -D_FORTIFY_SOURCE=2"
329 fi
331 dnl ... but put the warnings first, to make it possible to quiet certain
332 dnl warnings if necessary, while still providing most of the benefit
333 if test x$ADD_WARN \!= xno; then
334 ADD_WARN="-Wall -Wextra -Winline -Wshadow -Wcast-align -Wwrite-strings -Waggregate-return -Wpacked"
335 ADD_WARN="$ADD_WARN -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs"
336 CFLAGS="$ADD_WARN $CFLAGS"
337 fi
339 if test x$ADD_DEBUG \!= xno; then
340 CFLAGS="$CFLAGS -g"
341 OBJCFLAGS="$OBJCFLAGS -g"
342 SDL_LIBS="$SDL_LIBS -g"
343 AC_SUBST(SDL_LIBS)
344 fi
345 if test x$ADD_PROFILING \!= xno; then
346 CFLAGS="$CFLAGS -g -pg"
347 OBJCFLAGS="$OBJCFLAGS -g -pg"
348 SDL_LIBS="$SDL_LIBS -g -pg"
349 AC_SUBST(SDL_LIBS)
350 fi
352 dnl - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
354 AC_CONFIG_FILES([Makefile])
355 AC_OUTPUT
