]> git.mxchange.org Git - simgear.git/blob - configure.in
80a230d635e48b842c66aa0703c34e0e8d9fa7bd
[simgear.git] / configure.in
1 dnl Process this file with aclocal ; automake -a ; autoconf to produce a 
2 dnl working configure script.
3 dnl
4 dnl $Id$
5
6 AC_INIT(src/bucket/newbucket.cxx)
7
8 dnl Initialize the automake stuff
9 AM_INIT_AUTOMAKE(SimGear, 0.0.4)
10
11 dnl Checks for programs.
12 AC_PROG_MAKE_SET
13 AC_PROG_CC
14 AC_PROG_CXX
15 AC_PROG_RANLIB
16 AC_PROG_INSTALL
17 AC_PROG_LN_S
18
19 if echo $includedir | egrep "simgear$" > /dev/null; then
20     echo "includedir is" $includedir "libdir is" $libdir
21 else
22     includedir="${includedir}/simgear"
23     echo "includedir changed to" $includedir "libdir is" $libdir
24 fi
25
26
27 dnl Specify if we want logging (testing build) or not (release build)
28 # set logging default value
29 # with_logging=yes
30 AC_ARG_WITH(logging, [  --with-logging          Include logging output (default)])
31 if test "x$with_logging" = "xno" ; then
32     AC_DEFINE(FG_NDEBUG)
33 fi
34
35 dnl specify if we are building with "checker"
36 AC_ARG_WITH(efence, [  --with-efence           Specify if we are building with "electric-fence"])
37
38 if test "x$with_efence" = "xyes" ; then
39     echo "Building with efence"
40     LIBS= "$LIBS -lefence"
41 fi
42
43 dnl Check for MS Windows environment
44 AC_CHECK_HEADER(windows.h)
45
46 dnl extra library and include directories
47 EXTRA_DIRS="/usr/local /usr/local/plib /usr/X11R6"
48
49 if test -d /opt/X11R6 ; then
50      EXTRA_DIRS="$EXTRA_DIRS /opt/X11R6"
51 fi
52
53 if test "x$ac_cv_header_windows_h" = "xyes" ; then
54     EXTRA_DIRS="${EXTRA_DIRS} `pwd`/Win32"
55 # elif test `uname -s` = "SunOS" ; then
56 #   EXTRA_DIRS="${EXTRA_DIRS} `pwd`/SunOS"
57 fi
58 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
59
60 dnl Using AM_CONDITIONAL is a step out of the protected little 
61 dnl automake fold so it is potentially dangerous.  But, we are
62 dnl beginning to run into cases where the standard checks are not
63 dnl enough.  AM_CONDITIONALS are then referenced to conditionally
64 dnl build a Makefile.in from a Makefile.am which lets us define custom
65 dnl includes, compile alternative source files, etc.
66
67 dnl Enable serial support on Unix type systems
68 AM_CONDITIONAL(ENABLE_UNIX_SERIAL, true)
69
70 dnl Check for X11 (fancy)
71 AC_PATH_XTRA
72
73 dnl Checks for libraries.
74
75 null_LIBS="$LIBS"
76
77 AC_CHECK_LIB(m, cos)
78
79 base_LIBS="$LIBS"
80
81 AC_CHECK_LIB(socket, socket)
82 AC_CHECK_LIB(X11, XCreateWindow)
83 AC_CHECK_LIB(Xext, XShmCreateImage)
84 AC_CHECK_LIB(Xi, XGetExtensionVersion)
85 AC_CHECK_LIB(ICE, IceOpenConnection)
86 AC_CHECK_LIB(SM, SmcOpenConnection)
87 AC_CHECK_LIB(Xt, XtMalloc)
88 AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
89
90 dnl check for OpenGL related libraries
91
92 if test "x$ac_cv_header_windows_h" != "xyes" ; then
93     dnl Reasonable stuff for non-windoze variants ... :-)
94
95     AC_CHECK_LIB(GLcore, glNewList)
96     if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
97         dnl if no GLcore, check for GL
98         AC_CHECK_LIB(GL, glNewList)
99         if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
100             dnl if no GL, check for MesaGL
101             AC_CHECK_LIB(MesaGL, glNewList)
102         fi
103     else
104         dnl if GLcore found, then also check for GL
105         AC_CHECK_LIB(GL, glXCreateContext)
106     fi
107
108     dnl if using mesa, check for xmesa.h
109     if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; then
110         AC_CHECK_HEADER(GL/xmesa.h)
111         if test "x$ac_cv_header_GL_xmesa_h" = "xyes"; then
112             AC_DEFINE( XMESA )
113             AC_DEFINE( FX )
114         fi
115     fi
116
117     AC_CHECK_LIB(GLU, gluLookAt)
118     if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
119         dnl if no GLU, check for MesaGLU
120         AC_CHECK_LIB(MesaGLU, gluLookAt)
121     fi
122
123     dnl check for glut
124     AC_CHECK_LIB(glut, glutGetModifiers)
125
126     dnl test for glutGameModeString, but avoid adding glut a second time into
127     dnl the list of libraries
128     save_LIBS="$LIBS"
129     AC_CHECK_LIB(glut, glutGameModeString)
130     LIBS="$save_LIBS"
131 else
132     dnl Win32 is a little wierd because it has to try to handle the various
133     dnl winbloze-isms.  We'll just do this manually for now.
134
135     echo Win32 specific hacks...
136     AC_DEFINE(WIN32)
137
138     dnl force a failed check since we will be building under windoze
139     AM_CONDITIONAL(ENABLE_XMESA_FX, test "no" = "yes")
140
141     dnl just define these to true and hope for the best
142     ac_cv_lib_glut_glutGetModifiers="yes"
143     ac_cv_lib_glut_glutGameModeString="yes"
144
145     if test "x$with_sgi_opengl" = "xyes" ; then
146         echo "Building with glut.dll, glu.dll, and opengl.dll"
147         WIN32_GLUT=glut
148         WIN32_GLU=glu
149         WIN32_OPENGL=opengl
150     else 
151         echo "Building with glut32.dll, glu32.dll, and opengl32.dll"
152         WIN32_GLUT=glut32
153         WIN32_GLU=glu32
154         WIN32_OPENGL=opengl32
155     fi
156
157     LIBS="$LIBS -l${WIN32_GLUT} -l${WIN32_GLU} -l${WIN32_OPENGL}"
158     LIBS="$LIBS -luser32 -lgdi32"
159     echo "Will link apps with $LIBS"
160 fi
161
162 if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno"; then
163     echo 
164     echo "Unable to find the necessary OpenGL or GLUT libraries."
165     echo "See config.log for automated test details and results ..."
166     exit 1
167 fi
168
169 if test "x$ac_cv_lib_glut_glutGameModeString" = "xno"; then
170     echo
171     echo "Your version of glut doesn't support game mode."
172     echo "You need to fetch and install the latest version of glut from:"
173     echo
174     echo "    http://reality.sgi.com/opengl/glut3/glut3.html"
175     exit 1
176 fi
177
178 opengl_LIBS="$LIBS"
179 LIBS="$base_LIBS"
180
181 AC_SUBST(base_LIBS)
182 AC_SUBST(opengl_LIBS)
183
184 AM_CONDITIONAL(HAVE_XWINDOWS, test "x$ac_cv_lib_X11_XCreateWindow" = "xyes" )
185
186 dnl Check for "plib" without which we cannot go on
187 AC_CHECK_HEADER(plib/pu.h)
188 if test "x$ac_cv_header_plib_pu_h" != "xyes"; then
189     echo
190     echo "You *must* have the plib library installed on your system to build"
191     echo "the FGFS simulator!"
192     echo
193     echo "Please see README.plib for more details."
194     echo
195     echo "configure aborted."
196     exit
197 fi
198
199 dnl Check for system installed zlib
200 AC_CHECK_HEADER(zlib.h)
201 if test "x$ac_cv_header_zlib_h" = "xyes"; then
202     AC_DEFINE( HAVE_ZLIB )
203 else
204     echo "no zlib found, building."
205 fi
206 AM_CONDITIONAL(HAVE_ZLIB, test "x$ac_cv_header_zlib_h" = "xyes" )
207
208 dnl Checks for header files.
209 AC_HEADER_STDC
210 AC_CHECK_HEADERS( \
211         fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
212         sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h )
213
214 dnl Checks for typedefs, structures, and compiler characteristics.
215 AC_C_CONST
216 AC_TYPE_SIZE_T
217 AC_HEADER_TIME
218 AC_STRUCT_TM
219
220 dnl Checks for library functions.
221 AC_TYPE_SIGNAL
222 AC_FUNC_VPRINTF
223 AC_CHECK_FUNCS( ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
224         random setitimer getitimer signal GetLocalTime rint getrusage )
225
226 AM_CONFIG_HEADER(src/include/config.h)
227
228 AC_OUTPUT( \
229         Makefile \
230         src/Makefile \
231         src/include/Makefile \
232         src/include/version.h \
233         src/bucket/Makefile \
234         src/debug/Makefile \
235         src/math/Makefile \
236         src/misc/Makefile \
237         src/screen/Makefile \
238         src/serial/Makefile \
239         src/xgl/Makefile \
240         src/zlib/Makefile \
241 )
242
243 AC_OUTPUT_COMMANDS([./mksymlinks.sh])
244
245 echo ""
246 echo "Configure Summary"
247 echo "================="
248
249 echo "Prefix: $prefix"
250
251 if test "x$with_logging" != "x"; then
252     echo "Debug messages: $with_logging"
253 else
254     echo "Debug messages: yes"
255 fi
256
257 if test "x$with_efence" != "x"; then
258     echo "Electric fence: $with_efence"
259 else
260     echo "Electric fence: no"
261 fi