#!/bin/bash C_TEMPDIR=`mktemp -d /tmp/iwear-configure.XXXXXX` PQLIBDIRS="/usr/lib/ /usr/lib/pgsql/ /usr/local/pgsql/lib/" PQINCDIRS="/usr/include/ /usr/include/pgsql /usr/include/postgresql /usr/local/pgsql/include /usr/include/postgresql/8.0/" SSLINCDIRS="/usr/include/ssl /usr/include/openssl /usr/local/include/openssl /usr/local/include/ssl /home/solarispc/include/openssl" GLIB2INCLUDES="/opt/gnome/lib/glib-2.0/include /opt/gnome/include/glib-2.0 /usr/lib/glib-2.0/include /usr/include/glib-2.0" GLIB2CONFIG="/opt/gnome/lib/glib-2.0/include /usr/lib/glib-2.0/include" GLIB2LIBDIRS="/opt/gnome/lib/ /usr/lib/" ORBITCPPINCLUDES="/usr/include/orbitcpp-2.0 /opt/gnome/include/orbitcpp-2.0/" ORBITCPPCONFIG="" ORBITCPPLIBDIRS="/opt/gnome/lib/ /usr/lib/" ORBITCPPIDLS="/usr/bin/orbit-idl-2 /opt/gnome/bin/orbit-idl-2" ORBIT2INCLUDES="/opt/gnome/include/orbit-2.0/ /usr/include/orbit-2.0" ORBIT2LIBDIRS="/opt/gnome/lib/ /usr/lib/" LINCINCLUDES="/opt/gnome/include/linc-1.0 /usr/include/linc-1.0" IWEARINCDIRS="$HOME/include/ $HOME/iwear/include /usr/include" IWEARLIBDIRS="$HOME/lib/ $HOME/iwear/lib /usr/lib" IWDBINCDIRS="$HOME/include/ $HOME/iwear/include /usr/include" IWDBLIBDIRS="$HOME/lib/ $HOME/iwear/lib /usr/lib" IWSENSINCDIRS="$HOME/include/ $HOME/iwear/include /usr/include" IWSENSLIBDIRS="$HOME/lib/ $HOME/iwear/lib /usr/lib" QT3INCDIRS="/usr/lib/qt3/include/ /usr/pkg/qt3/include/ /usr/include/qt3/" QT3LIBDIRS="/usr/lib/qt3/lib/ /usr/pkg/qt3/lib/ /usr/lib/qt3/" BOOSTINCDIRS="/usr/include /home/solarispc/include/" XERCESLIBDIRS="/usr/lib" XERCESINCDIRS="/usr/include" SDLLIBDIRS="/usr/lib" SDLINCDIRS="/usr/include" SDL_TTFLIBDIRS="/usr/lib" SDL_TTFINCDIRS="/usr/include" SDL_IMAGELIBDIRS="/usr/lib" SDL_IMAGEINCDIRS="/usr/include" SDL_MIXERLIBDIRS="/usr/lib" SDL_MIXERINCDIRS="/usr/include" SDL_GFXLIBDIRS="/usr/lib" SDL_GFXINCDIRS="/usr/include" ID3TAGLIBDIRS="/usr/lib" ID3TAGINCDIRS="/usr/include" SYSLIB="/usr/lib" DLLIBS="# -ldl" THREADLIBS="# -lc -pthread -lpthread" BAIL=no # For colored output ESC="\033[1" RED="$ESC;31m" GRN="$ESC;32m" YEL="$ESC;33m" BLU="$ESC;34m" VIO="$ESC;35m" TUK="$ESC;36m" WHT="$ESC;37m" NOR="\033[m" # Set the variables if not already set if [ -z $CC ] then CC=gcc fi if [ -z $CPP ] then CPP=g++ fi if [ -z $OIDL2 ] then OIDL2=/opt/gnome/bin/orbit-idl-2 fi function log { echo $* >> $CONFLOG } function logecho { echo $* log $* } function asctoint { ASCII=$1 # echo -en $ASCII | $HEXDUMP -d | head -1 | cut -d" " -f4 echo -en $ASCII | perl -e 'my $a = <>; print ord($a);' } function check_ostype # {{{ { logecho -en "Checking OS Type .. " SYSTYPE=$(uname -s) case $SYSTYPE in Linux) OS_TYPE=linux ;; Darwin) OS_TYPE=mac ;; SunOS) OS_TYPE=solaris ;; freebsd4.6) OS_TYPE=freebsd ;; openbsd3.4) OS_TYPE=openbsd ;; *) OS_TYPE=$OSTYPE logecho -en ". [OS Type $OS_TYPE not supported, proceeding anyways].. " ;; esac logecho -e ." "$OS_TYPE } # }}} function check_dynlib # {{{ { logecho -en "Checking for dynamic library suffix .. " case $OS_TYPE in solaris | linux | openbsd | freebsd) DYN_SUFFIX="so" ;; mac) DYN_SUFFIX="dylib" ;; *) DYN_SUFFIX="so" logecho -en ". [OS Type $OS_TYPE not supported, proceeding with .so.. " ;; esac logecho -e ." "$DYN_SUFFIX logecho -en "Checking for dynamic linker flags .. " case $OS_TYPE in solaris ) LIBFLAGS="-Wl,-rpath $HOME/lib -shared -Wl,-warn-once,-soname," SYSCPPFLAGS="$SYSCPPFLAGS -fPIC" SYSCFLAGS="$SYSCFLAGS -fPIC" # logecho -en "[x86_64 -fPIC]" ;; linux | openbsd | freebsd) LIBFLAGS="-shared -Wl,-warn-once,-soname," if [ "$HOSTTYPE" == x86_64 ] then SYSCPPFLAGS="$SYSCPPFLAGS -fPIC" SYSCFLAGS="$SYSCFLAGS -fPIC" logecho -en "[x86_64 -fPIC]" fi ;; mac) LIBFLAGS="-flat_namespace -undefined suppress -dynamiclib -install_name" ;; *) LIBFLAGS="-shared -Wl,-warn-once,-soname," logecho -en ". [OS Type $OS_TYPE not supported, proceeding with $LIBFLAGS .. " ;; esac logecho -e ." "$LIBFLAGS } # }}} function cleanup # {{{ { if [ -d "$C_TEMPDIR" ] then log "Cleaning up temporary directories..." rm -r $C_TEMPDIR 2>&1 >> $CONFLOG fi } # }}} function check_version # {{{ { WANTED=$1 HAVE=$2 WHAT=$3 if [ -z "$4" ] then DISPLAY_WANTED=$WANTED else DISPLAY_WANTED=$4 fi if [ -z "$5" ] then DISPLAY_HAVE=$HAVE else DISPLAY_HAVE=$5 fi HAVE_MAJ=`echo $HAVE | cut -d"." -f1` HAVE_MIN=`echo $HAVE | cut -d"." -f2` HAVE_REL=`echo $HAVE | cut -d"." -f3` WANT_MAJ=`echo $WANTED | cut -d"." -f1` WANT_MIN=`echo $WANTED | cut -d"." -f2` WANT_REL=`echo $WANTED | cut -d"." -f3` VERSION_OK=yes log -e "Checking Version of $WHAT wanting $DISPLAY_WANTED and found $DISPLAY_HAVE" if [ $HAVE_MAJ -lt $WANT_MAJ ] then VERSION_OK=no echo "fail" echo "Your Major Version of $WHAT ($DISPLAY_HAVE) does not match the required one $DISPLAY_WANTED" return else if [ $HAVE_MAJ -eq $WANT_MAJ -a $HAVE_MIN -lt $WANT_MIN ] then echo "fail" echo "Your Minor Version of $WHAT ($DISPLAY_HAVE) does not match the required one $DISPLAY_WANTED" VERSION_OK=no return else if [ $HAVE_MAJ -eq $WANT_MAJ -a $HAVE_MIN -eq $WANT_MIN -a $HAVE_REL -lt $WANT_REL ] then echo "fail" echo "Your Release Version of $WHAT ($DISPLAY_HAVE) does not match the required one $DISPLAY_WANTED" VERSION_OK=no return fi fi fi } # }}} function toupper # {{{ { sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' } # }}} function tolower # {{{ { sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/' } # }}} function logsetvar # {{{ { VAR=$1 CONT=$2 log -e "Setting $VAR=$CONT" eval "$VAR=$CONT" } # }}} function search_libdir # {{{ { LFLAG=$1 PDIRS=$2 TEMPO=$C_TEMPDIR/check_lib TEMPC=$C_TEMPDIR/check_lib.c FOUNDLIB="" cat > $TEMPC <> $CONFLOG 2>&1 if [ -x "$TEMPO" ] then FOUNDLIB=$dir return fi done } # }}} function test_include # {{{ { MCC=$1 CFILE=$2 LCFLAGS=$3 OFILE=$4 TTAG=$5 TRIALSS=$6 TRIAL="" log "Testing Program $CFILE" log "Contents : " cat $CFILE >> $CONFLOG log "CFLAGS = $LCFLAGS" rm -f $OFILE for inc in $TRIALSS do if [ "$inc" == "#" ] then inc="" fi log "Exec ($MCC $LCFLAGS $TTAG $inc -o $OFILE $CFILE)" $MCC $LCFLAGS ${TTAG}${inc} -o $OFILE $CFILE >> $CONFLOG 2>&1 if [ -x "$OFILE" ] then log "Setting TRIAL=$inc" TRIAL=$inc return fi done } # }}} # Sets BAIL=yes if the Version is wrong function check_gcc #{{{ { BAIL=no VERSION_OK=no WANTED_GCC=$1 logecho -en "Checking for $CC >= $WANTED_GCC ... " if [ "$FORCEGCC" == "yes" ] then logecho "(skipped - user override)" return fi TEMP_C="$C_TEMPDIR/check_gcc.c" TEMP_X=`mktemp $C_TEMPDIR/check_gcc.XXXXXX` cat > $TEMP_C < #ifndef __GNUC_PATCHLEVEL__ #define __GNUC_PATCHLEVEL__ 0 #endif int main ( void ) { printf("%d.%d.%d\n",__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__); return 0; } XEOF log -e "\nContents of $TEMP_C" cat $TEMP_C >> $CONFLOG log -e "exec( $CC $CFLAGS $TEMP_C -o $TEMP_X )" $CC $CFLAGS $TEMP_C -o $TEMP_X >> $CONFLOG 2>&1 rm -f $TEMP_C if [ ! -x $TEMP_X ] then logecho -e "Could not create executable, check compiler and CFLAGS" exec echo "Stop" fi read GCC_VER < <($TEMP_X) check_version $WANTED_GCC $GCC_VER "gcc" if [ "$VERSION_OK" != "yes" ] then BAIL=yes return fi logecho -e "$GCC_VER (OK)" rm -f $TEMP_X } #}}} # Sets BAIL=yes if the Version is wrong function check_gpp #{{{ { BAIL=no WANTED_GPP=$1 logecho -en "Checking for $CPP >= $WANTED_GPP ... " if [ "$FORCEGPP" == "yes" ] then echo "(skipped - user override)" return fi TEMP_CPP="$C_TEMPDIR/check_gcc.cpp" TEMP_X=`mktemp $C_TEMPDIR/check_gcc.XXXXXX` cat > $TEMP_CPP < #include #ifndef __GNUC_PATCHLEVEL__ #define __GNUC_PATCHLEVEL__ 0 #endif int main ( void ) { printf("%d.%d.%d\n",__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__); return 0; } XEOF log -e "\nContents of $TEMP_CPP" cat $TEMP_CPP >> $CONFLOG log -e "Exec( $CPP $CPPFLAGS $TEMP_CPP -o $TEMP_X )" $CPP $CPPFLAGS $TEMP_CPP -o $TEMP_X >> $CONFLOG 2>&1 rm -f $TEMP_CPP if [ ! -x $TEMP_X ] then BAIL=yes logecho -e "\nCould not create a program with $CPP please verify that its working properly" return fi read GPP_VER < <($TEMP_X 2>> $CONFLOG) if [ -z "$GPP_VER" ] then logecho -e "\nWe were able to build an executable, but the executable failed to run" BAIL=yes return fi check_version $WANTED_GPP $GPP_VER "g++" if [ "$VERSION_OK" != "yes" ] then BAIL=yes return fi logecho "$GPP_VER (OK)" logecho -en "Checking for $CPP extra warning flag... " GPP_MAJ=`echo $GPP_VER | cut -d"." -f1` GPP_MIN=`echo $GPP_VER | cut -d"." -f2` GPP_REL=`echo $GPP_VER | cut -d"." -f3` WEXTRA="-W" if [ $GPP_MAJ -ge 4 ] then WEXTRA="-Wextra" else if [ $GPP_MIN -ge 4 ] then WEXTRA="-Wextra" fi fi logecho " $WEXTRA" rm -f $TEMP_X } #}}} # Sets BAIL=yes if the Version is wrong function check_gmake #{{{ { MAKE=`which gmake` if [ -z $MAKE ] then MAKE=`which make` fi log -e "Found a make at $MAKE" WANTED_VER=$1 logecho -n "Checking for GNU Make >= $WANTED_VER ... " if [ "$FORCEMAKE" ] then logecho "(user override)" return fi VER=$($MAKE --version 2>/dev/null | grep GNU | head -1 | sed 's/\([^0-9]*\)\([0-9\.]*\),\(.*\)$/\2/g' | sed 's/[^0-9\.]//g') if [ -z "$VER" ] then echo "fail" echo "This Environment is compatible with GNU Make only." echo "Please install GNU Make or provide a link called gmake within \$PATH" BAIL=yes return 1 fi check_version $WANTED_VER $VER "gmake" if [ "$VERSION_OK" != "yes" ] then BAIL=yes return fi logecho -e "$VER (OK)" MAKEMD5=$(md5sum $MAKE | cut -d" " -f1) if [ -z "$MAKEMD5" ] then MAKEMD5=$(md5 $MAKE | cut -d" " -f1) fi case $MAKEMD5 in 55abf10fc1cf2f59662a28662a2931b2 | 4efe0480f7fa6589ff382dcfdc5231a2 | e4014aa543f1e2e9fec083773af33385 | 1dd8dd18455acfe252a1f31d071748cb | 1c46755ef3c6ddf79321848af77341be | eae6e72fbfc491d7490df4fb34d5c4a9 | 2b33c6b8a6b2d2fd577d880d1f930a65 | 26b6db058718fb69be92b2b0995a0983 | 3c8b49e874180d6d1e45ec66f5102c45 ) BAIL=yes echo echo "Though we have detected a make version that satisfies the version" echo "required, it is in a blacklist of buggy make versions. We highly" echo "recommend that you upgrade your make version, since those make version" echo "wont work with the iwear makefiles" ;; *) # echo "md5sum : $MAKEMD5" ;; esac } #}}} # Sets $PKG_CONFIG to the pkg-config binary, leaves it empty if not present or # not to be used by user override function check_pkg_config #{{{ { PKG_CONFIG=`which pkg-config 2>/dev/null` logecho -n "Checking for pkg-config ... " if [ -z "$PKG_CONFIG" ] then logecho "no" else if [ "$NO_PKG_CONFIG" == "yes" ] then logecho "skipped (user override)" PKG_CONFIG="" else logecho "yes ($PKG_CONFIG)" fi fi } #}}} # The script needs sed sometimes function check_sed #{{{ { logecho -en "Checking for sed ... " SED=`which sed 2>/dev/null` if [ -z "$SED" ] then BAIL="yes" echo -e $RED logecho -n "(fail)"" " echo -en $YEL logecho -n "No sed in \$PATH" echo -e $NOR logecho "($PATH)" echo -e $YEL logecho "$0 needs sed in order to continue." logecho "Please install sed, add its location to the path," logecho "or create a symlink within the path to a functional sed" echo -e $NOR return fi logecho "(OK)" } # }}} function check_mktemp #{{{ { logecho -en "Checking for mktemp ... " mktemp=`which mktemp 2>/dev/null` if [ -z "$mktemp" ] then BAIL="yes" echo -e $RED logecho -n "(fail)"" " echo -en $YEL logecho -n "No mktemp in \$PATH" echo -e $NOR logecho "($PATH)" echo -e $YEL logecho "$0 needs mktemp in order to continue." logecho "Please install mktemp, add its location to the path," logecho "or create a symlink within the path to a functional mktemp" echo -e $NOR return fi TMPDIR=$(mktemp -d /tmp/xxx.XXXXXX 2>/dev/null) RET=$? if [ $RET != 0 ] then BAIL="yes" echo -e $RED logecho -n "(fail)"" " echo -en $YEL logecho -n "mktemp cannot create directories" echo -e $NOR logecho "($PATH)" echo -e $YEL logecho "$0 needs mktemp to create directories to continue" logecho "please install a recent mktemp to continue" echo -e $NOR return fi rmdir $TMPDIR &> /dev/null logecho "(OK)" } # }}} # Check for installation of pgsql libraries and the headers # sets PG_INCLUDE and PG_LIBDIR and BAIL if not found or version too old function check_pgsql # {{{ { WANTED_VER=$1 echo -en "Checking for PostgreSQL >= $WANTED_VER ... " PG_CONFIG=`which pg__config 2>/dev/null` if [ -z "$PG_CONFIG" ] then logecho -en "(no pg_config) " TEMP_C="$C_TEMPDIR/check_libpq.c" TEMP_X=`mktemp $C_TEMPDIR/check_libpq.XXXXXX` cat > $TEMP_C <> $CONFLOG log -e "ATTEMPTING TO FIND DIRECTORIES VIA TRIAL COMPILE" test_include $CC $TEMP_C "$CFLAGS -lpq" $TEMP_X -L "$PQLIBDIRS" log -e "Found PG_LIBDIR=$TRIAL" PG_LIBDIR=$TRIAL if [ -z "$PG_LIBDIR" ] then logecho "failed. Could not find directory where libpq.so lives in" BAIL=yes return fi ######----------------------------------------------------------- log -e "Trial compiling for header files" cat > $TEMP_C < #include int main ( void ) { printf(PG_VERSION); return 0; } XEOF log -e "Contents of $TEMP_C" cat $TEMP_C >> $CONFLOG test_include $CC $TEMP_C "$CFLAGS" $TEMP_X -I "$PQINCDIRS" PG_INCLUDE=$TRIAL if [ -x "$TEMP_X" ] then PG_VER=`$TEMP_X` fi log -e "TEST INCLUDE COMPILE $PG_INCLUDE" log -e "PG_VER=$PG_VER" if [ -z "$PG_INCLUDE" -o -z "$PG_VER" ] then logecho "\nfailed. Could not find directory where libpq-fe.h lives in" BAIL=yes return fi else PG_VER=`$PG_CONFIG --version | cut -d" " -f2-` PG_INCLUDE=`$PG_CONFIG --includedir` PG_LIBDIR=`$PG_CONFIG --libdir` log -e "pg_config found, getting dirs and flags from there..." log -e "Setting PG_VER=$PG_VER" log -e "Setting PG_INCLUDE=$PG_INCLUDE" log -e "Setting PG_LIBDIR=$PG_LIBDIR" fi check_version $WANTED_VER $PG_VER "PostgreSQL" if [ "$VERSION_OK" != "yes" ] then BAIL=yes return fi logecho -e "$PG_VER (OK)" } # }}} function check_libpq # {{{ { logecho -en "Checking for usable libpq ... " TEMP_C="$C_TEMPDIR/check_libpq.c" TEMP_X=`mktemp $C_TEMPDIR/check_libpq.XXXXXX` cat > $TEMP_C < int main ( void ) { PQconnectStart("Hello World"); return 0; } XEOF log -e "Contents of $TEMP_C" cat $TEMP_C >> $CONFLOG log -e "Exec( $CC $CFLAGS -I $PG_INCLUDE -L$PG_LIBDIR $TEMP_C -o $TEMP_X -lpq )" $CC $CFLAGS -I $PG_INCLUDE -L$PG_LIBDIR $TEMP_C -o $TEMP_X -lpq >> $CONFLOG 2>&1 if [ ! -x "$TEMP_X" ] then logecho "fail" BAIL=yes logecho "We were not able to compile the test program for libpq" fi rm -f $TEMP_C rm -f $TEMP_X logecho "(OK)" } #}}} function check_linc # {{{ { logecho -en "Checking linc includes... " TEMP_C="$C_TEMPDIR/check_linc.c" TEMP_X=`mktemp $C_TEMPDIR/check_linc.XXXXXX` cat > $TEMP_C < int main ( void ) { return 0; } XEOF log -e "Contents of $TEMP_C" cat $TEMP_C >> $CONFLOG test_include $CC $TEMP_C "-I $GLIB2_CONFIG -I $GLIB2_INCLUDE" $TEMP_X -I "$LINCINCLUDES" LINC_INCLUDE=$TRIAL log -e "Succes, set LINC_INCLUDE=$LINC_INCLUDE" if [ ! -x "$TEMP_X" ] then logecho "fail" BAIL=yes logecho "We were not able to compile the test program for linc. Have you installed the Headers (-devel package of your distro) ?" else logecho "(OK)" fi # rm -f $TEMP_C rm -f $TEMP_X } #}}} function check_iwear # {{{ { WANTED_VER=$1 TEMP_C="$C_TEMPDIR/check_iwear.c" TEMP_X=`mktemp $C_TEMPDIR/check_iwear.XXXXXX` cat > $TEMP_C < int main ( void ) { printf("%lu.%lu.%lu\n",IWEAR_MAJOR,IWEAR_MINOR,IWEAR_RELEASE); return 0; } XEOF logecho -en "Checking for iWear core libraries ... " search_libdir "-liwear_core" "$IWEARLIBDIRS" logsetvar IWEAR_LIBDIR $FOUNDLIB if [ -z "$FOUNDLIB" ] then logecho -e "fail" logecho -e "We were not able to generate a check program for $CHECKME." logecho -e "please see $CONFLOG for details" BAIL=yes return fi logecho " (OK)" logecho -en "Checking for iWear core includes ... " log -e "Trial compiling $TEMP_C" cat $TEMP_C >> $CONFLOG test_include $CC $TEMP_C "$DLLIB -L$IWEAR_LIBDIR -liwear_core" $TEMP_X -I "$IWEARINCDIRS" IWEAR_INCLUDE=$TRIAL log -e "Succes, set IWEAR_INCLUDE=$IWEAR_INCLUDE" if [ ! -x "$TEMP_X" ] then logecho "fail" BAIL=yes logecho "We were not able to compile the test program for iWear core. Have you installed the Headers (-devel package of your distro) ?" else logecho -e "yes ($IWEAR_INCLUDE)" logecho -en "Checking for iWear core >= $WANTED_VER ... " IWEAR_VER=`$TEMP_X` check_version $WANTED_VER $IWEAR_VER "iWear" $WANTED_VER $IWEAR_VER if [ "$VERSION_OK" != "yes" ] then BAIL=yes fi fi # echo -e "Want : $WANTED_VER" # echo -e "Have : $SSL_VER" rm -f $TEMP_C rm -f $TEMP_X if [ "$BAIL" != "yes" ] then logecho "$IWEAR_VER (OK)" fi } #}}} function check_boost # {{{ { WANTED_VER=$1 TEMP_C="$C_TEMPDIR/check_boost.cpp" TEMP_X=`mktemp $C_TEMPDIR/check_boost.XXXXXX` cat > $TEMP_C < #include using namespace std; int main ( void ) { cout << BOOST_VERSION / 100000 << "." << BOOST_VERSION / 100 % 1000 << "." << BOOST_VERSION % 100 << endl; return 0; } XEOF logecho -en "Checking for boost includes ... " log -e "Trial compiling $TEMP_C" cat $TEMP_C >> $CONFLOG test_include $CPP $TEMP_C "$DLLIB" $TEMP_X -I "$BOOSTINCDIRS" BOOST_INCLUDE=$TRIAL log -e "Succes, set BOOST_INCLUDE=$BOOST_INCLUDE" if [ ! -x "$TEMP_X" ] then logecho "fail" BAIL=yes logecho "We were not able to compile the test program for boost headers. Have you installed the Headers (-devel package of your distro) ?" else logecho -e "yes ($BOOST_INCLUDE)" logecho -en "Checking for boost >= $WANTED_VER ... " BOOST_VER=`$TEMP_X` check_version $WANTED_VER $BOOST_VER "boost" $WANTED_VER $BOOST_VER if [ "$VERSION_OK" != "yes" ] then BAIL=yes fi fi # echo -e "Want : $WANTED_VER" # echo -e "Have : $SSL_VER" rm -f $TEMP_C rm -f $TEMP_X if [ "$BAIL" != "yes" ] then logecho "$BOOST_VER (OK)" fi } #}}} function check_SDL # {{{ { WANTED_VER=$1 TEMP_C="$C_TEMPDIR/check_SDL.c" TEMP_X=`mktemp $C_TEMPDIR/check_SDL.XXXXXX` cat > $TEMP_C < int main ( void ) { printf("%lu.%lu.%lu\n", SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL ); return 0; } XEOF logecho -en "Checking for SDL ... " search_libdir "-lSDL" "$SDLLIBDIRS" logsetvar SDL_LIBDIR $FOUNDLIB if [ -z "$FOUNDLIB" ] then logecho -e "fail" logecho -e "We were not able to generate a check program for $CHECKME." logecho -e "please see $CONFLOG for details" BAIL=yes return fi logecho " (OK)" logecho -en "Checking for SDL includes ... " log -e "Trial compiling $TEMP_C" cat $TEMP_C >> $CONFLOG test_include $CC $TEMP_C "$DLLIB -L$SDL_LIBDIR -lSDL" $TEMP_X -I "$SDLINCDIRS" SDL_INCLUDE=$TRIAL log -e "Succes, set SDL_INCLUDE=$SDL_INCLUDE" if [ ! -x "$TEMP_X" ] then logecho "fail" BAIL=yes logecho "We were not able to compile the test program for SDL. Have you installed the Headers (-devel package of your distro) ?" else logecho -e "yes ($SDL_INCLUDE)" logecho -en "Checking for SDL >= $WANTED_VER ... " SDL_VER=$($TEMP_X) check_version $WANTED_VER $SDL_VER "SDL" $WANTED_VER $SDL_VER if [ "$VERSION_OK" != "yes" ] then BAIL=yes fi fi # echo -e "Want : $WANTED_VER" # echo -e "Have : $SSL_VER" rm -f $TEMP_C rm -f $TEMP_X if [ "$BAIL" != "yes" ] then logecho "$SDL_VER (OK)" fi } #}}} function check_id3tag # {{{ { WANTED_VER=$1 TEMP_C="$C_TEMPDIR/check_id3tag.c" TEMP_X=`mktemp $C_TEMPDIR/check_id3tag.XXXXXX` cat > $TEMP_C < int main ( void ) { printf("%lu.%lu.%lu\n", ID3_TAG_VERSION_MAJOR(ID3_TAG_VERSION), ID3_TAG_VERSION_MINOR(ID3_TAG_VERSION), 0); return 0; } XEOF logecho -en "Checking for libid3tag ... " search_libdir "-lid3tag" "$ID3TAGLIBDIRS" logsetvar ID3TAG_LIBDIR $FOUNDLIB if [ -z "$FOUNDLIB" ] then logecho -e "fail" logecho -e "We were not able to generate a check program for $CHECKME." logecho -e "please see $CONFLOG for details" BAIL=yes return fi logecho " (OK)" logecho -en "Checking for libid3tag includes ... " log -e "Trial compiling $TEMP_C" cat $TEMP_C >> $CONFLOG test_include $CC $TEMP_C "$DLLIB -L$ID3TAG_LIBDIR -lid3tag" $TEMP_X -I "$ID3TAGINCDIRS" ID3TAG_INCLUDE=$TRIAL log -e "Succes, set ID3TAG_INCLUDE=$ID3TAG_INCLUDE" if [ ! -x "$TEMP_X" ] then logecho "fail" BAIL=yes logecho "We were not able to compile the test program for id3tag. Have you installed the Headers (-devel package of your distro) ?" else logecho -e "yes ($ID3TAG_INCLUDE)" logecho -en "Checking for id3tag >= $WANTED_VER ... " ID3TAG_VER=$($TEMP_X) check_version $WANTED_VER $ID3TAG_VER "id3tag" $WANTED_VER $ID3TAG_VER if [ "$VERSION_OK" != "yes" ] then BAIL=yes fi fi # echo -e "Want : $WANTED_VER" # echo -e "Have : $SSL_VER" rm -f $TEMP_C rm -f $TEMP_X if [ "$BAIL" != "yes" ] then logecho "$ID3TAG_VER (OK)" fi } #}}} function check_SDL_image # {{{ { WANTED_VER=$1 TEMP_C="$C_TEMPDIR/check_SDL_image.c" TEMP_X=`mktemp $C_TEMPDIR/check_SDL_image.XXXXXX` cat > $TEMP_C < int main ( void ) { #ifdef SDL_IMAGE_MAJOR_VERSION printf("%lu.%lu.%lu\n", SDL_IMAGE_MAJOR_VERSION, SDL_IMAGE_MINOR_VERSION, SDL_IMAGE_PATCHLEVEL ); #else printf("0.0.0\n"); #endif return 0; } XEOF logecho -en "Checking for SDL_image ... " search_libdir "-lSDL_image" "$SDL_IMAGELIBDIRS" logsetvar SDL_image_LIBDIR $FOUNDLIB if [ -z "$FOUNDLIB" ] then logecho -e "fail" logecho -e "We were not able to generate a check program for $CHECKME." logecho -e "please see $CONFLOG for details" BAIL=yes return fi logecho " (OK)" logecho -en "Checking for SDL_image includes ... " log -e "Trial compiling $TEMP_C" cat $TEMP_C >> $CONFLOG test_include $CC $TEMP_C "$DLLIB -L$SDL_IMAGE_LIBDIR -lSDL_image" $TEMP_X -I "$SDL_IMAGEINCDIRS" SDL_IMAGE_INCLUDE=$TRIAL log -e "Succes, set SDL_IMAGE_INCLUDE=$SDL_IMAGE_INCLUDE" if [ ! -x "$TEMP_X" ] then logecho "fail" BAIL=yes logecho "We were not able to compile the test program for SDL_image. Have you installed the Headers (-devel package of your distro) ?" else logecho -e "yes ($SDL_IMAGE_INCLUDE)" logecho -en "Checking for SDL_image >= $WANTED_VER ... " SDL_IMAGE_VER=$($TEMP_X) check_version $WANTED_VER $SDL_IMAGE_VER "SDL_image" $WANTED_VER $SDL_IMAGE_VER if [ "$VERSION_OK" != "yes" ] then BAIL=yes fi fi # echo -e "Want : $WANTED_VER" # echo -e "Have : $SSL_VER" rm -f $TEMP_C rm -f $TEMP_X if [ "$BAIL" != "yes" ] then logecho "$SDL_TTF_VER (OK)" fi } #}}} function check_SDL_ttf # {{{ { WANTED_VER=$1 TEMP_C="$C_TEMPDIR/check_SDL_ttf.c" TEMP_X=`mktemp $C_TEMPDIR/check_SDL_ttf.XXXXXX` cat > $TEMP_C < int main ( void ) { printf("%lu.%lu.%lu\n", TTF_MAJOR_VERSION, TTF_MINOR_VERSION, TTF_PATCHLEVEL ); return 0; } XEOF logecho -en "Checking for SDL_ttf ... " search_libdir "-lSDL_ttf" "$SDL_TTFLIBDIRS" logsetvar SDL_TTF_LIBDIR $FOUNDLIB if [ -z "$FOUNDLIB" ] then logecho -e "fail" logecho -e "We were not able to generate a check program for $CHECKME." logecho -e "please see $CONFLOG for details" BAIL=yes return fi logecho " (OK)" logecho -en "Checking for SDL_ttf includes ... " log -e "Trial compiling $TEMP_C" cat $TEMP_C >> $CONFLOG test_include $CC $TEMP_C "$DLLIB -L$SDL_TTF_LIBDIR -lSDL_ttf" $TEMP_X -I "$SDL_TTFINCDIRS" SDL_TTF_INCLUDE=$TRIAL log -e "Succes, set SDL_TTF_INCLUDE=$SDL_TTF_INCLUDE" if [ ! -x "$TEMP_X" ] then logecho "fail" BAIL=yes logecho "We were not able to compile the test program for SDL_ttf. Have you installed the Headers (-devel package of your distro) ?" else logecho -e "yes ($SDL_TTF_INCLUDE)" logecho -en "Checking for SDL_ttf >= $WANTED_VER ... " SDL_TTF_VER=$($TEMP_X) check_version $WANTED_VER $SDL_TTF_VER "SDL_ttf" $WANTED_VER $SDL_TTF_VER if [ "$VERSION_OK" != "yes" ] then BAIL=yes fi fi # echo -e "Want : $WANTED_VER" # echo -e "Have : $SSL_VER" rm -f $TEMP_C rm -f $TEMP_X if [ "$BAIL" != "yes" ] then logecho "$SDL_TTF_VER (OK)" fi } #}}} function check_SDL_mixer # {{{ { WANTED_VER=$1 TEMP_C="$C_TEMPDIR/check_SDL_mixer.c" TEMP_X=`mktemp $C_TEMPDIR/check_SDL_mixer.XXXXXX` cat > $TEMP_C < int main ( void ) { printf("%lu.%lu.%lu\n", SDL_MIXER_MAJOR_VERSION, SDL_MIXER_MINOR_VERSION, SDL_MIXER_PATCHLEVEL ); return 0; } XEOF logecho -en "Checking for SDL_mixer ... " search_libdir "-lSDL_mixer" "$SDL_IMAGELIBDIRS" logsetvar SDL_MIXER_LIBDIR $FOUNDLIB if [ -z "$FOUNDLIB" ] then logecho -e "fail" logecho -e "We were not able to generate a check program for $CHECKME." logecho -e "please see $CONFLOG for details" BAIL=yes return fi logecho " (OK)" logecho -en "Checking for SDL_mixer includes ... " log -e "Trial compiling $TEMP_C" cat $TEMP_C >> $CONFLOG test_include $CC $TEMP_C "$DLLIB -L$SDL_MIXER_LIBDIR -lSDL_mixer" $TEMP_X -I "$SDL_MIXERINCDIRS" SDL_MIXER_INCLUDE=$TRIAL log -e "Succes, set SDL_IMAGE_INCLUDE=$SDL_MIXER_INCLUDE" if [ ! -x "$TEMP_X" ] then logecho "fail" BAIL=yes logecho "We were not able to compile the test program for SDL_mixer. Have you installed the Headers (-devel package of your distro) ?" else logecho -e "yes ($SDL_MIXER_INCLUDE)" logecho -en "Checking for SDL_mixer >= $WANTED_VER ... " SDL_MIXER_VER=$($TEMP_X) check_version $WANTED_VER $SDL_MIXER_VER "SDL_mixer" $WANTED_VER $SDL_MIXER_VER if [ "$VERSION_OK" != "yes" ] then BAIL=yes fi fi # echo -e "Want : $WANTED_VER" # echo -e "Have : $SSL_VER" rm -f $TEMP_C rm -f $TEMP_X if [ "$BAIL" != "yes" ] then logecho "$SDL_MIXER_VER (OK)" fi } #}}} function check_SDL_gfx # {{{ { WANTED_VER=$1 TEMP_C="$C_TEMPDIR/check_SDL_gfx.c" TEMP_X=`mktemp $C_TEMPDIR/check_SDL_gfx.XXXXXX` cat > $TEMP_C < int main ( void ) { printf("%lu.%lu.%lu\n", SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL ); return 0; } XEOF logecho -en "Checking for SDL_gfx ... " search_libdir "-lSDL_gfx" "$SDL_GFXLIBDIRS" logsetvar SDL_GFX_LIBDIR $FOUNDLIB if [ -z "$FOUNDLIB" ] then logecho -e "fail" logecho -e "We were not able to generate a check program for $CHECKME." logecho -e "please see $CONFLOG for details" BAIL=yes return fi logecho " (OK)" logecho -en "Checking for SDL_gfx includes ... " log -e "Trial compiling $TEMP_C" cat $TEMP_C >> $CONFLOG test_include $CC $TEMP_C "$DLLIB -L$SDL_GFX_LIBDIR -lSDL_gfx" $TEMP_X -I "$SDL_GFXINCDIRS" SDL_GFX_INCLUDE=$TRIAL log -e "Succes, set SDL_GFX_INCLUDE=$SDL_GFX_INCLUDE" if [ ! -x "$TEMP_X" ] then logecho "fail" BAIL=yes logecho "We were not able to compile the test program for SDL_gfx. Have you installed the Headers (-devel package of your distro) ?" else logecho -e "yes ($SDL_GFX_INCLUDE)" # logecho -en "Checking for SDL_gfx >= $WANTED_VER ... " # SDL_gfx_VER=$($TEMP_X) # check_version $WANTED_VER $SDL_gfx_VER "SDL_gfx" $WANTED_VER $SDL_gfx_VER # if [ "$VERSION_OK" != "yes" ] # then # BAIL=yes # fi fi # echo -e "Want : $WANTED_VER" # echo -e "Have : $SSL_VER" rm -f $TEMP_C rm -f $TEMP_X } #}}} function check_iwdb # {{{ { WANTED_VER=$1 TEMP_C="$C_TEMPDIR/check_iwdb.c" TEMP_X=`mktemp $C_TEMPDIR/check_iwdb.XXXXXX` cat > $TEMP_C < int main ( void ) { printf("%lu.%lu.%lu\n",DBCLASSES_MAJOR,DBCLASSES_MINOR,DBCLASSES_RELEASE); return 0; } XEOF logecho -en "Checking for iwear database libraries ... " search_libdir "-liwdb" "$IWDBLIBDIRS" logsetvar IWDB_LIBDIR $FOUNDLIB if [ -z "$FOUNDLIB" ] then logecho -e "fail" logecho -e "We were not able to generate a check program for $CHECKME." logecho -e "please see $CONFLOG for details" BAIL=yes return fi logecho " (OK)" logecho -en "Checking for iwear database includes ... " log -e "Trial compiling $TEMP_C" cat $TEMP_C >> $CONFLOG test_include $CC $TEMP_C "$DLLIB -L$IWDB_LIBDIR -liwdb" $TEMP_X -I "$IWDBINCDIRS" IWDB_INCLUDE=$TRIAL log -e "Succes, set IWDB_INCLUDE=$IWDB_INCLUDE" if [ ! -x "$TEMP_X" ] then logecho "fail" BAIL=yes logecho "We were not able to compile the test program for iwdb core. Have you installed the Headers (-devel package of your distro) ?" else logecho -e "yes ($IWDB_INCLUDE)" logecho -en "Checking for iwdb core >= $WANTED_VER ... " IWDB_VER=`$TEMP_X` check_version $WANTED_VER $IWDB_VER "iwdb" $WANTED_VER $IWDB_VER if [ "$VERSION_OK" != "yes" ] then BAIL=yes fi fi # echo -e "Want : $WANTED_VER" # echo -e "Have : $SSL_VER" rm -f $TEMP_C rm -f $TEMP_X if [ "$BAIL" != "yes" ] then logecho "$IWDB_VER (OK)" fi } #}}} function check_iwsens # {{{ { WANTED_VER=$1 TEMP_C="$C_TEMPDIR/check_iwsens.c" TEMP_X=`mktemp $C_TEMPDIR/check_iwsens.XXXXXX` cat > $TEMP_C < int main ( void ) { printf("%lu.%lu.%lu\n",IWSENS_MAJOR,IWSENS_MINOR,IWSENS_RELEASE); return 0; } XEOF logecho -en "Checking for iwear sensor core libraries ... " search_libdir "-liwsens" "$IWSENSLIBDIRS" logsetvar IWSENS_LIBDIR $FOUNDLIB if [ -z "$FOUNDLIB" ] then logecho -e "fail" logecho -e "We were not able to generate a check program for $CHECKME." logecho -e "please see $CONFLOG for details" BAIL=yes return fi logecho " (OK)" logecho -en "Checking for iwear sensor core includes ... " log -e "Trial compiling $TEMP_C" cat $TEMP_C >> $CONFLOG test_include $CC $TEMP_C "$DLLIB -L$IWSENS_LIBDIR -liwsens" $TEMP_X -I "$IWSENSINCDIRS" IWSENS_INCLUDE=$TRIAL log -e "Succes, set IWSENS_INCLUDE=$IWSENS_INCLUDE" if [ ! -x "$TEMP_X" ] then logecho "fail" BAIL=yes logecho "We were not able to compile the test program for iwsens core. Have you installed the Headers (-devel package of your distro) ?" else logecho -e "yes ($IWSENS_INCLUDE)" logecho -en "Checking for iwsens core >= $WANTED_VER ... " IWSENS_VER=`$TEMP_X` check_version $WANTED_VER $IWSENS_VER "iwsens" $WANTED_VER $IWSENS_VER if [ "$VERSION_OK" != "yes" ] then BAIL=yes fi fi # echo -e "Want : $WANTED_VER" # echo -e "Have : $SSL_VER" rm -f $TEMP_C rm -f $TEMP_X if [ "$BAIL" != "yes" ] then logecho "$IWSENS_VER (OK)" fi } #}}} function check_ssl # {{{ { WANTED_VER=$1 RW=$1 NUMVER=`echo $WANTED_VER | sed 's/[^0-9\.]//g'` SUBVER=`echo $WANTED_VER | sed 's/[0-9\.]//g'` REL=`asctoint $SUBVER` WANTED_VER="$NUMVER$REL" logecho -en "Checking for OpenSSL includes ... " TEMP_C="$C_TEMPDIR/check_ssl.c" TEMP_X=`mktemp $C_TEMPDIR/check_ssl.XXXXXX` cat > $TEMP_C < #include #include #include int main ( void ) { MD5_CTX ctx; MD5_Init(&ctx); // e.g. 0x0090702fL // 10 for 1. unsigned long int over = OPENSSL_VERSION_NUMBER; // over = 0x1101104fL; // 1.10.11d unsigned long int major = (over & 0xF0000000L) >> 28; if ( major > 9 ) major -= 6; unsigned long int minor = (over & 0x0FF00000L) >> 20; if ( minor > 9 ) minor -= 6; unsigned long int release = (over & 0x000FF000L) >> 12; if ( release > 9 ) release -= 6; unsigned long int patch = (over & 0x000000F0L) >> 4; printf("%lu.%lu.%lu%c\n",major,minor,release,(char)(96+patch)); return 0; } XEOF log -e "Trial compiling $TEMP_C" cat $TEMP_C >> $CONFLOG test_include $CC $TEMP_C "$DLLIB -lcrypto -lssl" $TEMP_X -I "$SSLINCDIRS" SSL_INCLUDE=$TRIAL log -e "Succes, set SSL_INCLUDE=$SSL_INCLUDE" if [ ! -x "$TEMP_X" ] then logecho "fail" BAIL=yes logecho "We were not able to compile the test program for openssl. Have you installed the Headers (-devel package of your distro) ?" else logecho -e "yes ($SSL_INCLUDE)" logecho -en "Checking for OpenSSL >= $RW ... " SSL_VER="0.9.7g" SSL_VER=`$TEMP_X` SW=$SSL_VER NUMVER=`echo $SSL_VER | sed 's/[^0-9\.]//g'` SUBVER=`echo $SSL_VER | sed 's/[0-9\.]//g'` REL=`asctoint $SUBVER` SSL_VER="$NUMVER$REL" check_version $WANTED_VER $SSL_VER "OpenSSL" $RW $SW if [ "$VERSION_OK" != "yes" ] then BAIL=yes fi fi # echo -e "Want : $WANTED_VER" # echo -e "Have : $SSL_VER" rm -f $TEMP_C rm -f $TEMP_X if [ "$BAIL" != "yes" ] then logecho "$SW (OK)" fi } #}}} function check_glib2 # {{{ { WANTED_VER=$1 logecho -en "Checking for glib2 includes ... " TEMP_C="$C_TEMPDIR/check_glib2.c" TEMP_X=`mktemp $C_TEMPDIR/check_ssl.XXXXXX` cat > $TEMP_C < #include int main ( void ) { return 0; } XEOF log -e "Trial compiling $TEMP_C" cat $TEMP_C >> $CONFLOG test_include $CC $TEMP_C "" $TEMP_X -I "$GLIB2INCLUDES" GLIB2_INCLUDE=$TRIAL log -e "Succes, set GLIB2_INCLUDE=$GLIB2_INCLUDE" if [ ! -x "$TEMP_X" ] then logecho "fail" BAIL=yes logecho "We were not able to compile the test program for glib2. Have you installed the Headers (-devel package of your distro) ?" logecho "Could not find glib.h in any of $GLIB2INCLUDES" return fi cat > $TEMP_C < int main ( void ) { return 0; // printf("%d.%d.%d\n", GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION) } XEOF log -e "Trial compiling $TEMP_C" cat $TEMP_C >> $CONFLOG test_include $CC $TEMP_C "-I $GLIB2_INCLUDE" $TEMP_X -I "$GLIB2CONFIG" GLIB2_CONFIG=$TRIAL log -e "GLIB2_CONFIG=$GLIB2_CONFIG" if [ -z "$GLIB2_CONFIG" ] then BAIL=yes logecho -e "fail" logecho -e "Could not find glibconfig.h in any of $GLIB2CONFIG" return fi cat > $TEMP_C < int main ( void ) { printf("%d.%d.%d\n", GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); return 0; } XEOF log -e "Trial compiling $TEMP_C" cat $TEMP_C >> $CONFLOG test_include $CC $TEMP_C "-I $GLIB2_INCLUDE -I $GLIB2_CONFIG" $TEMP_X -L "$GLIB2LIBDIRS" GLIB2_LIBDIR=$TRIAL if [ -z "$GLIB2_LIBDIR" ] then BAIL=yes logecho -e "fail" logecho -e "Could not find libglib-2.0 in any of $GLIB2LIBDIRS" return fi GLIB2_VER=`$TEMP_X` check_version $WANTED_VER $GLIB2_VER "glib2" if [ "$VERSION_OK" != "yes" ] then BAIL=yes fi if [ "$BAIL" != "yes" ] then logecho "$GLIB2_VER (OK)" fi rm -f $TEMP_C rm -f $TEMP_X } #}}} function check_orbit2 # {{{ { WANTED_VER=$1 logecho -en "Checking for ORBit2 includes ... " TEMP_C="$C_TEMPDIR/check_ORBit2.c" TEMP_X=`mktemp $C_TEMPDIR/check_ORBit2.XXXXXX` cat > $TEMP_C < #include int main ( void ) { return 0; } XEOF log -e "Trial compiling $TEMP_C" cat $TEMP_C >> $CONFLOG if [ -z "$LINC_INCLUDE" ] then LINC_INCLUDE="/usr/include/linc-1.0" fi test_include $CC $TEMP_C "-I $LINC_INCLUDE -I $GLIB2_CONFIG -I $GLIB2_INCLUDE" $TEMP_X -I "$ORBIT2INCLUDES" ORBIT2_INCLUDE=$TRIAL log -e "Succes, set ORBIT2_INCLUDE=$ORBIT2_INCLUDE" if [ ! -x "$TEMP_X" ] then logecho "fail" BAIL=yes logecho "We were not able to compile the test program for ORBit2. Have you installed the Headers (-devel package of your distro) ?" else logecho "(OK)" fi ############# DONE CHECKING FOR HEADERS cat > $TEMP_C < int main ( void ) { printf("%d.%d.%d\n", ORBIT_MAJOR_VERSION, ORBIT_MINOR_VERSION, ORBIT_MICRO_VERSION); return 0; } XEOF ############# CHECKING LIBRARY PATH AND VERSION logecho -en "Checking for ORBit2 >= $WANTED_VER ... " log -e "Trial compiling $TEMP_C" cat $TEMP_C >> $CONFLOG if [ -z "$LINC_INCLUDE" ] then LINC_INCLUDE="/usr/include/linc-1.0" fi test_include $CC $TEMP_C "-lORBit-2 -I $LINC_INCLUDE -I $ORBIT2_INCLUDE" $TEMP_X -L "$ORBIT2LIBDIRS" ORBIT2_LIBDIR=$TRIAL log -e "Setting ORBIT2_LIBDIR=$TRIAL" if [ -z "$ORBIT2_LIBDIR" ] then BAIL=yes logecho -e "fail" logecho -e "Could not find libORBit-2 in any of $ORBIT2LIBDIRS" return fi ORBIT2_VER=`$TEMP_X` check_version $WANTED_VER $ORBIT2_VER "ORBit2" if [ "$VERSION_OK" != "yes" ] then BAIL=yes fi if [ "$BAIL" != "yes" ] then logecho "$ORBIT2_VER (OK)" fi rm -f $TEMP_C rm -f $TEMP_X } #}}} function check_orbitcpp # {{{ { WANTED_VER=$1 logecho -en "Checking for orbitcpp includes ... " TEMP_C="$C_TEMPDIR/check_orbitcpp.c" TEMP_X=`mktemp $C_TEMPDIR/check_orbitcpp.XXXXXX` cat > $TEMP_C < #include int main ( void ) { return 0; } XEOF log -e "Trial compiling $TEMP_C" cat $TEMP_C >> $CONFLOG if [ -z "$LINC_INCLUDE" ] then LINC_INCLUDE="/usr/include/linc-1.0" fi test_include $CPP $TEMP_C "-I $LINC_INCLUDE -I $ORBIT2_INCLUDE -I $GLIB2_CONFIG -I $GLIB2_INCLUDE" $TEMP_X -I "$ORBITCPPINCLUDES" ORBITCPP_INCLUDE=$TRIAL log -e "Succes, set ORBITCPP_INCLUDE=$ORBITCPP_INCLUDE" if [ ! -x "$TEMP_X" ] then logecho "fail" BAIL=yes logecho "We were not able to compile the test program for orbitcpp. Have you installed the Headers (-devel package of your distro) ?" fi cat > $TEMP_C < #include using namespace _orbitcpp; int main ( void ) { printf("%d.%d.%d\n", LIB_MAJOR_VERSION, LIB_MINOR_VERSION, LIB_MICRO_VERSION); return 0; } XEOF log -e "Trial compiling $TEMP_C" cat $TEMP_C >> $CONFLOG test_include $CPP $TEMP_C "-lORBit-2-cpp -I $ORBITCPP_INCLUDE" $TEMP_X -L "$ORBITCPPLIBDIRS" ORBITCPP_LIBDIR=$TRIAL log -e "ORBITCPP_LIBDIR=$ORBITCPP_LIBDIR" if [ -z "$ORBITCPP_LIBDIR" ] then BAIL=yes logecho -e "fail" logecho -e "Could not find libORBit-2-cpp in any of $ORBITCPPLIBDIRS" return fi ORBITCPP_VER=`$TEMP_X` check_version $WANTED_VER $ORBITCPP_VER "orbitcpp" if [ "$VERSION_OK" != "yes" ] then BAIL=yes fi if [ "$BAIL" != "yes" ] then logecho "$ORBITCPP_VER (OK)" fi rm -f $TEMP_C rm -f $TEMP_X logecho -en "Checking for orbit-idl-2 ... " for idl in $ORBITCPPIDLS do if [ -x $idl ] then ORBITCPPIDL=$idl fi done if [ -z "$ORBITCPPIDL" ] then echo "none" echo -e "Could not find orbit-idl-2 in any of $ORBITCPPIDLS" BAIL=yes else logecho "yes ($ORBITCPPIDL)" fi } #}}} function check_strnlen # {{{ { logecho -en "Checking for strnlen ... " TEMP_C="$C_TEMPDIR/check_strnlen.c" TEMP_X=`mktemp $C_TEMPDIR/check_strnlen.XXXXXX` cat > $TEMP_C < int main ( void ) { strnlen(NULL,0); } XEOF log -e "Test Program $TEMP_C" cat $TEMP_C >> $CONFLOG log -e "Exec( $CC $TEMP_C -o $TEMP_X )" $CC $TEMP_C -o $TEMP_X >> $CONFLOG 2>&1 if [ -x "$TEMP_X" ] then HAVE_STRNLEN="yes" logecho "yes" else HAVE_STRNLEN="no" logecho "no" fi rm -f $TEMP_C rm -f $TEMP_X } #}}} function check_char_bit # {{{ { WANTED_BIT=$1 logecho -en "Checking for CHAR_BIT == $WANTED_BIT... " TEMP_C="$C_TEMPDIR/check_char_bit.c" TEMP_X=`mktemp $C_TEMPDIR/check_char_bit.XXXXXX` cat > $TEMP_C < #include int main ( void ) { printf("%d",CHAR_BIT); } XEOF log -e "Test Program $TEMP_C" cat $TEMP_C >> $CONFLOG log -e "Exec( $CC $TEMP_C -o $TEMP_X )" $CC $TEMP_C -o $TEMP_X >> $CONFLOG 2>&1 if [ ! -x "$TEMP_X" ] then logecho "Failed to create program to test for CHAR_BIT, consult $CONFLOG" BAIL=yes return; fi CHAR_BIT=$($TEMP_X) if [ $WANTED_BIT != $CHAR_BIT ] then BAIL=yes logecho "Unsupported CHAR_BIT value $CHAR_BIT" else logecho "(ok)" fi rm -f $TEMP_C rm -f $TEMP_X } #}}} function check_clock_gettime # {{{ { logecho -en "Checking for clock_gettime ... " TEMP_C="$C_TEMPDIR/check_clock_gettime.c" TEMP_X=`mktemp $C_TEMPDIR/check_clock_gettime.XXXXXX` cat > $TEMP_C < int main ( void ) { clock_gettime(CLOCK_REALTIME,NULL); } XEOF log -e "Test Program $TEMP_C" cat $TEMP_C >> $CONFLOG log -e "Exec( $CC $TEMP_C -o $TEMP_X )" if [ "$OS_TYPE" == "linux" -o "$OS_TYPE" == "solaris" ] then $CC -lrt $TEMP_C -o $TEMP_X >> $CONFLOG 2>&1 else $CC $TEMP_C -o $TEMP_X >> $CONFLOG 2>&1 fi if [ -x "$TEMP_X" ] then HAVE_CLOCK_GETTIME="yes" logecho "yes" else HAVE_CLOCK_GETTIME="no" logecho "no" fi rm -f $TEMP_C rm -f $TEMP_X } #}}} function check_pthread_timedlock # {{{ { logecho -en "Checking for pthread_mutex_timedlock ... " TEMP_C="$C_TEMPDIR/check_pthread_mutex_timedlock.c" TEMP_X=`mktemp $C_TEMPDIR/check_pthread_mutex_timedlock.XXXXXX` cat > $TEMP_C < int main ( void ) { pthread_mutex_timedlock(0,0); } XEOF log -e "Test Program $TEMP_C" cat $TEMP_C >> $CONFLOG log -e "Exec( $CC $TEMP_C -o $TEMP_X )" if [ "$OS_TYPE" == "linux" ] then $CC -lrt $TEMP_C -o $TEMP_X >> $CONFLOG 2>&1 else $CC $TEMP_C -o $TEMP_X >> $CONFLOG 2>&1 fi if [ -x "$TEMP_X" ] then HAVE_PTHREAD_MUTEX_TIMEDLOCK="yes" logecho "yes" else HAVE_PTHREAD_MUTEX_TIMEDLOCK="no" logecho "no" fi rm -f $TEMP_C rm -f $TEMP_X } #}}} function check_strcasestr # {{{ { logecho -en "Checking for strcasestr ... " TEMP_C="$C_TEMPDIR/check_strcasestr.c" TEMP_X=`mktemp $C_TEMPDIR/check_strcasestr.XXXXXX` cat > $TEMP_C < int main ( void ) { strcasestr(NULL,NULL); } XEOF log -e "Test Program $TEMP_C" cat $TEMP_C >> $CONFLOG log -e "Exec( $CC $TEMP_C -o $TEMP_X )" $CC $TEMP_C -o $TEMP_X >> $CONFLOG 2>&1 if [ -x "$TEMP_X" ] then HAVE_STRCASESTR="yes" echo "yes" else HAVE_STRCASESTR="no" echo "no" fi rm -f $TEMP_C rm -f $TEMP_X } #}}} function check_vasprintf # {{{ { logecho -en "Checking for vasprintf ... " TEMP_C="$C_TEMPDIR/check_vasprintf.c" TEMP_X=`mktemp $C_TEMPDIR/check_vasprintf.XXXXXX` cat > $TEMP_C < #include int main ( void ) { vasprintf(NULL,0); } XEOF log -e "Test Program $TEMP_C" cat $TEMP_C >> $CONFLOG log -e "Exec( $CC $TEMP_C -o $TEMP_X )" $CC $TEMP_C -o $TEMP_X >> $CONFLOG 2>&1 if [ -x "$TEMP_X" ] then HAVE_VASPRINTF="yes" logecho "yes" else HAVE_VASPRINTF="no" logecho "no" fi rm -f $TEMP_C rm -f $TEMP_X } #}}} function check_strerror_r # {{{ { logecho -en "Checking for strerror_r ... " TEMP_C="$C_TEMPDIR/check_strerror_r.c" TEMP_X=`mktemp $C_TEMPDIR/check_strerror_r.XXXXXX` cat > $TEMP_C < int main ( void ) { strerror_r(0,NULL,0); } XEOF log -e "Test Program $TEMP_C" cat $TEMP_C >> $CONFLOG log -e "Exec( $CC $TEMP_C -o $TEMP_X )" $CC $TEMP_C -o $TEMP_X >> $CONFLOG 2>&1 if [ -x "$TEMP_X" ] then HAVE_STRERROR_R="yes" logecho "yes" else HAVE_STRERROR_R="no" logecho "no" fi rm -f $TEMP_C rm -f $TEMP_X } #}}} function check_wireless # {{{ { case $OS_TYPE in linux) check_wireless_linux ;; mac) logecho -e $RED logecho logecho "Sorry, we dont have wireless support for MacOSX yet." logecho "It is heavily beeing worked on, please check a newer release." logecho -e $NOR ;; *) logecho -e $RED logecho logecho "Your Hosttype is not supportted for wireless operations" logecho -e $NOR ;; esac if [ "$HAVE_WIRELESS" != "yes" ] then logecho "Proceeding without wireless support" else logecho "Proceeding with wireless support" fi } # }}} function check_wireless_linux # {{{ { logecho -en "Checking for Linux wireless headers... " TEMP_C="$C_TEMPDIR/check_wireless.c" TEMP_X=`mktemp $C_TEMPDIR/check_wireless.XXXXXX` cat > $TEMP_C < #include int main ( void ) { printf("%d",WIRELESS_EXT); } XEOF log -e "Test Program $TEMP_C" cat $TEMP_C >> $CONFLOG log -e "Exec( $CC $TEMP_C -o $TEMP_X )" $CC $TEMP_C -o $TEMP_X >> $CONFLOG 2>&1 if [ -x "$TEMP_X" ] then HAVE_WIRELESS="yes" EXT_VER=$($TEMP_X) logecho "yes (wireless extensions $EXT_VER)" else HAVE_WIRELESS="no" logecho "no" logecho -e $RED logecho -e "We were unable to find the Linux Wireless Extension Headers" logecho -e $NOR # BAIL="yes" fi rm -f $TEMP_C rm -f $TEMP_X } #}}} function check_dlopen # {{{ { logecho -en "Checking for dlopen ... " TEMP_C="$C_TEMPDIR/check_dlopen.c" TEMP_X=`mktemp $C_TEMPDIR/check_dlopen.XXXXXX` cat > $TEMP_C < #include int main ( void ) { dlopen(NULL,0); } XEOF log -e "The Test Program $TEMP_C" cat $TEMP_C >> $CONFLOG DLLIB="none" test_include $CC $TEMP_C "$CFLAGS" $TEMP_X "" "$DLLIBS" DLLIB=$TRIAL log -e "Set DLLIB=$DLLIB" if [ -x "$TEMP_X" ] then logecho "(OK) with $DLLIB" fi if [ "$DLLIB" == "none" ] then logecho "fail. We were not able to determine how to use dlopen()" BAIL=yes fi LIBLIBS="$LIBLIBS $DLLIB" rm -f $TEMP_C rm -f $TEMP_X } #}}} function check_pthread # {{{ { logecho -en "Checking for libpthread... " TEMP_C="$C_TEMPDIR/check_pthread.c" TEMP_X=`mktemp $C_TEMPDIR/check_pthread.XXXXXX` cat > $TEMP_C < int main ( void ) { pthread_self(); } XEOF log -e "The Test Program $TEMP_C" cat $TEMP_C >> $CONFLOG TLIB="none" test_include $CC $TEMP_C "$CFLAGS" $TEMP_X "" "$THREADLIBS" TLIB=$TRIAL log -e "Set TLIB=$TLIB" if [ -x "$TEMP_X" ] then logecho "(OK) with $TLIB" fi if [ "$TLIB" == "none" ] then logecho "fail. We were not able to determine how to use POSIX Threads" BAIL=yes fi LIBLIBS="$LIBLIBS $TLIB" rm -f $TEMP_C rm -f $TEMP_X } #}}} function check_doxygen #{{{ { logecho -en "Checking for doxygen ... " DOXYGEN=`which doxygen 2>/dev/null` if [ -z "$DOXYGEN" ] then DOXYGEN="ls" echo "no" BAIL="yes" mkdir -p doc cat > doc/EMPTY </dev/null " else echo -e "$DOXYGEN (OK)" fi log -e "DOXYGEN=$DOXYGEN" } # }}} function check_libpqxx # {{{ { WANTED_VER=$1 logecho -en "Checking for usable libpqxx ... " if [ "$FORCEPQXX" ] then logecho return fi if [ "$PKG_CONFIG" ] then $PKG_CONFIG --exists libpqxx EXIST=$? if [ "$EXIST" == 0 ] then logecho "(OK)" else logecho "failed" logecho "We were not able to locate libpqxx via pkg-config" BAIL=yes return fi PQX_VER=$($PKG_CONFIG --modversion libpqxx) else TEMP_CPP="$C_TEMPDIR/check_libpq.cpp" TEMP_X=`mktemp $C_TEMPDIR/check_libpq.XXXXXX` cat > $TEMP_CPP < #include int main ( void ) { pqxx::connection Conn; int maj, min, rel; printf(VERSION); } XEOF log -e "TEst Program $TEMP_CPP" cat $TEMP_CPP >> $CONFLOG log -e "Exec( $CPP $CPPFLAGS -I $PG_INCLUDE -lpqxx $TEMP_CPP -o $TEMP_X)" $CPP $CPPFLAGS -I $PG_INCLUDE -lpqxx $TEMP_CPP -o $TEMP_X >> $CONFLOG 2>&1 if [ ! -x $TEMP_X ] then logecho -e "fail" logecho -e "We were not able to generate a check program, please see $CONFLOG for details" BAIL=yes return fi logecho "(OK)" PQX_VER=`$TEMP_X 2>/dev/null` fi logecho -en "Checking for libpqxx >= $WANTED_VER ... " check_version $WANTED_VER $PQX_VER "libpqxx" if [ "$VERSION_OK" != "yes" ] then BAIL=yes return fi rm -f $TEMP_CPP rm -f $TEMP_X logecho -e "$PQX_VER (OK)" } #}}} function check_xerces # {{{ { WANTED_VER=$1 CHECKME=xerces logecho -en "Checking for lib$CHECKME ..." search_libdir "-lxerces-c" "$XERCESLIBDIRS" logsetvar XERCES_LIBDIR $FOUNDLIB if [ -z "$FOUNDLIB" ] then logecho -e "fail" logecho -e "We were not able to generate a check program for $CHECKME." logecho -e "please see $CONFLOG for details" BAIL=yes return fi logecho "(OK)" TEMP_CPP="$C_TEMPDIR/check_xerces.cpp" TEMP_X=`mktemp $C_TEMPDIR/check_xerces.XXXXXX` cat > $TEMP_CPP < #include int main ( void ) { printf("%d.%d.%d", XERCES_VERSION_MAJOR, XERCES_VERSION_MINOR, XERCES_VERSION_REVISION); return 0; } XEOF logecho -en "Checking for $CHECKME includes ... " test_include $CPP $TEMP_CPP "$CFLAGS" $TEMP_X -I "$XERCESINCDIRS" if [ -x $TEMP_X ] then XER_VER=$($TEMP_X) logecho " (OK)" else logecho -e " failed" BAIL=yes return fi logecho -en "Checking for $CHECKME >= $WANTED_VER ... " check_version $WANTED_VER $XER_VER "xerces" if [ "$VERSION_OK" != "yes" ] then BAIL=yes return fi rm -f $TEMP_CPP rm -f $TEMP_X logecho -e "$XER_VER (OK)" } #}}} function check_qt3 # {{{ { WANTED_VER=$1 CHECKME=qt3 logecho -en "Checking for lib$CHECKME ..." search_libdir "-lqt-mt" "$QT3LIBDIRS" logsetvar QT3_LIBDIR $FOUNDLIB if [ -z "$FOUNDLIB" ] then logecho -e "fail" logecho -e "We were not able to generate a check program for $CHECKME." logecho -e "please see $CONFLOG for details" BAIL=yes return fi logecho "(OK)" TEMP_CPP="$C_TEMPDIR/check_qt3.cpp" TEMP_X=`mktemp $C_TEMPDIR/check_qt3.XXXXXX` cat > $TEMP_CPP < #include int main ( void ) { printf(QT_VERSION_STR); return 0; } XEOF logecho -en "Checking for $CHECKME includes ... " test_include $CPP $TEMP_CPP "$CFLAGS" $TEMP_X -I "$QT3INCDIRS" logsetvar QT3_INCLUDE $TRIAL if [ -x $TEMP_X ] then QT3_VER=$($TEMP_X) logecho " (OK)" else logecho -e " failed" BAIL=yes return fi logecho -en "Checking for $CHECKME >= $WANTED_VER ... " check_version $WANTED_VER $QT3_VER "qt3" if [ "$VERSION_OK" != "yes" ] then BAIL=yes return fi rm -f $TEMP_CPP rm -f $TEMP_X logecho -e "$QT3_VER (OK)" QT3_BINDIR=$(echo -n $QT3_LIBDIR | sed 's/lib\/$/bin\//') logecho -en "Checking for moc compiler in $QT3_BINDIR ... " if [ -x $QT3_BINDIR/moc ] then MOC=$QT3_BINDIR/moc logecho -e "($MOC)" else BAIL=yes return fi } #}}} function set_incdir #{{{ { INCDIR=$1 if [ ! -z "$INCDIR" ] then echo "INCLUDES:=\$(INCLUDES) -I $INCDIR" >> $MAKEFILE fi } #}}} function set_libdir #{{{ { LIBDIR=$1 if [ ! -z "$LIBDIR" ] then echo "LIBSEARCH:=\$(LIBSEARCH) -L$LIBDIR" >> $MAKEFILE fi } #}}} function check_echo # {{{ { logecho -en "Checking how to invoke echo in make ... " OUTPUT=`echo -en` if [ -z "$OUTPUT" ] then logecho " with -en" ECHOEN="echo -en" else logecho " plain" ECHOEN="echo" fi } # }}} # This generates the makefile from all the set variables function gen_makefile # {{{ { if [ ! -z "$C_TEMPDIR" ] then rm -rf $C_TEMPDIR fi MAKEFILE=$1 logecho -e "Generating $MAKEFILE" cat > $MAKEFILE <> $MAKEFILE fi if [ ! -z "$CPPFLAGS" ] then echo -e "Overriding \$CPPFLAGS to \"$CPPFLAGS\"" echo -e "\nCPPFLAGS=$CPPFLAGS" >> $MAKEFILE fi echo -e "\nCC=$CC" >> $MAKEFILE echo -e "CPP=$CPP" >> $MAKEFILE echo -e "\nLIBNAME=$LIBNAME" >> $MAKEFILE echo -e "LIBVERSION=$VERSION" >> $MAKEFILE echo -e "PREFIX=$PREFIX" >> $MAKEFILE echo -e "SYSCONF=$SYSCONF" >> $MAKEFILE echo -e "LIBS=$LIBS" >> $MAKEFILE echo -e "LIBLIBS=$LIBLIBS" >> $MAKEFILE echo -e "INCLUDES=$INCLUDES" >> $MAKEFILE echo -e "EXTRACLEANFILES=$EXTRACLEANFILES" >> $MAKEFILE echo -e "STERILFILES=$STERILFILES" >> $MAKEFILE echo -e "STERILDIRS=$STERILDIRS" >> $MAKEFILE echo -e "LIBSEARCH=$PREFIX/lib/" >> $MAKEFILE echo -e "DISTNAME=$DISTNAME" >> $MAKEFILE echo -e "DISTDIR=$DISTDIR" >> $MAKEFILE echo -e "DOXYGEN=$DOXYGEN" >> $MAKEFILE echo -e "ECHOEN=$ECHOEN" >> $MAKEFILE echo -e "DLLIB=$DLLIB" >> $MAKEFILE echo -e "DYN_SUFFIX=$DYN_SUFFIX" >> $MAKEFILE echo -e "LIBFLAGS=$LIBFLAGS" >> $MAKEFILE echo -e "WEXTRA=$WEXTRA" >> $MAKEFILE echo -e "CPPFLAGS:=\$(CPPFLAGS) $SYSCPPFLAGS \$(WEXTRA)" >> $MAKEFILE echo -e "CFLAGS:=\$(CFLAGS) $SYSCFLAGS \$(WEXTRA)" >> $MAKEFILE echo >> $MAKEFILE echo -en "SRCDIRS=" >> $MAKEFILE for dir in $SRCDIRS do echo -en "\$(TOPDIR)/$dir " >> $MAKEFILE done echo >> $MAKEFILE echo >> $MAKEFILE #MAINSRC=`echo -e $SRDIRS | cut -d" " -f1` if [ "$HAVE_STRCASESTR" == "no" ] then LIBFILES_src="$LIBFILES_src strcasestr.o" fi if [ "$HAVE_STRNLEN" == "no" ] then LIBFILES_src="$LIBFILES_src strnlen.o" fi if [ "$HAVE_CLOCK_GETTIME" == "no" ] then LIBFILES_src="$LIBFILES_src clock_gettime.o" fi if [ "$HAVE_PTHREAD_MUTEX_TIMEDLOCK" == "no" ] then LIBFILES_src="$LIBFILES_src pthread_mutex_timedlock.o" fi set_incdir $PG_INCLUDE set_incdir $SSL_INCLUDE set_incdir $GLIB2_INCLUDE set_incdir $ORBITCPP_INCLUDE set_incdir $ORBIT2_INCLUDE set_incdir $GLIB2_CONFIG set_incdir $IWEAR_INCLUDE set_incdir $QT3_INCLUDE set_incdir $BOOST_INCLUDE set_incdir $SDL_INCLUDE set_incdir $SDL_IMAGE_INCLUDE set_incdir $SDL_MIXER_INCLUDE set_incdir $SDL_GFX_INCLUDE set_libdir $GLIB2_LIBDIR set_libdir $ORBIT2_LIBDIR set_libdir $QT3_LIBDIR set_libdir $IWEAR_LIBDIR set_libdir $ORBITCPP_LIBDIR set_libdir $SDL_LIBDIR set_libdir $SDL_IMAGE_LIBDIR set_libdir $SDL_MIXER_LIBDIR set_libdir $SDL_GFX_LIBDIR for dir in $SRCDIRS do VARNAME="\$LIBFILES_$dir" eval "FILES=$VARNAME" # echo -e "$VARNAME=$FILES" | sed 's/^\$//' >> $MAKEFILE NVARNAME=$(echo -e "$VARNAME=" | sed 's/^\$//') echo -en $NVARNAME >> $MAKEFILE for file in $FILES do echo -n $file" " >> $MAKEFILE done echo >> $MAKEFILE done if [ ! -z "$ORBITCPPIDL" ] then echo "OIDL2:=$ORBITCPPIDL" >> $MAKEFILE fi if [ ! -z "$MOC" ] then echo "MOC=$MOC" >> $MAKEFILE fi } # }}} # This generates the config.h header function gen_config # {{{ { CONFIG_H=$1 log -e "Generating $CONFIG_H" cat > $CONFIG_H <> $CONFIG_H echo -e "#define __CONFIG_H" >> $CONFIG_H echo -e "\n#define PREFIX \"$PREFIX\"" >> $CONFIG_H echo -e "\n#define DYN_SUFFIX \"$DYN_SUFFIX\"" >> $CONFIG_H echo -e "\n#define SYSCONF \"$SYSCONF\"" >> $CONFIG_H echo -e "#define ARCH \"$CPU\"" >> $CONFIG_H # TODO We need to really check for gnu compatible environment echo -e "\n#ifndef _GNU_SOURCE" >> $CONFIG_H echo -e "#define _GNU_SOURCE" >> $CONFIG_H echo -e "#endif\n" >> $CONFIG_H echo -e "#endif\n\n" >> $CONFIG_H # # End global config.h ... the next is specific to iwear headers, and therefore should only origin there echo -e "#ifndef __${GPREFIX}_CONFIG_H" >> $CONFIG_H echo -e "#define __${GPREFIX}_CONFIG_H" >> $CONFIG_H if [ "$SSL_INCLUDE" ] then echo -e "\n#undef SSL_INCLUDE" >> $CONFIG_H echo -e "#define SSL_INCLUDE $SSL_INCLUDE" >> $CONFIG_H echo -e "#define SSINC(x) " >> $CONFIG_H echo -e "#ifndef OPENSSL_NO_KRB5" >> $CONFIG_H echo -e "#define OPENSSL_NO_KRB5" >> $CONFIG_H echo -e "#endif " >> $CONFIG_H fi if [ "$HAVE_STRNLEN" == "yes" ] then echo -e "\n#undef HAVE_STRNLEN" >> $CONFIG_H echo -e "#define HAVE_STRNLEN 1" >> $CONFIG_H fi if [ "$HAVE_STRCASESTR" == "yes" ] then echo -e "\n#undef HAVE_STRCASESTR" >> $CONFIG_H echo -e "#define HAVE_STRCASESTR 1" >> $CONFIG_H fi if [ "$HAVE_VASPRINTF" == "yes" ] then echo -e "\n#undef HAVE_VASPRINTF" >> $CONFIG_H echo -e "#define HAVE_VASPRINTF 1" >> $CONFIG_H fi if [ "$HAVE_STRERROR_R" == "yes" ] then echo -e "\n#undef HAVE_STRERROR_R" >> $CONFIG_H echo -e "#define HAVE_STRERROR_R 1" >> $CONFIG_H fi if [ "$HAVE_CLOCK_GETTIME" == "yes" ] then echo -e "\n#undef HAVE_CLOCK_GETTIME" >> $CONFIG_H echo -e "#define HAVE_CLOCK_GETTIME 1" >> $CONFIG_H fi if [ "$HAVE_PTHREAD_MUTEX_TIMEDLOCK" == "yes" ] then echo -e "\n#undef HAVE_PTHREAD_MUTEX_TIMEDLOCK" >> $CONFIG_H echo -e "#define HAVE_PTHREAD_MUTEX_TIMEDLOCK 1" >> $CONFIG_H fi if [ $OS_TYPE == "mac" ] then echo -e "\n#undef IW_MAC" >> $CONFIG_H echo -e "#define IW_MAC 1" >> $CONFIG_H fi if [ $OS_TYPE == "solaris" ] then echo -e "\n#undef IW_SOLARIS" >> $CONFIG_H echo -e "#define IW_SOLARIS 1" >> $CONFIG_H fi echo -e "\n#endif" >> $CONFIG_H VPREF=`echo -e $DISTNAME | toupper | sed 's/-/_/g'` if [ ! -z "$PG_INCLUDE" ] then echo -e "#define HAVE_IWPGDB 1" >> $CONFIG_H fi read V_MAJOR V_MINOR V_RELEASE < <(echo $VERSION | sed 's/\./ /g'); echo -e "\n#ifndef ${VPREF}_MAJOR" >> $CONFIG_H echo -e "#define ${VPREF}_MAJOR $V_MAJOR" >> $CONFIG_H echo -e "#define ${VPREF}_MINOR $V_MINOR" >> $CONFIG_H echo -e "#define ${VPREF}_RELEASE $V_RELEASE" >> $CONFIG_H echo -e "#endif" >> $CONFIG_H } # }}}