1 dnl Process this file with aclocal ; automake -a ; autoconf to produce a
2 dnl working configure script.
6 AC_INIT(simgear/bucket/newbucket.cxx)
8 dnl Initialize the automake stuff
9 AM_INIT_AUTOMAKE(SimGear, 0.0.17)
11 dnl Specify KAI C++ compiler and flags.
12 dnl Borrowed with slight modification from blitz distribution.
14 [ --with-cxx=COMPILER[:name-flags] set options for COMPILER (KCC)],
16 KCC*) # KAI C++ http://www.kai.com/
17 echo "Configuring for KAI C++"
18 AC_SG_SET_COMPILER($withval,"KCC","--restrict --strict_warnings")
19 CXX_OPTIMIZE_FLAGS=="+K3 -O3"
20 CXX_DEBUG_FLAGS="-g +K0"
28 dnl Checks for programs.
39 if test "$OS" = "IRIX" -o "$OS" = "IRIX64"; then
40 if test "$CXX" = "CC"; then
46 if echo $includedir | egrep "simgear$" > /dev/null; then
47 echo "includedir is" $includedir "libdir is" $libdir
49 includedir="${includedir}/simgear"
50 echo "includedir changed to" $includedir "libdir is" $libdir
53 # set logging default value
55 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
56 if test "x$with_logging" = "xno" ; then
60 dnl specify if we are building with "checker"
61 AC_ARG_WITH(efence, [ --with-efence Specify if we are building with "electric-fence"])
63 if test "x$with_efence" = "xyes" ; then
64 echo "Building with efence"
68 dnl Check for MS Windows environment
69 AC_CHECK_HEADER(windows.h)
71 if test "$HOSTTYPE" != "macintosh" ; then
72 dnl extra library and include directories
73 EXTRA_DIRS="/usr/local /usr/local/plib /usr/X11R6"
75 if test -d /opt/X11R6 ; then
76 EXTRA_DIRS="$EXTRA_DIRS /opt/X11R6"
79 if test "x$ac_cv_header_windows_h" = "xyes" ; then
80 if test -d /usr/mingw/usr ; then
81 EXTRA_DIRS="$EXTRA_DIRS /usr/mingw/usr"
83 EXTRA_DIRS="${EXTRA_DIRS} `pwd`/Win32"
87 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
89 dnl Using AM_CONDITIONAL is a step out of the protected little
90 dnl automake fold so it is potentially dangerous. But, we are
91 dnl beginning to run into cases where the standard checks are not
92 dnl enough. AM_CONDITIONALS are then referenced to conditionally
93 dnl build a Makefile.in from a Makefile.am which lets us define custom
94 dnl includes, compile alternative source files, etc.
96 dnl Enable serial support on Unix type systems
97 AM_CONDITIONAL(ENABLE_UNIX_SERIAL, true)
99 dnl X11 might be installed on Mac OS X, don't want to use it if it is.
100 if test "$HOSTTYPE" != "macintosh" ; then
101 dnl Check for X11 (fancy)
105 dnl Checks for libraries.
113 dnl Thread related checks
114 AC_CHECK_LIB(pthread, pthread_exit)
115 AC_CHECK_HEADER(pthread.h)
116 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
117 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
118 CFLAGS="$CFLAGS -D_REENTRANT"
120 AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes")
122 AC_CHECK_LIB(socket, socket)
124 dnl X11 might be installed, but we don't want to use it for OSX -dw-
125 if test "$HOSTTYPE" != "macintosh" ; then
126 AC_CHECK_LIB(X11, XCreateWindow)
127 AC_CHECK_LIB(Xext, XShmCreateImage)
128 AC_CHECK_LIB(Xi, XGetExtensionVersion)
129 AC_CHECK_LIB(ICE, IceOpenConnection)
130 AC_CHECK_LIB(SM, SmcOpenConnection)
131 AC_CHECK_LIB(Xt, XtMalloc)
132 AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
135 dnl check for OpenGL related libraries
137 if test "$HOSTTYPE" = "macintosh" ; then
139 LIBS="$LIBS -framework OpenGL -framework GLUT"
140 elif test "x$ac_cv_header_windows_h" != "xyes" ; then
141 dnl Reasonable stuff for non-windoze variants ... :-)
143 AC_CHECK_LIB(GLcore, glNewList)
144 if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
145 dnl if no GLcore, check for GL
146 AC_CHECK_LIB(GL, glNewList)
147 if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
148 dnl if no GL, check for MesaGL
149 AC_CHECK_LIB(MesaGL, glNewList)
152 dnl if GLcore found, then also check for GL
153 AC_CHECK_LIB(GL, glXCreateContext)
156 dnl if using mesa, check for xmesa.h
157 if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; then
158 AC_CHECK_HEADER(GL/xmesa.h)
159 if test "x$ac_cv_header_GL_xmesa_h" = "xyes"; then
165 AC_CHECK_LIB(GLU, gluLookAt)
166 if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
167 dnl if no GLU, check for MesaGLU
168 AC_CHECK_LIB(MesaGLU, gluLookAt)
172 AC_CHECK_LIB(glut, glutGetModifiers)
174 dnl test for glutGameModeString, but avoid adding glut a second time into
175 dnl the list of libraries
177 AC_CHECK_LIB(glut, glutGameModeString)
180 dnl Win32 is a little wierd because it has to try to handle the various
181 dnl winbloze-isms. We'll just do this manually for now.
183 echo Win32 specific hacks...
186 dnl force a failed check since we will be building under windoze
187 AM_CONDITIONAL(ENABLE_XMESA_FX, test "no" = "yes")
189 dnl just define these to true and hope for the best
190 ac_cv_lib_glut_glutGetModifiers="yes"
191 ac_cv_lib_glut_glutGameModeString="yes"
193 if test "x$with_sgi_opengl" = "xyes" ; then
194 echo "Building with glut.dll, glu.dll, and opengl.dll"
199 echo "Building with glut32.dll, glu32.dll, and opengl32.dll"
202 WIN32_OPENGL=opengl32
205 LIBS="$LIBS -l${WIN32_GLUT} -l${WIN32_GLU} -l${WIN32_OPENGL}"
206 LIBS="$LIBS -luser32 -lgdi32"
207 echo "Will link apps with $LIBS"
210 if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno"; then
212 echo "Unable to find the necessary OpenGL or GLUT libraries."
213 echo "See config.log for automated test details and results ..."
217 if test "x$ac_cv_lib_glut_glutGameModeString" = "xno"; then
219 echo "Your version of glut doesn't support game mode."
220 echo "You need to fetch and install the latest version of glut from:"
222 echo " http://reality.sgi.com/opengl/glut3/glut3.html"
230 AC_SUBST(opengl_LIBS)
232 AM_CONDITIONAL(HAVE_XWINDOWS, test "x$ac_cv_lib_X11_XCreateWindow" = "xyes" )
234 dnl Check for "plib" without which we cannot go on
235 AC_CHECK_HEADER(plib/pu.h)
236 if test "x$ac_cv_header_plib_pu_h" != "xyes"; then
238 echo "You *must* have the plib library installed on your system to build"
239 echo "the FGFS simulator!"
241 echo "Please see README.plib for more details."
243 echo "configure aborted."
247 # dnl Check for system installed gdbm
248 # AC_CHECK_HEADER(gdbm.h)
249 # if test "x$ac_cv_header_gdbm_h" = "xyes"; then
250 # AC_DEFINE( HAVE_GDBM )
252 # echo "no gdbm found, configuring and building."
254 # AM_CONDITIONAL(HAVE_GDBM, test "x$ac_cv_header_gdbm_h" = "xyes" )
256 dnl Check for system installed metakit
257 AC_CHECK_HEADER(mk4.h)
258 if test "x$ac_cv_header_mk4_h" != "xyes"; then
259 echo "no metakit found, configuring and building."
260 # Run configure in the metakit subdir
261 AC_CONFIG_SUBDIRS( simgear/metakit/unix )
263 AM_CONDITIONAL(HAVE_METAKIT, test "x$ac_cv_header_mk4_h" = "xyes" )
266 dnl Specify if we want logging (testing build) or not (release build)
268 dnl Check for system installed zlib
269 AC_CHECK_HEADER(zlib.h)
270 if test "x$ac_cv_header_zlib_h" = "xyes"; then
271 AC_DEFINE( HAVE_ZLIB )
273 echo "no zlib found, building."
275 AM_CONDITIONAL(HAVE_ZLIB, test "x$ac_cv_header_zlib_h" = "xyes" )
277 dnl Checks for header files.
280 fcntl.h getopt.h malloc.h memory.h stdint.h stdlib.h sys/param.h \
281 sys/stat.h sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h )
283 if test "x$ac_cv_header_stdint_h" = "xyes"; then
284 AC_DEFINE( HAVE_STDINT_H )
287 dnl Checks for typedefs, structures, and compiler characteristics.
293 dnl Checks for library functions.
296 AC_CHECK_FUNCS( ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
297 random setitimer getitimer signal GetLocalTime rint getrusage )
299 AM_CONFIG_HEADER(simgear/simgear_config.h)
306 simgear/bucket/Makefile \
307 simgear/debug/Makefile \
308 simgear/ephemeris/Makefile \
309 simgear/io/Makefile \
310 simgear/magvar/Makefile \
311 simgear/math/Makefile \
312 simgear/metar/Makefile \
313 simgear/misc/Makefile \
314 simgear/route/Makefile \
315 simgear/screen/Makefile \
316 simgear/serial/Makefile \
317 simgear/sky/Makefile \
318 simgear/threads/Makefile \
319 simgear/timing/Makefile \
320 simgear/xgl/Makefile \
321 simgear/xml/Makefile \
322 simgear/zlib/Makefile \
326 # if test "x$ac_cv_header_windows_h" = "xyes" ; then
327 # cp simgear/gdbm/autoconf.h.cygwin32 simgear/gdbm/autoconf.h
332 echo "Configure Summary"
333 echo "================="
335 echo "Prefix: $prefix"
337 if test "x$with_logging" != "x"; then
338 echo "Debug messages: $with_logging"
340 echo "Debug messages: yes"
343 if test "x$with_efence" != "x"; then
344 echo "Electric fence: $with_efence"
346 echo "Electric fence: no"
349 # if test "x$ac_cv_header_gdbm_h" != "xyes"; then
350 # echo "Building gdbm"
353 if test "x$ac_cv_header_mk4_h" != "xyes"; then
354 echo "Building metakit"
357 if test "x$ac_cv_header_zlib_h" != "xyes"; then
361 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
362 echo "Threads: pthread lib found."
364 echo "Threads: no threads (pthread lib not found.)"
367 if test "$OS" = "IRIX" -o "$OS" = "IRIX64"; then
368 if test "$CXX" = "CC"; then
369 echo "\nRemember to run: sh ../FlightGear/irix-hack.sh!\07\n"