]> git.mxchange.org Git - simgear.git/blob - configure.in
cf7769c8282cbf9e9df80a9994d5b41f064b3a64
[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 # Require at least automake 2.13
9 AC_PREREQ(2.13)
10
11 dnl Initialize the automake stuff
12 AM_INIT_AUTOMAKE(SimGear, 0.0.19pre1)
13
14 dnl Specify KAI C++ compiler and flags.
15 dnl Borrowed with slight modification from blitz distribution.
16 AC_ARG_WITH(cxx,
17   [  --with-cxx=COMPILER[:name-flags] set options for COMPILER (KCC)],
18   [case "$withval" in
19     KCC*)    # KAI C++ http://www.kai.com/
20       echo "Configuring for KAI C++"
21       AC_SG_SET_COMPILER($withval,"KCC","--restrict --strict_warnings")
22       CXX_OPTIMIZE_FLAGS=="+K3 -O3"
23       CXX_DEBUG_FLAGS="-g +K0"
24     ;;
25   esac
26 ])
27
28 echo CXX = $CXX
29 echo CC = $CC
30
31 dnl Checks for programs.
32 AC_PROG_MAKE_SET
33 AC_PROG_CC
34 AC_PROG_CPP
35 AC_PROG_CXX
36 AC_PROG_RANLIB
37 AC_PROG_INSTALL
38 AC_PROG_LN_S
39
40 AR="ar"
41 OS=`uname -s`
42 if test "$OS" = "IRIX" -o "$OS" = "IRIX64"; then
43     if test "$CXX" = "CC"; then
44         AR="CC -ar"
45         AC_SUBST(AR)
46     fi
47 fi
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 # Determine version of automake ... important because of
57 # incompatibilities between versions
58 AUTO_MAKE_VERSION=`automake --version | head -1 | awk '{print $4}' | sed -e 's/\-p[[0-9]]$//' | sed -e 's/\.//'`
59 AM_CONDITIONAL(ANCIENT_AUTOMAKE, test $AUTO_MAKE_VERSION -lt 14)
60 AM_CONDITIONAL(OLD_AUTOMAKE, test $AUTO_MAKE_VERSION -lt 15)
61
62 # set logging default value
63 # with_logging=yes
64 AC_ARG_WITH(logging, [  --with-logging          Include logging output (default)])
65 if test "x$with_logging" = "xno" ; then
66     AC_DEFINE(FG_NDEBUG)
67 fi
68
69 # Specify if we want to build with Norman's jpeg image server support.
70 # This requires libjpeg to be installed and available.
71 # Default to with_jpeg_server=no
72 JPEGLIB=''
73 AC_ARG_WITH(jpeg_factory, [  --with-jpeg-factory     Include Norman's jpeg image factory support code])
74 if test "x$with_jpeg_factory" = "xyes" ; then
75     echo "Building with Norman's jpeg image factory support"
76     AC_CHECK_LIB(jpeg, jpeg_start_compress)
77     if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
78         echo
79         echo "In order to build the jpeg factory code you need libjpeg installed."
80         echo "otherwise please configure with the --with-jpeg-sever=no option"
81         echo
82         echo "libjpeg is available at :"
83         echo "  ftp://ftp.uu.net in the directory graphics/jpeg"
84         exit 1
85     fi
86 else
87     echo "Building without Norman's jpeg image server support"
88 fi
89 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$with_jpeg_factory" = "xyes")
90
91
92 dnl Check for MS Windows environment
93 AC_CHECK_HEADER(windows.h)
94
95 AC_EGREP_CPP(yes,
96 [#ifdef __MINGW32__
97  yes
98  #endif
99 ],is_mingw=yes, is_mingw=no)
100
101 echo "IS_MINGW = $is_mingw"
102 AM_CONDITIONAL(IS_MINGW, test "x$is_mingw" = "xyes")
103
104 AC_EGREP_CPP(yes,
105 [#ifdef __CYGWIN__
106  yes
107  #endif
108 ],is_cygwin=yes, is_cygwin=no)
109
110 echo "IS_CYGWIN = $is_cygwin"
111 AM_CONDITIONAL(IS_CYGWIN, test "x$is_cygwin" = "xyes")
112
113 if test "x$HOSTTYPE" != "xmacintosh" -a "x$is_mingw" != "xyes"; then
114     dnl extra library and include directories
115     EXTRA_DIRS="/usr/local /usr/local/plib /usr/X11R6"
116
117     if test -d /opt/X11R6 ; then
118         EXTRA_DIRS="$EXTRA_DIRS /opt/X11R6"
119     fi
120 fi
121
122 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
123
124 dnl Using AM_CONDITIONAL is a step out of the protected little 
125 dnl automake fold so it is potentially dangerous.  But, we are
126 dnl beginning to run into cases where the standard checks are not
127 dnl enough.  AM_CONDITIONALS are then referenced to conditionally
128 dnl build a Makefile.in from a Makefile.am which lets us define custom
129 dnl includes, compile alternative source files, etc.
130
131 dnl X11 might be installed on Mac OS X, don't want to use it if it is.
132 if test "x$HOSTTYPE" != "xmacintosh" ; then
133     dnl Check for X11 (fancy)
134     AC_PATH_XTRA
135 fi
136
137 dnl Checks for libraries.
138
139 null_LIBS="$LIBS"
140
141 AC_CHECK_LIB(m, cos)
142
143 base_LIBS="$LIBS"
144
145 dnl Thread related checks
146 AC_CHECK_LIB(pthread, pthread_exit)
147 AC_CHECK_HEADER(pthread.h)
148 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
149     CXXFLAGS="$CXXFLAGS -D_REENTRANT"
150     CFLAGS="$CFLAGS -D_REENTRANT"
151 fi
152 AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes")
153
154 AC_CHECK_LIB(socket, socket)
155
156 dnl X11 might be installed, but we don't want to use it for OSX -dw-
157 if test "x$HOSTTYPE" != "xmacintosh" ; then
158     AC_CHECK_LIB(X11, XCreateWindow)
159     AC_CHECK_LIB(Xext, XShmCreateImage)
160     AC_CHECK_LIB(Xi, XGetExtensionVersion)
161     AC_CHECK_LIB(ICE, IceOpenConnection)
162     AC_CHECK_LIB(SM, SmcOpenConnection)
163     AC_CHECK_LIB(Xt, XtMalloc)
164     AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
165 fi
166
167 dnl check for OpenGL related libraries
168
169 if test "x$HOSTTYPE" = "xmacintosh" ; then
170     dnl Macintosh OSX
171     LIBS="$LIBS -framework OpenGL -framework GLUT"
172 elif test "x$ac_cv_header_windows_h" != "xyes" ; then
173     dnl Reasonable stuff for X-Windows based machines
174
175     AC_CHECK_LIB(GLcore, glNewList)
176     if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
177         dnl if no GLcore, check for GL
178         AC_CHECK_LIB(GL, glNewList)
179         if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
180             dnl if no GL, check for MesaGL
181             AC_CHECK_LIB(MesaGL, glNewList)
182         fi
183     else
184         dnl if GLcore found, then also check for GL
185         AC_CHECK_LIB(GL, glXCreateContext)
186     fi
187
188     dnl if using mesa, check for xmesa.h
189     if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; then
190         AC_CHECK_HEADER(GL/fxmesa.h)
191         if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
192             AC_DEFINE(XMESA)
193             AC_DEFINE(FX)
194         fi
195     fi
196
197     AC_CHECK_LIB(GLU, gluLookAt)
198     if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
199         dnl if no GLU, check for MesaGLU
200         AC_CHECK_LIB(MesaGLU, gluLookAt)
201     fi
202
203     dnl check for glut
204     AC_CHECK_LIB(glut, glutGetModifiers)
205
206     dnl test for glutGameModeString, but avoid adding glut a second time into
207     dnl the list of libraries
208     save_LIBS="$LIBS"
209     AC_CHECK_LIB(glut, glutGameModeString)
210     LIBS="$save_LIBS"
211 else
212     dnl Win32 libs
213
214     echo Win32 specific hacks...
215     AC_DEFINE(WIN32)
216
217     dnl force a failed check since we will be building under windoze
218     AM_CONDITIONAL(ENABLE_XMESA_FX, test "no" = "yes")
219
220     dnl just define these to true and hope for the best
221     ac_cv_lib_glut_glutGetModifiers="yes"
222     ac_cv_lib_glut_glutGameModeString="yes"
223
224     if test "x$with_sgi_opengl" = "xyes" ; then
225         echo "Building with glut.dll, glu.dll, and opengl.dll"
226         WIN32_GLUT=glut
227         WIN32_GLU=glu
228         WIN32_OPENGL=opengl
229     else 
230         echo "Building with glut32.dll, glu32.dll, and opengl32.dll"
231         WIN32_GLUT=glut32
232         WIN32_GLU=glu32
233         WIN32_OPENGL=opengl32
234     fi
235
236     LIBS="$LIBS -l${WIN32_GLUT} -l${WIN32_GLU} -l${WIN32_OPENGL}"
237     LIBS="$LIBS -luser32 -lgdi32"
238     if test "x$is_mingw" = "xyes" ; then
239         EXTRA_DIRS="${EXTRA_DIRS}"
240     fi
241     echo "Will link apps with $LIBS"
242 fi
243
244 if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno"; then
245     echo 
246     echo "Unable to find the necessary OpenGL or GLUT libraries."
247     echo "See config.log for automated test details and results ..."
248     exit 1
249 fi
250
251 if test "x$ac_cv_lib_glut_glutGameModeString" = "xno"; then
252     echo
253     echo "Your version of glut doesn't support game mode."
254     echo "You need to install the latest version of glut.  If your"
255     echo "distribution doesn't provide a newer version, you can get the source"
256     echo "code from:"
257     echo
258     echo "    http://reality.sgi.com/opengl/glut3/glut3.html"
259     exit 1
260 fi
261
262 opengl_LIBS="$LIBS"
263 LIBS="$base_LIBS"
264
265 AC_SUBST(base_LIBS)
266 AC_SUBST(opengl_LIBS)
267
268 AM_CONDITIONAL(HAVE_XWINDOWS, test "x$ac_cv_lib_X11_XCreateWindow" = "xyes" )
269
270 dnl Check for "plib" without which we cannot go on
271 AC_CHECK_HEADER(plib/pu.h)
272 if test "x$ac_cv_header_plib_pu_h" != "xyes"; then
273     echo
274     echo "You *must* have the plib library installed on your system to build"
275     echo "the FGFS simulator!"
276     echo
277     echo "Please see README.plib for more details."
278     echo
279     echo "configure aborted."
280     exit
281 fi
282
283 dnl Check for system installed metakit
284 AC_CHECK_HEADER(mk4.h)
285 if test "x$ac_cv_header_mk4_h" != "xyes"; then
286     echo 
287     echo "Metakit not found, you will need to install this first."
288     echo "Please read the README.metakit for more information."
289     exit
290 fi
291
292
293 dnl Specify if we want logging (testing build) or not (release build)
294
295 dnl Check for system installed zlib
296 AC_CHECK_HEADER(zlib.h)
297 if test "x$ac_cv_header_zlib_h" != "xyes"; then
298     echo 
299     echo "zlib not found, you will need to install this first."
300     echo "Please read the README.zlib for more information."
301     exit
302 fi
303
304 dnl Checks for header files.
305 AC_HEADER_STDC
306 AC_CHECK_HEADERS( \
307         fcntl.h getopt.h malloc.h memory.h stdint.h stdlib.h sys/param.h \
308         sys/stat.h sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h )
309
310 if test "x$ac_cv_header_stdint_h" = "xyes"; then
311     AC_DEFINE(HAVE_STDINT_H)
312 fi
313
314 dnl Checks for typedefs, structures, and compiler characteristics.
315 AC_C_CONST
316 AC_TYPE_SIZE_T
317 AC_HEADER_TIME
318 AC_STRUCT_TM
319
320 dnl Checks for library functions.
321 AC_TYPE_SIGNAL
322 AC_FUNC_VPRINTF
323 AC_CHECK_FUNCS( ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
324         random drand48 setitimer getitimer signal GetLocalTime rint getrusage )
325
326 AM_CONFIG_HEADER(simgear/simgear_config.h)
327
328 AC_OUTPUT( \
329         Makefile \
330         SimGear.spec \
331         src-libs/Makefile \
332         simgear/Makefile \
333         simgear/version.h \
334         simgear/bucket/Makefile \
335         simgear/debug/Makefile \
336         simgear/ephemeris/Makefile \
337         simgear/interpreter/Makefile \
338         simgear/io/Makefile \
339         simgear/magvar/Makefile \
340         simgear/math/Makefile \
341         simgear/metar/Makefile \
342         simgear/misc/Makefile \
343         simgear/route/Makefile \
344         simgear/screen/Makefile \
345         simgear/serial/Makefile \
346         simgear/sky/Makefile \
347         simgear/threads/Makefile \
348         simgear/timing/Makefile \
349         simgear/xgl/Makefile \
350         simgear/xml/Makefile \
351 )
352
353 # AC_OUTPUT_COMMANDS([])
354
355 echo ""
356 echo "Configure Summary"
357 echo "================="
358
359 echo "Prefix: $prefix"
360
361 if test "x$with_logging" != "x"; then
362     echo "Debug messages: $with_logging"
363 else
364     echo "Debug messages: yes"
365 fi
366
367 echo -n "Automake version: ($AUTO_MAKE_VERSION) "
368 automake --version | head -1
369
370 if test "x$with_jpeg_factory" = "xyes"; then
371    echo "With JPEG Factory support"
372 else
373    echo "Without JPEG Factory support"
374 fi
375
376 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
377    echo "Threads: pthread lib found."
378 else
379    echo "Threads: no threads (pthread lib not found.)"
380 fi