]> icculus.org git repositories - btb/d2x.git/blob - configure.in
Cygwin support, using SDL.
[btb/d2x.git] / configure.in
1 AC_INIT(main/inferno.c)
2
3 AM_CONFIG_HEADER(conf.h)
4 AM_INIT_AUTOMAKE(d2x, 0.0.9)
5
6 AM_MAINTAINER_MODE
7
8 AC_ISC_POSIX
9 AC_PROG_CC
10 AC_PROG_RANLIB
11 AC_STDC_HEADERS
12
13 AC_CYGWIN
14 AC_MINGW32
15
16 CFLAGS="-g -O2 -Wall"
17
18 dnl Count warnings as errors?
19 AC_ARG_ENABLE(werror,
20   [  --enable-werror              Count compiler warning as errors ],
21   [case "${enableval}" in
22     yes) CFLAGS="-Werror $CFLAGS" ;;
23     no)  ;;
24     *) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;;
25   esac],)
26
27 dnl Build with NDEBUG?
28 AC_ARG_ENABLE(ndebug,
29   [  --enable-ndebug              Take out extra Asserts, Int3, etc ],
30   [case "${enableval}" in
31     yes) AC_DEFINE(NDEBUG) ;;
32     no)  ;;
33     *) AC_MSG_ERROR(bad value ${withval} for --enable-ndebug) ;;
34   esac],)
35
36 # Test for DJGPP
37 AM_CONDITIONAL(ENV_DJGPP, test "$OSTYPE" = "MSDOS")
38 if test "$OSTYPE" = "MSDOS"; then
39
40   CFLAGS="-I \$(top_srcdir)/arch/dos/include $CFLAGS"
41   AC_DEFINE(__ENV_DJGPP__)
42   AC_PATH_PROG(NASM, nasmw, no)
43   TARGETS=d2x
44
45 else
46   CFLAGS="-D_REENTRANT -pipe $CFLAGS"
47   AM_CONDITIONAL(ENV_CYGWIN, test "$CYGWIN" = "yes")
48
49   AM_CONDITIONAL(ENV_LINUX, test "$OSTYPE" != "MSDOS")
50   AC_DEFINE(__ENV_LINUX__)
51
52
53   if test "$CYGWIN" = "yes"; then
54     AC_CHECK_LIB(SDL, SDL_Init, SDL_LIBS="-lSDL", AC_MSG_ERROR(The SDL which is required not found.))
55   else
56     AC_CHECK_LIB(SDL, SDL_Init, SDL_LIBS="-lSDL", AC_MSG_ERROR(The SDL which is required not found.),-ldl -lpthread)
57   fi
58   AC_CHECK_HEADERS(netipx/ipx.h)
59   AC_SUBST(SDL_LIBS)
60
61   # Check for OpenGL
62   AC_ARG_WITH(opengl,
63     [  --with-opengl                Build OpenGL support ],
64     [case "${withval}" in
65       yes) opengl=true ;;
66       no)  opengl=false ;;
67       *) AC_MSG_ERROR(bad value ${withval} for --with-opengl) ;;
68     esac],[opengl=false])
69   
70   if test x$opengl = xtrue; then
71     AC_CHECK_LIB(GL, main,
72       OGL_LIBS="-lGL", 
73       [AC_MSG_ERROR([GL not found, OpenGL cannot be built])
74        opengl=false],
75        )
76     AC_CHECK_LIB(GLU,main,
77       OGL_LIBS="${OGL_LIBS} -lGLU",
78       [AC_MSG_ERROR([GLU not found, OpenGL cannot be built])
79        opengl=false],
80        -lGL)
81   fi
82   AC_SUBST(OGL_LIBS)
83   AM_CONDITIONAL(USE_OPENGL, test x$opengl = xtrue)
84
85   # Check for GGI
86   AC_ARG_WITH(ggi,
87     [  --with-ggi                   Build GGI support ],
88     [case "${withval}" in
89       yes) ggi=true ;;
90       no)  ggi=false ;;
91       *)   AC_MSG_ERROR(bad value ${withval} for --with-ggi) ;;
92     esac],[ggi=false])
93
94   if test x$ggi = xtrue; then
95     AC_CHECK_LIB(ggi, ggiInit,
96       GGI_LIBS="-lggi",
97       [AC_MSG_ERROR([GGI not found, GGI version cannot be built]); ggi=false])
98     AC_CHECK_LIB(gii, giiInit,
99       GGI_LIBS="${GGI_LIBS} -lgii",
100       [AC_MSG_ERROR([GII not found, GGI version cannot be built]); ggi=false])
101   fi
102   AC_SUBST(GGI_LIBS)
103   AM_CONDITIONAL(USE_GGI, test x$ggi = xtrue)
104
105   # Check for SVGALib
106   AC_ARG_WITH(svga,
107     [  --with-svga                  Build SVGALib support ],
108     [case "${withval}" in
109       yes) svga=true ;;
110       no)  svga=false ;;
111       *) AC_MSG_ERROR(bad value ${withval} for --with-svga) ;;
112     esac],[svga=false])
113
114   if test x$svga = xtrue; then
115     AC_CHECK_LIB(vga, vga_getmousetype,
116       SVGA_LIBS="-lvga",
117       [AC_MSG_ERROR([vga not found, SVGALib cannot be built])
118        svga=false],
119        )
120     AC_CHECK_LIB(vgagl,gl_getcontext,
121       SVGA_LIBS="${SVGA_LIBS} -lvgagl",
122       [AC_MSG_ERROR([vgagl not found, SVGALib cannot be built])
123        svga=false],
124        -lvga)
125   fi
126   AC_SUBST(SVGA_LIBS)
127   AM_CONDITIONAL(USE_SVGALIB, test x$svga = xtrue)
128
129   if test x$opengl = xtrue; then
130     AC_DEFINE(OGL)
131     TARGETS=d2x-ogl
132   else
133     if test x$svga = xtrue; then
134       AC_DEFINE(SVGA)
135       TARGETS=d2x-svga
136     else
137       if test x$ggi = xtrue; then
138         AC_DEFINE(GGI)
139         TARGETS=d2x-ggi
140       else
141         TARGETS=d2x-sdl
142       fi
143     fi
144   fi
145
146   AC_PATH_PROG(NASM, nasm, no)
147   CFLAGS="-I\$(top_srcdir)/input/linux/include -I\$(top_srcdir)/arch/linux/include $CFLAGS"
148
149 fi
150
151 # Check for NASM and network
152 NO_ASM=0
153 NO_NETWORK=0
154 AC_ARG_WITH(assembler,
155   [  --without-assembler          Do not use assembler optimization ],
156       if test x$withval = xno; then
157         NO_ASM=1
158       fi)
159 AC_ARG_WITH(network,
160   [  --without-network            Do not build network/serial support ],
161       if test x$withval = xno; then
162         NO_NETWORK=1
163       fi)
164       
165 if test "$NASM" = "no"; then
166         NO_ASM=1 
167 fi
168 if test "$NO_ASM" = 1; then
169         AC_DEFINE(NO_ASM)
170         NASMFLAGS=""
171 else
172         case $ARCH in
173           win32)
174               NASMFLAGS="-f win32"
175               ;;
176           *)
177               if test "$OSTYPE" = "MSDOS"; then
178                   NASMFLAGS="-f coff"
179               else
180                   NASMFLAGS="-f elf -d__ENV_LINUX__ -i\$(srcdir)/"
181               fi
182               ;;
183         esac
184 fi  
185 if test "$NO_NETWORK" = 0; then
186         AC_DEFINE(NETWORK)
187 fi
188 AM_CONDITIONAL(USE_ASM, test "$NO_ASM" != 1)
189 AM_CONDITIONAL(USE_NETWORK, test "$NO_NETWORK" != 1)
190
191 AC_SUBST(NASMFLAGS)
192
193 AC_SUBST(CFLAGS)
194
195 AC_SUBST(TARGETS)
196
197 AC_ARG_PROGRAM
198
199 #libdir='$(shell pwd)/${top_srcdir}/main'
200 AC_OUTPUT(
201 Makefile
202 2d/Makefile
203 3d/Makefile
204 arch/Makefile
205 arch/dos/Makefile
206 arch/dos/allg_snd/Makefile
207 arch/dos/allg_snd/sound/Makefile
208 arch/dos/allg_snd/sound/drv/Makefile
209 arch/dos/bak/Makefile
210 arch/dos/comm/Makefile
211 arch/dos/comm/include/Makefile
212 arch/dos/include/Makefile
213 arch/dos/mm_snd/Makefile
214 arch/dos/mm_snd/include/Makefile
215 arch/include/Makefile
216 arch/ogl/Makefile
217 arch/ogl/include/Makefile
218 arch/linux/Makefile
219 arch/linux/include/Makefile
220 arch/win32/Makefile
221 arch/win32/d3dframe/Makefile
222 arch/win32/include/Makefile
223 cfile/Makefile
224 iff/Makefile
225 iff/archive/Makefile
226 includes/Makefile
227 input/Makefile
228 input/linux/Makefile
229 input/linux/include/Makefile
230 main/Makefile
231 main/editor/Makefile
232 main/old/Makefile
233 maths/Makefile
234 mem/Makefile
235 misc/Makefile
236 sound/Makefile
237 texmap/Makefile
238 unused/Makefile
239 unused/bios/Makefile
240 unused/lib/Makefile
241 unused/novga/Makefile
242 unused/pa_null/Makefile
243 unused/ui/Makefile
244 unused/vga/Makefile
245 unused/vga/new/Makefile
246 unused/win95/Makefile
247 video/Makefile
248 tools/Makefile
249 tools/cvs2cl/Makefile
250 )