]> icculus.org git repositories - btb/d2x.git/blob - configure.ac
fix nasm not found error message
[btb/d2x.git] / configure.ac
1 # -*- mode: shell-script -*-
2 AC_INIT(main/inferno.c)
3
4 AC_CANONICAL_BUILD
5 AC_CANONICAL_HOST
6
7 AM_CONFIG_HEADER(conf.h)
8 AM_INIT_AUTOMAKE(d2x, 0.1.2)
9
10 AM_MAINTAINER_MODE
11
12 #kludge to keep autoconf from adding -g -O2
13 CFLAGS=" $CFLAGS"
14
15 AC_PROG_INSTALL
16 AC_PROG_MAKE_SET
17 AC_ISC_POSIX
18 AC_CHECK_TOOL(CC, gcc, :)
19 AC_CHECK_TOOL(RANLIB, ranlib, :)
20 AC_CHECK_TOOL(STRIP, strip, :)
21 AC_CHECK_TOOL(AR, ar, :)
22 AC_PROG_CC
23 AC_STDC_HEADERS
24 AC_PATH_PROGS(NASM, nasmw nasm, no)
25
26 AC_CYGWIN
27 AC_MINGW32
28 if test x$CYGWIN = xyes; then
29     AC_MSG_WARN([Cygwin found, setting -mno-cygwin])
30     CFLAGS="-mno-cygwin $CFLAGS"
31     MINGW32=yes
32 fi
33
34 AM_CONDITIONAL(MINGW32, test x$MINGW32 = xyes)
35 if test x$MINGW32 = xyes; then
36     GL_LIBS="opengl32 glu32"
37 else
38     GL_LIBS="GL GLU"
39 fi
40
41 CFLAGS="-Wall $CFLAGS"
42
43 dnl Enable editor build?
44 AC_ARG_ENABLE(editor,
45   [  --enable-editor         Build editor? (not functional)],,)
46 if test x$enable_editor = xyes; then
47     AC_DEFINE(EDITOR)
48     D2X_MAIN_SUBDIRS=editor
49 fi
50 AM_CONDITIONAL(EDITOR, test x$enable_editor = xyes)
51
52 dnl Enable shareware build?
53 AC_ARG_ENABLE(shareware,
54   [  --enable-shareware      Build for demo datafiles (not functional)],,)
55 if test x$enable_shareware = xyes; then
56     AC_DEFINE(SHAREWARE)
57 fi
58 AM_CONDITIONAL(SHAREWARE, test x$enable_shareware = xyes)
59
60 dnl Enable movie trick?
61 AC_ARG_ENABLE(movies,
62   [  --enable-movie-trick    Enable trick to show movies],,)
63 if test x$enable_movie_trick = xyes; then
64     AC_DEFINE(MOVIE_TRICK)
65 fi
66 AM_CONDITIONAL(MOVIE_TRICK, test x$enable_movie_trick = xyes)
67
68 dnl Enable NMOVIES?
69 AC_ARG_ENABLE(nmovies,
70   [  --enable-nmovies        Turn off movies (render endlevel flythrough)],,)
71 if test x$enable_nmovies = xyes; then
72     AC_DEFINE(NMOVIES)
73 fi
74 AM_CONDITIONAL(NMOVIES, test x$enable_nmovies = xyes)
75
76 dnl Enable cross-platform bitmap/palette loader?
77 AC_ARG_ENABLE(xploader,
78   [  --enable-xploader       Enable cross-platform bitmap/palette loader ],,)
79 if test x$enable_xploader = xyes; then
80     AC_DEFINE(PORTABLE_LOADER)
81 fi
82
83 dnl Count warnings as errors?
84 AC_ARG_ENABLE(werror,
85   [  --enable-werror         Count compiler warning as errors ],,)
86 if test x$enable_werror = xyes; then
87     CFLAGS="-Werror $CFLAGS"
88 fi
89
90 dnl Build with NDEBUG?
91 AC_ARG_ENABLE(debug,
92   [  --disable-debug         Take out debug symbols, Asserts, Int3, etc ],,)
93 if test x$enable_debug = xno; then
94     AC_DEFINE(NDEBUG)
95     CFLAGS="-O2 $CFLAGS"
96 else
97     CFLAGS="-g $CFLAGS"
98 fi
99
100 # Test for DJGPP
101 AM_CONDITIONAL(DJGPP, test "$host_os" = "msdosdjgpp")
102 if test "$host_os" = "msdosdjgpp"; then
103
104   CFLAGS="-I \$(top_srcdir)/arch/dos/include $CFLAGS"
105   TARGETS=d2x
106   D2X_ARCH_SUBDIRS=dos
107 else
108
109   CFLAGS="-pipe $CFLAGS"
110
111   dnl Check for SDL
112   AM_PATH_SDL(1.1.7,
113     :,
114     AC_MSG_ERROR(SDL not found. Make sure sdl-config is in your PATH, or specify with --with-sdl-prefix)
115   )
116   CFLAGS="$SDL_CFLAGS $CFLAGS"
117   LIBS="$SDL_LIBS $LIBS"
118
119   TARGETS=d2x-sdl
120   D2X_ARCH_SUBDIRS=sdl
121
122   AC_CHECK_HEADERS(netipx/ipx.h)
123
124   # Check for OpenGL
125   AC_ARG_WITH(opengl,
126     [  --with-opengl           Build OpenGL support ],,)
127   if test x$with_opengl = xyes; then
128     for lib in $GL_LIBS; do
129         AC_CHECK_LIB($lib, main,
130             OGL_LIBS="${OGL_LIBS} -l$lib",
131             [AC_MSG_ERROR([$lib not found, --with-opengl cannot be used])
132             opengl=false],
133             ${OGL_LIBS}
134         )
135     done
136     AC_DEFINE(OGL)
137     TARGETS=d2x-ogl
138     D2X_ARCH_SUBDIRS="ogl ${D2X_ARCH_SUBDIRS}"
139   fi
140   AC_SUBST(OGL_LIBS)
141   AM_CONDITIONAL(USE_OPENGL, test x$with_opengl = xyes)
142
143   # Check for GGI
144   AC_ARG_WITH(ggi,
145     [  --with-ggi              Build GGI support ],,)
146   if test x$with_ggi = xyes; then
147     AC_CHECK_LIB(ggi, ggiInit,
148       GGI_LIBS="-lggi",
149       [AC_MSG_ERROR([GGI not found, GGI version cannot be built]); ggi=false])
150     AC_CHECK_LIB(gii, giiInit,
151       GGI_LIBS="${GGI_LIBS} -lgii",
152       [AC_MSG_ERROR([GII not found, GGI version cannot be built]); ggi=false])
153     AC_DEFINE(GGI)
154     TARGETS=d2x-ggi
155     D2X_ARCH_SUBDIRS="ggi ${D2X_ARCH_SUBDIRS}"
156   fi
157   AC_SUBST(GGI_LIBS)
158   AM_CONDITIONAL(USE_GGI, test x$with_ggi = xyes)
159
160   # Check for SVGALib
161   AC_ARG_WITH(svga,
162     [  --with-svga             Build SVGALib support ],,)
163   if test x$with_svga = xyes; then
164     AC_CHECK_LIB(vga,vga_getmousetype,
165       SVGA_LIBS="-lvga",
166       [AC_MSG_ERROR([vga not found, SVGALib cannot be built])
167        svga=false],
168        )
169     AC_CHECK_LIB(vgagl,gl_getcontext,
170       SVGA_LIBS="${SVGA_LIBS} -lvgagl",
171       [AC_MSG_ERROR([vgagl not found, SVGALib cannot be built])
172        svga=false],
173        -lvga)
174     AC_DEFINE(SVGA)
175     TARGETS=d2x-svga
176     D2X_ARCH_SUBDIRS="svgalib ${D2X_ARCH_SUBDIRS}"
177   fi
178   AC_SUBST(SVGA_LIBS)
179   AM_CONDITIONAL(USE_SVGALIB, test x$with_svga = xyes)
180
181   if test x$MINGW32 = xyes; then
182     D2X_ARCH_SUBDIRS="win32 ${D2X_ARCH_SUBDIRS}"
183     AC_DEFINE(SDL_JOYSTICK)
184   else
185     CFLAGS="-I \$(top_srcdir)/arch/linux/include $CFLAGS"
186     D2X_ARCH_SUBDIRS="linux ${D2X_ARCH_SUBDIRS}"
187
188     dnl Check for SDL joystick
189     AC_ARG_ENABLE(sdl-joystick,
190       [  --enable-sdl-joystick   Use SDL joystick (required for mingw) ],,)
191     if test x$enable_sdl_joystick = xyes; then
192         AC_DEFINE(SDL_JOYSTICK)
193     fi
194     AM_CONDITIONAL(SDL_JOYSTICK, test x$enable_sdl_joystick = xyes)
195   fi
196 fi
197
198 dnl Check for network
199 AC_ARG_ENABLE(network,
200   [  --disable-network       Do not build network/serial support ],,)
201 if test x$enable_network != xno; then
202     AC_DEFINE(NETWORK)
203 fi
204 AM_CONDITIONAL(USE_NETWORK, test x$enable_network != xno)
205
206 dnl Check for assembler
207 AC_ARG_ENABLE(assembler,
208   [  --disable-assembler     Do not use assembler optimization ],,)
209 if test x$enable_assembler = xno; then
210     AC_DEFINE(NO_ASM)
211 else
212     if test x$NASM = xno; then
213         AC_MSG_ERROR([nasm not found. Install it or use --disable-assembler])
214     else
215         NASMFLAGS="-i\$(srcdir)/ $NASMFLAGS"
216         case $host_os in
217           cygwin)
218               NASMFLAGS="-f win32 $NASMFLAGS"
219               ;;
220           msdosdjgpp)
221               NASMFLAGS="-f coff $NASMFLAGS"
222               ;;
223           linux*)
224               NASMFLAGS="-f elf -d__linux__ $NASMFLAGS"
225               ;;
226           *)
227               AC_MSG_ERROR([Assembler not supported for this OS])
228         esac
229     fi
230 fi
231 AM_CONDITIONAL(USE_ASM, test x$enable_assembler != xno)
232
233 AM_PROG_AS
234
235 AC_SUBST(D2X_ARCH_SUBDIRS)
236
237 AC_SUBST(D2X_MAIN_SUBDIRS)
238
239 AC_SUBST(TARGETS)
240
241 AC_SUBST(NASMFLAGS)
242
243 AC_SUBST(CFLAGS)
244
245 AC_OUTPUT(
246 Makefile
247 2d/Makefile
248 3d/Makefile
249 arch/Makefile
250 arch/dos/Makefile
251 arch/ggi/Makefile
252 arch/linux/Makefile
253 arch/ogl/Makefile
254 arch/sdl/Makefile
255 arch/svgalib/Makefile
256 arch/win32/Makefile
257 cfile/Makefile
258 iff/Makefile
259 main/Makefile
260 main/editor/Makefile
261 maths/Makefile
262 mem/Makefile
263 misc/Makefile
264 texmap/Makefile
265 )