1 # -*- mode: shell-script -*-
7 AC_INIT(d2x,[D2X_MAJOR.D2X_MINOR.D2X_MICRO],[descent-source@warpcore.org])
14 AM_INIT_AUTOMAKE([1.6])
16 AM_CONFIG_HEADER(conf.h)
18 AC_DEFINE_UNQUOTED(D2XMAJOR,D2X_MAJOR,[d2x major version])
19 AC_DEFINE_UNQUOTED(D2XMINOR,D2X_MINOR,[d2x minor version])
20 AC_DEFINE_UNQUOTED(D2XMICRO,D2X_MICRO,[d2x micro version])
24 #kludge to keep autoconf from adding -g -O2
30 AC_CHECK_TOOL(CC, gcc, :)
31 AC_CHECK_TOOL(RANLIB, ranlib, :)
32 AC_CHECK_TOOL(STRIP, strip, :)
33 AC_CHECK_TOOL(AR, ar, :)
37 AC_PATH_PROGS(NASM, nasm nasmw, no)
42 AC_DEFINE(WORDS_NEED_ALIGNMENT,,[Define if your processor needs data to be word-aligned])
46 build_macosx_bundle=no
47 build_simple_bundle=no
51 AC_MSG_WARN([Cygwin found, setting -mno-cygwin])
52 CFLAGS="-mno-cygwin $CFLAGS"
60 AC_MSG_RESULT(Mac OS X/Darwin; Mac OS X bundle)
61 build_macosx_bundle=yes
62 DATADIR='EXE>>../Resources'
63 #SCOREDIR='/Library/Preferences/KoboDeluxe/scores'
64 #CONFIGDIR='HOME>>Library/Preferences'
65 #CONFIGFILE='KoboDeluxe Preferences'
73 AC_CHECK_DECLS(nanosleep,,,[#include <time.h>])
74 AC_CHECK_TYPES([struct timespec, struct timeval],,,[#include <sys/time.h>])
76 AM_CONDITIONAL(MINGW32, test x$MINGW32 = xyes)
77 if test x$MINGW32 = xyes; then
78 GL_LIBS="opengl32 glu32"
79 elif test x$MACOSX = xyes; then
85 AM_CONDITIONAL(MACOSX, test x$MACOSX = xyes)
86 AM_CONDITIONAL(BUILD_MACOSX_BUNDLE, test x$build_macosx_bundle = xyes)
87 AM_CONDITIONAL(BUILD_SIMPLE_BUNDLE, test x$build_simple_bundle = xyes)
89 dnl Set $prefix and $exec_prefix to $ac_default_prefix if they are not set
90 test "x$prefix" = "xNONE" && prefix=$ac_default_prefix
91 test "x$exec_prefix" = "xNONE" && exec_prefix="${prefix}"
93 dnl Set default locations to find data files.
94 default_sharepath="$datadir/games/$PACKAGE"
96 CFLAGS="-Wall $CFLAGS"
98 dnl Enable editor build?
100 [ --enable-editor Build editor? (not functional)],,)
101 if test x$enable_editor = xyes; then
102 AC_DEFINE(EDITOR,,[Define if you want to build the editor])
103 D2X_MAIN_SUBDIRS=editor
105 AM_CONDITIONAL(EDITOR, test x$enable_editor = xyes)
107 dnl Enable macdata build?
108 AC_ARG_ENABLE(macdata,
109 [ --enable-macdata Build for mac datafiles],,)
110 if test x$enable_macdata = xyes; then
111 AC_DEFINE(MACDATA,,[Define if you want to build for mac datafiles])
112 D2X_FEATURES="macdata ${D2X_FEATURES}"
114 AM_CONDITIONAL(MACDATA, test x$enable_macdata = xyes)
116 dnl Build with NDEBUG?
118 [ --disable-debug Take out debug symbols, Asserts, Int3, etc ],,)
119 if test x$enable_debug = xno; then
120 AC_DEFINE(NDEBUG,,[Define to disable asserts, int3, etc.])
124 D2X_FEATURES="debug ${D2X_FEATURES}"
127 dnl Build with RELEASE?
128 AC_ARG_ENABLE(release,
129 [ --enable-release Release build. Removes debug/editor things ],,)
130 if test x$enable_release = xyes; then
131 AC_DEFINE(RELEASE,,[Define for a "release" build])
132 D2X_FEATURES="release ${D2X_FEATURES}"
135 dnl Build without using sdl-joystick ?
136 AC_ARG_ENABLE(linuxjoy,
137 [ --enable-linuxjoy do not use the SDL Joystick. (eg for MS Sidewinder)],,)
138 if test x$enable_linuxjoy = xyes; then
139 AC_DEFINE(USE_LINUX_JOY,,[define to not use the SDL_Joystick routines.])
141 AM_CONDITIONAL(USE_LINUX_JOY, test x$enable_linuxjoy = xyes)
143 dnl Build with FAST_FILE_IO?
144 AC_ARG_ENABLE(fastfileio,
145 [ --disable-fastfileio Disable fast file i/o. ],,)
146 if test x$enable_fastfileio != xno; then
147 if test x$ac_cv_c_bigendian = xyes; then
148 AC_MSG_WARN([big-endian cpu detected. disabling fastfileio])
149 enable_fastfileio="no";
152 if test x$enable_fastfileio != xno; then
153 AC_DEFINE(FAST_FILE_IO,,[Define for faster i/o on little-endian cpus])
154 D2X_FEATURES="fastfileio ${D2X_FEATURES}"
157 dnl Build with CONSOLE?
158 AC_ARG_ENABLE(console,
159 [ --enable-console Enable console (experimental) ],,)
160 if test x$enable_console = xyes; then
161 AC_DEFINE(CONSOLE,,[Define to enable console])
164 AM_CONDITIONAL(CONSOLE, test x$enable_console = xyes)
166 AC_ARG_WITH(sharepath,
167 [[ --with-sharepath=DIR Use DIR for shared game data (unix only) [DATADIR/games/d2x]]],
168 sharepath=$withval, sharepath="auto")
169 if test "x$sharepath" = "xauto" -o "x$sharepath" = "xyes" -o "x$sharepath" = "x"; then
170 sharepath="$default_sharepath"
173 eval sharepath=$sharepath
174 AC_DEFINE_UNQUOTED(SHAREPATH, "$sharepath",[Define this to be the shared game directory root])
177 if test x$MSDOS = xyes; then
178 CFLAGS="-I \$(top_srcdir)/arch/dos/include $CFLAGS"
183 CFLAGS="-pipe $CFLAGS"
188 AC_MSG_ERROR(SDL not found. Make sure sdl-config is in your PATH, or specify with --with-sdl-prefix)
190 CFLAGS="$SDL_CFLAGS $CFLAGS"
191 LIBS="$SDL_LIBS $LIBS"
196 AC_CHECK_HEADERS(netipx/ipx.h)
198 # Check for SDL_image
199 AC_CHECK_LIB(SDL_image, IMG_ReadXPMFromArray,
200 LIBS="-lSDL_image $LIBS"
201 AC_DEFINE(SDL_IMAGE,,[Define if you have the SDL_image library]))
205 [ --with-opengl Build OpenGL support ],,)
206 if test x$with_opengl = xyes; then
207 for lib in $GL_LIBS; do
208 AC_CHECK_LIB($lib, main,
209 OGL_LIBS="${OGL_LIBS} -l$lib",
210 [AC_MSG_ERROR([$lib not found, --with-opengl cannot be used])
215 AC_DEFINE(OGL,,[Define if you want an OpenGL build])
217 D2X_ARCH_SUBDIRS="ogl ${D2X_ARCH_SUBDIRS}"
220 AM_CONDITIONAL(USE_OPENGL, test x$with_opengl = xyes)
224 [ --with-ggi Build GGI support ],,)
225 if test x$with_ggi = xyes; then
226 AC_CHECK_LIB(ggi, ggiInit,
228 [AC_MSG_ERROR([GGI not found, GGI version cannot be built]); ggi=false])
229 AC_CHECK_LIB(gii, giiInit,
230 GGI_LIBS="${GGI_LIBS} -lgii",
231 [AC_MSG_ERROR([GII not found, GGI version cannot be built]); ggi=false])
232 AC_DEFINE(GGI,,[Define if you want a GGI build])
234 D2X_ARCH_SUBDIRS="ggi ${D2X_ARCH_SUBDIRS}"
237 AM_CONDITIONAL(USE_GGI, test x$with_ggi = xyes)
241 [ --with-svga Build SVGALib support ],,)
242 if test x$with_svga = xyes; then
243 AC_CHECK_LIB(vga,vga_getmousetype,
245 [AC_MSG_ERROR([vga not found, SVGALib cannot be built])
248 AC_CHECK_LIB(vgagl,gl_getcontext,
249 SVGA_LIBS="${SVGA_LIBS} -lvgagl",
250 [AC_MSG_ERROR([vgagl not found, SVGALib cannot be built])
253 AC_DEFINE(SVGA,,[Define if you want an SVGALib build])
255 D2X_ARCH_SUBDIRS="svgalib ${D2X_ARCH_SUBDIRS}"
258 AM_CONDITIONAL(USE_SVGALIB, test x$with_svga = xyes)
260 if test x$MINGW32 = xyes; then
261 D2X_ARCH_SUBDIRS="win32 ${D2X_ARCH_SUBDIRS}"
263 CFLAGS="-I \$(top_srcdir)/arch/linux/include $CFLAGS"
264 D2X_ARCH_SUBDIRS="linux ${D2X_ARCH_SUBDIRS}"
268 dnl Check for network
269 AC_ARG_ENABLE(network,
270 [ --disable-network Do not build network/serial support ],,)
271 if test x$enable_network != xno; then
273 cygwin* | mingw* | msdos* | linux*)
274 enable_native_ipx="yes";
277 AC_MSG_WARN([d2x doesn't support native ipx on this host. disabling native ipx])
278 enable_native_ipx="no";
283 AC_CHECK_LIB(socket, socket, LIBS="${LIBS} -lsocket",
284 [AC_MSG_ERROR(socket lib required for net support on solaris not found)])
285 AC_CHECK_LIB(nsl, inet_addr, LIBS="${LIBS} -lnsl",
286 [AC_MSG_ERROR(nsl lib required for net support on solaris not found)])
290 if test x$enable_network != xno; then
291 if test x$enable_native_ipx != xno; then
292 D2X_FEATURES="ipx ${D2X_FEATURES}"
293 AC_DEFINE(NATIVE_IPX,,[Define to use the IPX support of the OS])
295 AC_DEFINE(NETWORK,,[Define if you want a network build])
296 D2X_FEATURES="network ${D2X_FEATURES}"
298 AM_CONDITIONAL(USE_NETWORK, test x$enable_network != xno)
299 AM_CONDITIONAL(USE_NATIVE_IPX, test x$enable_native_ipx != xno)
301 dnl Check for assembler
302 AC_ARG_ENABLE(assembler,
303 [ --disable-assembler Do not use assembler optimization ],,)
304 if test x$enable_assembler != xno; then
305 if test x$NASM = xno; then
306 AC_MSG_WARN([nasm not found. disabling assembler])
307 enable_assembler="no"
309 NASMFLAGS="-i\$(srcdir)/ $NASMFLAGS"
312 NASMFLAGS="-f win32 $NASMFLAGS"
315 NASMFLAGS="-f coff $NASMFLAGS"
318 NASMFLAGS="-f elf -d__linux__ $NASMFLAGS"
321 AC_MSG_WARN([nasm not supported for this OS. disabling assembler])
322 enable_assembler="no"
327 if test x$enable_assembler = xno; then
328 AC_DEFINE(NO_ASM,,[Define if you want an assembler free build])
329 D2X_FEATURES="no_asm ${D2X_FEATURES}"
331 AM_CONDITIONAL(USE_ASM, test x$enable_assembler != xno)
334 /* General defines */
335 #ifndef PACKAGE_STRING
336 #define PACKAGE_STRING PACKAGE " " VERSION
338 #define VERSION_NAME PACKAGE_STRING
340 #define PIGGY_USE_PAGING 1
343 #if defined(__APPLE__) && defined(__MACH__)
353 # define SVGALIB_INPUT 1
354 # define SVGALIB_VIDEO 1
358 # define SDL_GL_VIDEO 1
369 # define SDL_GL_VIDEO 1
378 AC_SUBST(D2X_SUBDIRS)
380 AC_SUBST(D2X_ARCH_SUBDIRS)
382 AC_SUBST(D2X_MAIN_SUBDIRS)
400 arch/svgalib/Makefile
419 d2x has been configured successfully.
421 Platform(s): $D2X_ARCH_SUBDIRS
422 Features : $D2X_FEATURES $D2X_SUBDIRS $D2X_MAIN_SUBDIRS
424 Shared game data directory (unix only): $sharepath