Fixed includes and bugs so that it compiles
[construo.git] / configure.ac
blob754988634bb02f7f21ae4a94dc3422150930aa9c
1 ##  Construo - A wire-frame construction game
2 ##  Copyright (C) 2002 Ingo Ruhnke <grumbel@gmx.de>
3 ##
4 ##  This program is free software; you can redistribute it and/or
5 ##  modify it under the terms of the GNU General Public License
6 ##  as published by the Free Software Foundation; either version 2
7 ##  of the License, or (at your option) any later version.
8 ## 
9 ##  This program is distributed in the hope that it will be useful,
10 ##  but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ##  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 ##  GNU General Public License for more details.
13 ##  
14 ##  You should have received a copy of the GNU General Public License
15 ##  along with this program; if not, write to the Free Software
16 ##  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18 # init automake/conf
19 AC_INIT(construo, 0.2.2)
20 AM_INIT_AUTOMAKE
21 AC_CONFIG_SRCDIR(construo.hxx)
22 AM_CONFIG_HEADER(config.h)
24 # check for some programs
25 AC_PROG_CXX
26 AC_PROG_RANLIB
27 AC_PROG_INSTALL
28 AC_PATH_XTRA
29 AC_LANG(C++)
31 AC_MSG_CHECKING([whether we are enabling debug-mode])
32 AC_ARG_ENABLE([debug],
33               AC_HELP_STRING([--enable-debug],
34                              [enable debug support (default: no)]),,
35               [enable_debug=no])
36 AC_MSG_RESULT($enable_debug)
38 if test x$enable_debug = xyes; then
39   AC_DEFINE(DEBUG, 1, [Enable debuging])
40   CXXFLAGS="-g -O0 -Wall -Werror"
43 AC_MSG_CHECKING([whether we are enabling gprof profiling-support])
44 AC_ARG_ENABLE([gprof],
45               AC_HELP_STRING([--enable-gprof],
46                              [enable gprof profiling (default: no)]),,
47               [enable_gprof=no])
48 AC_MSG_RESULT($enable_gprof)
50 if test x$enable_gprof = xyes; then
51   CXXFLAGS="$CXXFLAGS -pg"
54 AC_MSG_CHECKING([whether we are enabling FunctionCheck profiling])
55 AC_ARG_ENABLE([fcheck],
56               AC_HELP_STRING([--enable-fcheck],
57                              [enable fcheck profiling (default: no)]),,
58               [enable_fcheck=no])
59 AC_MSG_RESULT($enable_fcheck)
61 if test x$enable_fcheck = xyes; then
62   CXXFLAGS="`fc-config --cflags`"
63   LIBS="$LIBS `fc-config --libs`"
66 AC_MSG_CHECKING([whether we want to compile the X11 client])
67 AC_ARG_ENABLE([x11],
68               AC_HELP_STRING([--enable-x11],
69                              [enable x11 support (default: yes)]),,
70               [enable_x11=yes])
71 AC_MSG_RESULT($enable_x11)
73 AC_MSG_CHECKING([whether we want to compile the glut client])
74 AC_ARG_ENABLE([glut],
75               AC_HELP_STRING([--enable-glut],
76                              [enable glut support (default: yes)]),,
77               [enable_glut=yes])
78 AC_MSG_RESULT($enable_glut)
80 AC_CHECK_HEADER([sstream],
81                 [],
82                 [AC_MSG_NOTICE([using replacement sstream from compatlib/])
83                 CXXFLAGS="$CXXFLAGS -Icompatlib/"])
85 dnl Checking for the install prefix and then use it to define PINGUS_DATADIR
86 dnl PINGUS_EXPAND_DIR(pingus_datadir, "$datadir/$PACKAGE")
87 dnl AC_DEFINE_UNQUOTED(PINGUS_DATADIR, "$pingus_datadir", [Location of Pingus data files])
88 dnl AC_DEFINE(CONSTRUO_DATADIR, $datadir/$PACKAGE, [Location of Construo datafiles])
89 AC_DEFINE_DIR(DATADIR, datadir, [Location of datafiles])
91 AC_CHECK_LIB(z, gzopen)
93 dnl --------------------------------------
94 dnl -- Check for usable Display Targets --
95 dnl --------------------------------------
96 ConstruoTargets=""
98 dnl -------------------
99 dnl -- Check for X11 --
100 dnl -------------------
101 if test -n "$X_DISPLAY_MISSING"; then
102    echo ""
103    echo "### Error: Couldn't find X11 header files, probally x11-devel packages"
104    echo "###        not installed?"
105    echo ""
106 else
107     if test x$enable_x11 = xyes; then
108       ConstruoTargets="$ConstruoTargets construo.x11"
109     fi
110     x11_LIBS="$x11_LIBS $X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS -lX11"
111     x11_CXXFLAGS="$CXXFLAGS $X_CFLAGS"
114 AC_CHECK_LIB(Xext, XMissingExtension,
115 [x11_LIBS="$x11_LIBS -lXext"
116  AC_DEFINE(HAVE_LIBXEXT, 1, [Xext is available])],
117 [], $x11_LIBS)
119 AC_CHECK_LIB(Xxf86vm, XF86VidModeSwitchToMode,
120 [x11_LIBS="$x11_LIBS -lXxf86vm"
121  AC_DEFINE(HAVE_LIBXXF86VM, 1, [VidMode is available])],
122 [], $x11_LIBS)
124 AC_SUBST(x11_LIBS)
125 AC_SUBST(x11_CXXFLAGS)
127 dnl --------------------
128 dnl -- Check for Glut --
129 dnl --------------------
130 AC_CHECK_LIB(glut, glutMainLoop,
132   if test x$enable_glut = xyes; then
133     ConstruoTargets="$ConstruoTargets construo.glut"
134   fi
135   AC_SUBST(glut_LIBS,"-lglut")
139 dnl ------------------------
140 dnl -- Check for FreeGlut --
141 dnl ------------------------
142 AC_CHECK_LIB(freeglut-1.3, glutMainLoop,
144   if test x$enable_glut = xyes; then
145     ConstruoTargets="$ConstruoTargets construo.freeglut"
146   fi
147   AC_SUBST(freeglut_LIBS,"-lfreeglut-1.3")
148 dnl  echo "Freeglut: " $freeglut_LIBS
152 if test -z "$ConstruoTargets"; then
153    echo ""
154    echo "ERROR: Neither X11 nor Glut could be detected, so Construo is not"
155    echo "ERROR: buildable. You might need to install the -devel packages for"
156    echo "ERROR: the libraries or check what else could have gone wrong."
157    echo "ERROR: The file 'config.log' contains more details on the runed libary"
158    echo "ERROR: checks and might help you to figure out what went wrong."
159    echo ""
160    exit 1
163 AC_SUBST(ConstruoTargets)
165 AC_CONFIG_FILES(Makefile examples/Makefile)
166 AC_OUTPUT
168 echo ""
169 echo "   CXXFLAGS      = $CXXFLAGS"
170 echo "   LIBS          = $LIBS"
171 echo "   Debugging     = $enable_debug"
172 echo "   GProf         = $enable_gprof"
173 echo "   FunctionCheck = $enable_fcheck"
174 echo "   Targets       =$ConstruoTargets"
175 echo ""
176 echo "Now type 'make' and everything should work, if not, write a bug reports to:"
177 echo ""
178 echo "  Ingo Ruhnke <grumbel@gmx.de>"
179 echo ""
181 # EOF #