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