#! /bin/sh PROJECT=glaze PROJECT_BLURB="a shiny way to wrap OpenGL" MAJOR=0 MINOR=0 RELEASE=0 VERSION=${MAJOR}.${MINOR}.${RELEASE} 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 } # 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 printf "Checking for working C compiler (${CC})... " printf "int main(void){return 42;}\n" > minimal.c if ${CC} -o minimal minimal.c > /dev/null 2>&1 then printf "Yes.\n" else printf "No.\n" cat < /dev/null 2>&1 then WARN_CFLAGS="${WARN_CFLAGS}${WARN_CFLAGS:+ }${flag}" fi done printf "\t${WARN_CFLAGS}\n" rm -f minimal minimal.c printf "#include \nint main(void){return 0;}\n" > arch-minimal.c printf "Checking for machine-dependent compiler support:\n" printf " Compiler can create 32-bit binaries... " have_m32=Yes if ${CC} -m32 -o arch-minimal arch-minimal.c > /dev/null 2>&1 then printf "Yes.\n" printf " Target directory for 32-bit targets... " lib32_dir=$(gcc -m32 --print-multiarch) if [ "$lib32_dir" = "" ]; then lib32_dir="i386-linux-gnu" printf "\n\n" printf "\t\t*** Warning: Failed to query target directory.\n" printf "\t\tHard-coding to $lib32_dir\n" printf "\t\tFix LIB32_DIR in Makefile.config as needed.\n\n" else printf "${lib32_dir}\n" fi else printf "No.\n" have_m32=No fi printf " Compiler can create 64-bit binaries... " have_m64=Yes if ${CC} -m64 -o arch-minimal arch-minimal.c > /dev/null 2>&1 then printf "Yes.\n" printf " Target directory for 64-bit targets... " lib64_dir=$(gcc -m64 --print-multiarch) if [ "$lib64_dir" = "" ]; then lib64_dir="x86_64-linux-gnu" printf "\n\n" printf "\t\t*** Warning: Failed to query target directory.\n" printf "\t\tHard-coding to $lib64_dir\n" printf "\t\tFix LIB64_DIR in Makefile.config as needed.\n\n" else printf "${lib64_dir}\n" fi else printf "No.\n" have_m64=No fi if [ "$have_m32" = "No" ] || [ "$have_m64" = "No" ]; then cat < Makefile.config < config.h < glaze.pc < glaze-32.pc <