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 if test x$MACOSX = xyes; then
73 AC_DEFINE(__MACOSX__,,[Define if building on MAC OS X])
75 AM_CONDITIONAL(MACOSX, test x$MACOSX = xyes)
77 dnl Set $prefix and $exec_prefix to $ac_default_prefix if they are not set
78 test "x$prefix" = "xNONE" && prefix=$ac_default_prefix
79 test "x$exec_prefix" = "xNONE" && exec_prefix="${prefix}"
81 dnl Set default locations to find data files.
82 default_sharepath="$datadir/games/$PACKAGE"
84 CFLAGS="-Wall $CFLAGS"
86 dnl Enable editor build?
88 [ --enable-editor Build editor? (not functional)],,)
89 if test x$enable_editor = xyes; then
90 AC_DEFINE(EDITOR,,[Define if you want to build the editor])
91 D2X_MAIN_SUBDIRS=editor
93 AM_CONDITIONAL(EDITOR, test x$enable_editor = xyes)
95 dnl Enable macdata build?
96 AC_ARG_ENABLE(macdata,
97 [ --enable-macdata Build for mac datafiles],,)
98 if test x$enable_macdata = xyes; then
99 AC_DEFINE(MACDATA,,[Define if you want to build for mac datafiles])
100 D2X_FEATURES="macdata ${D2X_FEATURES}"
102 AM_CONDITIONAL(MACDATA, test x$enable_macdata = xyes)
104 dnl Build with NDEBUG?
106 [ --disable-debug Take out debug symbols, Asserts, Int3, etc ],,)
107 if test x$enable_debug = xno; then
108 AC_DEFINE(NDEBUG,,[Define to disable asserts, int3, etc.])
112 D2X_FEATURES="debug ${D2X_FEATURES}"
115 dnl Build with RELEASE?
116 AC_ARG_ENABLE(release,
117 [ --enable-release Release build. Removes debug/editor things ],,)
118 if test x$enable_release = xyes; then
119 AC_DEFINE(RELEASE,,[Define for a "release" build])
120 D2X_FEATURES="release ${D2X_FEATURES}"
123 dnl Build without using sdl-joystick ?
124 AC_ARG_ENABLE(linuxjoy,
125 [ --enable-linuxjoy do not use the SDL Joystick. (eg for MS Sidewinder)],,)
126 if test x$enable_linuxjoy = xyes; then
127 AC_DEFINE(USE_LINUX_JOY,,[define to not use the SDL_Joystick routines.])
129 AM_CONDITIONAL(USE_LINUX_JOY, test x$enable_linuxjoy = xyes)
131 dnl Build with FAST_FILE_IO?
132 AC_ARG_ENABLE(fastfileio,
133 [ --disable-fastfileio Disable fast file i/o. ],,)
134 if test x$enable_fastfileio != xno; then
135 if test x$ac_cv_c_bigendian = xyes; then
136 AC_MSG_WARN([big-endian cpu detected. disabling fastfileio])
137 enable_fastfileio="no";
140 if test x$enable_fastfileio != xno; then
141 AC_DEFINE(FAST_FILE_IO,,[Define for faster i/o on little-endian cpus])
142 D2X_FEATURES="fastfileio ${D2X_FEATURES}"
145 AC_ARG_WITH(sharepath,
146 [[ --with-sharepath=DIR Use DIR for shared game data (unix only) [DATADIR/games/d2x]]],
147 sharepath=$withval, sharepath="auto")
148 if test "x$sharepath" = "xauto" -o "x$sharepath" = "xyes" -o "x$sharepath" = "x"; then
149 sharepath="$default_sharepath"
152 eval sharepath=$sharepath
153 AC_DEFINE_UNQUOTED(SHAREPATH, "$sharepath",[Define this to be the shared game directory root])
156 if test x$MSDOS = xyes; then
157 CFLAGS="-I \$(top_srcdir)/arch/dos/include $CFLAGS"
162 CFLAGS="-pipe $CFLAGS"
167 AC_MSG_ERROR(SDL not found. Make sure sdl-config is in your PATH, or specify with --with-sdl-prefix)
169 CFLAGS="$SDL_CFLAGS $CFLAGS"
170 LIBS="$SDL_LIBS $LIBS"
175 AC_CHECK_HEADERS(netipx/ipx.h)
179 [ --with-opengl Build OpenGL support ],,)
180 if test x$with_opengl = xyes; then
181 for lib in $GL_LIBS; do
182 AC_CHECK_LIB($lib, main,
183 OGL_LIBS="${OGL_LIBS} -l$lib",
184 [AC_MSG_ERROR([$lib not found, --with-opengl cannot be used])
189 AC_DEFINE(OGL,,[Define if you want an OpenGL build])
191 D2X_ARCH_SUBDIRS="ogl ${D2X_ARCH_SUBDIRS}"
194 AM_CONDITIONAL(USE_OPENGL, test x$with_opengl = xyes)
198 [ --with-ggi Build GGI support ],,)
199 if test x$with_ggi = xyes; then
200 AC_CHECK_LIB(ggi, ggiInit,
202 [AC_MSG_ERROR([GGI not found, GGI version cannot be built]); ggi=false])
203 AC_CHECK_LIB(gii, giiInit,
204 GGI_LIBS="${GGI_LIBS} -lgii",
205 [AC_MSG_ERROR([GII not found, GGI version cannot be built]); ggi=false])
206 AC_DEFINE(GGI,,[Define if you want a GGI build])
208 D2X_ARCH_SUBDIRS="ggi ${D2X_ARCH_SUBDIRS}"
211 AM_CONDITIONAL(USE_GGI, test x$with_ggi = xyes)
215 [ --with-svga Build SVGALib support ],,)
216 if test x$with_svga = xyes; then
217 AC_CHECK_LIB(vga,vga_getmousetype,
219 [AC_MSG_ERROR([vga not found, SVGALib cannot be built])
222 AC_CHECK_LIB(vgagl,gl_getcontext,
223 SVGA_LIBS="${SVGA_LIBS} -lvgagl",
224 [AC_MSG_ERROR([vgagl not found, SVGALib cannot be built])
227 AC_DEFINE(SVGA,,[Define if you want an SVGALib build])
229 D2X_ARCH_SUBDIRS="svgalib ${D2X_ARCH_SUBDIRS}"
232 AM_CONDITIONAL(USE_SVGALIB, test x$with_svga = xyes)
234 if test x$MINGW32 = xyes; then
235 D2X_ARCH_SUBDIRS="win32 ${D2X_ARCH_SUBDIRS}"
237 CFLAGS="-I \$(top_srcdir)/arch/linux/include $CFLAGS"
238 D2X_ARCH_SUBDIRS="linux ${D2X_ARCH_SUBDIRS}"
242 dnl Check for network
243 AC_ARG_ENABLE(network,
244 [ --disable-network Do not build network/serial support ],,)
245 if test x$enable_network != xno; then
246 if test x$MACOSX = xyes; then
247 AC_MSG_WARN([OS X detected. disabling network])
250 if test x$MINGW32 = xyes; then
251 AC_MSG_WARN([MINGW detected. disabling network])
255 if test x$enable_network != xno; then
256 AC_DEFINE(NETWORK,,[Define if you want a network build])
257 D2X_FEATURES="network ${D2X_FEATURES}"
259 AM_CONDITIONAL(USE_NETWORK, test x$enable_network != xno)
261 dnl Check for assembler
262 AC_ARG_ENABLE(assembler,
263 [ --disable-assembler Do not use assembler optimization ],,)
264 if test x$enable_assembler != xno; then
265 if test x$NASM = xno; then
266 AC_MSG_WARN([nasm not found. disabling assembler])
267 enable_assembler="no"
269 NASMFLAGS="-i\$(srcdir)/ $NASMFLAGS"
272 NASMFLAGS="-f win32 $NASMFLAGS"
275 NASMFLAGS="-f coff $NASMFLAGS"
278 NASMFLAGS="-f elf -d__linux__ $NASMFLAGS"
281 AC_MSG_WARN([nasm not supported for this OS. disabling assembler])
282 enable_assembler="no"
287 if test x$enable_assembler = xno; then
288 AC_DEFINE(NO_ASM,,[Define if you want an assembler free build])
289 D2X_FEATURES="no_asm ${D2X_FEATURES}"
291 AM_CONDITIONAL(USE_ASM, test x$enable_assembler != xno)
294 /* General defines */
296 #define PIGGY_USE_PAGING 1
309 # define SVGALIB_INPUT 1
310 # define SVGALIB_VIDEO 1
314 # define SDL_GL_VIDEO 1
325 # define SDL_GL_VIDEO 1
334 AC_SUBST(D2X_ARCH_SUBDIRS)
336 AC_SUBST(D2X_MAIN_SUBDIRS)
354 arch/svgalib/Makefile
371 d2x has been configured successfully.
373 Platform(s): $D2X_ARCH_SUBDIRS
374 Features : $D2X_FEATURES $D2X_MAIN_SUBDIRS
376 Shared game data directory (unix only): $sharepath