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])
48 AC_MSG_WARN([Cygwin found, setting -mno-cygwin])
49 CFLAGS="-mno-cygwin $CFLAGS"
63 AM_CONDITIONAL(MINGW32, test x$MINGW32 = xyes)
64 if test x$MINGW32 = xyes; then
65 GL_LIBS="opengl32 glu32"
66 elif test x$MACOSX = xyes; then
72 AM_CONDITIONAL(MACOSX, test x$MACOSX = xyes)
74 dnl Set $prefix and $exec_prefix to $ac_default_prefix if they are not set
75 test "x$prefix" = "xNONE" && prefix=$ac_default_prefix
76 test "x$exec_prefix" = "xNONE" && exec_prefix="${prefix}"
78 dnl Set default locations to find data files.
79 default_sharepath="$datadir/games/$PACKAGE"
81 CFLAGS="-Wall $CFLAGS"
83 dnl Enable editor build?
85 [ --enable-editor Build editor? (not functional)],,)
86 if test x$enable_editor = xyes; then
87 AC_DEFINE(EDITOR,,[Define if you want to build the editor])
88 D2X_MAIN_SUBDIRS=editor
90 AM_CONDITIONAL(EDITOR, test x$enable_editor = xyes)
92 dnl Enable macdata build?
93 AC_ARG_ENABLE(macdata,
94 [ --enable-macdata Build for mac datafiles],,)
95 if test x$enable_macdata = xyes; then
96 AC_DEFINE(MACDATA,,[Define if you want to build for mac datafiles])
97 D2X_FEATURES="macdata ${D2X_FEATURES}"
99 AM_CONDITIONAL(MACDATA, test x$enable_macdata = xyes)
101 dnl Build with NDEBUG?
103 [ --disable-debug Take out debug symbols, Asserts, Int3, etc ],,)
104 if test x$enable_debug = xno; then
105 AC_DEFINE(NDEBUG,,[Define to disable asserts, int3, etc.])
109 D2X_FEATURES="debug ${D2X_FEATURES}"
112 dnl Build with RELEASE?
113 AC_ARG_ENABLE(release,
114 [ --enable-release Release build. Removes debug/editor things ],,)
115 if test x$enable_release = xyes; then
116 AC_DEFINE(RELEASE,,[Define for a "release" build])
117 D2X_FEATURES="release ${D2X_FEATURES}"
120 dnl Build without using sdl-joystick ?
121 AC_ARG_ENABLE(linuxjoy,
122 [ --enable-linuxjoy do not use the SDL Joystick. (eg for MS Sidewinder)],,)
123 if test x$enable_linuxjoy = xyes; then
124 AC_DEFINE(USE_LINUX_JOY,,[define to not use the SDL_Joystick routines.])
126 AM_CONDITIONAL(USE_LINUX_JOY, test x$enable_linuxjoy = xyes)
128 dnl Build with FAST_FILE_IO?
129 AC_ARG_ENABLE(fastfileio,
130 [ --disable-fastfileio Disable fast file i/o. ],,)
131 if test x$enable_fastfileio != xno; then
132 if test x$ac_cv_c_bigendian = xyes; then
133 AC_MSG_WARN([big-endian cpu detected. disabling fastfileio])
134 enable_fastfileio="no";
137 if test x$enable_fastfileio != xno; then
138 AC_DEFINE(FAST_FILE_IO,,[Define for faster i/o on little-endian cpus])
139 D2X_FEATURES="fastfileio ${D2X_FEATURES}"
142 dnl Build with CONSOLE?
143 AC_ARG_ENABLE(console,
144 [ --enable-console Enable console (very experimental) ],,)
145 if test x$enable_console = xyes; then
146 AC_DEFINE(CONSOLE,,[Define to enable console])
147 D2X_FEATURES="console ${D2X_FEATURES}"
150 AC_ARG_WITH(sharepath,
151 [[ --with-sharepath=DIR Use DIR for shared game data (unix only) [DATADIR/games/d2x]]],
152 sharepath=$withval, sharepath="auto")
153 if test "x$sharepath" = "xauto" -o "x$sharepath" = "xyes" -o "x$sharepath" = "x"; then
154 sharepath="$default_sharepath"
157 eval sharepath=$sharepath
158 AC_DEFINE_UNQUOTED(SHAREPATH, "$sharepath",[Define this to be the shared game directory root])
161 if test x$MSDOS = xyes; then
162 CFLAGS="-I \$(top_srcdir)/arch/dos/include $CFLAGS"
167 CFLAGS="-pipe $CFLAGS"
172 AC_MSG_ERROR(SDL not found. Make sure sdl-config is in your PATH, or specify with --with-sdl-prefix)
174 CFLAGS="$SDL_CFLAGS $CFLAGS"
175 LIBS="$SDL_LIBS $LIBS"
180 AC_CHECK_HEADERS(netipx/ipx.h)
182 # Check for SDL_image
183 AC_CHECK_LIB(SDL_image, IMG_ReadXPMFromArray,
184 LIBS="-lSDL_image $LIBS"
185 AC_DEFINE(SDL_IMAGE,,[Define if you have the SDL_image library]))
189 [ --with-opengl Build OpenGL support ],,)
190 if test x$with_opengl = xyes; then
191 for lib in $GL_LIBS; do
192 AC_CHECK_LIB($lib, main,
193 OGL_LIBS="${OGL_LIBS} -l$lib",
194 [AC_MSG_ERROR([$lib not found, --with-opengl cannot be used])
199 AC_DEFINE(OGL,,[Define if you want an OpenGL build])
201 D2X_ARCH_SUBDIRS="ogl ${D2X_ARCH_SUBDIRS}"
204 AM_CONDITIONAL(USE_OPENGL, test x$with_opengl = xyes)
208 [ --with-ggi Build GGI support ],,)
209 if test x$with_ggi = xyes; then
210 AC_CHECK_LIB(ggi, ggiInit,
212 [AC_MSG_ERROR([GGI not found, GGI version cannot be built]); ggi=false])
213 AC_CHECK_LIB(gii, giiInit,
214 GGI_LIBS="${GGI_LIBS} -lgii",
215 [AC_MSG_ERROR([GII not found, GGI version cannot be built]); ggi=false])
216 AC_DEFINE(GGI,,[Define if you want a GGI build])
218 D2X_ARCH_SUBDIRS="ggi ${D2X_ARCH_SUBDIRS}"
221 AM_CONDITIONAL(USE_GGI, test x$with_ggi = xyes)
225 [ --with-svga Build SVGALib support ],,)
226 if test x$with_svga = xyes; then
227 AC_CHECK_LIB(vga,vga_getmousetype,
229 [AC_MSG_ERROR([vga not found, SVGALib cannot be built])
232 AC_CHECK_LIB(vgagl,gl_getcontext,
233 SVGA_LIBS="${SVGA_LIBS} -lvgagl",
234 [AC_MSG_ERROR([vgagl not found, SVGALib cannot be built])
237 AC_DEFINE(SVGA,,[Define if you want an SVGALib build])
239 D2X_ARCH_SUBDIRS="svgalib ${D2X_ARCH_SUBDIRS}"
242 AM_CONDITIONAL(USE_SVGALIB, test x$with_svga = xyes)
244 if test x$MINGW32 = xyes; then
245 D2X_ARCH_SUBDIRS="win32 ${D2X_ARCH_SUBDIRS}"
247 CFLAGS="-I \$(top_srcdir)/arch/linux/include $CFLAGS"
248 D2X_ARCH_SUBDIRS="linux ${D2X_ARCH_SUBDIRS}"
252 dnl Check for network
253 AC_ARG_ENABLE(network,
254 [ --disable-network Do not build network/serial support ],,)
255 if test x$enable_network != xno; then
256 if test x$MACOSX = xyes; then
257 AC_MSG_WARN([OS X detected. disabling network])
261 if test x$enable_network != xno; then
262 AC_DEFINE(NETWORK,,[Define if you want a network build])
263 D2X_FEATURES="network ${D2X_FEATURES}"
265 AM_CONDITIONAL(USE_NETWORK, test x$enable_network != xno)
267 dnl Check for assembler
268 AC_ARG_ENABLE(assembler,
269 [ --disable-assembler Do not use assembler optimization ],,)
270 if test x$enable_assembler != xno; then
271 if test x$NASM = xno; then
272 AC_MSG_WARN([nasm not found. disabling assembler])
273 enable_assembler="no"
275 NASMFLAGS="-i\$(srcdir)/ $NASMFLAGS"
278 NASMFLAGS="-f win32 $NASMFLAGS"
281 NASMFLAGS="-f coff $NASMFLAGS"
284 NASMFLAGS="-f elf -d__linux__ $NASMFLAGS"
287 AC_MSG_WARN([nasm not supported for this OS. disabling assembler])
288 enable_assembler="no"
293 if test x$enable_assembler = xno; then
294 AC_DEFINE(NO_ASM,,[Define if you want an assembler free build])
295 D2X_FEATURES="no_asm ${D2X_FEATURES}"
297 AM_CONDITIONAL(USE_ASM, test x$enable_assembler != xno)
300 /* General defines */
301 #define VERSION_NAME PACKAGE_STRING
303 #define PIGGY_USE_PAGING 1
306 #if defined(__APPLE__) && defined(__MACH__)
316 # define SVGALIB_INPUT 1
317 # define SVGALIB_VIDEO 1
321 # define SDL_GL_VIDEO 1
332 # define SDL_GL_VIDEO 1
341 AC_SUBST(D2X_ARCH_SUBDIRS)
343 AC_SUBST(D2X_MAIN_SUBDIRS)
361 arch/svgalib/Makefile
378 d2x has been configured successfully.
380 Platform(s): $D2X_ARCH_SUBDIRS
381 Features : $D2X_FEATURES $D2X_MAIN_SUBDIRS
383 Shared game data directory (unix only): $sharepath