4 PROJECT_BLURB="a program for monitoring performance of OpenGL applications"
6 # Test whether this shell is capable of parameter substring processing.
7 ( option='a/b'; : ${option#*/} ) 2>/dev/null || {
9 The shell interpreting '$0' is lacking some required features.
11 To work around this problem you may try to execute:
20 # Store original IFS value so it can be changed (and restored) in many places.
21 readonly DEFAULT_IFS="$IFS"
23 srcdir=$(dirname "$0")
25 # For a non-srcdir configure invocation (such as ../configure), create
26 # the directory structure and copy Makefiles.
27 if [ "$srcdir" != "." ]; then
29 for dir in . $(grep "^subdirs *=" "$srcdir"/Makefile | sed -e "s/subdirs *= *//"); do
31 cp "$srcdir"/"$dir"/Makefile.local "$dir"
32 cp "$srcdir"/"$dir"/Makefile "$dir"
36 # Set several defaults (optionally specified by the user in
37 # environment variables)
42 # Set the defaults for values the user can specify with command-line
49 Usage: ./configure [options]...
51 This script configures ${PROJECT} to build on your system.
53 It verifies that dependencies are available, determines flags needed
54 to compile and link against various required libraries, and identifies
55 whether various system functions can be used or if locally-provided
56 replacements will be built instead.
58 Finally, it allows you to control various aspects of the build and
61 First, some common variables can specified via environment variables:
63 CC The C compiler to use
64 CFLAGS Flags to pass to the C compiler
65 LDFLAGS Flags to pass when linking
67 Each of these values can further be controlled by specifying them
68 later on the "make" command line.
70 Additionally, various options can be specified on the configure
73 --prefix=PREFIX Install files in PREFIX [$PREFIX]
75 By default, "make install" will install the resulting program to
76 $PREFIX/bin, documentation to $PREFIX/man, etc. You can
77 specify an installation prefix other than $PREFIX using
78 --prefix, for instance:
80 ./configure --prefix=\$HOME
82 Fine tuning of some installation directories is available:
84 --bindir=DIR Install executables to DIR [PREFIX/bin]
85 --libdir=DIR Install libraries to DIR [PREFIX/lib]
86 --mandir=DIR Install man pages to DIR [PREFIX/share/man]
87 --sysconfdir=DIR Read-only single-machine data [PREFIX/etc]
89 Additional options are accepted for compatibility with other
90 configure-script calling conventions, but don't do anything yet:
92 --build=<cpu>-<vendor>-<os> Currently ignored
93 --host=<cpu>-<vendor>-<os> Currently ignored
94 --infodir=DIR Currently ignored
95 --datadir=DIR Currently ignored
96 --localstatedir=DIR Currently ignored
97 --libexecdir=DIR Currently ignored
98 --disable-maintainer-mode Currently ignored
99 --disable-dependency-tracking Currently ignored
104 # Given two absolute paths ("from" and "to"), compute a relative path
105 # from "from" to "to". For example:
107 # relative_path /foo/bar/baz /foo/qux -> ../../qux
110 if [ $# -ne 2 ] ; then
111 echo "Internal error: relative_path requires exactly 2 arguments"
118 # Handle trivial case up-front
119 if [ "$from" = "$to" ] ; then
125 while [ "${to#$shared}" = "$to" ] && [ "$shared" != "." ] ; do
126 shared="$(dirname $shared)"
127 relative="..${relative:+/${relative}}"
130 echo "${relative:-.}${to#$shared}"
134 # Parse command-line options
136 if [ "${option}" = '--help' ] ; then
139 elif [ "${option%%=*}" = '--prefix' ] ; then
140 PREFIX="${option#*=}"
141 elif [ "${option%%=*}" = '--bindir' ] ; then
142 BINDIR="${option#*=}"
143 elif [ "${option%%=*}" = '--libdir' ] ; then
144 LIBDIR="${option#*=}"
145 elif [ "${option%%=*}" = '--mandir' ] ; then
146 MANDIR="${option#*=}"
147 elif [ "${option%%=*}" = '--sysconfdir' ] ; then
148 SYSCONFDIR="${option#*=}"
149 elif [ "${option%%=*}" = '--build' ] ; then
151 elif [ "${option%%=*}" = '--host' ] ; then
153 elif [ "${option%%=*}" = '--infodir' ] ; then
155 elif [ "${option%%=*}" = '--datadir' ] ; then
157 elif [ "${option%%=*}" = '--localstatedir' ] ; then
159 elif [ "${option%%=*}" = '--libexecdir' ] ; then
161 elif [ "${option}" = '--disable-maintainer-mode' ] ; then
163 elif [ "${option}" = '--disable-dependency-tracking' ] ; then
166 echo "Unrecognized option: ${option}"
175 Welcome to ${PROJECT}, ${PROJECT_BLURB}
177 We hope that the process of building and installing ${PROJECT} is quick
180 If anything goes wrong in the configure process, you can override any
181 decisions it makes by manually editing the Makefile.config file that
182 it creates. Also please do as much as you can to figure out what could
183 be different on your machine compared to those of the ${PROJECT}
184 developers. Then, please email those details to the ${PROJECT} developers so
185 that they can hopefully make future versions of ${PROJECT} easier for you to
188 We'll now investigate your system to verify that all required
189 dependencies are available:
195 if pkg-config --version > /dev/null 2>&1; then
201 printf "Checking for talloc development files... "
202 if pkg-config --exists talloc; then
205 talloc_cflags=$(pkg-config --cflags talloc)
206 talloc_ldflags=$(pkg-config --libs talloc)
211 errors=$((errors + 1))
214 printf "Checking which platform we are on... "
216 if [ $uname = "Darwin" ] ; then
219 linker_resolves_library_dependencies=0
220 elif [ $uname = "SunOS" ] ; then
223 linker_resolves_library_dependencies=0
224 elif [ $uname = "FreeBSD" ] ; then
227 linker_resolves_library_dependencies=0
228 elif [ $uname = "OpenBSD" ] ; then
231 linker_resolves_library_dependencies=0
232 elif [ $uname = "Linux" ] || [ $uname = "GNU" ] ; then
235 linker_resolves_library_dependencies=1
240 *** Warning: Unknown platform. ${PROJECT} might or might not build correctly.
245 if [ $errors -gt 0 ]; then
248 *** Error: The dependencies of ${PROJECT} could not be satisfied. You will
249 need to install the following packages before being able to compile
253 if [ $have_talloc -eq 0 ]; then
254 echo " The talloc library (including development files such as headers)"
255 echo " http://talloc.samba.org/"
259 With any luck, you're using a modern, package-based operating system
260 that has all of these packages available in the distribution. In that
261 case a simple command will install everything you need. For example:
263 On Debian and similar systems:
265 sudo apt-get install libtalloc-dev
267 Or on Fedora and similar systems:
269 sudo yum install libtalloc-devel
271 On other systems, similar commands can be used, but the details of the
272 package names may be different.
275 if [ $have_pkg_config -eq 0 ]; then
277 Note: the pkg-config program is not available. This configure script
278 uses pkg-config to find the compilation flags required to link against
279 the various libraries needed by ${PROJECT}. It's possible you simply need
280 to install pkg-config with a command such as:
282 sudo apt-get install pkg-config
284 sudo yum install pkgconfig
286 But if pkg-config is not available for your system, then you will need
287 to modify the configure script to manually set the cflags and ldflags
288 variables to the correct values to link against each library in each
289 case that pkg-config could not be used to determine those values.
294 When you have installed the necessary dependencies, you can run
295 configure again to ensure the packages can be found, or simply run
302 printf "int main(void){return 0;}\n" > minimal.c
305 printf "Checking for available C compiler warning flags... "
306 for flag in -Wall -Wextra -Wmissing-declarations; do
307 if ${CC} $flag -o minimal minimal.c > /dev/null 2>&1
309 WARN_CFLAGS="${WARN_CFLAGS}${WARN_CFLAGS:+ }${flag}"
312 printf "\n\t${WARN_CFLAGS}\n"
314 rm -f minimal minimal.c
318 All required packages were found. You may now run the following
319 commands to compile and install ${PROJECT}:
326 # construct the Makefile.config
327 cat > Makefile.config <<EOF
328 # This Makefile.config was automatically generated by the ./configure
329 # script of ${PROJECT}. If the configure script identified anything
330 # incorrectly, then you can edit this file to try to correct things,
331 # but be warned that if configure is run again it will destroy your
332 # changes, (and this could happen by simply calling "make" if the
333 # configure script is updated).
335 # The top-level directory for the source, (the directory containing
336 # the configure script). This may be different than the build
337 # directory (the current directory at the time configure was run).
340 configure_options = $@
342 # We use vpath directives (rather than the VPATH variable) since the
343 # VPATH variable matches targets as well as prerequisites, (which is
344 # not useful since then a target left-over from a srcdir build would
345 # cause a target to not be built in the non-srcdir build).
347 # Also, we don't use a single "vpath % \$(srcdir)" here because we
348 # don't want the vpath to trigger for our emacs lisp compilation,
349 # (unless we first find a way to convince emacs to build the .elc
350 # target in a directory other than the directory of the .el
351 # prerequisite). In the meantime, we're actually copying in the .el
352 # files, (which is quite ugly).
354 vpath %.cc \$(srcdir)
356 vpath Makefile.% \$(srcdir)
358 # The C compiler to use
361 # Default FLAGS for C compiler (can be overridden by user such as "make CFLAGS=-g")
364 # Default FLAGS for the linker (can be overridden by user such as "make LDFLAGS=-znow")
367 # Flags to enable warnings when using the C compiler
368 WARN_CFLAGS=${WARN_CFLAGS}
370 # The prefix to which ${PROJECT} should be installed
373 # The directory to which executables should be installed
374 bindir = ${BINDIR:=\$(prefix)/bin}
376 # The directory to which libraries should be installed
377 libdir = ${LIBDIR:=\$(prefix)/lib}
379 # The directory to which man pages should be installed
380 mandir = ${MANDIR:=\$(prefix)/share/man}
382 # The directory to which read-only (configuration) files should be installed
383 sysconfdir = ${SYSCONFDIR:=\$(prefix)/etc}
385 # Supported platforms (so far) are: LINUX, MACOSX, SOLARIS, FREEBSD, OPENBSD
386 PLATFORM = ${platform}
388 # Whether the linker will automatically resolve the dependency of one
389 # library on another (if not, then linking a binary requires linking
390 # directly against both)
391 LINKER_RESOLVES_LIBRARY_DEPENDENCIES = ${linker_resolves_library_dependencies}
393 # Flags needed to compile and link against talloc
394 TALLOC_CFLAGS = ${talloc_cflags}
395 TALLOC_LDFLAGS = ${talloc_ldflags}
397 # Flags needed to have linker link only to necessary libraries
398 AS_NEEDED_LDFLAGS = ${as_needed_ldflags}
400 # Combined flags for compiling and linking against all of the above
401 CONFIGURE_CFLAGS = \$(TALLOC_CFLAGS)
402 CONFIGURE_LDFLAGS = \$(TALLOC_LDFLAGS)
407 /* Generated by configure. */
409 /* Relative path from ${bindir} to ${libdir} */
410 #define BINDIR_TO_LIBFIPSDIR "$(relative_path ${BINDIR} ${LIBDIR})/fips"