Turned -Werror back off by default
[btb/d2x.git] / configure.in
1 AC_INIT(main/game.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 #CFLAGS="-g -O2 -Wall -Werror"
18
19 # Test for DJGPP
20 if test "$OSTYPE" = "MSDOS"; then
21
22   CFLAGS="-I \$(top_srcdir)/arch/dos/include $CFLAGS"
23   AM_CONDITIONAL(ENV_DJGPP, test "$OSTYPE" = "MSDOS")
24   AC_DEFINE(__ENV_DJGPP__)
25   AC_PATH_PROG(NASM, nasmw, no)
26
27
28 else
29   CFLAGS="-D_REENTRANT -pipe $CFLAGS"
30   AM_CONDITIONAL(ENV_LINUX, test "$OSTYPE" != "MSDOS")
31   AC_DEFINE(__ENV_LINUX__)
32
33
34   AC_CHECK_LIB(SDL, SDL_Init, SDL_LIBS="-lSDL", AC_MSG_ERROR(The SDL which is required not found.),-ldl -lpthread)
35   AC_CHECK_HEADERS(netipx/ipx.h)
36   AC_SUBST(SDL_LIBS)
37
38   
39   # Check for OpenGL
40   AC_ARG_WITH(opengl,
41     [  --with-opengl                Build OpenGL support ],
42     [case "${withval}" in
43       yes) opengl=true ;;
44       no)  opengl=false ;;
45       *) AC_MSG_ERROR(bad value ${withval} for --with-opengl) ;;
46     esac],[opengl=false])
47   
48   if test x$opengl = xtrue; then
49     AC_CHECK_LIB(GL, main,
50       OGL_LIBS="-lGL", 
51       [AC_MSG_ERROR(GL not found, OpenGL cannot be built)
52        opengl=false],
53        -L/usr/X11R6/lib -lX11 -lXext -lm)
54     AC_CHECK_LIB(GLU,main,
55       OGL_LIBS="${OGL_LIBS} -lGLU",
56       [AC_MSG_ERROR(GLU not found, OpenGL cannot be built)
57        opengl=false],
58        -lGL -L/usr/X11R6/lib -lX11 -lXext -lm)
59   fi
60
61   if test x$opengl = xtrue; then
62     AC_DEFINE(OGL)
63     CFLAGS="-I \$(top_srcdir)/input/ggi/include $CFLAGS"
64   else
65     CFLAGS="-I \$(top_srcdir)/input/sdl/include $CFLAGS"
66   fi
67   AM_CONDITIONAL(USE_OPENGL, test x$opengl = xtrue)
68
69   AC_PATH_PROG(NASM, nasm, no)
70   CFLAGS="-I \$(top_srcdir)/input/linux/include -I \$(top_srcdir)/arch/linux/include $CFLAGS"
71
72 fi
73
74 # Check for NASM and network
75 NO_ASM=0
76 NO_NETWORK=0
77 AC_ARG_WITH(assembler,
78   [  --without-assembler          Do not use assembler optimization ],
79       if test x$withval = xno; then
80         NO_ASM=1
81       fi)
82 AC_ARG_WITH(network,
83   [  --without-network            Do not build network/serial support ],
84       if test x$withval = xno; then
85         NO_NETWORK=1
86       fi)
87       
88 if test "$NASM" = "no"; then
89         NO_ASM=1 
90 fi
91 if test "$NO_ASM" = 1; then
92         AC_DEFINE(NO_ASM)
93         NASMFLAGS=""
94 else
95         case $ARCH in
96           win32)
97               NASMFLAGS="-f win32"
98               ;;
99           *)
100               if test "$OSTYPE" = "MSDOS"; then
101                   NASMFLAGS="-f coff"
102               else
103                   NASMFLAGS="-f elf -d__ENV_LINUX__"
104               fi
105               ;;
106         esac
107 fi  
108 if test "$NO_NETWORK" = 0; then
109         AC_DEFINE(NETWORK)
110 fi
111 AM_CONDITIONAL(USE_ASM, test "$NO_ASM" != 1)
112 AC_SUBST(NASMFLAGS)
113
114 AC_SUBST(CFLAGS)
115
116 AC_ARG_PROGRAM
117
118 #libdir='$(shell pwd)/${top_srcdir}/main'
119 AC_OUTPUT(
120 Makefile
121 2d/Makefile
122 3d/Makefile
123 maths/Makefile
124 mem/Makefile
125 cfile/Makefile
126 iff/Makefile
127 texmap/Makefile
128 misc/Makefile
129 input/Makefile
130 video/Makefile
131 sound/Makefile
132 arch/Makefile
133 main/Makefile
134 )
135