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