]> git.mxchange.org Git - simgear.git/blob - configure.in
13c6fcfa69388bf89e196d9a20758fdd2d63f306
[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 if echo $includedir | egrep "simgear$" > /dev/null; then
38     echo "includedir is" $includedir "libdir is" $libdir
39 else
40     includedir="${includedir}/simgear"
41     echo "includedir changed to" $includedir "libdir is" $libdir
42 fi
43
44
45 # set logging default value
46 # with_logging=yes
47 AC_ARG_WITH(logging, [  --with-logging          Include logging output (default)])
48 if test "x$with_logging" = "xno" ; then
49     AC_DEFINE(FG_NDEBUG)
50 fi
51
52 dnl specify if we are building with "checker"
53 AC_ARG_WITH(efence, [  --with-efence           Specify if we are building with "electric-fence"])
54
55 if test "x$with_efence" = "xyes" ; then
56     echo "Building with efence"
57     LIBS= "$LIBS -lefence"
58 fi
59
60 dnl Check for MS Windows environment
61 AC_CHECK_HEADER(windows.h)
62
63 dnl extra library and include directories
64 EXTRA_DIRS="/usr/local /usr/local/plib /usr/X11R6"
65
66 if test -d /opt/X11R6 ; then
67      EXTRA_DIRS="$EXTRA_DIRS /opt/X11R6"
68 fi
69
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"
74 fi
75 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
76
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.
83
84 dnl Enable serial support on Unix type systems
85 AM_CONDITIONAL(ENABLE_UNIX_SERIAL, true)
86
87 dnl Check for X11 (fancy)
88 AC_PATH_XTRA
89
90 dnl Checks for libraries.
91
92 null_LIBS="$LIBS"
93
94 AC_CHECK_LIB(m, cos)
95
96 base_LIBS="$LIBS"
97
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"
104 fi
105 AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -o "x$ac_cv_header_pthread_h" = "xyes")
106
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)
115
116 dnl check for OpenGL related libraries
117
118 if test "x$ac_cv_header_windows_h" != "xyes" ; then
119     dnl Reasonable stuff for non-windoze variants ... :-)
120
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)
128         fi
129     else
130         dnl if GLcore found, then also check for GL
131         AC_CHECK_LIB(GL, glXCreateContext)
132     fi
133
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
138             AC_DEFINE( XMESA )
139             AC_DEFINE( FX )
140         fi
141     fi
142
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)
147     fi
148
149     dnl check for glut
150     AC_CHECK_LIB(glut, glutGetModifiers)
151
152     dnl test for glutGameModeString, but avoid adding glut a second time into
153     dnl the list of libraries
154     save_LIBS="$LIBS"
155     AC_CHECK_LIB(glut, glutGameModeString)
156     LIBS="$save_LIBS"
157 else
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.
160
161     echo Win32 specific hacks...
162     AC_DEFINE(WIN32)
163
164     dnl force a failed check since we will be building under windoze
165     AM_CONDITIONAL(ENABLE_XMESA_FX, test "no" = "yes")
166
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"
170
171     if test "x$with_sgi_opengl" = "xyes" ; then
172         echo "Building with glut.dll, glu.dll, and opengl.dll"
173         WIN32_GLUT=glut
174         WIN32_GLU=glu
175         WIN32_OPENGL=opengl
176     else 
177         echo "Building with glut32.dll, glu32.dll, and opengl32.dll"
178         WIN32_GLUT=glut32
179         WIN32_GLU=glu32
180         WIN32_OPENGL=opengl32
181     fi
182
183     LIBS="$LIBS -l${WIN32_GLUT} -l${WIN32_GLU} -l${WIN32_OPENGL}"
184     LIBS="$LIBS -luser32 -lgdi32"
185     echo "Will link apps with $LIBS"
186 fi
187
188 if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno"; then
189     echo 
190     echo "Unable to find the necessary OpenGL or GLUT libraries."
191     echo "See config.log for automated test details and results ..."
192     exit 1
193 fi
194
195 if test "x$ac_cv_lib_glut_glutGameModeString" = "xno"; then
196     echo
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:"
199     echo
200     echo "    http://reality.sgi.com/opengl/glut3/glut3.html"
201     exit 1
202 fi
203
204 opengl_LIBS="$LIBS"
205 LIBS="$base_LIBS"
206
207 AC_SUBST(base_LIBS)
208 AC_SUBST(opengl_LIBS)
209
210 AM_CONDITIONAL(HAVE_XWINDOWS, test "x$ac_cv_lib_X11_XCreateWindow" = "xyes" )
211
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
215     echo
216     echo "You *must* have the plib library installed on your system to build"
217     echo "the FGFS simulator!"
218     echo
219     echo "Please see README.plib for more details."
220     echo
221     echo "configure aborted."
222     exit
223 fi
224
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 )
229 # else
230 #     echo "no gdbm found, configuring and building."
231 # fi
232 # AM_CONDITIONAL(HAVE_GDBM, test "x$ac_cv_header_gdbm_h" = "xyes" )
233
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 )
240 fi
241 AM_CONDITIONAL(HAVE_METAKIT, test "x$ac_cv_header_mk4_h" = "xyes" )
242
243
244 dnl Specify if we want logging (testing build) or not (release build)
245
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 )
250 else
251     echo "no zlib found, building."
252 fi
253 AM_CONDITIONAL(HAVE_ZLIB, test "x$ac_cv_header_zlib_h" = "xyes" )
254
255 dnl Checks for header files.
256 AC_HEADER_STDC
257 AC_CHECK_HEADERS( \
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 )
260
261 dnl Checks for typedefs, structures, and compiler characteristics.
262 AC_C_CONST
263 AC_TYPE_SIZE_T
264 AC_HEADER_TIME
265 AC_STRUCT_TM
266
267 dnl Checks for library functions.
268 AC_TYPE_SIGNAL
269 AC_FUNC_VPRINTF
270 AC_CHECK_FUNCS( ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
271         random setitimer getitimer signal GetLocalTime rint getrusage )
272
273 AM_CONFIG_HEADER(simgear/config.h)
274
275 AC_OUTPUT( \
276         Makefile \
277         SimGear.spec \
278         simgear/Makefile \
279         simgear/version.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 \
297 )
298
299 AC_OUTPUT_COMMANDS([
300 #       if test "x$ac_cv_header_windows_h" = "xyes" ; then
301 #               cp simgear/gdbm/autoconf.h.cygwin32 simgear/gdbm/autoconf.h
302 #       fi
303 ])
304
305 echo ""
306 echo "Configure Summary"
307 echo "================="
308
309 echo "Prefix: $prefix"
310
311 if test "x$with_logging" != "x"; then
312     echo "Debug messages: $with_logging"
313 else
314     echo "Debug messages: yes"
315 fi
316
317 if test "x$with_efence" != "x"; then
318     echo "Electric fence: $with_efence"
319 else
320     echo "Electric fence: no"
321 fi
322
323 # if test "x$ac_cv_header_gdbm_h" != "xyes"; then
324 #    echo "Building gdbm"
325 # fi
326
327 if test "x$ac_cv_header_mk4_h" != "xyes"; then
328    echo "Building metakit"
329 fi
330
331 if test "x$ac_cv_header_zlib_h" != "xyes"; then
332    echo "Building zlib"
333 fi
334
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."
337 else
338    echo "Threads: no threads (pthreads not found.)"
339 fi