#! /bin/sh PROJECT=fips PROJECT_BLURB="a program for monitoring performance of OpenGL applications" # Test whether this shell is capable of parameter substring processing. ( option='a/b'; : ${option#*/} ) 2>/dev/null || { echo " The shell interpreting '$0' is lacking some required features. To work around this problem you may try to execute: ksh $0 $* or bash $0 $* " exit 1 } # Store original IFS value so it can be changed (and restored) in many places. readonly DEFAULT_IFS="$IFS" srcdir=$(dirname "$0") # For a non-srcdir configure invocation (such as ../configure), create # the directory structure and copy Makefiles. if [ "$srcdir" != "." ]; then for dir in . $(grep "^subdirs *=" "$srcdir"/Makefile | sed -e "s/subdirs *= *//"); do mkdir -p "$dir" cp "$srcdir"/"$dir"/Makefile.local "$dir" cp "$srcdir"/"$dir"/Makefile "$dir" done fi # Set several defaults (optionally specified by the user in # environment variables) CC=${CC:-gcc} CFLAGS=${CFLAGS:--O2} LDFLAGS=${LDFLAGS:-} # Set the defaults for values the user can specify with command-line # options. PREFIX=/usr/local usage () { cat <-- Currently ignored --host=-- Currently ignored --infodir=DIR Currently ignored --datadir=DIR Currently ignored --localstatedir=DIR Currently ignored --libexecdir=DIR Currently ignored --disable-maintainer-mode Currently ignored --disable-dependency-tracking Currently ignored EOF } # Given two absolute paths ("from" and "to"), compute a relative path # from "from" to "to". For example: # # relative_path /foo/bar/baz /foo/qux -> ../../qux relative_path () { if [ $# -ne 2 ] ; then echo "Internal error: relative_path requires exactly 2 arguments" exit 1; fi from="$1" to="$2" # Handle trivial case up-front if [ "$from" = "$to" ] ; then echo "" else shared="$from" relative="" while [ "${to#$shared}" = "$to" ] && [ "$shared" != "." ] ; do shared="$(dirname $shared)" relative="..${relative:+/${relative}}" done echo "${relative:-.}${to#$shared}" fi } # Parse command-line options for option; do if [ "${option}" = '--help' ] ; then usage exit 0 elif [ "${option%%=*}" = '--prefix' ] ; then PREFIX="${option#*=}" elif [ "${option%%=*}" = '--bindir' ] ; then BINDIR="${option#*=}" elif [ "${option%%=*}" = '--libdir' ] ; then LIBDIR="${option#*=}" elif [ "${option%%=*}" = '--mandir' ] ; then MANDIR="${option#*=}" elif [ "${option%%=*}" = '--sysconfdir' ] ; then SYSCONFDIR="${option#*=}" elif [ "${option%%=*}" = '--build' ] ; then true elif [ "${option%%=*}" = '--host' ] ; then true elif [ "${option%%=*}" = '--infodir' ] ; then true elif [ "${option%%=*}" = '--datadir' ] ; then true elif [ "${option%%=*}" = '--localstatedir' ] ; then true elif [ "${option%%=*}" = '--libexecdir' ] ; then true elif [ "${option}" = '--disable-maintainer-mode' ] ; then true elif [ "${option}" = '--disable-dependency-tracking' ] ; then true else echo "Unrecognized option: ${option}" echo "See:" echo " $0 --help" echo "" exit 1 fi done cat < /dev/null 2>&1; then have_pkg_config=1 else have_pkg_config=0 fi printf "Checking for talloc development files... " if pkg-config --exists talloc; then printf "Yes.\n" have_talloc=1 talloc_cflags=$(pkg-config --cflags talloc) talloc_ldflags=$(pkg-config --libs talloc) else printf "No.\n" have_talloc=0 talloc_cflags= errors=$((errors + 1)) fi printf "Checking which platform we are on... " uname=`uname` if [ $uname = "Darwin" ] ; then printf "Mac OS X.\n" platform=MACOSX linker_resolves_library_dependencies=0 elif [ $uname = "SunOS" ] ; then printf "Solaris.\n" platform=SOLARIS linker_resolves_library_dependencies=0 elif [ $uname = "FreeBSD" ] ; then printf "FreeBSD.\n" platform=FREEBSD linker_resolves_library_dependencies=0 elif [ $uname = "OpenBSD" ] ; then printf "OpenBSD.\n" platform=OPENBSD linker_resolves_library_dependencies=0 elif [ $uname = "Linux" ] || [ $uname = "GNU" ] ; then printf "$uname\n" platform="$uname" linker_resolves_library_dependencies=1 else printf "Unknown.\n" cat < minimal.c WARN_CFLAGS="" printf "Checking for available C compiler warning flags... " for flag in -Wall -Wextra -Wmissing-declarations; do if ${CC} $flag -o minimal minimal.c > /dev/null 2>&1 then WARN_CFLAGS="${WARN_CFLAGS}${WARN_CFLAGS:+ }${flag}" fi done printf "\n\t${WARN_CFLAGS}\n" rm -f minimal minimal.c cat < Makefile.config < config.h <