]> git.mxchange.org Git - flightgear.git/blob - configure.in
Changes by Bernie Bright to add getrusage() check.
[flightgear.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 dnl
3 dnl The basis for this file was generated by autoscan(1) [pere 1998-03-19]
4 dnl
5
6 AC_INIT(Simulator/Aircraft/aircraft.c)
7
8 dnl specify the compiled flight model
9 AC_ARG_WITH(flight-model, [  --with-flight-model        Specify the compiled in flight model (navion, cherokee)])
10
11 if test "x$with_flight_model" = "xcherokee" ; then
12     echo "Building with cherokee flight model"
13 else 
14     echo "Building with navion flight model"
15 fi
16 AM_CONDITIONAL(ENABLE_CHEROKEE, test "x$with_flight_model" = "xcherokee")
17
18 dnl Let the Win32 user specify if they want to build with the SGI
19 dnl opengl.dll as opposed to the more standard openg32.dll
20 AC_ARG_WITH(sgiopengl, [  --with-sgiopengl        Build against opengl.dll glu.dll and glut.dll])
21
22 dnl Initialize the automake stuff
23 AM_INIT_AUTOMAKE(FlightGear, 0.52)
24
25 dnl Checks for programs.
26 AC_PROG_MAKE_SET
27 AC_PROG_CC
28 AC_PROG_CXX
29 AC_PROG_RANLIB
30 AC_PROG_INSTALL
31 AC_PROG_LN_S
32
33 dnl Initialize libtool
34 dnl AM_PROG_LIBTOOL
35
36 dnl Initialize maintainer mode
37 dnl AM_MAINTAINER_MODE
38
39 dnl This is needed for AC_TRY_COMPILE later
40 dnl AC_ISC_POSIX
41
42 dnl Check to see if this `configure' is being run in the `Cygwin32' environment
43 dnl AM_CYGWIN32
44
45 dnl Check for MS Windows environment
46 AC_CHECK_HEADER(windows.h)
47
48 dnl Using AM_CONDITIONAL is a step out of the protected little 
49 dnl automake fold so it is potentially dangerous.  But, we are
50 dnl beginning to run into cases where the standard checks are not
51 dnl enough.  AM_CONDITIONALS are then referenced to conditionally
52 dnl build a Makefile.in from a Makefile.am which lets us define custom
53 dnl includes, compile alternative source files, etc.
54
55 dnl Check for external variables daylight and timezone.
56 AC_EXT_DAYLIGHT
57 AM_CONDITIONAL(HAVE_DAYLIGHT, test "$have_daylight" = yes )
58
59 AC_EXT_TIMEZONE
60 AM_CONDITIONAL(HAVE_TIMEZONE, test "$have_timezone" = yes )
61
62 dnl Check for Linux style audio support
63 AM_CONDITIONAL(ENABLE_AUDIO_SUPPORT, \
64         test -r /usr/include/soundcard.h \
65                 -o -r /usr/include/linux/soundcard.h \
66                 -o -r /usr/include/machine/soundcard.h \
67                 -o -r /usr/include/audio.h \
68                 -o "x$ac_cv_header_windows_h" = "xyes" )
69
70 AM_CONDITIONAL(ENABLE_IRIX_AUDIO, test -r /usr/include/audio.h)
71
72 AM_CONDITIONAL(ENABLE_WIN32_AUDIO, test "x$ac_cv_header_windows_h" = "xyes")
73
74 dnl extra library and include directories
75 EXTRA_DIRS="/usr/local /usr/X11R6 /opt/X11R6"
76
77 if test "x$ac_cv_header_windows_h" = "xyes" ; then
78     EXTRA_DIRS="${EXTRA_DIRS} `pwd`/Win32"
79 # elif test `uname -s` = "SunOS" ; then
80 #   EXTRA_DIRS="${EXTRA_DIRS} `pwd`/SunOS"
81 fi
82 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
83
84 dnl Check for X11 (fancy)
85 AC_PATH_XTRA
86
87 dnl Checks for libraries.
88
89 AC_CHECK_LIB(m, cos)
90 AC_CHECK_LIB(socket, socket)
91 AC_CHECK_LIB(X11, XCreateWindow)
92 AC_CHECK_LIB(Xext, XShmCreateImage)
93 AC_CHECK_LIB(Xi, XGetExtensionVersion)
94 AC_CHECK_LIB(ICE, IceOpenConnection)
95 AC_CHECK_LIB(SM, SmcOpenConnection)
96 AC_CHECK_LIB(Xt, XtMalloc)
97 AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
98
99 dnl check for OpenGL related libraries
100
101 if test "x$ac_cv_header_windows_h" != "xyes" ; then
102     dnl Reasonable stuff non-windoze variants ... :-)
103
104     AC_CHECK_LIB(GLcore, glNewList)
105     if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
106         dnl if no GLcore, check for GL
107         AC_CHECK_LIB(GL, glNewList)
108         if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
109             dnl if no GL, check for MesaGL
110             AC_CHECK_LIB(MesaGL, glNewList)
111         fi
112     else
113         dnl if GLcore found, then also check for GL
114         AC_CHECK_LIB(GL, glXCreateContext)
115     fi
116
117     dnl if using mesa, check for xmesa.h
118     if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; then
119         AC_CHECK_HEADER(GL/xmesa.h)
120         AM_CONDITIONAL(ENABLE_XMESA_FX, \
121                        test "x$ac_cv_header_GL_xmesa_h" = "xyes")
122     else
123         dnl force a failed check
124         AM_CONDITIONAL(ENABLE_XMESA_FX, test "no" = "yes")
125     fi
126
127     AC_CHECK_LIB(GLU, gluLookAt)
128     if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
129         dnl if no GLU, check for MesaGLU
130         AC_CHECK_LIB(MesaGLU, gluLookAt)
131     fi
132
133     AC_CHECK_LIB(glut, glutGetModifiers)
134 else
135     dnl Win32 is a little wierd because it has to try to handle the various
136     dnl winbloze-isms.  We'll just do this manually for now.
137
138     echo Win32 specific hacks...
139     AC_DEFINE(WIN32)
140
141     dnl force a failed check since we will be building under windoze
142     AM_CONDITIONAL(ENABLE_XMESA_FX, test "no" = "yes")
143
144     if test "x$with_sgiopengl" = "xyes" ; then
145         echo "Building with glut.dll, glu.dll, and opengl.dll"
146         WIN32_GLUT=glut
147         WIN32_GLU=glu
148         WIN32_OPENGL=opengl
149     else 
150         echo "Building with glut32.dll, glu32.dll, and opengl32.dll"
151         WIN32_GLUT=glut32
152         WIN32_GLU=glu32
153         WIN32_OPENGL=opengl32
154     fi
155
156     if test -f `pwd`/Win32/${WIN32_GLUT}.dll; then
157         echo "    found ${WIN32_GLUT}.dll, adding -l${WIN32_GLUT}"
158         LIBS="$LIBS -l${WIN32_GLUT}"
159     else
160         echo "    Cannot find ${WIN32_GLUT}.dll"
161         exit 1
162     fi
163
164     if test -f `pwd`/Win32/${WIN32_GLU}.dll; then
165         echo "    found ${WIN32_GLU}.dll"
166     else
167         echo "    Can't find ${WIN32_GLU}.dll, assuming it's someplace"
168     fi
169     echo "    adding -l${WIN32_GLU}"
170     LIBS="$LIBS -l${WIN32_GLU}"
171
172     if test -f `pwd`/Win32/${WIN32_OPENGL}.dll; then
173         echo "    found ${WIN32_OPENGL}.dll"
174     else
175         echo "    Can't find ${WIN32_OPENGL}.dll, assuming it's somplace"
176     fi
177     echo "    adding -l${WIN32_OPENGL}"
178     LIBS="$LIBS -l${WIN32_OPENGL}"
179
180     echo "    adding -luser32 -lgdi32"
181     LIBS="$LIBS -luser32 -lgdi32"
182     ac_cv_lib_glut_glutGetModifiers="yes"
183 fi
184
185 dnl Checks for header files.
186 AC_HEADER_STDC
187 AC_CHECK_HEADERS( \
188         fcntl.h getopt.h malloc.h stdlib.h sys/time.h sys/timeb.h \
189         unistd.h windows.h winbase.h values.h )
190
191 dnl Checks for typedefs, structures, and compiler characteristics.
192 AC_C_CONST
193 AC_TYPE_SIZE_T
194 AC_HEADER_TIME
195 AC_STRUCT_TM
196
197 dnl Checks for library functions.
198 AC_TYPE_SIGNAL
199 AC_FUNC_VPRINTF
200 AC_CHECK_FUNCS( ftime gettimeofday mktime strstr rand random \
201         setitimer getitimer signal GetLocalTime rint getrusage )
202
203 if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno"; then
204     echo 
205     echo "Unable to find the necessary OpenGL or GLUT libraries."
206     echo "See config.log for automated test details and results ..."
207     exit 1
208 fi
209
210 AM_CONFIG_HEADER(Include/config.h)
211
212 AC_OUTPUT( \
213         Makefile \
214         Include/Makefile \
215         Lib/Makefile \
216         Lib/Audio/Makefile \
217         Lib/Audio/src/Makefile \
218         Lib/Audio/example/Makefile \
219         Lib/Bucket/Makefile \
220         Lib/Debug/Makefile \
221         Lib/DEM/Makefile \
222         Lib/Math/Makefile \
223         Lib/Misc/Makefile \
224         Lib/PUI/Makefile \
225         Lib/XGL/Makefile \
226         Lib/zlib/Makefile \
227         Simulator/Makefile \
228         Simulator/Aircraft/Makefile \
229         Simulator/Astro/Makefile \
230         Simulator/Autopilot/Makefile \
231         Simulator/Cockpit/Makefile \
232         Simulator/Controls/Makefile \
233         Simulator/Flight/LaRCsim/Makefile \
234         Simulator/Flight/Slew/Makefile \
235         Simulator/Flight/Makefile \
236         Simulator/GUI/Makefile \
237         Simulator/Joystick/Makefile \
238         Simulator/Main/Makefile \
239         Simulator/Main/runfg \
240         Simulator/Main/runfg.bat \
241         Simulator/Makefile \
242         Simulator/Scenery/Makefile \
243         Simulator/Time/Makefile \
244         Simulator/Weather/Makefile \
245         Tools/Makefile \
246         Tools/Areas/Makefile \
247         Tools/AssemTris/Makefile \
248         Tools/Dem2node/Makefile \
249         Tools/DemInfo/Makefile \
250         Tools/DemRaw2ascii/Makefile \
251         Tools/FixNode/Makefile \
252         Tools/FixObj/Makefile \
253         Tools/SplitTris/Makefile \
254         Tools/Stripe_w/Makefile \
255         Tools/Tri2obj/Makefile \
256         Tools/Triangle/Makefile \
257         Tests/Makefile \
258 )
259
260 AC_OUTPUT_COMMANDS([chmod 755 Simulator/Main/runfg])