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