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 if test x$CYGWIN = xyes; then
43 AC_MSG_WARN([Cygwin found, setting -mno-cygwin])
44 CFLAGS="-mno-cygwin $CFLAGS"
48 AM_CONDITIONAL(MINGW32, test x$MINGW32 = xyes)
49 if test x$MINGW32 = xyes; then
50 GL_LIBS="opengl32 glu32"
55 dnl Set $prefix and $exec_prefix to $ac_default_prefix if they are not set
56 test "x$prefix" = "xNONE" && prefix=$ac_default_prefix
57 test "x$exec_prefix" = "xNONE" && exec_prefix="${prefix}"
59 dnl Set default locations to find data files.
61 default_sharepath="$foo/games/$PACKAGE"
63 CFLAGS="-Wall $CFLAGS"
65 dnl Enable editor build?
67 [ --enable-editor Build editor? (not functional)],,)
68 if test x$enable_editor = xyes; then
69 AC_DEFINE(EDITOR,,[Define if you want to build the editor])
70 D2X_MAIN_SUBDIRS=editor
72 AM_CONDITIONAL(EDITOR, test x$enable_editor = xyes)
74 dnl Enable shareware build?
75 AC_ARG_ENABLE(shareware,
76 [ --enable-shareware Build for demo datafiles (not functional)],,)
77 if test x$enable_shareware = xyes; then
78 AC_DEFINE(SHAREWARE,,[Define if you want to build the demo version])
79 D2X_FEATURES="shareware ${D2X_FEATURES}"
81 AM_CONDITIONAL(SHAREWARE, test x$enable_shareware = xyes)
83 dnl Enable movie trick?
85 [ --enable-movie-trick Enable trick to show movies (experimental)],,)
86 if test x$enable_movie_trick = xyes; then
87 AC_DEFINE(MOVIE_TRICK,,[Define to enable trick to show movies])
88 D2X_FEATURES="movie_trick ${D2X_FEATURES}"
90 AM_CONDITIONAL(MOVIE_TRICK, test x$enable_movie_trick = xyes)
93 AC_ARG_ENABLE(nmovies,
94 [ --enable-nmovies Turn off movies (render extra sequences) (experimental)],,)
95 if test x$enable_nmovies = xyes; then
96 AC_DEFINE(NMOVIES,,[Define to render some extra sequences (instead of movies)])
97 D2X_FEATURES="nmovies ${D2X_FEATURES}"
99 AM_CONDITIONAL(NMOVIES, test x$enable_nmovies = xyes)
101 dnl Count warnings as errors?
102 AC_ARG_ENABLE(werror,
103 [ --enable-werror Count compiler warning as errors ],,)
104 if test x$enable_werror = xyes; then
105 CFLAGS="-Werror $CFLAGS"
106 D2X_FEATURES="werror ${D2X_FEATURES}"
109 dnl Build with NDEBUG?
111 [ --disable-debug Take out debug symbols, Asserts, Int3, etc ],,)
112 if test x$enable_debug = xno; then
113 AC_DEFINE(NDEBUG,,[Define to disable asserts, int3, etc.])
117 D2X_FEATURES="debug ${D2X_FEATURES}"
120 dnl Build with RELEASE?
121 AC_ARG_ENABLE(release,
122 [ --enable-release Release build. Removes debug/editor things ],,)
123 if test x$enable_release = xyes; then
124 AC_DEFINE(RELEASE,,[Define for a "release" build])
125 D2X_FEATURES="release ${D2X_FEATURES}"
128 AC_ARG_WITH(sharepath,
129 [[ --with-sharepath=DIR Use DIR for shared game data (unix only) [DATADIR/games/d2x]]],
130 sharepath=$withval, sharepath="auto")
131 if test "x$sharepath" = "xauto" -o "x$sharepath" = "xyes" -o "x$sharepath" = "x"; then
132 sharepath="$default_sharepath"
134 AC_DEFINE_UNQUOTED(SHAREPATH, "$sharepath",[Define this to be the shared game directory root])
137 AM_CONDITIONAL(DJGPP, test "$host_os" = "msdosdjgpp")
138 if test "$host_os" = "msdosdjgpp"; then
140 CFLAGS="-I \$(top_srcdir)/arch/dos/include $CFLAGS"
145 CFLAGS="-pipe $CFLAGS"
150 AC_MSG_ERROR(SDL not found. Make sure sdl-config is in your PATH, or specify with --with-sdl-prefix)
152 CFLAGS="$SDL_CFLAGS $CFLAGS"
153 LIBS="$SDL_LIBS $LIBS"
158 AC_CHECK_HEADERS(netipx/ipx.h)
162 [ --with-opengl Build OpenGL support ],,)
163 if test x$with_opengl = xyes; then
164 for lib in $GL_LIBS; do
165 AC_CHECK_LIB($lib, main,
166 OGL_LIBS="${OGL_LIBS} -l$lib",
167 [AC_MSG_ERROR([$lib not found, --with-opengl cannot be used])
172 AC_DEFINE(OGL,,[Define if you want an OpenGL build])
174 D2X_ARCH_SUBDIRS="ogl ${D2X_ARCH_SUBDIRS}"
177 AM_CONDITIONAL(USE_OPENGL, test x$with_opengl = xyes)
181 [ --with-ggi Build GGI support ],,)
182 if test x$with_ggi = xyes; then
183 AC_CHECK_LIB(ggi, ggiInit,
185 [AC_MSG_ERROR([GGI not found, GGI version cannot be built]); ggi=false])
186 AC_CHECK_LIB(gii, giiInit,
187 GGI_LIBS="${GGI_LIBS} -lgii",
188 [AC_MSG_ERROR([GII not found, GGI version cannot be built]); ggi=false])
189 AC_DEFINE(GGI,,[Define if you want a GGI build])
191 D2X_ARCH_SUBDIRS="ggi ${D2X_ARCH_SUBDIRS}"
194 AM_CONDITIONAL(USE_GGI, test x$with_ggi = xyes)
198 [ --with-svga Build SVGALib support ],,)
199 if test x$with_svga = xyes; then
200 AC_CHECK_LIB(vga,vga_getmousetype,
202 [AC_MSG_ERROR([vga not found, SVGALib cannot be built])
205 AC_CHECK_LIB(vgagl,gl_getcontext,
206 SVGA_LIBS="${SVGA_LIBS} -lvgagl",
207 [AC_MSG_ERROR([vgagl not found, SVGALib cannot be built])
210 AC_DEFINE(SVGA,,[Define if you want an SVGALib build])
212 D2X_ARCH_SUBDIRS="svgalib ${D2X_ARCH_SUBDIRS}"
215 AM_CONDITIONAL(USE_SVGALIB, test x$with_svga = xyes)
217 if test x$MINGW32 = xyes; then
218 D2X_ARCH_SUBDIRS="win32 ${D2X_ARCH_SUBDIRS}"
220 CFLAGS="-I \$(top_srcdir)/arch/linux/include $CFLAGS"
221 D2X_ARCH_SUBDIRS="linux ${D2X_ARCH_SUBDIRS}"
225 dnl Check for network
226 AC_ARG_ENABLE(network,
227 [ --disable-network Do not build network/serial support ],,)
228 if test x$enable_network != xno; then
229 AC_DEFINE(NETWORK,,[Define if you want a network build])
230 D2X_FEATURES="network ${D2X_FEATURES}"
232 AM_CONDITIONAL(USE_NETWORK, test x$enable_network != xno)
234 dnl Check for assembler
235 AC_ARG_ENABLE(assembler,
236 [ --disable-assembler Do not use assembler optimization ],,)
237 if test x$enable_assembler = xno; then
238 AC_DEFINE(NO_ASM,,[Define if you want an assembler free build])
239 D2X_FEATURES="no_asm ${D2X_FEATURES}"
241 if test x$NASM = xno; then
242 AC_MSG_ERROR([nasm not found. Install it or use --disable-assembler])
244 NASMFLAGS="-i\$(srcdir)/ $NASMFLAGS"
247 NASMFLAGS="-f win32 $NASMFLAGS"
250 NASMFLAGS="-f coff $NASMFLAGS"
253 NASMFLAGS="-f elf -d__linux__ $NASMFLAGS"
256 AC_MSG_ERROR([Assembler not supported for this OS])
260 AM_CONDITIONAL(USE_ASM, test x$enable_assembler != xno)
263 /* General defines */
265 #define PIGGY_USE_PAGING 1
274 # define SVGALIB_INPUT 1
275 # define SVGALIB_VIDEO 1
279 # define SDL_GL_VIDEO 1
290 # define SDL_GL_VIDEO 1
299 AC_SUBST(D2X_ARCH_SUBDIRS)
301 AC_SUBST(D2X_MAIN_SUBDIRS)
319 arch/svgalib/Makefile
334 d2x has been configured successfully.
336 Platform(s): $D2X_ARCH_SUBDIRS
337 Features : $D2X_FEATURES $D2X_MAIN_SUBDIRS
339 Shared game data directory (unix only): $sharepath