2eed56a78aaff9e58699c87781ace51d10db11f9
[construo.git] / configure.ac
blob2eed56a78aaff9e58699c87781ace51d10db11f9
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_CHECK_HEADER([sstream],
67                 [],
68                 [AC_MSG_NOTICE([using replacement sstream from compatlib/])
69                 CXXFLAGS="$CXXFLAGS -Icompatlib/"])
71 dnl Checking for the install prefix and then use it to define PINGUS_DATADIR
72 dnl PINGUS_EXPAND_DIR(pingus_datadir, "$datadir/games/$PACKAGE")
73 dnl AC_DEFINE_UNQUOTED(PINGUS_DATADIR, "$pingus_datadir", [Location of Pingus data files])
74 dnl AC_DEFINE(CONSTRUO_DATADIR, $datadir/games/$PACKAGE, [Location of Construo datafiles])
75 AC_DEFINE_DIR(DATADIR, datadir, [Location of datafiles])
77 AC_CHECK_LIB(z, gzopen)
79 dnl --------------------------------------
80 dnl -- Check for usable Display Targets --
81 dnl --------------------------------------
82 ConstruoTargets=""
84 dnl -------------------
85 dnl -- Check for X11 --
86 dnl -------------------
87 if test -n "$X_DISPLAY_MISSING"; then
88    echo ""
89    echo "### Error: Couldn't find X11 header files, probally x11-devel packages"
90    echo "###        not installed?"
91    echo ""
92 else
93     ConstruoTargets="$ConstruoTargets construo.x11"
94     x11_LIBS="$x11_LIBS $X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS -lX11"
95     x11_CXXFLAGS="$CXXFLAGS $X_CFLAGS"
98 AC_CHECK_LIB(Xext, XMissingExtension,
99 [x11_LIBS="$x11_LIBS -lXext"
100  AC_DEFINE(HAVE_LIBXEXT, 1, [Xext is available])],
101 [], $x11_LIBS)
103 AC_CHECK_LIB(Xxf86vm, XF86VidModeSwitchToMode,
104 [x11_LIBS="$x11_LIBS -lXxf86vm"
105  AC_DEFINE(HAVE_LIBXXF86VM, 1, [VidMode is available])],
106 [], $x11_LIBS)
108 AC_SUBST(x11_LIBS)
109 AC_SUBST(x11_CXXFLAGS)
111 dnl --------------------
112 dnl -- Check for Glut --
113 dnl --------------------
114 AC_CHECK_LIB(glut, glutMainLoop,
116   ConstruoTargets="$ConstruoTargets construo.glut"
117   AC_SUBST(glut_LIBS,"-lglut")
121 dnl ------------------------
122 dnl -- Check for FreeGlut --
123 dnl ------------------------
124 AC_CHECK_LIB(freeglut-1.3, glutMainLoop,
126   ConstruoTargets="$ConstruoTargets construo.freeglut"
127   AC_SUBST(freeglut_LIBS,"-lfreeglut-1.3")
128 dnl  echo "Freeglut: " $freeglut_LIBS
132 if test -z "$ConstruoTargets"; then
133    echo ""
134    echo "ERROR: Neither X11 nor Glut could be detected, so Construo is not"
135    echo "ERROR: buildable. You might need to install the -devel packages for"
136    echo "ERROR: the libraries or check what else could have gone wrong."
137    echo "ERROR: The file 'config.log' contains more details on the runed libary"
138    echo "ERROR: checks and might help you to figure out what went wrong."
139    echo ""
140    exit 1
143 AC_SUBST(ConstruoTargets)
145 AC_CONFIG_FILES(Makefile examples/Makefile)
146 AC_OUTPUT
148 echo ""
149 echo "   CXXFLAGS      = $CXXFLAGS"
150 echo "   LIBS          = $LIBS"
151 echo "   Debugging     = $enable_debug"
152 echo "   GProf         = $enable_gprof"
153 echo "   FunctionCheck = $enable_fcheck"
154 echo "   Targets       =$ConstruoTargets"
155 echo ""
156 echo "Now type 'make' and everything should work, if not, write a bug reports to:"
157 echo ""
158 echo "  Ingo Ruhnke <grumbel@gmx.de>"
159 echo ""
161 # EOF #