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_MSG_WARN([Cygwin found, setting -mno-cygwin])
43 CFLAGS="-mno-cygwin $CFLAGS"
57 AM_CONDITIONAL(MINGW32, test x$MINGW32 = xyes)
58 if test x$MINGW32 = xyes; then
59 GL_LIBS="opengl32 glu32"
60 elif test x$MACOSX = xyes; then
66 if test x$MACOSX = xyes; then
67 AC_DEFINE(__MACOSX__,,[Define if building on MAC OS X])
69 AM_CONDITIONAL(MACOSX, test x$MACOSX = xyes)
71 dnl Set $prefix and $exec_prefix to $ac_default_prefix if they are not set
72 test "x$prefix" = "xNONE" && prefix=$ac_default_prefix
73 test "x$exec_prefix" = "xNONE" && exec_prefix="${prefix}"
75 dnl Set default locations to find data files.
76 default_sharepath="$datadir/games/$PACKAGE"
78 CFLAGS="-Wall $CFLAGS"
80 dnl Enable editor build?
82 [ --enable-editor Build editor? (not functional)],,)
83 if test x$enable_editor = xyes; then
84 AC_DEFINE(EDITOR,,[Define if you want to build the editor])
85 D2X_MAIN_SUBDIRS=editor
87 AM_CONDITIONAL(EDITOR, test x$enable_editor = xyes)
89 dnl Enable shareware build?
90 AC_ARG_ENABLE(shareware,
91 [ --enable-shareware Build for demo datafiles (not functional)],,)
92 if test x$enable_shareware = xyes; then
93 AC_DEFINE(SHAREWARE,,[Define if you want to build the demo version])
94 D2X_FEATURES="shareware ${D2X_FEATURES}"
96 AM_CONDITIONAL(SHAREWARE, test x$enable_shareware = xyes)
98 dnl Build with NDEBUG?
100 [ --disable-debug Take out debug symbols, Asserts, Int3, etc ],,)
101 if test x$enable_debug = xno; then
102 AC_DEFINE(NDEBUG,,[Define to disable asserts, int3, etc.])
106 D2X_FEATURES="debug ${D2X_FEATURES}"
109 dnl Build with RELEASE?
110 AC_ARG_ENABLE(release,
111 [ --enable-release Release build. Removes debug/editor things ],,)
112 if test x$enable_release = xyes; then
113 AC_DEFINE(RELEASE,,[Define for a "release" build])
114 D2X_FEATURES="release ${D2X_FEATURES}"
117 dnl Build with FAST_FILE_IO?
118 AC_ARG_ENABLE(fastfileio,
119 [ --disable-fastfileio Disable fast file i/o. ],,)
120 if test x$enable_fastfileio != xno; then
121 if test x$ac_cv_c_bigendian = xyes; then
122 AC_MSG_WARN([big-endian cpu detected. disabling fastfileio])
123 enable_fastfileio="no";
126 if test x$enable_fastfileio != xno; then
127 AC_DEFINE(FAST_FILE_IO,,[Define for faster i/o on little-endian cpus])
128 D2X_FEATURES="fastfileio ${D2X_FEATURES}"
131 AC_ARG_WITH(sharepath,
132 [[ --with-sharepath=DIR Use DIR for shared game data (unix only) [DATADIR/games/d2x]]],
133 sharepath=$withval, sharepath="auto")
134 if test "x$sharepath" = "xauto" -o "x$sharepath" = "xyes" -o "x$sharepath" = "x"; then
135 sharepath="$default_sharepath"
138 eval sharepath=$sharepath
139 AC_DEFINE_UNQUOTED(SHAREPATH, "$sharepath",[Define this to be the shared game directory root])
142 if test x$MSDOS = xyes; then
143 CFLAGS="-I \$(top_srcdir)/arch/dos/include $CFLAGS"
148 CFLAGS="-pipe $CFLAGS"
153 AC_MSG_ERROR(SDL not found. Make sure sdl-config is in your PATH, or specify with --with-sdl-prefix)
155 CFLAGS="$SDL_CFLAGS $CFLAGS"
156 LIBS="$SDL_LIBS $LIBS"
161 AC_CHECK_HEADERS(netipx/ipx.h)
165 [ --with-opengl Build OpenGL support ],,)
166 if test x$with_opengl = xyes; then
167 for lib in $GL_LIBS; do
168 AC_CHECK_LIB($lib, main,
169 OGL_LIBS="${OGL_LIBS} -l$lib",
170 [AC_MSG_ERROR([$lib not found, --with-opengl cannot be used])
175 AC_DEFINE(OGL,,[Define if you want an OpenGL build])
177 D2X_ARCH_SUBDIRS="ogl ${D2X_ARCH_SUBDIRS}"
180 AM_CONDITIONAL(USE_OPENGL, test x$with_opengl = xyes)
184 [ --with-ggi Build GGI support ],,)
185 if test x$with_ggi = xyes; then
186 AC_CHECK_LIB(ggi, ggiInit,
188 [AC_MSG_ERROR([GGI not found, GGI version cannot be built]); ggi=false])
189 AC_CHECK_LIB(gii, giiInit,
190 GGI_LIBS="${GGI_LIBS} -lgii",
191 [AC_MSG_ERROR([GII not found, GGI version cannot be built]); ggi=false])
192 AC_DEFINE(GGI,,[Define if you want a GGI build])
194 D2X_ARCH_SUBDIRS="ggi ${D2X_ARCH_SUBDIRS}"
197 AM_CONDITIONAL(USE_GGI, test x$with_ggi = xyes)
201 [ --with-svga Build SVGALib support ],,)
202 if test x$with_svga = xyes; then
203 AC_CHECK_LIB(vga,vga_getmousetype,
205 [AC_MSG_ERROR([vga not found, SVGALib cannot be built])
208 AC_CHECK_LIB(vgagl,gl_getcontext,
209 SVGA_LIBS="${SVGA_LIBS} -lvgagl",
210 [AC_MSG_ERROR([vgagl not found, SVGALib cannot be built])
213 AC_DEFINE(SVGA,,[Define if you want an SVGALib build])
215 D2X_ARCH_SUBDIRS="svgalib ${D2X_ARCH_SUBDIRS}"
218 AM_CONDITIONAL(USE_SVGALIB, test x$with_svga = xyes)
220 if test x$MINGW32 = xyes; then
221 D2X_ARCH_SUBDIRS="win32 ${D2X_ARCH_SUBDIRS}"
223 CFLAGS="-I \$(top_srcdir)/arch/linux/include $CFLAGS"
224 D2X_ARCH_SUBDIRS="linux ${D2X_ARCH_SUBDIRS}"
228 dnl Check for network
229 AC_ARG_ENABLE(network,
230 [ --disable-network Do not build network/serial support ],,)
231 if test x$enable_network != xno; then
232 AC_DEFINE(NETWORK,,[Define if you want a network build])
233 D2X_FEATURES="network ${D2X_FEATURES}"
235 AM_CONDITIONAL(USE_NETWORK, test x$enable_network != xno)
237 dnl Check for assembler
238 AC_ARG_ENABLE(assembler,
239 [ --disable-assembler Do not use assembler optimization ],,)
240 if test x$enable_assembler != xno; then
241 if test x$NASM = xno; then
242 AC_MSG_WARN([nasm not found. disabling assembler])
243 enable_assembler="no"
245 NASMFLAGS="-i\$(srcdir)/ $NASMFLAGS"
248 NASMFLAGS="-f win32 $NASMFLAGS"
251 NASMFLAGS="-f coff $NASMFLAGS"
254 NASMFLAGS="-f elf -d__linux__ $NASMFLAGS"
257 AC_MSG_WARN([nasm not supported for this OS. disabling assembler])
258 enable_assembler="no"
263 if test x$enable_assembler = xno; then
264 AC_DEFINE(NO_ASM,,[Define if you want an assembler free build])
265 D2X_FEATURES="no_asm ${D2X_FEATURES}"
267 AM_CONDITIONAL(USE_ASM, test x$enable_assembler != xno)
270 /* General defines */
272 #define PIGGY_USE_PAGING 1
285 # define SVGALIB_INPUT 1
286 # define SVGALIB_VIDEO 1
290 # define SDL_GL_VIDEO 1
301 # define SDL_GL_VIDEO 1
310 AC_SUBST(D2X_ARCH_SUBDIRS)
312 AC_SUBST(D2X_MAIN_SUBDIRS)
330 arch/svgalib/Makefile
346 d2x has been configured successfully.
348 Platform(s): $D2X_ARCH_SUBDIRS
349 Features : $D2X_FEATURES $D2X_MAIN_SUBDIRS
351 Shared game data directory (unix only): $sharepath