C_TEMPDIR=`mktemp -d /tmp/iwear-configure.XXXXXX` # some useful defaults DEBUG=0 DEBUGLEVEL=0 CONFLOG=config.log SRCDIRS="src" CONFIG_H=./include/config.h LIBS= LIBLIBS= INCLUDES=-Iinclude PREFIX="/usr" SYSCONF="/etc" # call this whenever $PREFIX has changed function set_dirs { eval PREFIX='$PREFIX' eval SYSCONF='$SYSCONF' 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/" ORBITCXXINCLUDES="# /usr/include/orbitcpp-2.0 /opt/gnome/include/orbitcpp-2.0/" ORBITCXXCONFIG="" ORBITCXXLIBDIRS="# /opt/gnome/lib/ /usr/lib/" ORBITCXXIDLS="# /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="# $PREFIX/include/ $HOME/include/ $HOME/iwear/include /usr/include" IWEARLIBDIRS="# $PREFIX/lib/ $HOME/lib/ $HOME/iwear/lib /usr/lib" IWDBINCDIRS="# $PREFIX/include/ $HOME/include/ $HOME/iwear/include /usr/include" IWDBLIBDIRS="# $PREFIX/lib/ $HOME/lib/ $HOME/iwear/lib /usr/lib" IWSENSINCDIRS="# $PREFIX/include/ $HOME/include/ $HOME/iwear/include /usr/include" IWSENSLIBDIRS="# $PREFIX/lib/ $HOME/lib/ $HOME/iwear/lib /usr/lib" QT3INCDIRS="# /usr/include/ $PREFIX/include/ /usr/lib/qt3/include/ /usr/pkg/qt3/include/ /usr/include/qt3/" QT3LIBDIRS="# /usr/lib/ $PREFIX/lib/ /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" WEXTRA="-W" FPIC="-fPIC" # For colored output ESC="\033[1" RED="$ESC;31m" GRN="$ESC;32m" DGRN="$ESC;92m" 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 $CXX ] then CXX=g++ fi if [ -z $OIDL2 ] then OIDL2=/opt/gnome/bin/orbit-idl-2 fi trap cleanup 2 15 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 ptac { perl -e "print reverse <>;" } function read_config_cache # {{{ { touch config.cache CACHE=$(cat config.cache ) CACHE="$CACHE $@" CACHE=$( echo $CACHE | sed 's/ /\n/g' | ptac | sort -sut= -k1,1 | sed 's/^[a-zA-Z0-9]*=$//g' | ptac | sed 's/\r/ /g' | tr '\n' ' ' ) echo $CACHE } # }}} function checkfor # {{{ { logecho -en "Checking for $* .." } # }}} function failoutput { if [ -z "$*" ] then echo -en ". $RED" logecho -en "FAILED" echo -e "$NOR" else echo -en ". $RED" logecho -en "$*" echo -e "$NOR" fi } function okoutput # {{{ { if [ -z "$*" ] then echo -en ". $DGRN" logecho -en "(OK)" echo -e "$NOR" else echo -en ". $DGRN" logecho -en "$*" echo -e "$NOR" fi } # }}} function needs_program #{{{ { PROG=$1 logecho -n "." echo -en "$RED " logecho -n " (fail)"" " echo -e $YEL logecho -n "No $PROG in \$PATH" echo -e $NOR logecho "($PATH)" echo -e $YEL logecho "$0 needs $PROG in order to continue." logecho "Please install $PROG, add its location to \$PATH," logecho "or create a symlink within the path to a functional $PROG." echo -e $NOR check_exit 1 } # }}} function check_tee # {{{ { if [[ ! -z "$check_tee_outcome" ]] then return fi checkfor "tee" TEE=$(which tee 2>/dev/null) if [ -z "$TEE" ] then needs_program "tee" fi check_tee_outcome="ok" okoutput $TEE } # }}} function check_perl # {{{ { if [[ ! -z "$check_perl_outcome" ]] then return fi checkfor "perl" PERL=$(which perl 2>/dev/null) if [ -z "$PERL" ] then needs_program "perl" check_exit 1 fi okoutput $PERL } # }}} function check_exit # {{{ { if [ "$1" == "true" -o "$1" == 1 -o "$1" == "yes" ] then cleanup fi } # }}} function write_config_cache # {{{ { echo $@ > config.cache } # }}} function check_ostype # {{{ { checkfor "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 ".$RED [OS Type $OS_TYPE not supported, proceeding anyways with default settings]..$NOR " ;; esac okoutput $OS_TYPE } # }}} function check_dynlib # {{{ { if [[ ! -z "$check_dynlib_outcome" ]] then return fi checkfor "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 okoutput $DYN_SUFFIX checkfor "dynamic linker flags" case $OS_TYPE in solaris ) LIBFLAGS="-Wl,-rpath $PREFIX/lib -shared -Wl,-warn-once,-soname," log -en "[x86_64 -fPIC]" ;; linux | openbsd | freebsd) LIBFLAGS="-shared -Wl,-warn-once,-soname," if [ "$HOSTTYPE" == x86_64 ] then FPIC="-fPIC" log -en "[x86_64 -fPIC]" fi ;; mac) LIBFLAGS="-flat_namespace -undefined suppress -dynamiclib -install_name" ;; *) LIBFLAGS="-shared -Wl,-warn-once,-soname," logecho -en ". $RED[OS Type $OS_TYPE not supported, proceeding with $LIBFLAGS]$NOR.. " ;; esac check_dynlib_outcome="ok" okoutput $LIBFLAGS } # }}} function cleanup # {{{ { if [ -d "$C_TEMPDIR" ] then log "Cleaning up temporary directories..." rm -r $C_TEMPDIR 2>&1 >> $CONFLOG fi exec echo "Stop" exec exit 1 } # }}} 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` if [ -z "$HAVE_REL" ] then HAVE_REL=0 fi WANT_MAJ=`echo $WANTED | cut -d"." -f1` WANT_MIN=`echo $WANTED | cut -d"." -f2` WANT_REL=`echo $WANTED | cut -d"." -f3` if [ -z "$WANT_REL" ] then WANT_REL=0 fi 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 failoutput 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 failoutput 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 failoutput 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 log "CFLAGS = $LCFLAGS" # delete output file rm -f $OFILE for inc in $TRIALSS do # inc contains the actually tested directory. if it should not contain # anything, it is # # since gcc sometimes bugs out on -L/-I without additional parameter we # remove that flags altogether when issuing the cmd INC="${TTAG}${inc}" if [ "$inc" == "#" ] then inc="" INC="" fi # delete output file rm -f $OFILE log "Exec ($MCC $LCFLAGS $INC -o $OFILE $CFILE)" $MCC $LCFLAGS $INC -o $OFILE $CFILE >> $CONFLOG 2>&1 if [ -x "$OFILE" ] then log "Setting TRIAL=$inc" TRIAL=$inc # remove /usr/include as its the usual one for all headers if [ "$TRIAL" == "/usr/include" ] then TRIAL="" fi return fi done TRIAL="error" } # }}} # Sets check_exit 1 if the Version is wrong function check_gcc #{{{ { VERSION_OK=no WANTED_GCC=$1 if [[ ! -z "$check_gcc_outcome" ]] then return fi checkfor "$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" check_exit 1 fi read GCC_VER < <($TEMP_X) check_version $WANTED_GCC $GCC_VER "gcc" if [ "$VERSION_OK" != "yes" ] then check_exit 1 fi okoutput "$GCC_VER (OK)" rm -f $TEMP_X } #}}} function check_cxx #{{{ { if [[ ! -z "$check_cxx_outcome" ]] then return fi if [[ -z "$CXX" ]] then CXX="g++" fi WANTED_CXX=$1 checkfor "$CXX >= $WANTED_CXX" if [ "$FORCECXX" == "yes" ] then echo "(skipped - user override)" return fi TEMP_CXX="$C_TEMPDIR/check_gcc.cpp" TEMP_X=`mktemp $C_TEMPDIR/check_gcc.XXXXXX` cat > $TEMP_CXX < #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_CXX" cat $TEMP_CXX >> $CONFLOG log -e "Exec( $CXX $CXXFLAGS $TEMP_CXX -o $TEMP_X )" $CXX $CXXFLAGS $TEMP_CXX -o $TEMP_X >> $CONFLOG 2>&1 rm -f $TEMP_CXX if [ ! -x $TEMP_X ] then logecho -e "\nCould not create a program with $CXX as C++ compiler please verify that its working properly" check_exit 1 fi read CXX_VER < <($TEMP_X 2>> $CONFLOG) if [ -z "$CXX_VER" ] then logecho -e "\nWe were able to build an executable, but the executable failed to run" check_exit 1 fi check_version $WANTED_CXX $CXX_VER "g++" if [ "$VERSION_OK" != "yes" ] then check_exit 1 fi okoutput "$CXX_VER (OK)" logecho -en "Checking for $CXX extra warning flag .." CXX_MAJ=`echo $CXX_VER | cut -d"." -f1` CXX_MIN=`echo $CXX_VER | cut -d"." -f2` CXX_REL=`echo $CXX_VER | cut -d"." -f3` if [ $CXX_MAJ -ge 4 ] then WEXTRA="-Wextra" else if [ $CXX_MIN -ge 4 ] then WEXTRA="-Wextra" fi fi okoutput "$WEXTRA" rm -f $TEMP_X check_cxx_outcome="ok" } #}}} function check_gmake #{{{ { if [[ ! -z "$check_gmake_outcome" ]] then return fi check_sed checkfor "Make" MAKE=$(which gmake) if [ -z $MAKE ] then MAKE=$(which make) fi if [ -z "$MAKE" ] then needs_program "make or gmake" check_exit 1 fi okoutput "$MAKE" log -e "Found a make at $MAKE" WANTED_VER=$1 checkfor "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 logecho logecho "This Environment is compatible with GNU Make only." logecho "Please install GNU Make or provide a link called gmake within \$PATH" check_exit 1 fi check_version $WANTED_VER $VER "gmake" if [ "$VERSION_OK" != "yes" ] then check_exit 1 fi okoutput "$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 ) logecho logecho "Though we have detected a make version that satisfies the version" logecho "required, it is in a blacklist of buggy make versions. We highly" logecho "recommend that you upgrade your make version, since those make version" logecho "wont work with the iwear makefiles" check_exit 1 ;; *) # echo "md5sum : $MAKEMD5" ;; esac check_gmake_outcome="ok" } #}}} # 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 #{{{ { if [[ ! -z "$check_pkg_config_outcome" ]] then return fi PKG_CONFIG=`which pkg-config 2>/dev/null` checkfor "pkg-config" if [ -z "$PKG_CONFIG" ] then logecho ". no" else if [ "$NO_PKG_CONFIG" == "yes" ] then logecho ". skipped (user override)" PKG_CONFIG="" else okoutput $PKG_CONFIG fi fi check_pkg_config_outcome="ok" } #}}} # The script needs sed sometimes function check_sed #{{{ { if [[ ! -z "$check_sed_outcome" ]] then # assume everything went ok return fi logecho -en "Checking for sed .." SED=`which sed 2>/dev/null` if [ -z "$SED" ] then needs_program "sed" check_exit 1 fi check_sed_outcome="ok" okoutput $SED } # }}} function check_mktemp #{{{ { if [[ ! -z "$check_mktemp_outcome" ]] then return fi logecho -en "Checking for mktemp .." mktemp=`which mktemp 2>/dev/null` if [ -z "$mktemp" ] then needs_program "mktemp" check_exit 1 fi TMPDIR=$(mktemp -d /tmp/xxx.XXXXXX 2>/dev/null) RET=$? if [ $RET != 0 ] then needs_program "mktemp" check_exit 1 fi rmdir $TMPDIR &> /dev/null okoutput $mktemp check_mktemp_outcome="ok" } # }}} # Check for installation of pgsql libraries and the headers # sets PG_INCLUDE and PG_LIBDIR if not found or version too old function check_pgsql # {{{ { WANTED_VER=$1 if [[ ! -z "$check_pgsql_outcome" ]] then return fi checkfor "PostgreSQL => $WATNED_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" search_include $CC $TEMP_C "$CFLAGS -lpq" $TEMP_X -L "$PQLIBDIRS" log -e "Found PG_LIBDIR=$TRIAL" PG_LIBDIR=$TRIAL if [ "$PG_LIBDIR" == "error" ] then logecho "failed. Could not find directory where libpq.so lives in" check_exit 1 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 search_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 [ "$PG_INCLUDE" == "error" -o -z "$PG_VER" ] then logecho "\nfailed. Could not find directory where libpq-fe.h lives in" check_exit 1 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 check_exit 1 return fi logecho -e ". $PG_VER (OK)" check_pgsql_outcome="ok" } # }}} function check_libpq # {{{ { if [[ ! -z "$check_libpq_outcome" ]] then return fi 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 PGL="-L$PG_LIBDIR" if [ -z "$PG_LIBDIR" ] then PGL="" fi 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 $PGL $TEMP_C -o $TEMP_X -lpq >> $CONFLOG 2>&1 if [ ! -x "$TEMP_X" ] then logecho "fail" check_exit 1 logecho "We were not able to compile the test program for libpq" fi rm -f $TEMP_C rm -f $TEMP_X logecho ". (OK)" check_libpq_outcome="ok" } #}}} function check_linc # {{{ { if [[ ! -z "$check_linc_outcome" ]] then return fi 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 search_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" check_exit 1 logecho "We were not able to compile the test program for linc. Have you installed the Headers (-devel package of your distro) ?" else logecho ". $LINC_INCLUDE" fi # rm -f $TEMP_C rm -f $TEMP_X check_linc_outcome="ok" } #}}} function check_iwear # {{{ { if [[ ! -z "$check_iwear_outcome" ]] then return fi check_boost 1.34.0 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 checkfor "iWear core libraries" search_libdir "-liwear_core" "$IWEARLIBDIRS" logsetvar IWEAR_LIBDIR $FOUNDLIB if [ "$FOUNDLIB" == "error" ] then failoutput logecho -e "We were not able to generate a check program for $CHECKME." logecho -e "please see $CONFLOG for details" check_exit 1 return fi logecho ". $IWEAR_LIBDIR" logecho -en "Checking for iWear core includes .." log -e "Trial compiling $TEMP_C" cat $TEMP_C >> $CONFLOG search_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" check_exit 1 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 ". $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 check_exit 1 fi fi if [ "$BAIL" != "yes" ] then logecho ". $IWEAR_VER (OK)" fi check_iwear_outcome="ok" } #}}} function check_boost # {{{ { if [[ ! -z "$check_boost_outcome" ]] then return fi 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 checkfor "boost includes" log -e "Trial compiling $TEMP_C" cat $TEMP_C >> $CONFLOG search_include $CXX $TEMP_C "$DLLIB" $TEMP_X -I "$BOOSTINCDIRS" BOOST_INCLUDE=$TRIAL log -e "Succes, set BOOST_INCLUDE=$BOOST_INCLUDE" if [ ! -x "$TEMP_X" ] then failoutput logecho "We were not able to compile the test program for boost headers. Have you installed the Headers (-devel package of your distro) ?" check_exit 1 else okoutput $BOOST_INCLUDE checkfor "boost >= $WANTED_VER" BOOST_VER=`$TEMP_X` check_version $WANTED_VER $BOOST_VER "boost" $WANTED_VER $BOOST_VER if [ "$VERSION_OK" != "yes" ] then check_exit 1 fi fi okoutput "$BOOST_VER (OK)" check_boost_outcome="ok" } #}}} 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 checkfor "SDL" search_libdir "-lSDL" "$SDLLIBDIRS" logsetvar SDL_LIBDIR $FOUNDLIB if [ "$FOUNDLIB" == "error" ] then logecho -e "fail" logecho -e "We were not able to generate a check program for $CHECKME." logecho -e "please see $CONFLOG for details" check_exit 1 return fi okoutput "$SDL_LIBDIR" checkfor "SDL includes" log -e "Trial compiling $TEMP_C" cat $TEMP_C >> $CONFLOG search_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" check_exit 1 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 ". $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 check_exit 1 fi fi if [ "$BAIL" != "yes" ] then okoutput "$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 [ "$FOUNDLIB" == "error" ] then logecho -e "fail" logecho -e "We were not able to generate a check program for $CHECKME." logecho -e "please see $CONFLOG for details" check_exit 1 return fi logecho " (OK)" logecho -en "Checking for libid3tag includes ... " log -e "Trial compiling $TEMP_C" cat $TEMP_C >> $CONFLOG search_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" check_exit 1 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 check_exit 1 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 [ "$FOUNDLIB" == "error" ] then logecho -e "fail" logecho -e "We were not able to generate a check program for $CHECKME." logecho -e "please see $CONFLOG for details" check_exit 1 return fi logecho " (OK)" logecho -en "Checking for SDL_image includes ... " log -e "Trial compiling $TEMP_C" cat $TEMP_C >> $CONFLOG search_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" check_exit 1 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 check_exit 1 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 [ "$FOUNDLIB" == "error" ] then logecho -e "fail" logecho -e "We were not able to generate a check program for $CHECKME." logecho -e "please see $CONFLOG for details" check_exit 1 return fi logecho " (OK)" logecho -en "Checking for SDL_ttf includes ... " log -e "Trial compiling $TEMP_C" cat $TEMP_C >> $CONFLOG search_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" check_exit 1 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 check_exit 1 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 < #ifndef SDL_MIXER_MAJOR_VERSION #define SDL_MIXER_MAJOR_VERSION MIX_MAJOR_VERSION #endif #ifndef SDL_MIXER_MINOR_VERSION #define SDL_MIXER_MINOR_VERSION MIX_MINOR_VERSION #endif #ifndef SDL_MIXER_PATCHLEVEL #define SDL_MIXER_PATCHLEVEL MIX_PATCHLEVEL #endif 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 [ "$FOUNDLIB" == "error" ] then logecho -e "fail" logecho -e "We were not able to generate a check program for $CHECKME." logecho -e "please see $CONFLOG for details" check_exit 1 return fi logecho " (OK)" logecho -en "Checking for SDL_mixer includes ... " log -e "Trial compiling $TEMP_C" cat $TEMP_C >> $CONFLOG search_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" check_exit 1 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 check_exit 1 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 [ "$FOUNDLIB" == "error" ] then logecho -e "fail" logecho -e "We were not able to generate a check program for $CHECKME." logecho -e "please see $CONFLOG for details" check_exit 1 return fi logecho " (OK)" logecho -en "Checking for SDL_gfx includes ... " log -e "Trial compiling $TEMP_C" cat $TEMP_C >> $CONFLOG search_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" check_exit 1 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 # check_exit 1 # 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 <> $CONFLOG search_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" check_exit 1 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 check_exit 1 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 [ "$FOUNDLIB" == "error" ] then logecho -e "fail" logecho -e "We were not able to generate a check program for $CHECKME." logecho -e "please see $CONFLOG for details" check_exit 1 return fi logecho " (OK)" logecho -en "Checking for iwear sensor core includes ... " log -e "Trial compiling $TEMP_C" cat $TEMP_C >> $CONFLOG search_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" check_exit 1 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 check_exit 1 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_iwidl #{{{ { # Ok this is not really a check since we need it for building the iwear rpc # library itself. But since we now that we will install to $PREFIX we # simply set the iwidl compiler to there. IWIDL=$PREFIX/bin/iwidl } #}}} 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" checkfor "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 search_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" check_exit 1 logecho "We were not able to compile the test program for openssl. Have you installed the Headers (-devel package of your distro) ?" else okoutput $SSL_INCLUDE checkfor "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 check_exit 1 fi fi if [ "$BAIL" != "yes" ] then okoutput "$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 search_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" check_exit 1 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 search_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 check_exit 1 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 search_include $CC $TEMP_C "-I $GLIB2_INCLUDE -I $GLIB2_CONFIG" $TEMP_X -L "$GLIB2LIBDIRS" GLIB2_LIBDIR=$TRIAL if [ -z "$GLIB2_LIBDIR" ] then check_exit 1 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 check_exit 1 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 search_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" check_exit 1 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 search_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 check_exit 1 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 check_exit 1 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 search_include $CXX $TEMP_C "-I $LINC_INCLUDE -I $ORBIT2_INCLUDE -I $GLIB2_CONFIG -I $GLIB2_INCLUDE" $TEMP_X -I "$ORBITCXXINCLUDES" ORBITCXX_INCLUDE=$TRIAL log -e "Succes, set ORBITCXX_INCLUDE=$ORBITCXX_INCLUDE" if [ ! -x "$TEMP_X" ] then logecho "fail" check_exit 1 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 search_include $CXX $TEMP_C "-lORBit-2-cpp -I $ORBITCXX_INCLUDE" $TEMP_X -L "$ORBITCXXLIBDIRS" ORBITCXX_LIBDIR=$TRIAL log -e "ORBITCXX_LIBDIR=$ORBITCXX_LIBDIR" if [ -z "$ORBITCXX_LIBDIR" ] then check_exit 1 logecho -e "fail" logecho -e "Could not find libORBit-2-cpp in any of $ORBITCXXLIBDIRS" return fi ORBITCXX_VER=`$TEMP_X` check_version $WANTED_VER $ORBITCXX_VER "orbitcpp" if [ "$VERSION_OK" != "yes" ] then check_exit 1 fi if [ "$BAIL" != "yes" ] then logecho "$ORBITCXX_VER (OK)" fi rm -f $TEMP_C rm -f $TEMP_X logecho -en "Checking for orbit-idl-2 ... " for idl in $ORBITCXXIDLS do if [ -x $idl ] then ORBITCXXIDL=$idl fi done if [ -z "$ORBITCXXIDL" ] then echo "none" echo -e "Could not find orbit-idl-2 in any of $ORBITCXXIDLS" check_exit 1 else logecho "yes ($ORBITCXXIDL)" 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 # {{{ { if [[ ! -z "$check_char_bit_outcome" ]] then return fi WANTED_BIT=$1 checkfor "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" check_exit 1 fi CHAR_BIT=$($TEMP_X) if [ $WANTED_BIT != $CHAR_BIT ] then logecho "Unsupported CHAR_BIT value $CHAR_BIT" check_exit 1 else okoutput fi rm -f $TEMP_C rm -f $TEMP_X check_char_bit_outcome="ok" } #}}} 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" search_include $CC $TEMP_C "$CFLAGS" $TEMP_X "" "$DLLIBS" DLLIB=$TRIAL log -e "Set DLLIB=$DLLIB" if [ -x "$TEMP_X" ] then okoutput "with $DLLIB (OK)" fi if [ "$DLLIB" == "none" ] then logecho "fail. We were not able to determine how to use dlopen()" check_exit 1 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" search_include $CC $TEMP_C "$CFLAGS" $TEMP_X "" "$THREADLIBS" TLIB=$TRIAL log -e "Set TLIB=$TLIB" if [ -x "$TEMP_X" ] then okoutput "(OK) with $TLIB" fi if [ "$TLIB" == "none" ] then logecho "fail. We were not able to determine how to use POSIX Threads" check_exit 1 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" check_exit 1 return fi PQX_VER=$($PKG_CONFIG --modversion libpqxx) else TEMP_CXX="$C_TEMPDIR/check_libpq.cpp" TEMP_X=`mktemp $C_TEMPDIR/check_libpq.XXXXXX` cat > $TEMP_CXX < #include int main ( void ) { pqxx::connection Conn; int maj, min, rel; printf(VERSION); } XEOF log -e "TEst Program $TEMP_CXX" cat $TEMP_CXX >> $CONFLOG log -e "Exec( $CXX $CXXFLAGS -I $PG_INCLUDE -lpqxx $TEMP_CXX -o $TEMP_X)" $CXX $CXXFLAGS -I $PG_INCLUDE -lpqxx $TEMP_CXX -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" check_exit 1 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 check_exit 1 return fi rm -f $TEMP_CXX 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 [ "$FOUNDLIB" == "error" ] then logecho -e "fail" logecho -e "We were not able to generate a check program for $CHECKME." logecho -e "please see $CONFLOG for details" check_exit 1 return fi logecho "(OK)" TEMP_CXX="$C_TEMPDIR/check_xerces.cpp" TEMP_X=`mktemp $C_TEMPDIR/check_xerces.XXXXXX` cat > $TEMP_CXX < #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 ... " search_include $CXX $TEMP_CXX "$CFLAGS" $TEMP_X -I "$XERCESINCDIRS" if [ -x $TEMP_X ] then XER_VER=$($TEMP_X) logecho " (OK)" else logecho -e " failed" check_exit 1 return fi logecho -en "Checking for $CHECKME >= $WANTED_VER ... " check_version $WANTED_VER $XER_VER "xerces" if [ "$VERSION_OK" != "yes" ] then check_exit 1 return fi rm -f $TEMP_CXX 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 [ "$FOUNDLIB" == "error" ] then logecho -e "fail" logecho -e "We were not able to generate a check program for $CHECKME." logecho -e "please see $CONFLOG for details" check_exit 1 return fi logecho "(OK)" TEMP_CXX="$C_TEMPDIR/check_qt3.cpp" TEMP_X=`mktemp $C_TEMPDIR/check_qt3.XXXXXX` cat > $TEMP_CXX < #include int main ( void ) { printf(QT_VERSION_STR); return 0; } XEOF logecho -en "Checking for $CHECKME includes ... " search_include $CXX $TEMP_CXX "$CFLAGS" $TEMP_X -I "$QT3INCDIRS" logsetvar QT3_INCLUDE $TRIAL if [ -x $TEMP_X ] then QT3_VER=$($TEMP_X) logecho " (OK)" else logecho -e " failed" check_exit 1 return fi logecho -en "Checking for $CHECKME >= $WANTED_VER ... " check_version $WANTED_VER $QT3_VER "qt3" if [ "$VERSION_OK" != "yes" ] then check_exit 1 return fi rm -f $TEMP_CXX 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 logecho -e "not found" check_exit 1 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 # {{{ { checkfor "how to invoke echo in make" OUTPUT=`echo -en` if [ -z "$OUTPUT" ] then okoutput " with -en" ECHOEN="echo -en" else okoutput " 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 "$CXXFLAGS" ] then echo -e "Overriding \$CXXFLAGS to \"$CXXFLAGS\"" echo -e "\nCXXFLAGS=$CXXFLAGS" >> $MAKEFILE fi if [ ! -z "$IWIDL" ] then echo -e "\nIWIDL=$IWIDL" >> $MAKEFILE fi echo -e "\nCC=$CC" >> $MAKEFILE echo -e "CXX=$CXX" >> $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=-L$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 "FPIC=$FPIC" >> $MAKEFILE echo -e "COMMONFLAGS:=\$(COMMONFLAGS) \$(WEXTRA)" >> $MAKEFILE if [ "$NOSTATLIB" ] then echo -e "NOSTATLIB=true" >> $MAKEFILE fi if [ "$OPTFLAGS" ] then echo -e "OPTFLAGS=$OPTFLAGS" >> $MAKEFILE echo -e "COMMONFLAGS:=\$(COMMONFLAGS) \$(OPTFLAGS)" >> $MAKEFILE fi if [ "$DEBUGFLAGS" ] then echo -e "DEBUGFLAGS=$DEBUGFLAGS" >> $MAKEFILE echo -e "COMMONFLAGS:=\$(COMMONFLAGS) \$(DEBUGFLAGS)" >> $MAKEFILE fi echo >> $MAKEFILE echo -en "SRCDIRS=" >> $MAKEFILE for dir in $SRCDIRS do echo -en "\$(TOPDIR)/$dir " >> $MAKEFILE done if [ -z "$TANSDIRS" ] then TRANSDIRS="$SRCDIRS include" fi echo >> $MAKEFILE echo -en "TRANSDIRS=" >> $MAKEFILE for dir in $TRANSDIRS do echo -en "\$(TOPDIR)/$dir " >> $MAKEFILE done echo >> $MAKEFILE echo >> $MAKEFILE # check for addition of several objects into the main library sources 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 $ORBITCXX_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 $ORBITCXX_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 "$MOC" ] then echo "MOC=$MOC" >> $MAKEFILE fi if LD_DEBUG=libs ls *.goofy 2>&1 | grep "search path" | sed 's/:/\n/g' | sed 's/[ \t]/\n/g' | sort | uniq | grep "$PREFIXS/lib" &> /dev/null then log "Could find the prefix in library search path" else echo echo "You don't have $PREFIX/lib in your library search path. In order to have the library working properly, you need it there, e.g. by adding it to LD_LIBRARY_PATH" echo fi } # }}} # This generates the config.h header function gen_config # {{{ { CONFIG_H=$1 CONFIG_H_TMP=$1.tmp logecho -en "Symlinking internal includes ... " pushd . &> /dev/null cd include rm -f $DISTNAME # set -x HERE=$(pwd) DIRPART=$(dirname $DISTNAME) BASEPART=$(basename $DISTNAME) if [[ ! -z "$DIRPART" ]] then mkdir -p "$DIRPART" cd $DIRPART fi ln -s "$HERE" "$BASEPART" # set +x popd &> /dev/null logecho -e "done" logecho -e "Generating $CONFIG_H" cat > $CONFIG_H_TMP <> $CONFIG_H_TMP echo -e "#define __CONFIG_H_TMP" >> $CONFIG_H_TMP echo -e "\n#define PREFIX \"$PREFIX\"" >> $CONFIG_H_TMP echo -e "\n#define DYN_SUFFIX \"$DYN_SUFFIX\"" >> $CONFIG_H_TMP echo -e "\n#define SYSCONF \"$SYSCONF\"" >> $CONFIG_H_TMP echo -e "#define ARCH \"$CPU\"" >> $CONFIG_H_TMP # TODO We need to really check for gnu compatible environment echo -e "\n#ifndef _GNU_SOURCE" >> $CONFIG_H_TMP echo -e "#define _GNU_SOURCE" >> $CONFIG_H_TMP echo -e "#endif\n" >> $CONFIG_H_TMP echo -e "#endif\n\n" >> $CONFIG_H_TMP # # End global config.h ... the next is specific to iwear headers, and therefore should only origin there echo -e "#ifndef __${GPREFIX}_CONFIG_H_TMP" >> $CONFIG_H_TMP echo -e "#define __${GPREFIX}_CONFIG_H_TMP" >> $CONFIG_H_TMP if [ "$SSL_INCLUDE" ] then echo -e "\n#undef SSL_INCLUDE" >> $CONFIG_H_TMP echo -e "#define SSL_INCLUDE $SSL_INCLUDE" >> $CONFIG_H_TMP echo -e "#define SSINC(x) " >> $CONFIG_H_TMP echo -e "#ifndef OPENSSL_NO_KRB5" >> $CONFIG_H_TMP echo -e "#define OPENSSL_NO_KRB5" >> $CONFIG_H_TMP echo -e "#endif " >> $CONFIG_H_TMP fi if [ "$HAVE_STRNLEN" == "yes" ] then echo -e "\n#undef HAVE_STRNLEN" >> $CONFIG_H_TMP echo -e "#define HAVE_STRNLEN 1" >> $CONFIG_H_TMP fi if [ "$HAVE_STRCASESTR" == "yes" ] then echo -e "\n#undef HAVE_STRCASESTR" >> $CONFIG_H_TMP echo -e "#define HAVE_STRCASESTR 1" >> $CONFIG_H_TMP fi if [ "$HAVE_VASPRINTF" == "yes" ] then echo -e "\n#undef HAVE_VASPRINTF" >> $CONFIG_H_TMP echo -e "#define HAVE_VASPRINTF 1" >> $CONFIG_H_TMP fi if [ "$HAVE_STRERROR_R" == "yes" ] then echo -e "\n#undef HAVE_STRERROR_R" >> $CONFIG_H_TMP echo -e "#define HAVE_STRERROR_R 1" >> $CONFIG_H_TMP fi if [ "$HAVE_CLOCK_GETTIME" == "yes" ] then echo -e "\n#undef HAVE_CLOCK_GETTIME" >> $CONFIG_H_TMP echo -e "#define HAVE_CLOCK_GETTIME 1" >> $CONFIG_H_TMP fi if [ "$HAVE_PTHREAD_MUTEX_TIMEDLOCK" == "yes" ] then echo -e "\n#undef HAVE_PTHREAD_MUTEX_TIMEDLOCK" >> $CONFIG_H_TMP echo -e "#define HAVE_PTHREAD_MUTEX_TIMEDLOCK 1" >> $CONFIG_H_TMP fi if [ $OS_TYPE == "mac" ] then echo -e "\n#undef IW_MAC" >> $CONFIG_H_TMP echo -e "#define IW_MAC 1" >> $CONFIG_H_TMP fi if [ $OS_TYPE == "solaris" ] then echo -e "\n#undef IW_SOLARIS" >> $CONFIG_H_TMP echo -e "#define IW_SOLARIS 1" >> $CONFIG_H_TMP fi echo -e "\n#endif" >> $CONFIG_H_TMP VPREF=`echo -e $DISTNAME | toupper | sed 's/-/_/g' | sed 's/\//_/g'` if [ ! -z "$PG_INCLUDE" ] then echo -e "#define HAVE_IWPGDB 1" >> $CONFIG_H_TMP fi read V_MAJOR V_MINOR V_RELEASE < <(echo $VERSION | sed 's/\./ /g'); echo -e "\n#ifndef ${VPREF}_MAJOR" >> $CONFIG_H_TMP echo -e "#define ${VPREF}_MAJOR $V_MAJOR" >> $CONFIG_H_TMP echo -e "#define ${VPREF}_MINOR $V_MINOR" >> $CONFIG_H_TMP echo -e "#define ${VPREF}_RELEASE $V_RELEASE" >> $CONFIG_H_TMP echo -e "#define ${VPREF}_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))" >> $CONFIG_H_TMP echo -e "#define ${VPREF}_VERSION_CODE ${VPREF}_VERSION(${VPREF}_MAJOR,${VPREF}_MINOR,${VPREF}_RELEASE)" >> $CONFIG_H_TMP echo -e "$PRIVATE_CONFIG" >> $CONFIG_H_TMP echo -e "#endif" >> $CONFIG_H_TMP if [[ ! -f $CONFIG_H ]] then mv $CONFIG_H_TMP $CONFIG_H else DIFFOUT=$(diff $CONFIG_H_TMP $CONFIG_H) if [[ -z "$DIFFOUT" ]] then rm -f $CONFIG_H_TMP else mv $CONFIG_H_TMP $CONFIG_H fi fi #ls -la $CONFIG_H } # }}} function output_config { echo -e "\nCurrent Configuration :\n" while [[ $# != 0 ]] do VAR=$1 echo -e "$VAR\t\t${!VAR}" shift done cat <