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