]> icculus.org git repositories - btb/d2x.git/blob - configure.in
Switched from Cygwin to mingw32 on MS boxes. Vastly improved compilability.
[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.0.9)
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 NO_ASM=0
23 NO_NETWORK=0
24 GL_LIBS="GL GLU"
25
26 AC_CYGWIN
27 if test x$CYGWIN = xyes; then
28     AC_MSG_WARN([Cygwin found, setting -mno-cygwin])
29     CFLAGS="$CFLAGS -mno-cygwin"
30 fi
31
32 AC_MINGW32
33 AM_CONDITIONAL(MINGW32, test x$MINGW32 = xyes)
34 if test x$MINGW32 = xyes; then
35     GL_LIBS="opengl32 glu32"
36     AC_MSG_WARN([mingw32 found, disabling network and assembler])
37     NO_ASM=1
38     NO_NETWORK=1
39 fi
40
41 CFLAGS="$CFLAGS -g -O2 -Wall"
42
43 dnl Count warnings as errors?
44 AC_ARG_WITH(werror,
45   [  --with-werror                Count compiler warning as errors ],
46   [case "${withval}" in
47     yes) CFLAGS="-Werror $CFLAGS" ;;
48     no)  ;;
49     *) AC_MSG_ERROR(bad value ${withval} for --with-werror) ;;
50   esac],)
51
52 dnl Build with NDEBUG?
53 AC_ARG_WITH(ndebug,
54   [  --with-ndebug                Take out extra Asserts, Int3, etc ],
55   [case "${withval}" in
56     yes) AC_DEFINE(NDEBUG) ;;
57     no)  ;;
58     *) AC_MSG_ERROR(bad value ${withval} for --with-ndebug) ;;
59   esac],)
60
61 # Test for DJGPP
62 AM_CONDITIONAL(ENV_DJGPP, test "$host_os" = "msdosdjgpp")
63 if test "$host_os" = "msdosdjgpp"; then
64
65   CFLAGS="-I \$(top_srcdir)/arch/dos/include $CFLAGS"
66   AC_DEFINE(__ENV_DJGPP__)
67   AC_PATH_PROG(NASM, nasm, no)
68   TARGETS=d2x
69
70 else
71   CFLAGS="-pipe $CFLAGS"
72
73   case "$host_os" in
74     *linux*) AC_DEFINE(__ENV_LINUX__) ;;
75   esac
76
77   dnl Check for SDL
78   AM_PATH_SDL(1.1.7,
79     :,
80     AC_MSG_ERROR(SDL not found. Make sure sdl-config is in your PATH, or specify with --with-sdl-prefix)
81   )
82   AC_SUBST(SDL_LIBS)
83
84   AC_CHECK_HEADERS(netipx/ipx.h)
85
86   # Check for OpenGL
87   AC_ARG_WITH(opengl,
88     [  --with-opengl                Build OpenGL support ],
89     [case "${withval}" in
90       yes) opengl=true ;;
91       no)  opengl=false ;;
92       *) AC_MSG_ERROR(bad value ${withval} for --with-opengl) ;;
93     esac],[opengl=false])
94
95   if test x$opengl = xtrue; then
96     for lib in $GL_LIBS; do
97         AC_CHECK_LIB($lib, main,
98             OGL_LIBS="$OGL_LIBS -l$lib",
99             [AC_MSG_ERROR([$lib not found, --with-opengl cannot be used])
100             opengl=false],
101         )
102     done
103   fi
104   AC_SUBST(OGL_LIBS)
105   AM_CONDITIONAL(USE_OPENGL, test x$opengl = xtrue)
106
107   CFLAGS="$SDL_CFLAGS $CFLAGS"
108
109   # Check for GGI
110   AC_ARG_WITH(ggi,
111     [  --with-ggi                   Build GGI support ],
112     [case "${withval}" in
113       yes) ggi=true ;;
114       no)  ggi=false ;;
115       *)   AC_MSG_ERROR(bad value ${withval} for --with-ggi) ;;
116     esac],[ggi=false])
117
118   if test x$ggi = xtrue; then
119     AC_CHECK_LIB(ggi, ggiInit,
120       GGI_LIBS="-lggi",
121       [AC_MSG_ERROR([GGI not found, GGI version cannot be built]); ggi=false])
122     AC_CHECK_LIB(gii, giiInit,
123       GGI_LIBS="${GGI_LIBS} -lgii",
124       [AC_MSG_ERROR([GII not found, GGI version cannot be built]); ggi=false])
125   fi
126   AC_SUBST(GGI_LIBS)
127   AM_CONDITIONAL(USE_GGI, test x$ggi = xtrue)
128
129   # Check for SVGALib
130   AC_ARG_WITH(svga,
131     [  --with-svga                  Build SVGALib support ],
132     [case "${withval}" in
133       yes) svga=true ;;
134       no)  svga=false ;;
135       *) AC_MSG_ERROR(bad value ${withval} for --with-svga) ;;
136     esac],[svga=false])
137
138   if test x$svga = xtrue; then
139     AC_CHECK_LIB(vga, vga_getmousetype,
140       SVGA_LIBS="-lvga",
141       [AC_MSG_ERROR([vga not found, SVGALib cannot be built])
142        svga=false],
143        )
144     AC_CHECK_LIB(vgagl,gl_getcontext,
145       SVGA_LIBS="${SVGA_LIBS} -lvgagl",
146       [AC_MSG_ERROR([vgagl not found, SVGALib cannot be built])
147        svga=false],
148        -lvga)
149   fi
150   AC_SUBST(SVGA_LIBS)
151   AM_CONDITIONAL(USE_SVGALIB, test x$svga = xtrue)
152
153   if test x$opengl = xtrue; then
154     AC_DEFINE(OGL)
155     TARGETS=d2x-ogl
156   else
157     if test x$svga = xtrue; then
158       AC_DEFINE(SVGA)
159       TARGETS=d2x-svga
160     else
161       if test x$ggi = xtrue; then
162         AC_DEFINE(GGI)
163         TARGETS=d2x-ggi
164       else
165         TARGETS=d2x-sdl
166       fi
167     fi
168   fi
169
170   AC_PATH_PROG(NASM, nasm, no)
171   CFLAGS="-I\$(top_srcdir)/input/linux/include -I\$(top_srcdir)/arch/linux/include $CFLAGS"
172
173 fi
174
175 # Check for NASM and network
176 AC_ARG_WITH(assembler,
177   [  --without-assembler          Do not use assembler optimization ],
178       if test x$withval = xno; then
179         NO_ASM=1
180       fi)
181 AC_ARG_WITH(network,
182   [  --without-network            Do not build network/serial support ],
183       if test x$withval = xno; then
184         NO_NETWORK=1
185       fi)
186       
187 if test "$NASM" = "no"; then
188         NO_ASM=1 
189 fi
190 if test "$NO_ASM" = 1; then
191         AC_DEFINE(NO_ASM)
192         NASMFLAGS=""
193 else
194         case $host_os in
195           cygwin)
196               NASMFLAGS="-f win32 -i\$(srcdir)/"
197               ;;
198           msdosdjgpp)
199               NASMFLAGS="-f coff -i\$(srcdir)/"
200               ;;
201           linux*)
202               NASMFLAGS="-f elf -d__ENV_LINUX__ -i\$(srcdir)/"
203               ;;
204           *)
205               AC_MSG_ERROR([Assembler not supported for this OS])
206         esac
207 fi  
208 if test "$NO_NETWORK" = 0; then
209         AC_DEFINE(NETWORK)
210 fi
211 AM_CONDITIONAL(USE_ASM, test "$NO_ASM" != 1)
212 AM_CONDITIONAL(USE_NETWORK, test "$NO_NETWORK" != 1)
213
214 AC_SUBST(NASMFLAGS)
215
216 AC_SUBST(CFLAGS)
217
218 AC_SUBST(TARGETS)
219
220 AC_ARG_PROGRAM
221
222 #libdir='$(shell pwd)/${top_srcdir}/main'
223 AC_OUTPUT(
224 Makefile
225 2d/Makefile
226 3d/Makefile
227 arch/Makefile
228 arch/dos/Makefile
229 arch/dos/allg_snd/Makefile
230 arch/dos/allg_snd/sound/Makefile
231 arch/dos/allg_snd/sound/drv/Makefile
232 arch/dos/bak/Makefile
233 arch/dos/comm/Makefile
234 arch/dos/comm/include/Makefile
235 arch/dos/include/Makefile
236 arch/dos/mm_snd/Makefile
237 arch/dos/mm_snd/include/Makefile
238 arch/include/Makefile
239 arch/linux/Makefile
240 arch/linux/include/Makefile
241 arch/win32/Makefile
242 arch/win32/d3dframe/Makefile
243 arch/win32/include/Makefile
244 cfile/Makefile
245 iff/Makefile
246 iff/archive/Makefile
247 includes/Makefile
248 input/Makefile
249 input/linux/Makefile
250 input/linux/include/Makefile
251 main/Makefile
252 main/editor/Makefile
253 main/old/Makefile
254 maths/Makefile
255 mem/Makefile
256 misc/Makefile
257 sound/Makefile
258 texmap/Makefile
259 unused/Makefile
260 unused/bios/Makefile
261 unused/lib/Makefile
262 unused/novga/Makefile
263 unused/pa_null/Makefile
264 unused/ui/Makefile
265 unused/vga/Makefile
266 unused/vga/new/Makefile
267 unused/win95/Makefile
268 video/Makefile
269 tools/Makefile
270 tools/cvs2cl/Makefile
271 )