No longer #ifdef'ing out the whole file. RCS header added
[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.1.1)
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 if test x$CYGWIN = xyes; then
25     AC_MSG_WARN([Cygwin found, setting -mno-cygwin])
26     CFLAGS="$CFLAGS -mno-cygwin"
27     MINGW32=yes
28 fi
29
30 AM_CONDITIONAL(MINGW32, test x$MINGW32 = xyes)
31 if test x$MINGW32 = xyes; then
32     GL_LIBS="opengl32 glu32"
33     NASM_PROG=nasmw
34 else
35     GL_LIBS="GL GLU"
36     NASM_PROG=nasm
37 fi
38
39 CFLAGS="$CFLAGS -O2 -Wall"
40
41 dnl Enable editor build?
42 AC_ARG_ENABLE(editor,
43   [  --enable-editor         Build editor? ],,)
44 if test x$enable_editor = xyes; then
45     AC_DEFINE(EDITOR)
46 fi
47 AM_CONDITIONAL(EDITOR, test x$enable_editor = xyes)
48
49 dnl Enable cross-platform bitmap/palette loader?
50 AC_ARG_ENABLE(xploader,
51   [  --enable-xploader       Enable xp bitmap/palette loader ],,)
52 if test x$enable_xploader = xyes; then
53     AC_DEFINE(PORTABLE_LOADER)
54 fi
55
56 dnl Count warnings as errors?
57 AC_ARG_ENABLE(werror,
58   [  --enable-werror         Count compiler warning as errors ],,)
59 if test x$enable_werror = xyes; then
60     CFLAGS="-Werror $CFLAGS"
61 fi
62
63 dnl Build with NDEBUG?
64 AC_ARG_ENABLE(debug,
65   [  --disable-debug         Take out debug symbols, Asserts, Int3, etc ],,)
66 if test x$enable_debug = xno; then
67     AC_DEFINE(NDEBUG)
68 else
69     CFLAGS="-g $CFLAGS"
70 fi
71
72 # Test for DJGPP
73 AM_CONDITIONAL(ENV_DJGPP, test "$host_os" = "msdosdjgpp")
74 if test "$host_os" = "msdosdjgpp"; then
75
76   CFLAGS="-I \$(top_srcdir)/arch/dos/include $CFLAGS"
77   AC_PATH_PROG(NASM, nasm, no)
78   D2X_ARCH_SUBDIRS=dos
79 else
80
81   CFLAGS="-pipe $CFLAGS"
82
83   D2X_ARCH_SUBDIRS=sdl
84   if test x$MINGW32 = xyes; then
85     D2X_ARCH_SUBDIRS="win32 ${D2X_ARCH_SUBDIRS}"
86   else
87     D2X_ARCH_SUBDIRS="linux ${D2X_ARCH_SUBDIRS}"
88   fi
89
90   dnl Check for SDL
91   AM_PATH_SDL(1.1.7,
92     :,
93     AC_MSG_ERROR(SDL not found. Make sure sdl-config is in your PATH, or specify with --with-sdl-prefix)
94   )
95   AC_SUBST(SDL_LIBS)
96
97   CFLAGS="$SDL_CFLAGS $CFLAGS"
98
99   AC_CHECK_HEADERS(netipx/ipx.h)
100
101   # Check for OpenGL
102   AC_ARG_WITH(opengl,
103     [  --with-opengl           Build OpenGL support ],,)
104   if test x$with_opengl = xyes; then
105     for lib in $GL_LIBS; do
106         AC_CHECK_LIB($lib, main,
107             OGL_LIBS="${OGL_LIBS} -l$lib",
108             [AC_MSG_ERROR([$lib not found, --with-opengl cannot be used])
109             opengl=false],
110             ${OGL_LIBS}
111         )
112     done
113     AC_DEFINE(OGL)
114   fi
115   AC_SUBST(OGL_LIBS)
116   AM_CONDITIONAL(USE_OPENGL, test x$with_opengl = xyes)
117
118   # Check for GGI
119   AC_ARG_WITH(ggi,
120     [  --with-ggi              Build GGI support ],,)
121   if test x$with_ggi = xyes; then
122     AC_CHECK_LIB(ggi, ggiInit,
123       GGI_LIBS="-lggi",
124       [AC_MSG_ERROR([GGI not found, GGI version cannot be built]); ggi=false])
125     AC_CHECK_LIB(gii, giiInit,
126       GGI_LIBS="${GGI_LIBS} -lgii",
127       [AC_MSG_ERROR([GII not found, GGI version cannot be built]); ggi=false])
128     AC_DEFINE(GGI)
129   fi
130   AC_SUBST(GGI_LIBS)
131   AM_CONDITIONAL(USE_GGI, test x$with_ggi = xtrue)
132
133   # Check for SVGALib
134   AC_ARG_WITH(svga,
135     [  --with-svga             Build SVGALib support ],,)
136   if test x$with_svga = xyes; then
137     AC_CHECK_LIB(vga,vga_getmousetype,
138       SVGA_LIBS="-lvga",
139       [AC_MSG_ERROR([vga not found, SVGALib cannot be built])
140        svga=false],
141        )
142     AC_CHECK_LIB(vgagl,gl_getcontext,
143       SVGA_LIBS="${SVGA_LIBS} -lvgagl",
144       [AC_MSG_ERROR([vgagl not found, SVGALib cannot be built])
145        svga=false],
146        -lvga)
147     AC_DEFINE(SVGA)
148   fi
149   AC_SUBST(SVGA_LIBS)
150   AM_CONDITIONAL(USE_SVGALIB, test x$with_svga = yes)
151
152   AC_PATH_PROG(NASM, $NASM_PROG, no)
153 fi
154
155 dnl Check for network
156 AC_ARG_ENABLE(network,
157   [  --disable-network       Do not build network/serial support ],,)
158 if test x$enable_network != xno; then
159     AC_DEFINE(NETWORK)
160 fi
161 AM_CONDITIONAL(USE_NETWORK, test x$enable_network != xno)
162
163 dnl Check for assembler
164 AC_ARG_ENABLE(assembler,
165   [  --disable-assembler     Do not use assembler optimization ],,)
166 if test x$enable_assembler = xno; then
167     AC_DEFINE(NO_ASM)
168 else
169     if test x$NASM = xno; then
170         AC_MSG_ERROR([$NASM_PROG not found. Install it or use --disable-assembler])
171     else
172         NASMFLAGS="-i\$(srcdir)/ $NASMFLAGS"
173         case $host_os in
174           cygwin)
175               NASMFLAGS="-f win32 $NASMFLAGS"
176               ;;
177           msdosdjgpp)
178               NASMFLAGS="-f coff $NASMFLAGS"
179               ;;
180           linux*)
181               NASMFLAGS="-f elf -d__linux__ $NASMFLAGS"
182               ;;
183           *)
184               AC_MSG_ERROR([Assembler not supported for this OS])
185         esac
186     fi
187 fi
188 AM_CONDITIONAL(USE_ASM, test x$enable_assembler != xno)
189
190 AC_SUBST(D2X_ARCH_SUBDIRS)
191
192 AC_SUBST(NASMFLAGS)
193
194 AC_SUBST(CFLAGS)
195
196 AC_OUTPUT(
197 Makefile
198 2d/Makefile
199 3d/Makefile
200 arch/Makefile
201 arch/dos/Makefile
202 arch/linux/Makefile
203 arch/sdl/Makefile
204 arch/win32/Makefile
205 cfile/Makefile
206 iff/Makefile
207 input/Makefile
208 main/Makefile
209 maths/Makefile
210 mem/Makefile
211 misc/Makefile
212 sound/Makefile
213 texmap/Makefile
214 video/Makefile
215 )