1dnl Process this file with autoconf to produce a configure script.
2AC_INIT(vamos, 0.7.1, snick-a-doo@comcast.net)
3AC_CONFIG_SRCDIR(world/World.cc)
4AC_CONFIG_AUX_DIR(config)
5
6AM_INIT_AUTOMAKE
7
8AC_ARG_ENABLE(unit_tests,
9  [  --enable-unit-tests  build and execute unit tests],
10    [case "${enableval}" in
11       yes) unit_tests=true;;
12       no) unit_tests=false;;
13       *) AC_MSG_ERROR(bad value ${enableval} for --enable-unit-tests);;
14     esac],
15  [unit_tests=true])
16
17dnl Checks for programs.
18AC_PROG_CXX
19AC_PROG_INSTALL
20AC_PROG_MAKE_SET
21
22AC_PROG_LIBTOOL
23
24AC_PATH_X
25
26dnl Checks for libraries.
27AC_CHECK_LIB(SDL, SDL_Init,,
28	AC_MSG_ERROR([SDL >= v1.2 is required.]))
29
30AC_CHECK_LIB(openal, alGetError,,
31	AC_MSG_ERROR([OpenAL >= v1.1 is required.]))
32
33AC_CHECK_LIB(alut, alutGetError,,
34	AC_MSG_ERROR([ALUT >= v1.1 is required.]))
35
36AC_CHECK_HEADER(windows.h, AC_DEFINE(WIN32))
37
38dnl Checks for typedefs, structures, and compiler characteristics.
39
40dnl Checks for library functions.
41
42dnl Stolen from plib's configure.in
43if test "x$ac_cv_header_windows_h" != "xyes" ; then
44    dnl Check for X11
45    AC_PATH_XTRA
46    x_suffix="$X_LIBS $X_PRE_LIBS -lX11 -lXi -lXext -lXmu $X_EXTRA_LIBS"
47
48    AC_CHECK_LIB(dl, dlclose)
49
50    AC_CHECK_LIB(GL, glNewList,,,$x_suffix)
51    if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
52        dnl if no GL, check for MesaGL
53        AC_CHECK_LIB(MesaGL, glNewList,,,$x_suffix)
54    fi
55
56    dnl if using mesa, check for xmesa.h
57    if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; then
58        AC_CHECK_HEADER(GL/xmesa.h)
59        AM_CONDITIONAL(ENABLE_XMESA_FX, \
60                       test "x$ac_cv_header_GL_xmesa_h" = "xyes")
61    else
62        dnl force a failed check
63        AM_CONDITIONAL(ENABLE_XMESA_FX, test "no" = "yes")
64    fi
65
66    AC_CHECK_LIB(GLU, gluLookAt,,,$x_suffix)
67    if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
68        dnl if no GLU, check for MesaGLU
69        AC_CHECK_LIB(MesaGLU, gluLookAt,,,$x_suffix)
70    fi
71
72    opengl_LIBS="$LIBS $x_suffix"
73
74    dnl check for glut...or freeglut
75    AC_CHECK_LIB(freeglut, glutGetModifiers,,,$opengl_LIBS)
76    if test "x$ac_cv_lib_freeglut_glutGetModifiers" = "xno" ; then
77        dnl if no freeglut, check for Real GLUT
78        AC_CHECK_LIB(glut, glutGetModifiers,,,$opengl_LIBS)
79    fi
80else
81  dnl CygWin under Windoze.
82
83  AC_CHECK_HEADERS(windows.h GL/gl.h GL/glext.h,,,
84  [[#if HAVE_WINDOWS_H
85  # include <windows.h>
86  #endif
87  #if HAVE_GL_GL_H
88  # include <GL/gl.h>
89  #endif
90  ]])
91
92  dnl force a failed check
93  AM_CONDITIONAL(ENABLE_XMESA_FX, test "no" = "yes")
94
95  dnl CygWin doesn't look in this directory
96  LIBS="$LIBS -L/usr/local/lib"
97
98  dnl OpenGL libraries
99  LIBS="$LIBS -lwinmm -lglut32 -lglu32 -lopengl32 -luser32 -lgdi32"
100fi
101
102dnl OpenGL
103AC_CHECK_HEADERS(GL/gl.h GL/glu.h,,
104	AC_MSG_ERROR([OpenGL is required.]))
105AC_CHECK_HEADER(GL/glut.h,,
106	AC_MSG_ERROR([Glut >= v3.7 is required.]))
107
108dnl libpng
109AC_CHECK_LIB(png, png_sig_cmp,,,$x_suffix)
110AC_CHECK_HEADER(png.h,,
111	AC_MSG_ERROR([libpng is required.]))
112
113dnl Boost
114AX_BOOST_BASE([1.46.0],, AC_MSG_ERROR([Boost >= v1.46.0 is required.]))
115
116AM_CONDITIONAL(DO_UNIT_TESTS, test x$unit_tests = xtrue)
117
118AC_CONFIG_FILES([Makefile
119				config/Makefile
120				scripts/Makefile
121				body/Makefile
122				geometry/Makefile
123				media/Makefile
124				track/Makefile
125				world/Makefile
126				vamos/Makefile
127				data/Makefile
128				data/cars/Makefile
129				data/cars/F1/Makefile
130				data/cars/GT/Makefile
131				data/controls/Makefile
132				data/textures/Makefile
133				data/tracks/Makefile
134				data/sounds/Makefile
135				data/worlds/Makefile
136				doc/Makefile
137				caelum/Makefile])
138AC_OUTPUT
139