]> icculus.org git repositories - theoddone33/hhexen.git/blob - configure.in
Round 4: Some minor build system housekeeping, as well as removing some depricated...
[theoddone33/hhexen.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 dnl configure.in for HHexen v1.3
3 AC_REVISION([configure.in 1.00])
4 AC_INIT(base/a_action.c)                
5 AC_CONFIG_HEADER(include/config.h)
6
7 # We want these before the checks, so the checks can modify their values.
8
9 dnl **** Command-line arguments ****
10
11 dnl Default values
12 GLHEXEN="false"
13 GLLIBS=""
14 BASELIBS=""
15 SVGALIBS=""
16 LIBS="-L/usr/X11R6/lib"
17 HAVESVGA="no"
18 HAVEX11="yes"
19 HAVEGL="yes"
20 FORCEMESAGL="no"
21
22 AC_ARG_ENABLE(gl,
23 [  --enable-gl                  Enable OpenGL mode],
24 [GLHEXEN="true"; AC_DEFINE(RENDER3D)])
25
26 AC_ARG_ENABLE(gl-mesa,
27 [  --enable-gl-mesa             Enable OpenGL mode for Mesa 3d acceleration],
28 [GLHEXEN="true"; FORCEMESAGL="yes" ;AC_DEFINE(RENDER3D)])
29
30 AC_ARG_ENABLE(demowad,
31 [  --enable-demowad             Enable compilation with the demo wadfile],
32 [ AC_DEFINE(DEMO_WAD)])
33
34 AC_ARG_ENABLE(assassin,
35 [  --disable-assassin           Compile HHexen without support for the assassin],
36 , [AC_DEFINE(ASSASSIN)])
37
38 AC_SUBST(GLHEXEN)
39 AC_SUBST(SVGALIBS)
40
41 AC_DEFINE(_REENTRANT)
42 AC_DEFINE(NORANGECHECKING)
43
44 dnl **** Check for some programs ****
45
46 AC_PROG_CC
47 AC_PROG_CPP
48
49 dnl **** Check for some libraries ****
50
51 dnl Check for pthread
52 AC_CHECK_LIB(pthread, pthread_create, [BASELIBS="-lpthread"])
53 AC_SUBST(BASELIBS)
54
55 dnl Check for SvgaLib
56 AC_CHECK_LIB(vga, vga_setmode, [SVGALIBS="-lvga"; HAVESVGA="yes"])
57
58 dnl Check for all libs needed by X11 version
59 AC_CHECK_LIB(Xext,XShmQueryExtension, [LIBS="$LIBS -lXext"],[HAVEX11="no"])
60 AC_CHECK_LIB(X11, main, [LIBS="$LIBS -lX11"], [HAVEX11="no"])
61 AC_CHECK_LIB(dl, dlopen)
62 AC_CHECK_LIB(m, sqrt)
63
64 dnl Check for GL libraries
65
66 if test "$GLHEXEN" = "true"
67 then
68   if test "$FORCEMESAGL" = "yes"
69   then
70     AC_CHECK_LIB(MesaGL, glBindTexture, ,HAVEGL="no")
71     AC_CHECK_LIB(MesaGLU, gluOrtho2D, ,HAVEGL="no")
72   else
73     AC_CHECK_LIB(GL, glBindTexture,[LIBS="$LIBS -lGL";]
74       AC_CHECK_LIB(GLU, gluOrtho2D, ,
75         AC_CHECK_LIB(MesaGL, glBindTexture,[LIBS="$LIBS -lMesaGL";]
76           AC_CHECK_LIB(MesaGLU, gluOrtho2D, , HAVEGL="no"),
77           HAVEGL="no")
78         ),
79         AC_CHECK_LIB(MesaGL, glBindTexture,[LIBS="$LIBS -lMesaGL";]
80           AC_CHECK_LIB(MesaGLU, gluOrtho2D, , HAVEGL="no"),
81         HAVEGL="no")
82     )
83   fi
84 fi
85
86 dnl **** Check for gcc strength-reduce bug ****
87
88 if test "x${GCC}" = "xyes"
89 then
90   CFLAGS="$CFLAGS -Wall"
91   AC_CACHE_CHECK( "for gcc strength-reduce bug", ac_cv_c_gcc_strength_bug,
92                   AC_TRY_RUN([
93 int main(void) {
94   static int Array[[3]];
95   unsigned int B = 3;
96   int i;
97   for(i=0; i<B; i++) Array[[i]] = i - 3;
98   exit( Array[[1]] != -2 );
99 }],
100     ac_cv_c_gcc_strength_bug="no",
101     ac_cv_c_gcc_strength_bug="yes",
102     ac_cv_c_gcc_strength_bug="yes") )
103   if test "$ac_cv_c_gcc_strength_bug" = "yes"
104   then
105     CFLAGS="$CFLAGS -fno-strength-reduce"
106   fi
107 fi
108
109 dnl **** Check for underscore on external symbols ****
110
111 AC_CACHE_CHECK("whether external symbols need an underscore prefix",
112                ac_cv_c_extern_prefix,
113 [saved_libs=$LIBS
114 LIBS="conftest_asm.s $LIBS"
115 cat > conftest_asm.s <<EOF
116         .globl _ac_test
117 _ac_test:
118         .long 0
119 EOF
120 AC_TRY_LINK([extern int ac_test;],[if (ac_test) return 1],
121             ac_cv_c_extern_prefix="yes",ac_cv_c_extern_prefix="no")
122 LIBS=$saved_libs])
123
124 dnl **** Check for endianness ****
125
126 dnl AC_C_BIGENDIAN
127
128 dnl **** Check for functions ****
129
130 AC_FUNC_ALLOCA()
131
132 dnl **** Check for header files ****
133
134 AC_CHECK_HEADERS(\
135         linux/cdrom.h \
136 )
137 AC_HEADER_STAT()
138
139 dnl **** Check for types ****
140
141 AC_C_CONST()
142 AC_C_INLINE()
143 AC_TYPE_SIZE_T()
144 AC_CHECK_SIZEOF(long long,0)
145
146 dnl **** Generate output files ****
147
148 MAKE_NAME=Makefile
149 AC_SUBST_FILE(MAKE_RULES)
150
151 AC_OUTPUT(Makefile)
152
153 if test "$HAVESVGA" = "no"
154 then
155   echo
156   echo "Warning: It appears that you do not have SvgaLib installed on your system"
157   echo "         If you want to compile with SvgaLib support, you will need to"
158   echo "         download the library from 'http://www.svgalib.org'."
159 fi
160
161 if test "$HAVEX11" = "no"
162 then
163   echo
164   echo "Warning: Configure did not find some necessary libraries for an X11"
165   echo "         build.  Perhaps you do not have X11 installed correctly."
166   echo "         Until this problem is resolved, you won't be able to compile"
167   echo "         the X11 or OpenGL versions."
168 dnl Add this line so we don't get two error messages
169   HAVEGL="yes"
170 fi
171
172 if test "$HAVEGL" = "no"
173 then
174     echo
175     echo "Warning: Configure was not able to find your OpenGL libraries."
176     echo "         Perhaps you do not have them installed correctly. Until"
177     echo "         this problem is resolved, you won't be able to compile"
178     echo "         the OpenGL version of HHexen."
179 fi
180
181 if test "$GLHEXEN" = "true"
182 then
183   echo
184   echo "Configure finished.  Do 'make clean', then 'make' to build the OpenGL version."
185   echo
186 else
187   echo
188   echo "Configure finished. Do 'make clean', then 'make x11' or 'make svgalib' to build"
189   echo
190 fi