]> icculus.org git repositories - theoddone33/hhexen.git/blob - configure.in
Round 3: Some minor cross-platform compatibility changes (FreeBSD), still may not...
[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(userconfig,
35 [  --enable-userconfig          Make HHexen store it's config in users' home directories],
36 [ AC_DEFINE(USERCONFIG)])
37
38 AC_ARG_ENABLE(assassin,
39 [  --disable-assassin           Compile HHexen without support for the assassin],
40 , [AC_DEFINE(ASSASSIN)])
41
42 AC_SUBST(GLHEXEN)
43 AC_SUBST(SVGALIBS)
44
45 AC_DEFINE(_REENTRANT)
46 AC_DEFINE(NORANGECHECKING)
47
48 dnl **** Check for some programs ****
49
50 AC_PROG_CC
51 AC_PROG_CPP
52
53 dnl **** Check for some libraries ****
54
55 dnl Check for pthread
56 AC_CHECK_LIB(pthread, pthread_create, [BASELIBS="-lpthread"])
57 AC_SUBST(BASELIBS)
58
59 dnl Check for SvgaLib
60 AC_CHECK_LIB(vga, vga_setmode, [SVGALIBS="-lvga"; HAVESVGA="yes"])
61
62 dnl Check for all libs needed by X11 version
63 AC_CHECK_LIB(Xext,XShmQueryExtension, [LIBS="$LIBS -lXext"],[HAVEX11="no"])
64 AC_CHECK_LIB(X11, main, [LIBS="$LIBS -lX11"], [HAVEX11="no"])
65 AC_CHECK_LIB(dl, dlopen)
66 AC_CHECK_LIB(m, sqrt)
67
68 dnl Check for GL libraries
69
70 if test "$GLHEXEN" = "true"
71 then
72   if test "$FORCEMESAGL" = "yes"
73   then
74     AC_CHECK_LIB(MesaGL, glBindTexture, ,HAVEGL="no")
75     AC_CHECK_LIB(MesaGLU, gluOrtho2D, ,HAVEGL="no")
76   else
77     AC_CHECK_LIB(GL, glBindTexture,[LIBS="$LIBS -lGL";]
78       AC_CHECK_LIB(GLU, gluOrtho2D, ,
79         AC_CHECK_LIB(MesaGL, glBindTexture,[LIBS="$LIBS -lMesaGL";]
80           AC_CHECK_LIB(MesaGLU, gluOrtho2D, , HAVEGL="no"),
81           HAVEGL="no")
82         ),
83         AC_CHECK_LIB(MesaGL, glBindTexture,[LIBS="$LIBS -lMesaGL";]
84           AC_CHECK_LIB(MesaGLU, gluOrtho2D, , HAVEGL="no"),
85         HAVEGL="no")
86     )
87   fi
88 fi
89
90 dnl **** Check for gcc strength-reduce bug ****
91
92 if test "x${GCC}" = "xyes"
93 then
94   CFLAGS="$CFLAGS -Wall"
95   AC_CACHE_CHECK( "for gcc strength-reduce bug", ac_cv_c_gcc_strength_bug,
96                   AC_TRY_RUN([
97 int main(void) {
98   static int Array[[3]];
99   unsigned int B = 3;
100   int i;
101   for(i=0; i<B; i++) Array[[i]] = i - 3;
102   exit( Array[[1]] != -2 );
103 }],
104     ac_cv_c_gcc_strength_bug="no",
105     ac_cv_c_gcc_strength_bug="yes",
106     ac_cv_c_gcc_strength_bug="yes") )
107   if test "$ac_cv_c_gcc_strength_bug" = "yes"
108   then
109     CFLAGS="$CFLAGS -fno-strength-reduce"
110   fi
111 fi
112
113 dnl **** Check for underscore on external symbols ****
114
115 AC_CACHE_CHECK("whether external symbols need an underscore prefix",
116                ac_cv_c_extern_prefix,
117 [saved_libs=$LIBS
118 LIBS="conftest_asm.s $LIBS"
119 cat > conftest_asm.s <<EOF
120         .globl _ac_test
121 _ac_test:
122         .long 0
123 EOF
124 AC_TRY_LINK([extern int ac_test;],[if (ac_test) return 1],
125             ac_cv_c_extern_prefix="yes",ac_cv_c_extern_prefix="no")
126 LIBS=$saved_libs])
127
128 dnl **** Check for endianness ****
129
130 dnl AC_C_BIGENDIAN
131
132 dnl **** Check for functions ****
133
134 AC_FUNC_ALLOCA()
135
136 dnl **** Check for header files ****
137
138 AC_CHECK_HEADERS(\
139         linux/cdrom.h \
140 )
141 AC_HEADER_STAT()
142
143 dnl **** Check for types ****
144
145 AC_C_CONST()
146 AC_C_INLINE()
147 AC_TYPE_SIZE_T()
148 AC_CHECK_SIZEOF(long long,0)
149
150 dnl **** Generate output files ****
151
152 MAKE_NAME=Makefile
153 AC_SUBST_FILE(MAKE_RULES)
154
155 AC_OUTPUT(Makefile)
156
157 if test "$HAVESVGA" = "no"
158 then
159   echo
160   echo "Warning: It appears that you do not have SvgaLib installed on your system"
161   echo "         If you want to compile with SvgaLib support, you will need to"
162   echo "         download the library from 'http://www.svgalib.org'."
163 fi
164
165 if test "$HAVEX11" = "no"
166 then
167   echo
168   echo "Warning: Configure did not find some necessary libraries for an X11"
169   echo "         build.  Perhaps you do not have X11 installed correctly."
170   echo "         Until this problem is resolved, you won't be able to compile"
171   echo "         the X11 or OpenGL versions."
172 dnl Add this line so we don't get two error messages
173   HAVEGL="yes"
174 fi
175
176 if test "$HAVEGL" = "no"
177 then
178     echo
179     echo "Warning: Configure was not able to find your OpenGL libraries."
180     echo "         Perhaps you do not have them installed correctly. Until"
181     echo "         this problem is resolved, you won't be able to compile"
182     echo "         the OpenGL version of HHexen."
183 fi
184
185 if test "$GLHEXEN" = "true"
186 then
187   echo
188   echo "Configure finished.  Do 'make clean', then 'make' to build the OpenGL version."
189   echo
190 else
191   echo
192   echo "Configure finished. Do 'make clean', then 'make x11' or 'make svgalib' to build"
193   echo
194 fi