#! /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 LIBDIR= 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 } # Parse command-line options for option; do if [ "${option}" = '--help' ] ; then usage exit 0 elif [ "${option%%=*}" = '--prefix' ] ; then PREFIX="${option#*=}" elif [ "${option%%=*}" = '--libdir' ] ; then LIBDIR="${option#*=}" elif [ "${option%%=*}" = '--includedir' ] ; then INCLUDEDIR="${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 # We set this value early, (rather than just while printing the # Makefile.config file later like most values), because we need to # actually investigate this value compared to the ldconfig_paths value # below. if [ -z "$LIBDIR" ] ; then libdir_expanded="${PREFIX}/lib" else # very non-general variable expansion libdir_expanded=`echo "$LIBDIR" | sed "s|\\${prefix}|${PREFIX}|g; s|\\$prefix/|${PREFIX}/|; s|//*|/|g"` fi 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 libdir_in_ldconfig=0 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 printf "Checking for $libdir_expanded in ldconfig... " ldconfig_paths=$(/sbin/ldconfig -N -X -v 2>/dev/null | sed -n -e 's,^\(/.*\):\( (.*)\)\?$,\1,p') # Separate ldconfig_paths only on newline (not on any potential # embedded space characters in any filenames). Note, we use a # literal newline in the source here rather than something like: # # IFS=$(printf '\n') # # because the shell's command substitution deletes any trailing newlines. IFS=" " for path in $ldconfig_paths; do if [ "$path" = "$libdir_expanded" ]; then libdir_in_ldconfig=1 fi done IFS=$DEFAULT_IFS if [ "$libdir_in_ldconfig" = '0' ]; then printf "No (will set RPATH)\n" else printf "Yes\n" fi 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 <