1 dnl Process this file with autoget.sh to produce a working configure
7 AC_CONFIG_SRCDIR([simgear/bucket/newbucket.cxx])
9 dnl Require at least automake 2.52
12 dnl Initialize the automake stuff
13 AM_INIT_AUTOMAKE(SimGear, 0.3.1)
15 dnl Specify KAI C++ compiler and flags.
16 dnl Borrowed with slight modification from blitz distribution.
18 [ --with-cxx=COMPILER[:name-flags] set options for COMPILER (KCC)],
20 KCC*) # KAI C++ http://www.kai.com/
21 echo "Configuring for KAI C++"
22 AC_SG_SET_COMPILER($withval,"KCC","--restrict --strict_warnings")
23 CXX_OPTIMIZE_FLAGS=="+K3 -O3"
24 CXX_DEBUG_FLAGS="-g +K0"
32 dnl Checks for programs.
41 dnl set the $host variable based on local machine/os
44 dnl Used on the Irix platform
49 if test "$CXX" = "CC"; then
58 if echo $includedir | egrep "simgear$" > /dev/null; then
59 echo "includedir is" $includedir "libdir is" $libdir
61 includedir="${includedir}/simgear"
62 echo "includedir changed to" $includedir "libdir is" $libdir
65 dnl set logging; default value of with_logging=yes
66 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
67 if test "x$with_logging" = "xno" ; then
68 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
71 # Specify if we want to build with Norman's jpeg image server support.
72 # This requires libjpeg to be installed and available.
73 # Default to with_jpeg_server=no
75 AC_ARG_WITH(jpeg_factory, [ --with-jpeg-factory Include Norman's jpeg image factory support code])
76 if test "x$with_jpeg_factory" = "xyes" ; then
77 echo "Building with Norman's jpeg image factory support"
78 AC_CHECK_LIB(jpeg, jpeg_start_compress)
79 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
81 echo "In order to build the jpeg factory code you need libjpeg installed."
82 echo "otherwise please configure with the --with-jpeg-sever=no option"
84 echo "libjpeg is available at :"
85 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
89 echo "Building without Norman's jpeg image server support"
91 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$with_jpeg_factory" = "xyes")
94 dnl Determine an extra directories to add to include/lib search paths
96 *-apple-darwin* | *-*-mingw32*)
97 echo no EXTRA_DIRS for $host
101 if test -d /usr/X11R6 ; then
102 EXTRA_DIR1="/usr/X11R6"
104 if test -d /opt/X11R6 ; then
105 EXTRA_DIR2="/opt/X11R6"
107 EXTRA_DIRS="$EXTRA_DIR1 $EXTRA_DIR2"
111 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
114 dnl Using AM_CONDITIONAL is a step out of the protected little
115 dnl automake fold so it is potentially dangerous. But, we are
116 dnl beginning to run into cases where the standard checks are not
117 dnl enough. AM_CONDITIONALS are then referenced to conditionally
118 dnl build a Makefile.in from a Makefile.am which lets us define custom
119 dnl includes, compile alternative source files, etc.
121 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
122 dnl to use it if it is.
124 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
125 echo no fancy X11 check
134 dnl Checks for libraries.
142 dnl Thread related checks
143 AC_CHECK_LIB(pthread, pthread_exit)
144 AC_CHECK_HEADER(pthread.h)
145 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
146 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
147 CFLAGS="$CFLAGS -D_REENTRANT"
149 AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes")
151 AC_CHECK_LIB(socket, socket)
154 *-*-cygwin* | *-*-mingw32*)
155 dnl CygWin under Windoze.
157 echo Win32 specific hacks...
158 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
159 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
161 LIBS="$LIBS -lglut32 -lglu32 -lopengl32"
162 LIBS="$LIBS -luser32 -lgdi32 -lwinmm"
164 dnl add -lwsock32 for mingwin
167 LIBS="$LIBS -lws2_32"
171 echo "Will link apps with $LIBS"
177 LIBS="$LIBS -framework GLUT -framework OpenGL -framework Carbon -lobjc"
181 dnl X-Windows based machines
183 AC_CHECK_LIB(X11, XCreateWindow)
184 AC_CHECK_LIB(Xext, XShmCreateImage)
185 AC_CHECK_LIB(Xi, XGetExtensionVersion)
186 AC_CHECK_LIB(ICE, IceOpenConnection)
187 AC_CHECK_LIB(SM, SmcOpenConnection)
188 AC_CHECK_LIB(Xt, XtMalloc)
189 AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
191 AC_CHECK_LIB(GLcore, glNewList)
192 if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
193 dnl if no GLcore, check for GL
194 AC_CHECK_LIB(GL, glNewList)
195 if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
196 dnl if no GL, check for MesaGL
197 AC_CHECK_LIB(MesaGL, glNewList)
200 dnl if GLcore found, then also check for GL
201 AC_CHECK_LIB(GL, glXCreateContext)
204 dnl if using mesa, check for xmesa.h
205 if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; then
206 AC_CHECK_HEADER(GL/fxmesa.h)
207 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
208 AC_DEFINE([XMESA], 1, [Define for fxmesa])
209 AC_DEFINE([FX], 1, [Define for fxmesa])
213 AC_CHECK_LIB(GLU, gluLookAt)
214 if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
215 dnl if no GLU, check for MesaGLU
216 AC_CHECK_LIB(MesaGLU, gluLookAt)
224 dnl check for glut location
225 AC_CHECK_HEADER(GL/glut.h)
226 if test "x$ac_cv_header_GL_glut_h" = "xyes"; then
227 AC_DEFINE([GLUT_H], "GL/glut.h", [Define as glut.h include location])
229 AC_CHECK_HEADER(GLUT/glut.h)
230 if test "x$ac_cv_header_GLUT_glut_h" = "xyes"; then
231 AC_DEFINE([GLUT_H], "GLUT/glut.h", [Define as glut.h include location])
233 echo "Neither GL/glut.h nor GLUT/glut.h found. Cannot continue"
242 AC_SUBST(opengl_LIBS)
244 dnl Check for MS Windows environment
245 AC_CHECK_HEADER(windows.h)
246 AM_CONDITIONAL(EXTGL_NEEDED, test "x$ac_cv_header_windows_h" = "xyes")
248 # The following are C++ items that need to be tested for with the c++
253 dnl Check for "plib" without which we cannot go on
254 AC_CHECK_HEADER(plib/ul.h)
255 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
257 echo "You *must* have the plib library installed on your system to build"
260 echo "Please see README.plib for more details."
262 echo "configure aborted."
266 AC_MSG_CHECKING([for plib 1.6.0 or newer])
270 #define MIN_PLIB_VERSION 160
273 int major, minor, micro;
275 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
284 [AC_MSG_RESULT(wrong version);
285 AC_MSG_ERROR([Install plib 1.6.0 or later first...])],
289 dnl Check for MetaKit
290 AC_CHECK_HEADER(mk4.h)
291 if test "x$ac_cv_header_mk4_h" != "xyes"; then
293 echo "MetaKit library not found."
295 echo "If your OS does not provide an installable package for MetaKit"
296 echo "you will have to compile and install it first yourself. A copy"
297 echo "of metakit-$(VERSION).tar.gz is included with SimGear. You will"
298 echo "have to untar this source code, and follow it's included instructions"
299 echo "to compile and install on your system."
301 echo "configure aborted."
305 AC_MSG_CHECKING([for metakit 2.4.3 or newer])
307 LIBS="$saved_LIBS -lmk4"
311 #define MIN_MK4_VERSION 243
314 int major, minor, micro;
316 if ( d4_MetaKitLibraryVersion < MIN_MK4_VERSION ) {
325 [AC_MSG_RESULT(wrong version);
328 Install metakit 2.4.3 or later first.
330 Or, the compiler may not be finding your libmk4.so library.
331 Please check the config.log file for specific details of the
332 failure if you believe you have the correct metakit version.
333 Also, look up this issue in the FlightGear FAQ.])],
339 dnl Check for system installed zlib
340 AC_CHECK_HEADER(zlib.h)
341 if test "x$ac_cv_header_zlib_h" != "xyes"; then
343 echo "zlib library not found."
345 echo "If your OS does not provide an installable package for zlib"
346 echo "you will have to compile and install it first yourself. A copy"
347 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
348 echo "have to untar this source code, and follow it's included instructions"
349 echo "to compile and install on your system."
351 echo "configure aborted."
355 dnl Checks for header files.
358 fcntl.h getopt.h malloc.h memory.h stdint.h stdlib.h sys/param.h \
359 sys/stat.h sys/time.h sys/timeb.h unistd.h winbase.h values.h )
361 if test "x$ac_cv_header_stdint_h" = "xyes"; then
362 AC_DEFINE([HAVE_STDINT_H], 1, [Define if stdint.h exists])
365 dnl Checks for typedefs, structures, and compiler characteristics.
371 dnl Checks for library functions.
375 ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
376 random drand48 setitimer getitimer signal GetLocalTime rint getrusage )
378 AM_CONFIG_HEADER(simgear/simgear_config.h)
386 simgear/bucket/Makefile \
387 simgear/debug/Makefile \
388 simgear/ephemeris/Makefile \
389 simgear/io/Makefile \
390 simgear/magvar/Makefile \
391 simgear/math/Makefile \
392 simgear/metar/Makefile \
393 simgear/misc/Makefile \
394 simgear/route/Makefile \
395 simgear/screen/Makefile \
396 simgear/serial/Makefile \
397 simgear/sky/Makefile \
398 simgear/sky/clouds3d/Makefile \
399 simgear/threads/Makefile \
400 simgear/timing/Makefile \
401 simgear/xgl/Makefile \
402 simgear/xml/Makefile \
408 echo "Configure Summary"
409 echo "================="
411 echo "Prefix: $prefix"
413 if test "x$with_logging" != "x"; then
414 echo "Debug messages: $with_logging"
416 echo "Debug messages: yes"
419 echo -n "Automake version: "
420 automake --version | head -1
422 if test "x$ac_cv_header_GL_glut_h" = "xyes"; then
423 echo "With GL/glut.h"
425 if test "x$ac_cv_header_GLUT_glut_h" = "xyes"; then
426 echo "With GLUT/glut.h"
429 if test "x$with_jpeg_factory" = "xyes"; then
430 echo "With JPEG Factory support"
432 echo "Without JPEG Factory support"
435 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
436 echo "Threads: pthread lib found."
438 echo "Threads: no threads (pthread lib not found.)"