]> icculus.org git repositories - btb/d2x.git/blob - configure.in
Little fixes
[btb/d2x.git] / configure.in
1 # -*- mode: shell-script -*-
2 AC_INIT(main/inferno.c)
3
4 AC_VALIDATE_CACHED_SYSTEM_TUPLE(
5         rm $cache_file
6         echo restart configure
7         exit 1
8 )
9
10 AM_CONFIG_HEADER(conf.h)
11 AM_INIT_AUTOMAKE(d2x, 0.1.1)
12
13 AM_MAINTAINER_MODE
14
15 AC_PROG_INSTALL
16 AC_CHECK_TOOL(CC, gcc, :)
17 AC_ISC_POSIX
18 AC_CHECK_TOOL(RANLIB, ranlib, :)
19 AC_CHECK_TOOL(AR, ar, :)
20 AC_STDC_HEADERS
21
22 AC_CYGWIN
23 if test x$CYGWIN = xyes; then
24     AC_MSG_WARN([Cygwin found, setting -mno-cygwin])
25     CFLAGS="$CFLAGS -mno-cygwin"
26 fi
27
28 AC_MINGW32
29 AM_CONDITIONAL(MINGW32, test x$MINGW32 = xyes)
30 if test x$MINGW32 = xyes; then
31     GL_LIBS="opengl32 glu32"
32     NASM_PROG=nasmw
33 else
34     GL_LIBS="GL GLU"
35     NASM_PROG=nasm
36 fi
37
38 CFLAGS="$CFLAGS -O2 -Wall"
39
40 dnl Enable cross-platform bitmap/palette loader?
41 AC_ARG_ENABLE(xploader,
42   [  --enable-xploader       Enable xp bitmap/palette loader ],,)
43 if test x$enable_xploader = xyes; then
44     AC_DEFINE(PORTABLE_LOADER)
45 fi
46
47 dnl Count warnings as errors?
48 AC_ARG_ENABLE(werror,
49   [  --enable-werror         Count compiler warning as errors ],,)
50 if test x$enable_werror = xyes; then
51     CFLAGS="-Werror $CFLAGS"
52 fi
53
54 dnl Build with NDEBUG?
55 AC_ARG_ENABLE(debug,
56   [  --disable-debug         Take out debug symbols, Asserts, Int3, etc ],,)
57 if test x$enable_debug = xno; then
58     AC_DEFINE(NDEBUG)
59 else
60     CFLAGS="-g $CFLAGS"
61 fi
62
63 # Test for DJGPP
64 AM_CONDITIONAL(ENV_DJGPP, test "$host_os" = "msdosdjgpp")
65 if test "$host_os" = "msdosdjgpp"; then
66
67   CFLAGS="-I \$(top_srcdir)/arch/dos/include $CFLAGS"
68   AC_PATH_PROG(NASM, nasm, no)
69   TARGETS=d2x
70   D2X_ARCH_SUBDIRS=dos
71
72 else
73   CFLAGS="-pipe $CFLAGS"
74
75   D2X_ARCH_SUBDIRS=sdl
76   if test x$MINGW32 = xyes; then
77     D2X_ARCH_SUBDIRS="win32 ${D2X_ARCH_SUBDIRS}"
78   else
79     D2X_ARCH_SUBDIRS="linux ${D2X_ARCH_SUBDIRS}"
80   fi
81
82   dnl Check for SDL
83   AM_PATH_SDL(1.1.7,
84     :,
85     AC_MSG_ERROR(SDL not found. Make sure sdl-config is in your PATH, or specify with --with-sdl-prefix)
86   )
87   AC_SUBST(SDL_LIBS)
88
89   AC_CHECK_HEADERS(netipx/ipx.h)
90
91   # Check for OpenGL
92   AC_ARG_WITH(opengl,
93     [  --with-opengl           Build OpenGL support ],
94     [case "${withval}" in
95       yes) opengl=true ;;
96       no)  opengl=false ;;
97       *) AC_MSG_ERROR(bad value ${withval} for --with-opengl) ;;
98     esac],[opengl=false])
99
100   if test x$opengl = xtrue; then
101     for lib in $GL_LIBS; do
102         AC_CHECK_LIB($lib, main,
103             OGL_LIBS="${OGL_LIBS} -l$lib",
104             [AC_MSG_ERROR([$lib not found, --with-opengl cannot be used])
105             opengl=false],
106             ${OGL_LIBS}
107         )
108     done
109   fi
110   AC_SUBST(OGL_LIBS)
111   AM_CONDITIONAL(USE_OPENGL, test x$opengl = xtrue)
112
113   CFLAGS="$SDL_CFLAGS $CFLAGS"
114
115   # Check for GGI
116   AC_ARG_WITH(ggi,
117     [  --with-ggi              Build GGI support ],
118     [case "${withval}" in
119       yes) ggi=true ;;
120       no)  ggi=false ;;
121       *)   AC_MSG_ERROR(bad value ${withval} for --with-ggi) ;;
122     esac],[ggi=false])
123
124   if test x$ggi = xtrue; then
125     AC_CHECK_LIB(ggi, ggiInit,
126       GGI_LIBS="-lggi",
127       [AC_MSG_ERROR([GGI not found, GGI version cannot be built]); ggi=false])
128     AC_CHECK_LIB(gii, giiInit,
129       GGI_LIBS="${GGI_LIBS} -lgii",
130       [AC_MSG_ERROR([GII not found, GGI version cannot be built]); ggi=false])
131   fi
132   AC_SUBST(GGI_LIBS)
133   AM_CONDITIONAL(USE_GGI, test x$ggi = xtrue)
134
135   # Check for SVGALib
136   AC_ARG_WITH(svga,
137     [  --with-svga             Build SVGALib support ],
138     [case "${withval}" in
139       yes) svga=true ;;
140       no)  svga=false ;;
141       *) AC_MSG_ERROR(bad value ${withval} for --with-svga) ;;
142     esac],[svga=false])
143
144   if test x$svga = xtrue; then
145     AC_CHECK_LIB(vga, vga_getmousetype,
146       SVGA_LIBS="-lvga",
147       [AC_MSG_ERROR([vga not found, SVGALib cannot be built])
148        svga=false],
149        )
150     AC_CHECK_LIB(vgagl,gl_getcontext,
151       SVGA_LIBS="${SVGA_LIBS} -lvgagl",
152       [AC_MSG_ERROR([vgagl not found, SVGALib cannot be built])
153        svga=false],
154        -lvga)
155   fi
156   AC_SUBST(SVGA_LIBS)
157   AM_CONDITIONAL(USE_SVGALIB, test x$svga = xtrue)
158
159   if test x$opengl = xtrue; then
160     AC_DEFINE(OGL)
161     TARGETS=d2x-ogl
162   else
163     if test x$svga = xtrue; then
164       AC_DEFINE(SVGA)
165       TARGETS=d2x-svga
166     else
167       if test x$ggi = xtrue; then
168         AC_DEFINE(GGI)
169         TARGETS=d2x-ggi
170       else
171         TARGETS=d2x-sdl
172       fi
173     fi
174   fi
175
176   AC_PATH_PROG(NASM, $NASM_PROG, no)
177   CFLAGS="-I\$(top_srcdir)/input/linux/include -I\$(top_srcdir)/arch/linux/include $CFLAGS"
178
179 fi
180
181 dnl Check for network
182 AC_ARG_ENABLE(network,
183   [  --disable-network       Do not build network/serial support ],,)
184 if test x$enable_network != xno; then
185     AC_DEFINE(NETWORK)
186 fi
187 AM_CONDITIONAL(USE_NETWORK, test x$enable_network != xno)
188
189 dnl Check for assembler
190 AC_ARG_ENABLE(assembler,
191   [  --disable-assembler     Do not use assembler optimization ],,)
192 if test x$enable_assembler = xno; then
193     AC_DEFINE(NO_ASM)
194 else
195     if test x$NASM = xno; then
196         AC_MSG_ERROR([$NASM_PROG not found. Install it or use --disable-assembler])
197     else
198         NASMFLAGS="-i\$(srcdir)/ $NASMFLAGS"
199         case $host_os in
200           cygwin)
201               NASMFLAGS="-f win32 $NASMFLAGS"
202               ;;
203           msdosdjgpp)
204               NASMFLAGS="-f coff $NASMFLAGS"
205               ;;
206           linux*)
207               NASMFLAGS="-f elf -d__linux__ $NASMFLAGS"
208               ;;
209           *)
210               AC_MSG_ERROR([Assembler not supported for this OS])
211         esac
212     fi
213 fi
214 AM_CONDITIONAL(USE_ASM, test x$enable_assembler != xno)
215
216 AC_SUBST(D2X_ARCH_SUBDIRS)
217
218 AC_SUBST(NASMFLAGS)
219
220 AC_SUBST(CFLAGS)
221
222 AC_SUBST(TARGETS)
223
224 AC_ARG_PROGRAM
225
226 #libdir='$(shell pwd)/${top_srcdir}/main'
227 AC_OUTPUT(
228 Makefile
229 2d/Makefile
230 3d/Makefile
231 arch/Makefile
232 arch/dos/Makefile
233 arch/linux/Makefile
234 arch/sdl/Makefile
235 arch/win32/Makefile
236 cfile/Makefile
237 iff/Makefile
238 input/Makefile
239 main/Makefile
240 maths/Makefile
241 mem/Makefile
242 misc/Makefile
243 sound/Makefile
244 texmap/Makefile
245 video/Makefile
246 )