4 PROJECT_BLURB="run an OpenGL program in a modified environment"
8 # For a non-srcdir configure invocation (such as ../configure), create
9 # the directory structure and copy Makefiles.
10 if [ "$srcdir" != "." ]; then
12 for dir in . $(grep "^subdirs *=" "$srcdir"/Makefile | sed -e "s/subdirs *= *//"); do
14 cp "$srcdir"/"$dir"/Makefile.local "$dir"
15 cp "$srcdir"/"$dir"/Makefile "$dir"
19 # Set several defaults (optionally specified by the user in
20 # environment variables)
25 # Set the defaults for values the user can specify with command-line
32 Usage: ./configure [options]...
34 This script configures ${PROJECT} to build on your system.
36 It verifies that dependencies are available, determines flags needed
37 to compile and link against various required libraries, and identifies
38 whether various system functions can be used or if locally-provided
39 replacements will be built instead.
41 Finally, it allows you to control various aspects of the build and
44 First, some common variables can specified via environment variables:
46 CC The C compiler to use
47 CFLAGS Flags to pass to the C compiler
48 LDFLAGS Flags to pass when linking
50 Each of these values can further be controlled by specifying them
51 later on the "make" command line.
53 Additionally, various options can be specified on the configure
56 --prefix=PREFIX Install files in PREFIX [$PREFIX]
58 By default, "make install" will install the resulting program to
59 $PREFIX/bin, documentation to $PREFIX/man, etc. You can
60 specify an installation prefix other than $PREFIX using
61 --prefix, for instance:
63 ./configure --prefix=\$HOME
65 Fine tuning of some installation directories is available:
67 --bindir=DIR Install executables to DIR [PREFIX/bin]
68 --libdir=DIR Install libraries to DIR [PREFIX/lib]
69 --mandir=DIR Install man pages to DIR [PREFIX/share/man]
70 --sysconfdir=DIR Read-only single-machine data [PREFIX/etc]
72 Additional options are accepted for compatibility with other
73 configure-script calling conventions, but don't do anything yet:
75 --build=<cpu>-<vendor>-<os> Currently ignored
76 --host=<cpu>-<vendor>-<os> Currently ignored
77 --infodir=DIR Currently ignored
78 --datadir=DIR Currently ignored
79 --localstatedir=DIR Currently ignored
80 --libexecdir=DIR Currently ignored
81 --disable-maintainer-mode Currently ignored
82 --disable-dependency-tracking Currently ignored
87 # Parse command-line options
89 if [ "${option}" = '--help' ] ; then
92 elif [ "${option%%=*}" = '--prefix' ] ; then
94 elif [ "${option%%=*}" = '--bindir' ] ; then
96 elif [ "${option%%=*}" = '--libdir' ] ; then
98 elif [ "${option%%=*}" = '--mandir' ] ; then
100 elif [ "${option%%=*}" = '--sysconfdir' ] ; then
101 SYSCONFDIR="${option#*=}"
102 elif [ "${option%%=*}" = '--build' ] ; then
104 elif [ "${option%%=*}" = '--host' ] ; then
106 elif [ "${option%%=*}" = '--infodir' ] ; then
108 elif [ "${option%%=*}" = '--datadir' ] ; then
110 elif [ "${option%%=*}" = '--localstatedir' ] ; then
112 elif [ "${option%%=*}" = '--libexecdir' ] ; then
114 elif [ "${option}" = '--disable-maintainer-mode' ] ; then
116 elif [ "${option}" = '--disable-dependency-tracking' ] ; then
119 echo "Unrecognized option: ${option}"
127 printf "Checking for working C compiler (${CC})... "
128 printf "int main(void){return 42;}\n" > minimal.c
129 if ${CC} -o minimal minimal.c > /dev/null 2>&1
136 *** Error: No functioning C compiler found. Either set the CC environment
137 to a working C compiler, or else install gcc:
141 You may be able to install gcc with a command such as:
143 sudo apt-get install build-essential
145 sudo yum install make automake gcc gcc-c++ kernel-devel
154 printf "Checking for available C compiler warning flags:\n"
155 for flag in -Wall -Wextra -Wmissing-declarations -Werror=attributes; do
156 if ${CC} $flag -o minimal minimal.c > /dev/null 2>&1
158 WARN_CFLAGS="${WARN_CFLAGS}${WARN_CFLAGS:+ }${flag}"
161 printf "\t${WARN_CFLAGS}\n"
163 rm -f minimal minimal.c
165 printf "#include <features.h>\nint main(void){return 0;}\n" > arch-minimal.c
167 printf "Checking for machine-dependent compiler support:\n"
169 printf " Compiler can create 32-bit binaries... "
171 if ${CC} -m32 -o arch-minimal arch-minimal.c > /dev/null 2>&1
179 printf " Compiler can create 64-bit binaries... "
181 if ${CC} -m64 -o arch-minimal arch-minimal.c > /dev/null 2>&1
189 if [ "$have_m32" = "No" ] || [ "$have_m64" = "No" ]; then
192 * Warning: Cannot create both 32 and 64-bit glenv libraries. Glenv will not
193 support applications of the non-native size. Fixing this may be
194 as simple as running a command such as:
196 sudo apt-get install gcc-multilib
200 rm -f arch-minimal arch-minimal.c
204 printf "Checking for pkg-config... "
205 if pkg-config --version > /dev/null 2>&1; then
211 *** Error: This configure script requires pkg-config to find the
212 compilation flags required to link against the various libraries
213 needed by ${PROJECT}. The pkg-config program can be obtained from:
215 http://www.freedesktop.org/wiki/Software/pkg-config/
217 Or you may be able install it with a command such as:
219 sudo apt-get install pkg-config
221 sudo yum install pkgconfig
229 printf "Checking for glaze... "
230 if pkg-config --exists glaze; then
233 glaze_cflags=$(pkg-config --cflags glaze)
234 glaze_ldflags=$(pkg-config --libs glaze)
238 errors=$((errors + 1))
241 if [ $errors -gt 0 ]; then
244 *** Error: The dependencies of ${PROJECT} could not be satisfied. You will
245 need to install the following packages before being able to compile
249 if [ $have_glaze -eq 0 ]; then
250 echo " The glaze library"
251 echo " git://git.cworth.org/git/glaze/"
258 # construct the Makefile.config
259 cat > Makefile.config <<EOF
260 # This Makefile.config was automatically generated by the ./configure
261 # script of ${PROJECT}. If the configure script identified anything
262 # incorrectly, then you can edit this file to try to correct things,
263 # but be warned that if configure is run again it will destroy your
264 # changes, (and this could happen by simply calling "make" if the
265 # configure script is updated).
267 # The top-level directory for the source, (the directory containing
268 # the configure script). This may be different than the build
269 # directory (the current directory at the time configure was run).
272 configure_options = $@
274 # We use vpath directives (rather than the VPATH variable) since the
275 # VPATH variable matches targets as well as prerequisites, (which is
276 # not useful since then a target left-over from a srcdir build would
277 # cause a target to not be built in the non-srcdir build).
280 # The C compiler to use
283 # Default FLAGS for C compiler (can be overridden by user such as "make CFLAGS=-g")
286 # Default FLAGS for the linker (can be overridden by user such as "make LDFLAGS=-znow")
289 # Flags to enable warnings when using the C compiler
290 WARN_CFLAGS = ${WARN_CFLAGS}
292 # The prefix to which ${PROJECT} should be installed
295 # The directory to which executables should be installed
296 BINDIR = ${BINDIR:-\$(PREFIX)/bin}
298 # The directory to which libraries should be installed
299 LIBDIR = ${LIBDIR:-\$(PREFIX)/lib}
301 # The directory to which headers should be installed
302 INCLUDEDIR = ${INCLUDEDIR:-\$(PREFIX)/include}
304 # Whether compiler can create 32 or 64-bit binaries
305 COMPILER_SUPPORTS_32 = ${have_m32}
306 COMPILER_SUPPORTS_64 = ${have_m64}
308 # Flags needed to compile and link against Glaze
309 GLAZE_CFLAGS = ${glaze_cflags}
310 GLAZE_LDFLAGS = ${glaze_ldflags}
316 You may now run the following commands to compile and install ${PROJECT}: