4 PROJECT_BLURB="a shiny way to wrap OpenGL"
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 glaze libraries. Glaze 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 You may now run the following commands to compile and install ${PROJECT}:
211 # construct the Makefile.config
212 cat > Makefile.config <<EOF
213 # This Makefile.config was automatically generated by the ./configure
214 # script of ${PROJECT}. If the configure script identified anything
215 # incorrectly, then you can edit this file to try to correct things,
216 # but be warned that if configure is run again it will destroy your
217 # changes, (and this could happen by simply calling "make" if the
218 # configure script is updated).
220 # The top-level directory for the source, (the directory containing
221 # the configure script). This may be different than the build
222 # directory (the current directory at the time configure was run).
225 configure_options = $@
227 # We use vpath directives (rather than the VPATH variable) since the
228 # VPATH variable matches targets as well as prerequisites, (which is
229 # not useful since then a target left-over from a srcdir build would
230 # cause a target to not be built in the non-srcdir build).
233 # The C compiler to use
236 # Default FLAGS for C compiler (can be overridden by user such as "make CFLAGS=-g")
239 # Default FLAGS for the linker (can be overridden by user such as "make LDFLAGS=-znow")
242 # Flags to enable warnings when using the C compiler
243 WARN_CFLAGS=${WARN_CFLAGS}
245 # The prefix to which ${PROJECT} should be installed
248 # The directory to which executables should be installed
249 BINDIR = ${BINDIR:=\$(PREFIX)/bin}
251 # The directory to which libraries should be installed
252 LIBDIR = ${LIBDIR:=\$(PREFIX)/lib}
254 # The directory to which headers should be installed
255 INCLUDEDIR = ${INCLUDEDIR:=\$(PREFIX)/include}
257 # Whether compiler can create 32 or 64-bit binaries
258 COMPILER_SUPPORTS_32 = ${have_m32}
259 COMPILER_SUPPORTS_64 = ${have_m64}