1 dnl Process this file with aclocal ; automake -a ; autoconf to produce a
2 dnl working configure script.
7 AC_CONFIG_SRCDIR([simgear/bucket/newbucket.cxx])
9 # Require at least automake 2.52
12 dnl Initialize the automake stuff
13 AM_INIT_AUTOMAKE(SimGear, 0.3.0)
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.
42 # Used on the Irix platform
46 if test "$OS" = "IRIX" -o "$OS" = "IRIX64"; then
47 if test "$CXX" = "CC"; then
56 if echo $includedir | egrep "simgear$" > /dev/null; then
57 echo "includedir is" $includedir "libdir is" $libdir
59 includedir="${includedir}/simgear"
60 echo "includedir changed to" $includedir "libdir is" $libdir
63 # set logging default value
65 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
66 if test "x$with_logging" = "xno" ; then
67 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
70 # Specify if we want to build with Norman's jpeg image server support.
71 # This requires libjpeg to be installed and available.
72 # Default to with_jpeg_server=no
74 AC_ARG_WITH(jpeg_factory, [ --with-jpeg-factory Include Norman's jpeg image factory support code])
75 if test "x$with_jpeg_factory" = "xyes" ; then
76 echo "Building with Norman's jpeg image factory support"
77 AC_CHECK_LIB(jpeg, jpeg_start_compress)
78 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
80 echo "In order to build the jpeg factory code you need libjpeg installed."
81 echo "otherwise please configure with the --with-jpeg-sever=no option"
83 echo "libjpeg is available at :"
84 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
88 echo "Building without Norman's jpeg image server support"
90 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$with_jpeg_factory" = "xyes")
93 dnl Check for MS Windows environment
94 AC_CHECK_HEADER(windows.h)
100 ],is_mingw=yes, is_mingw=no)
102 echo "IS_MINGW = $is_mingw"
103 AM_CONDITIONAL(IS_MINGW, test "x$is_mingw" = "xyes")
109 ],is_cygwin=yes, is_cygwin=no)
111 echo "IS_CYGWIN = $is_cygwin"
112 AM_CONDITIONAL(IS_CYGWIN, test "x$is_cygwin" = "xyes")
114 if test "x$HOSTTYPE" != "xmacintosh" -a "x$is_mingw" != "xyes"; then
115 dnl extra library and include directories
116 EXTRA_DIRS="/usr/X11R6"
118 if test -d /opt/X11R6 ; then
119 EXTRA_DIRS="$EXTRA_DIRS /opt/X11R6"
123 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
125 dnl Using AM_CONDITIONAL is a step out of the protected little
126 dnl automake fold so it is potentially dangerous. But, we are
127 dnl beginning to run into cases where the standard checks are not
128 dnl enough. AM_CONDITIONALS are then referenced to conditionally
129 dnl build a Makefile.in from a Makefile.am which lets us define custom
130 dnl includes, compile alternative source files, etc.
132 dnl X11 might be installed on Mac OS X, don't want to use it if it is.
133 if test "x$HOSTTYPE" != "xmacintosh" ; then
134 dnl Check for X11 (fancy)
138 dnl Checks for libraries.
146 dnl Thread related checks
147 AC_CHECK_LIB(pthread, pthread_exit)
148 AC_CHECK_HEADER(pthread.h)
149 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
150 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
151 CFLAGS="$CFLAGS -D_REENTRANT"
153 AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes")
155 AC_CHECK_LIB(socket, socket)
157 dnl X11 might be installed, but we don't want to use it for OSX -dw-
158 if test "x$HOSTTYPE" != "xmacintosh" ; then
159 AC_CHECK_LIB(X11, XCreateWindow)
160 AC_CHECK_LIB(Xext, XShmCreateImage)
161 AC_CHECK_LIB(Xi, XGetExtensionVersion)
162 AC_CHECK_LIB(ICE, IceOpenConnection)
163 AC_CHECK_LIB(SM, SmcOpenConnection)
164 AC_CHECK_LIB(Xt, XtMalloc)
165 AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
168 dnl check for OpenGL related libraries
170 AM_CONDITIONAL(EXTGL_NEEDED, test "x$ac_cv_header_windows_h" = "xyes")
172 if test "x$HOSTTYPE" = "xmacintosh" ; then
174 LIBS="$LIBS -framework OpenGL -framework GLUT"
175 elif test "x$ac_cv_header_windows_h" != "xyes" ; then
176 dnl Reasonable stuff for X-Windows based machines
178 AC_CHECK_LIB(GLcore, glNewList)
179 if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
180 dnl if no GLcore, check for GL
181 AC_CHECK_LIB(GL, glNewList)
182 if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
183 dnl if no GL, check for MesaGL
184 AC_CHECK_LIB(MesaGL, glNewList)
187 dnl if GLcore found, then also check for GL
188 AC_CHECK_LIB(GL, glXCreateContext)
191 dnl if using mesa, check for xmesa.h
192 if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; then
193 AC_CHECK_HEADER(GL/fxmesa.h)
194 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
195 AC_DEFINE([XMESA], 1, [Define for fxmesa])
196 AC_DEFINE([FX], 1, [Define for fxmesa])
200 AC_CHECK_LIB(GLU, gluLookAt)
201 if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
202 dnl if no GLU, check for MesaGLU
203 AC_CHECK_LIB(MesaGLU, gluLookAt)
207 AC_CHECK_LIB(glut, glutGetModifiers)
209 dnl test for glutGameModeString, but avoid adding glut a second time into
210 dnl the list of libraries
212 AC_CHECK_LIB(glut, glutGameModeString)
217 echo Win32 specific hacks...
218 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
219 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
221 dnl just define these to true and hope for the best
222 ac_cv_lib_glut_glutGetModifiers="yes"
223 ac_cv_lib_glut_glutGameModeString="yes"
225 if test "x$with_sgi_opengl" = "xyes" ; then
226 echo "Building with glut.dll, glu.dll, and opengl.dll"
231 echo "Building with glut32.dll, glu32.dll, and opengl32.dll"
234 WIN32_OPENGL=opengl32
237 LIBS="$LIBS -l${WIN32_GLUT} -l${WIN32_GLU} -l${WIN32_OPENGL}"
238 LIBS="$LIBS -luser32 -lgdi32"
239 if test "x$is_mingw" = "xyes" ; then
240 EXTRA_DIRS="${EXTRA_DIRS}"
242 echo "Will link apps with $LIBS"
245 if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno"; then
247 echo "Unable to find the necessary OpenGL or GLUT libraries."
248 echo "See config.log for automated test details and results ..."
252 if test "x$ac_cv_lib_glut_glutGameModeString" = "xno"; then
254 echo "Your version of glut doesn't support game mode."
255 echo "You need to install the latest version of glut. If your"
256 echo "distribution doesn't provide a newer version, you can get the source"
259 echo " http://reality.sgi.com/opengl/glut3/glut3.html"
267 AC_SUBST(opengl_LIBS)
269 AM_CONDITIONAL(HAVE_XWINDOWS, test "x$ac_cv_lib_X11_XCreateWindow" = "xyes" )
271 # The following are C++ items that need to be tested for with the c++
276 dnl Check for "plib" without which we cannot go on
277 AC_CHECK_HEADER(plib/ul.h)
278 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
280 echo "You *must* have the plib library installed on your system to build"
283 echo "Please see README.plib for more details."
285 echo "configure aborted."
289 AC_MSG_CHECKING([for plib 1.6.0 or newer])
293 #define MIN_PLIB_VERSION 160
296 int major, minor, micro;
298 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
307 [AC_MSG_RESULT(wrong version);
308 AC_MSG_ERROR([Install plib 1.6.0 or later first...])],
312 dnl Check for system installed metakit
313 AC_CHECK_HEADER(mk4.h)
314 if test "x$ac_cv_header_mk4_h" != "xyes"; then
316 echo "Metakit not found, you will need to install this first."
317 echo "Please read the README.metakit for more information."
323 dnl Specify if we want logging (testing build) or not (release build)
325 dnl Check for system installed zlib
326 AC_CHECK_HEADER(zlib.h)
327 if test "x$ac_cv_header_zlib_h" != "xyes"; then
329 echo "zlib not found, you will need to install this first."
330 echo "Please read the README.zlib for more information."
334 dnl Checks for header files.
337 fcntl.h getopt.h malloc.h memory.h stdint.h stdlib.h sys/param.h \
338 sys/stat.h sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h )
340 if test "x$ac_cv_header_stdint_h" = "xyes"; then
341 AC_DEFINE([HAVE_STDINT_H], 1, [Define if stdint.h exists])
344 dnl Checks for typedefs, structures, and compiler characteristics.
350 dnl Checks for library functions.
353 AC_CHECK_FUNCS( ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
354 random drand48 setitimer getitimer signal GetLocalTime rint getrusage )
356 AM_CONFIG_HEADER(simgear/simgear_config.h)
364 simgear/bucket/Makefile \
365 simgear/debug/Makefile \
366 simgear/ephemeris/Makefile \
367 simgear/io/Makefile \
368 simgear/magvar/Makefile \
369 simgear/math/Makefile \
370 simgear/metar/Makefile \
371 simgear/misc/Makefile \
372 simgear/route/Makefile \
373 simgear/screen/Makefile \
374 simgear/serial/Makefile \
375 simgear/sky/Makefile \
376 simgear/sky/clouds3d/Makefile \
377 simgear/threads/Makefile \
378 simgear/timing/Makefile \
379 simgear/xgl/Makefile \
380 simgear/xml/Makefile \
386 echo "Configure Summary"
387 echo "================="
389 echo "Prefix: $prefix"
391 if test "x$with_logging" != "x"; then
392 echo "Debug messages: $with_logging"
394 echo "Debug messages: yes"
397 echo -n "Automake version: ($AUTO_MAKE_VERSION) "
398 automake --version | head -1
400 if test "x$with_jpeg_factory" = "xyes"; then
401 echo "With JPEG Factory support"
403 echo "Without JPEG Factory support"
406 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
407 echo "Threads: pthread lib found."
409 echo "Threads: no threads (pthread lib not found.)"