4 PROJECT_BLURB="a shiny way to wrap OpenGL"
9 VERSION=${MAJOR}.${MINOR}.${RELEASE}
11 srcdir=$(dirname "$0")
13 # For a non-srcdir configure invocation (such as ../configure), create
14 # the directory structure and copy Makefiles.
15 if [ "$srcdir" != "." ]; then
17 for dir in . $(grep "^subdirs *=" "$srcdir"/Makefile | sed -e "s/subdirs *= *//"); do
19 cp "$srcdir"/"$dir"/Makefile.local "$dir"
20 cp "$srcdir"/"$dir"/Makefile "$dir"
24 # Set several defaults (optionally specified by the user in
25 # environment variables)
30 # Set the defaults for values the user can specify with command-line
37 Usage: ./configure [options]...
39 This script configures ${PROJECT} to build on your system.
41 It verifies that dependencies are available, determines flags needed
42 to compile and link against various required libraries, and identifies
43 whether various system functions can be used or if locally-provided
44 replacements will be built instead.
46 Finally, it allows you to control various aspects of the build and
49 First, some common variables can specified via environment variables:
51 CC The C compiler to use
52 CFLAGS Flags to pass to the C compiler
53 LDFLAGS Flags to pass when linking
55 Each of these values can further be controlled by specifying them
56 later on the "make" command line.
58 Additionally, various options can be specified on the configure
61 --prefix=PREFIX Install files in PREFIX [$PREFIX]
63 By default, "make install" will install the resulting program to
64 $PREFIX/bin, documentation to $PREFIX/man, etc. You can
65 specify an installation prefix other than $PREFIX using
66 --prefix, for instance:
68 ./configure --prefix=\$HOME
70 Fine tuning of some installation directories is available:
72 --bindir=DIR Install executables to DIR [PREFIX/bin]
73 --libdir=DIR Install libraries to DIR [PREFIX/lib]
74 --mandir=DIR Install man pages to DIR [PREFIX/share/man]
75 --sysconfdir=DIR Read-only single-machine data [PREFIX/etc]
77 Additional options are accepted for compatibility with other
78 configure-script calling conventions, but don't do anything yet:
80 --build=<cpu>-<vendor>-<os> Currently ignored
81 --host=<cpu>-<vendor>-<os> Currently ignored
82 --infodir=DIR Currently ignored
83 --datadir=DIR Currently ignored
84 --localstatedir=DIR Currently ignored
85 --libexecdir=DIR Currently ignored
86 --disable-maintainer-mode Currently ignored
87 --disable-dependency-tracking Currently ignored
92 # Parse command-line options
94 if [ "${option}" = '--help' ] ; then
97 elif [ "${option%%=*}" = '--prefix' ] ; then
99 elif [ "${option%%=*}" = '--bindir' ] ; then
100 BINDIR="${option#*=}"
101 elif [ "${option%%=*}" = '--libdir' ] ; then
102 LIBDIR="${option#*=}"
103 elif [ "${option%%=*}" = '--mandir' ] ; then
104 MANDIR="${option#*=}"
105 elif [ "${option%%=*}" = '--sysconfdir' ] ; then
106 SYSCONFDIR="${option#*=}"
107 elif [ "${option%%=*}" = '--build' ] ; then
109 elif [ "${option%%=*}" = '--host' ] ; then
111 elif [ "${option%%=*}" = '--infodir' ] ; then
113 elif [ "${option%%=*}" = '--datadir' ] ; then
115 elif [ "${option%%=*}" = '--localstatedir' ] ; then
117 elif [ "${option%%=*}" = '--libexecdir' ] ; then
119 elif [ "${option}" = '--disable-maintainer-mode' ] ; then
121 elif [ "${option}" = '--disable-dependency-tracking' ] ; then
124 echo "Unrecognized option: ${option}"
132 printf "Checking for working C compiler (${CC})... "
133 printf "int main(void){return 42;}\n" > minimal.c
134 if ${CC} -o minimal minimal.c > /dev/null 2>&1
141 *** Error: No functioning C compiler found. Either set the CC environment
142 to a working C compiler, or else install gcc:
146 You may be able to install gcc with a command such as:
148 sudo apt-get install build-essential
150 sudo yum install make automake gcc gcc-c++ kernel-devel
159 printf "Checking for available C compiler warning flags:\n"
160 for flag in -Wall -Wextra -Wmissing-declarations -Werror=attributes; do
161 if ${CC} $flag -o minimal minimal.c > /dev/null 2>&1
163 WARN_CFLAGS="${WARN_CFLAGS}${WARN_CFLAGS:+ }${flag}"
166 printf "\t${WARN_CFLAGS}\n"
168 rm -f minimal minimal.c
170 printf "#include <features.h>\nint main(void){return 0;}\n" > arch-minimal.c
172 printf "Checking for machine-dependent compiler support:\n"
174 printf " Compiler can create 32-bit binaries... "
176 if ${CC} -m32 -o arch-minimal arch-minimal.c > /dev/null 2>&1
180 printf " Target directory for 32-bit targets... "
182 lib32_dir=$(gcc -m32 --print-multiarch)
183 printf "${lib32_dir}\n"
190 printf " Compiler can create 64-bit binaries... "
192 if ${CC} -m64 -o arch-minimal arch-minimal.c > /dev/null 2>&1
196 printf " Target directory for 64-bit targets... "
198 lib64_dir=$(gcc -m64 --print-multiarch)
199 printf "${lib64_dir}\n"
206 if [ "$have_m32" = "No" ] || [ "$have_m64" = "No" ]; then
209 * Warning: Cannot create both 32 and 64-bit glaze libraries. Glaze will not
210 support applications of the non-native size. Fixing this may be
211 as simple as running a command such as:
213 sudo apt-get install gcc-multilib
217 rm -f arch-minimal arch-minimal.c
221 You may now run the following commands to compile and install ${PROJECT}:
228 # construct the Makefile.config
229 cat > Makefile.config <<EOF
230 # This Makefile.config was automatically generated by the ./configure
231 # script of ${PROJECT}. If the configure script identified anything
232 # incorrectly, then you can edit this file to try to correct things,
233 # but be warned that if configure is run again it will destroy your
234 # changes, (and this could happen by simply calling "make" if the
235 # configure script is updated).
237 # The top-level directory for the source, (the directory containing
238 # the configure script). This may be different than the build
239 # directory (the current directory at the time configure was run).
242 configure_options = $@
244 # We use vpath directives (rather than the VPATH variable) since the
245 # VPATH variable matches targets as well as prerequisites, (which is
246 # not useful since then a target left-over from a srcdir build would
247 # cause a target to not be built in the non-srcdir build).
250 # The C compiler to use
253 # Default FLAGS for C compiler (can be overridden by user such as "make CFLAGS=-g")
256 # Default FLAGS for the linker (can be overridden by user such as "make LDFLAGS=-znow")
259 # Flags to enable warnings when using the C compiler
260 WARN_CFLAGS = ${WARN_CFLAGS}
262 # The prefix to which ${PROJECT} should be installed
265 # The directory to which executables should be installed
266 BINDIR = ${BINDIR:-\$(PREFIX)/bin}
268 # The directory to which libraries should be installed
269 LIBDIR = ${LIBDIR:-\$(PREFIX)/lib}
271 # The directory to which headers should be installed
272 INCLUDEDIR = ${INCLUDEDIR:-\$(PREFIX)/include}
274 # Whether compiler can create 32 or 64-bit binaries
275 COMPILER_SUPPORTS_32 = ${have_m32}
276 LIB32_DIR = lib/${lib32_dir}
277 COMPILER_SUPPORTS_64 = ${have_m64}
278 LIB64_DIR = lib/${lib64_dir}
280 # Version information for glaze library
288 # construct the glaze.pc file
291 exec_prefix=\${prefix}
292 libdir=${LIBDIR:-\${exec_prefix\}/lib}
293 includedir=${INCLUDEDIR:-\${prefix\}/include}
296 Description: ${PROJECT_BLURB}
299 Libs: -L\${libdir} -lglaze
300 Cflags: -I\${includedir}/glaze