]> git.mxchange.org Git - simgear.git/blob - configure.in
- added virtual destructor to XMLVisitor to make sure derived classes
[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(simgear/bucket/newbucket.cxx)
7
8 dnl Initialize the automake stuff
9 AM_INIT_AUTOMAKE(SimGear, 0.0.16)
10
11 dnl Specify KAI C++ compiler and flags.
12 dnl Borrowed with slight modification from blitz distribution.
13 AC_ARG_WITH(cxx,
14   [  --with-cxx=COMPILER[:name-flags] set options for COMPILER (KCC)],
15   [case "$withval" in
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"
21     ;;
22   esac
23 ])
24
25 echo CXX = $CXX
26 echo CC = $CC
27
28 dnl Checks for programs.
29 AC_PROG_MAKE_SET
30 AC_PROG_CC
31 AC_PROG_CPP
32 AC_PROG_CXX
33 AC_PROG_RANLIB
34 AC_PROG_INSTALL
35 AC_PROG_LN_S
36
37 AR="ar"
38 OS=`uname -s`
39 if test "$OS" = "IRIX" -o "$OS" = "IRIX64"; then
40     if test "$CXX" = "CC"; then
41         AR="CC -ar"
42         AC_SUBST(AR)
43     fi
44 fi
45
46 if echo $includedir | egrep "simgear$" > /dev/null; then
47     echo "includedir is" $includedir "libdir is" $libdir
48 else
49     includedir="${includedir}/simgear"
50     echo "includedir changed to" $includedir "libdir is" $libdir
51 fi
52
53
54 # set logging default value
55 # with_logging=yes
56 AC_ARG_WITH(logging, [  --with-logging          Include logging output (default)])
57 if test "x$with_logging" = "xno" ; then
58     AC_DEFINE(FG_NDEBUG)
59 fi
60
61 dnl specify if we are building with "checker"
62 AC_ARG_WITH(efence, [  --with-efence           Specify if we are building with "electric-fence"])
63
64 if test "x$with_efence" = "xyes" ; then
65     echo "Building with efence"
66     LIBS="$LIBS -lefence"
67 fi
68
69 dnl Check for MS Windows environment
70 AC_CHECK_HEADER(windows.h)
71
72 dnl extra library and include directories
73 EXTRA_DIRS="/usr/local /usr/local/plib /usr/X11R6"
74
75 if test -d /opt/X11R6 ; then
76      EXTRA_DIRS="$EXTRA_DIRS /opt/X11R6"
77 fi
78
79 if test "x$ac_cv_header_windows_h" = "xyes" ; then
80     EXTRA_DIRS="${EXTRA_DIRS} `pwd`/Win32"
81 # elif test `uname -s` = "SunOS" ; then
82 #   EXTRA_DIRS="${EXTRA_DIRS} `pwd`/SunOS"
83 fi
84 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
85
86 dnl Using AM_CONDITIONAL is a step out of the protected little 
87 dnl automake fold so it is potentially dangerous.  But, we are
88 dnl beginning to run into cases where the standard checks are not
89 dnl enough.  AM_CONDITIONALS are then referenced to conditionally
90 dnl build a Makefile.in from a Makefile.am which lets us define custom
91 dnl includes, compile alternative source files, etc.
92
93 dnl Enable serial support on Unix type systems
94 AM_CONDITIONAL(ENABLE_UNIX_SERIAL, true)
95
96 dnl Check for X11 (fancy)
97 AC_PATH_XTRA
98
99 dnl Checks for libraries.
100
101 null_LIBS="$LIBS"
102
103 AC_CHECK_LIB(m, cos)
104
105 base_LIBS="$LIBS"
106
107 dnl Thread related checks
108 AC_CHECK_LIB(pthread, pthread_exit)
109 AC_CHECK_HEADER(pthread.h)
110 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
111     CXXFLAGS="$CXXFLAGS -D_REENTRANT"
112     CFLAGS="$CFLAGS -D_REENTRANT"
113 fi
114 AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes")
115
116 AC_CHECK_LIB(socket, socket)
117 AC_CHECK_LIB(X11, XCreateWindow)
118 AC_CHECK_LIB(Xext, XShmCreateImage)
119 AC_CHECK_LIB(Xi, XGetExtensionVersion)
120 AC_CHECK_LIB(ICE, IceOpenConnection)
121 AC_CHECK_LIB(SM, SmcOpenConnection)
122 AC_CHECK_LIB(Xt, XtMalloc)
123 AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
124
125 dnl check for OpenGL related libraries
126
127 if test "x$ac_cv_header_windows_h" != "xyes" ; then
128     dnl Reasonable stuff for non-windoze variants ... :-)
129
130     AC_CHECK_LIB(GLcore, glNewList)
131     if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
132         dnl if no GLcore, check for GL
133         AC_CHECK_LIB(GL, glNewList)
134         if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
135             dnl if no GL, check for MesaGL
136             AC_CHECK_LIB(MesaGL, glNewList)
137         fi
138     else
139         dnl if GLcore found, then also check for GL
140         AC_CHECK_LIB(GL, glXCreateContext)
141     fi
142
143     dnl if using mesa, check for xmesa.h
144     if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; then
145         AC_CHECK_HEADER(GL/xmesa.h)
146         if test "x$ac_cv_header_GL_xmesa_h" = "xyes"; then
147             AC_DEFINE( XMESA )
148             AC_DEFINE( FX )
149         fi
150     fi
151
152     AC_CHECK_LIB(GLU, gluLookAt)
153     if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
154         dnl if no GLU, check for MesaGLU
155         AC_CHECK_LIB(MesaGLU, gluLookAt)
156     fi
157
158     dnl check for glut
159     AC_CHECK_LIB(glut, glutGetModifiers)
160
161     dnl test for glutGameModeString, but avoid adding glut a second time into
162     dnl the list of libraries
163     save_LIBS="$LIBS"
164     AC_CHECK_LIB(glut, glutGameModeString)
165     LIBS="$save_LIBS"
166 else
167     dnl Win32 is a little wierd because it has to try to handle the various
168     dnl winbloze-isms.  We'll just do this manually for now.
169
170     echo Win32 specific hacks...
171     AC_DEFINE(WIN32)
172
173     dnl force a failed check since we will be building under windoze
174     AM_CONDITIONAL(ENABLE_XMESA_FX, test "no" = "yes")
175
176     dnl just define these to true and hope for the best
177     ac_cv_lib_glut_glutGetModifiers="yes"
178     ac_cv_lib_glut_glutGameModeString="yes"
179
180     if test "x$with_sgi_opengl" = "xyes" ; then
181         echo "Building with glut.dll, glu.dll, and opengl.dll"
182         WIN32_GLUT=glut
183         WIN32_GLU=glu
184         WIN32_OPENGL=opengl
185     else 
186         echo "Building with glut32.dll, glu32.dll, and opengl32.dll"
187         WIN32_GLUT=glut32
188         WIN32_GLU=glu32
189         WIN32_OPENGL=opengl32
190     fi
191
192     LIBS="$LIBS -l${WIN32_GLUT} -l${WIN32_GLU} -l${WIN32_OPENGL}"
193     LIBS="$LIBS -luser32 -lgdi32"
194     echo "Will link apps with $LIBS"
195 fi
196
197 if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno"; then
198     echo 
199     echo "Unable to find the necessary OpenGL or GLUT libraries."
200     echo "See config.log for automated test details and results ..."
201     exit 1
202 fi
203
204 if test "x$ac_cv_lib_glut_glutGameModeString" = "xno"; then
205     echo
206     echo "Your version of glut doesn't support game mode."
207     echo "You need to fetch and install the latest version of glut from:"
208     echo
209     echo "    http://reality.sgi.com/opengl/glut3/glut3.html"
210     exit 1
211 fi
212
213 opengl_LIBS="$LIBS"
214 LIBS="$base_LIBS"
215
216 AC_SUBST(base_LIBS)
217 AC_SUBST(opengl_LIBS)
218
219 AM_CONDITIONAL(HAVE_XWINDOWS, test "x$ac_cv_lib_X11_XCreateWindow" = "xyes" )
220
221 dnl Check for "plib" without which we cannot go on
222 AC_CHECK_HEADER(plib/pu.h)
223 if test "x$ac_cv_header_plib_pu_h" != "xyes"; then
224     echo
225     echo "You *must* have the plib library installed on your system to build"
226     echo "the FGFS simulator!"
227     echo
228     echo "Please see README.plib for more details."
229     echo
230     echo "configure aborted."
231     exit
232 fi
233
234 # dnl Check for system installed gdbm
235 # AC_CHECK_HEADER(gdbm.h)
236 # if test "x$ac_cv_header_gdbm_h" = "xyes"; then
237 #     AC_DEFINE( HAVE_GDBM )
238 # else
239 #     echo "no gdbm found, configuring and building."
240 # fi
241 # AM_CONDITIONAL(HAVE_GDBM, test "x$ac_cv_header_gdbm_h" = "xyes" )
242
243 dnl Check for system installed metakit
244 AC_CHECK_HEADER(mk4.h)
245 if test "x$ac_cv_header_mk4_h" != "xyes"; then
246     echo "no metakit found, configuring and building."
247     # Run configure in the metakit subdir
248     AC_CONFIG_SUBDIRS( simgear/metakit/unix )
249 fi
250 AM_CONDITIONAL(HAVE_METAKIT, test "x$ac_cv_header_mk4_h" = "xyes" )
251
252
253 dnl Specify if we want logging (testing build) or not (release build)
254
255 dnl Check for system installed zlib
256 AC_CHECK_HEADER(zlib.h)
257 if test "x$ac_cv_header_zlib_h" = "xyes"; then
258     AC_DEFINE( HAVE_ZLIB )
259 else
260     echo "no zlib found, building."
261 fi
262 AM_CONDITIONAL(HAVE_ZLIB, test "x$ac_cv_header_zlib_h" = "xyes" )
263
264 dnl Checks for header files.
265 AC_HEADER_STDC
266 AC_CHECK_HEADERS( \
267         fcntl.h getopt.h malloc.h memory.h stdint.h stdlib.h sys/param.h \
268         sys/stat.h sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h )
269
270 if test "x$ac_cv_header_stdint_h" = "xyes"; then
271     AC_DEFINE( HAVE_STDINT_H )
272 fi
273
274 dnl Checks for typedefs, structures, and compiler characteristics.
275 AC_C_CONST
276 AC_TYPE_SIZE_T
277 AC_HEADER_TIME
278 AC_STRUCT_TM
279
280 dnl Checks for library functions.
281 AC_TYPE_SIGNAL
282 AC_FUNC_VPRINTF
283 AC_CHECK_FUNCS( ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
284         random setitimer getitimer signal GetLocalTime rint getrusage )
285
286 AM_CONFIG_HEADER(simgear/simgear_config.h)
287
288 AC_OUTPUT( \
289         Makefile \
290         SimGear.spec \
291         simgear/Makefile \
292         simgear/version.h \
293         simgear/bucket/Makefile \
294         simgear/debug/Makefile \
295         simgear/ephemeris/Makefile \
296         simgear/io/Makefile \
297         simgear/magvar/Makefile \
298         simgear/math/Makefile \
299         simgear/metar/Makefile \
300         simgear/misc/Makefile \
301         simgear/route/Makefile \
302         simgear/screen/Makefile \
303         simgear/serial/Makefile \
304         simgear/sky/Makefile \
305         simgear/threads/Makefile \
306         simgear/timing/Makefile \
307         simgear/xgl/Makefile \
308         simgear/xml/Makefile \
309         simgear/zlib/Makefile \
310 )
311
312 AC_OUTPUT_COMMANDS([
313 #       if test "x$ac_cv_header_windows_h" = "xyes" ; then
314 #               cp simgear/gdbm/autoconf.h.cygwin32 simgear/gdbm/autoconf.h
315 #       fi
316 ])
317
318 echo ""
319 echo "Configure Summary"
320 echo "================="
321
322 echo "Prefix: $prefix"
323
324 if test "x$with_logging" != "x"; then
325     echo "Debug messages: $with_logging"
326 else
327     echo "Debug messages: yes"
328 fi
329
330 if test "x$with_efence" != "x"; then
331     echo "Electric fence: $with_efence"
332 else
333     echo "Electric fence: no"
334 fi
335
336 # if test "x$ac_cv_header_gdbm_h" != "xyes"; then
337 #    echo "Building gdbm"
338 # fi
339
340 if test "x$ac_cv_header_mk4_h" != "xyes"; then
341    echo "Building metakit"
342 fi
343
344 if test "x$ac_cv_header_zlib_h" != "xyes"; then
345    echo "Building zlib"
346 fi
347
348 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
349    echo "Threads: pthread lib found."
350 else
351    echo "Threads: no threads (pthread lib not found.)"
352 fi
353
354 if test "$OS" = "IRIX" -o "$OS" = "IRIX64"; then
355     if test "$CXX" = "CC"; then
356         echo "\nRemember to run: sh ../FlightGear/irix-hack.sh!\07\n"
357     fi
358 fi