e59ef10020bdeaafb2792ccea35293f4bbaf53eb
[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_LINUX, test "$OSTYPE" != "MSDOS")
48   AC_DEFINE(__ENV_LINUX__)
49
50
51   AC_CHECK_LIB(SDL, SDL_Init, SDL_LIBS="-lSDL", AC_MSG_ERROR(The SDL which is required not found.),-ldl -lpthread)
52   AC_CHECK_HEADERS(netipx/ipx.h)
53   AC_SUBST(SDL_LIBS)
54
55   # Check for OpenGL
56   AC_ARG_WITH(opengl,
57     [  --with-opengl                Build OpenGL support ],
58     [case "${withval}" in
59       yes) opengl=true ;;
60       no)  opengl=false ;;
61       *) AC_MSG_ERROR(bad value ${withval} for --with-opengl) ;;
62     esac],[opengl=false])
63   
64   if test x$opengl = xtrue; then
65     AC_CHECK_LIB(GL, main,
66       OGL_LIBS="-lGL", 
67       [AC_MSG_ERROR([GL not found, OpenGL cannot be built])
68        opengl=false],
69        )
70     AC_CHECK_LIB(GLU,main,
71       OGL_LIBS="${OGL_LIBS} -lGLU",
72       [AC_MSG_ERROR([GLU not found, OpenGL cannot be built])
73        opengl=false],
74        -lGL)
75   fi
76   AC_SUBST(OGL_LIBS)
77   AM_CONDITIONAL(USE_OPENGL, test x$opengl = xtrue)
78
79   # Check for GGI
80   AC_ARG_WITH(ggi,
81     [  --with-ggi                   Build GGI support ],
82     [case "${withval}" in
83       yes) ggi=true ;;
84       no)  ggi=false ;;
85       *)   AC_MSG_ERROR(bad value ${withval} for --with-ggi) ;;
86     esac],[ggi=false])
87
88   if test x$ggi = xtrue; then
89     AC_CHECK_LIB(ggi, ggiInit,
90       GGI_LIBS="-lggi",
91       [AC_MSG_ERROR([GGI not found, GGI version cannot be built]); ggi=false])
92     AC_CHECK_LIB(gii, giiInit,
93       GGI_LIBS="${GGI_LIBS} -lgii",
94       [AC_MSG_ERROR([GII not found, GGI version cannot be built]); ggi=false])
95   fi
96   AC_SUBST(GGI_LIBS)
97   AM_CONDITIONAL(USE_GGI, test x$ggi = xtrue)
98
99   # Check for SVGALib
100   AC_ARG_WITH(svga,
101     [  --with-svga                  Build SVGALib support ],
102     [case "${withval}" in
103       yes) svga=true ;;
104       no)  svga=false ;;
105       *) AC_MSG_ERROR(bad value ${withval} for --with-svga) ;;
106     esac],[svga=false])
107
108   if test x$svga = xtrue; then
109     AC_CHECK_LIB(vga, vga_getmousetype,
110       SVGA_LIBS="-lvga",
111       [AC_MSG_ERROR([vga not found, SVGALib cannot be built])
112        svga=false],
113        )
114     AC_CHECK_LIB(vgagl,gl_getcontext,
115       SVGA_LIBS="${SVGA_LIBS} -lvgagl",
116       [AC_MSG_ERROR([vgagl not found, SVGALib cannot be built])
117        svga=false],
118        -lvga)
119   fi
120   AC_SUBST(SVGA_LIBS)
121   AM_CONDITIONAL(USE_SVGALIB, test x$svga = xtrue)
122
123   if test x$opengl = xtrue; then
124     AC_DEFINE(OGL)
125     TARGETS=d2x-ogl
126   else
127     if test x$svga = xtrue; then
128       AC_DEFINE(SVGA)
129       TARGETS=d2x-svga
130     else
131       if test x$ggi = xtrue; then
132         AC_DEFINE(GGI)
133         TARGETS=d2x-ggi
134       else
135         TARGETS=d2x-sdl
136       fi
137     fi
138   fi
139
140   AC_PATH_PROG(NASM, nasm, no)
141   CFLAGS="-I\$(top_srcdir)/input/linux/include -I\$(top_srcdir)/arch/linux/include $CFLAGS"
142
143 fi
144
145 # Check for NASM and network
146 NO_ASM=0
147 NO_NETWORK=0
148 AC_ARG_WITH(assembler,
149   [  --without-assembler          Do not use assembler optimization ],
150       if test x$withval = xno; then
151         NO_ASM=1
152       fi)
153 AC_ARG_WITH(network,
154   [  --without-network            Do not build network/serial support ],
155       if test x$withval = xno; then
156         NO_NETWORK=1
157       fi)
158       
159 if test "$NASM" = "no"; then
160         NO_ASM=1 
161 fi
162 if test "$NO_ASM" = 1; then
163         AC_DEFINE(NO_ASM)
164         NASMFLAGS=""
165 else
166         case $ARCH in
167           win32)
168               NASMFLAGS="-f win32"
169               ;;
170           *)
171               if test "$OSTYPE" = "MSDOS"; then
172                   NASMFLAGS="-f coff"
173               else
174                   NASMFLAGS="-f elf -d__ENV_LINUX__ -i\$(srcdir)/"
175               fi
176               ;;
177         esac
178 fi  
179 if test "$NO_NETWORK" = 0; then
180         AC_DEFINE(NETWORK)
181 fi
182 AM_CONDITIONAL(USE_ASM, test "$NO_ASM" != 1)
183 AM_CONDITIONAL(USE_NETWORK, test "$NO_NETWORK" != 1)
184
185 AC_SUBST(NASMFLAGS)
186
187 AC_SUBST(CFLAGS)
188
189 AC_SUBST(TARGETS)
190
191 AC_ARG_PROGRAM
192
193 #libdir='$(shell pwd)/${top_srcdir}/main'
194 AC_OUTPUT(
195 Makefile
196 2d/Makefile
197 3d/Makefile
198 arch/Makefile
199 arch/dos/Makefile
200 arch/dos/allg_snd/Makefile
201 arch/dos/allg_snd/sound/Makefile
202 arch/dos/allg_snd/sound/drv/Makefile
203 arch/dos/bak/Makefile
204 arch/dos/comm/Makefile
205 arch/dos/comm/include/Makefile
206 arch/dos/include/Makefile
207 arch/dos/mm_snd/Makefile
208 arch/dos/mm_snd/include/Makefile
209 arch/include/Makefile
210 arch/ogl/Makefile
211 arch/ogl/include/Makefile
212 arch/linux/Makefile
213 arch/linux/include/Makefile
214 arch/sdl/Makefile
215 arch/win32/Makefile
216 arch/win32/d3dframe/Makefile
217 arch/win32/include/Makefile
218 cfile/Makefile
219 iff/Makefile
220 iff/archive/Makefile
221 includes/Makefile
222 input/Makefile
223 input/linux/Makefile
224 input/linux/include/Makefile
225 main/Makefile
226 main/editor/Makefile
227 main/old/Makefile
228 maths/Makefile
229 mem/Makefile
230 misc/Makefile
231 sound/Makefile
232 texmap/Makefile
233 unused/Makefile
234 unused/bios/Makefile
235 unused/lib/Makefile
236 unused/novga/Makefile
237 unused/pa_null/Makefile
238 unused/ui/Makefile
239 unused/vga/Makefile
240 unused/vga/new/Makefile
241 unused/win95/Makefile
242 video/Makefile
243 tools/Makefile
244 tools/cvs2cl/Makefile
245 )