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.15)
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.
37 if echo $includedir | egrep "simgear$" > /dev/null; then
38 echo "includedir is" $includedir "libdir is" $libdir
40 includedir="${includedir}/simgear"
41 echo "includedir changed to" $includedir "libdir is" $libdir
45 # set logging default value
47 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
48 if test "x$with_logging" = "xno" ; then
52 dnl specify if we are building with "checker"
53 AC_ARG_WITH(efence, [ --with-efence Specify if we are building with "electric-fence"])
55 if test "x$with_efence" = "xyes" ; then
56 echo "Building with efence"
57 LIBS= "$LIBS -lefence"
60 dnl Check for MS Windows environment
61 AC_CHECK_HEADER(windows.h)
63 dnl extra library and include directories
64 EXTRA_DIRS="/usr/local /usr/local/plib /usr/X11R6"
66 if test -d /opt/X11R6 ; then
67 EXTRA_DIRS="$EXTRA_DIRS /opt/X11R6"
70 if test "x$ac_cv_header_windows_h" = "xyes" ; then
71 EXTRA_DIRS="${EXTRA_DIRS} `pwd`/Win32"
72 # elif test `uname -s` = "SunOS" ; then
73 # EXTRA_DIRS="${EXTRA_DIRS} `pwd`/SunOS"
75 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
77 dnl Using AM_CONDITIONAL is a step out of the protected little
78 dnl automake fold so it is potentially dangerous. But, we are
79 dnl beginning to run into cases where the standard checks are not
80 dnl enough. AM_CONDITIONALS are then referenced to conditionally
81 dnl build a Makefile.in from a Makefile.am which lets us define custom
82 dnl includes, compile alternative source files, etc.
84 dnl Enable serial support on Unix type systems
85 AM_CONDITIONAL(ENABLE_UNIX_SERIAL, true)
87 dnl Check for X11 (fancy)
90 dnl Checks for libraries.
98 dnl Thread related checks
99 AC_CHECK_LIB(pthread, pthread_exit)
100 AC_CHECK_HEADER(pthread.h)
101 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -o "x$ac_cv_header_pthread_h" = "xyes"; then
102 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
103 CFLAGS="$CFLAGS -D_REENTRANT"
105 AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -o "x$ac_cv_header_pthread_h" = "xyes")
107 AC_CHECK_LIB(socket, socket)
108 AC_CHECK_LIB(X11, XCreateWindow)
109 AC_CHECK_LIB(Xext, XShmCreateImage)
110 AC_CHECK_LIB(Xi, XGetExtensionVersion)
111 AC_CHECK_LIB(ICE, IceOpenConnection)
112 AC_CHECK_LIB(SM, SmcOpenConnection)
113 AC_CHECK_LIB(Xt, XtMalloc)
114 AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
116 dnl check for OpenGL related libraries
118 if test "x$ac_cv_header_windows_h" != "xyes" ; then
119 dnl Reasonable stuff for non-windoze variants ... :-)
121 AC_CHECK_LIB(GLcore, glNewList)
122 if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
123 dnl if no GLcore, check for GL
124 AC_CHECK_LIB(GL, glNewList)
125 if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
126 dnl if no GL, check for MesaGL
127 AC_CHECK_LIB(MesaGL, glNewList)
130 dnl if GLcore found, then also check for GL
131 AC_CHECK_LIB(GL, glXCreateContext)
134 dnl if using mesa, check for xmesa.h
135 if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; then
136 AC_CHECK_HEADER(GL/xmesa.h)
137 if test "x$ac_cv_header_GL_xmesa_h" = "xyes"; then
143 AC_CHECK_LIB(GLU, gluLookAt)
144 if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
145 dnl if no GLU, check for MesaGLU
146 AC_CHECK_LIB(MesaGLU, gluLookAt)
150 AC_CHECK_LIB(glut, glutGetModifiers)
152 dnl test for glutGameModeString, but avoid adding glut a second time into
153 dnl the list of libraries
155 AC_CHECK_LIB(glut, glutGameModeString)
158 dnl Win32 is a little wierd because it has to try to handle the various
159 dnl winbloze-isms. We'll just do this manually for now.
161 echo Win32 specific hacks...
164 dnl force a failed check since we will be building under windoze
165 AM_CONDITIONAL(ENABLE_XMESA_FX, test "no" = "yes")
167 dnl just define these to true and hope for the best
168 ac_cv_lib_glut_glutGetModifiers="yes"
169 ac_cv_lib_glut_glutGameModeString="yes"
171 if test "x$with_sgi_opengl" = "xyes" ; then
172 echo "Building with glut.dll, glu.dll, and opengl.dll"
177 echo "Building with glut32.dll, glu32.dll, and opengl32.dll"
180 WIN32_OPENGL=opengl32
183 LIBS="$LIBS -l${WIN32_GLUT} -l${WIN32_GLU} -l${WIN32_OPENGL}"
184 LIBS="$LIBS -luser32 -lgdi32"
185 echo "Will link apps with $LIBS"
188 if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno"; then
190 echo "Unable to find the necessary OpenGL or GLUT libraries."
191 echo "See config.log for automated test details and results ..."
195 if test "x$ac_cv_lib_glut_glutGameModeString" = "xno"; then
197 echo "Your version of glut doesn't support game mode."
198 echo "You need to fetch and install the latest version of glut from:"
200 echo " http://reality.sgi.com/opengl/glut3/glut3.html"
208 AC_SUBST(opengl_LIBS)
210 AM_CONDITIONAL(HAVE_XWINDOWS, test "x$ac_cv_lib_X11_XCreateWindow" = "xyes" )
212 dnl Check for "plib" without which we cannot go on
213 AC_CHECK_HEADER(plib/pu.h)
214 if test "x$ac_cv_header_plib_pu_h" != "xyes"; then
216 echo "You *must* have the plib library installed on your system to build"
217 echo "the FGFS simulator!"
219 echo "Please see README.plib for more details."
221 echo "configure aborted."
225 # dnl Check for system installed gdbm
226 # AC_CHECK_HEADER(gdbm.h)
227 # if test "x$ac_cv_header_gdbm_h" = "xyes"; then
228 # AC_DEFINE( HAVE_GDBM )
230 # echo "no gdbm found, configuring and building."
232 # AM_CONDITIONAL(HAVE_GDBM, test "x$ac_cv_header_gdbm_h" = "xyes" )
234 dnl Check for system installed metakit
235 AC_CHECK_HEADER(mk4.h)
236 if test "x$ac_cv_header_mk4_h" != "xyes"; then
237 echo "no metakit found, configuring and building."
238 # Run configure in the metakit subdir
239 AC_CONFIG_SUBDIRS( simgear/metakit/unix )
241 AM_CONDITIONAL(HAVE_METAKIT, test "x$ac_cv_header_mk4_h" = "xyes" )
244 dnl Specify if we want logging (testing build) or not (release build)
246 dnl Check for system installed zlib
247 AC_CHECK_HEADER(zlib.h)
248 if test "x$ac_cv_header_zlib_h" = "xyes"; then
249 AC_DEFINE( HAVE_ZLIB )
251 echo "no zlib found, building."
253 AM_CONDITIONAL(HAVE_ZLIB, test "x$ac_cv_header_zlib_h" = "xyes" )
255 dnl Checks for header files.
258 fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
259 sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h )
261 dnl Checks for typedefs, structures, and compiler characteristics.
267 dnl Checks for library functions.
270 AC_CHECK_FUNCS( ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
271 random setitimer getitimer signal GetLocalTime rint getrusage )
273 AM_CONFIG_HEADER(simgear/config.h)
280 simgear/bucket/Makefile \
281 simgear/debug/Makefile \
282 simgear/ephemeris/Makefile \
283 simgear/io/Makefile \
284 simgear/magvar/Makefile \
285 simgear/math/Makefile \
286 simgear/metar/Makefile \
287 simgear/misc/Makefile \
288 simgear/route/Makefile \
289 simgear/screen/Makefile \
290 simgear/serial/Makefile \
291 simgear/sky/Makefile \
292 simgear/threads/Makefile \
293 simgear/timing/Makefile \
294 simgear/xgl/Makefile \
295 simgear/xml/Makefile \
296 simgear/zlib/Makefile \
300 # if test "x$ac_cv_header_windows_h" = "xyes" ; then
301 # cp simgear/gdbm/autoconf.h.cygwin32 simgear/gdbm/autoconf.h
306 echo "Configure Summary"
307 echo "================="
309 echo "Prefix: $prefix"
311 if test "x$with_logging" != "x"; then
312 echo "Debug messages: $with_logging"
314 echo "Debug messages: yes"
317 if test "x$with_efence" != "x"; then
318 echo "Electric fence: $with_efence"
320 echo "Electric fence: no"
323 # if test "x$ac_cv_header_gdbm_h" != "xyes"; then
324 # echo "Building gdbm"
327 if test "x$ac_cv_header_mk4_h" != "xyes"; then
328 echo "Building metakit"
331 if test "x$ac_cv_header_zlib_h" != "xyes"; then
335 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -o "x$ac_cv_header_pthread_h" = "xyes"; then
336 echo "Threads: pthread is supported."
338 echo "Threads: no threads (pthreads not found.)"