--- a/configure Mon Feb 12 21:13:23 2024 +0100 +++ b/configure Sun Jun 09 15:43:08 2024 +0200 @@ -1,40 +1,53 @@ #!/bin/sh - -PREFIX=/usr -EPREFIX=$PREFIX +# create temporary directory +TEMP_DIR=".tmp-`uname -n`" +rm -Rf "$TEMP_DIR" +if mkdir -p "$TEMP_DIR"; then + : +else + echo "Cannot create tmp dir $TEMP_DIR" + echo "Abort" + exit 1 +fi +touch "$TEMP_DIR/options" +touch "$TEMP_DIR/features" -BINDIR= -SBINDIR= -LIBDIR= -LIBEXECDIR= -DATADIR= -SYSCONFDIR= -SHAREDSTATEDIR= -LOCALSTATEDIR= -INCLUDEDIR= -INFODIR= -MANDIR= +# define standard variables +# also define standard prefix (this is where we will search for config.site) +prefix=/usr +exec_prefix= +bindir= +sbindir= +libdir= +libexecdir= +datarootdir= +datadir= +sysconfdir= +sharedstatedir= +localstatedir= +runstatedir= +includedir= +infodir= +localedir= +mandir= -OS=`uname -s` -OS_VERSION=`uname -r` - -TEMP_DIR=".tmp-`uname -n`" -mkdir -p $TEMP_DIR -if [ $? -ne 0 ]; then - echo "Cannot create tmp dir" - echo "Abort" -fi -touch $TEMP_DIR/options -touch $TEMP_DIR/features +# custom variables # features +# clean abort +abort_configure() +{ + rm -Rf "$TEMP_DIR" + exit 1 +} + # help text printhelp() { - echo "Usage: $0 [OPTIONS]..." - cat << __EOF__ + echo "Usage: $0 [OPTIONS]..." + cat << __EOF__ Installation directories: --prefix=PREFIX path prefix for architecture-independent files [/usr] @@ -47,497 +60,692 @@ --sysconfdir=DIR system configuration files [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR run-time variable data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --mandir=DIR man documentation [DATAROOTDIR/man] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] Options: + --debug add extra compile flags for debug builds + --release add extra compile flags for release builds --toolkit=(gtk4|gtk3|gtk2|gtk2legacy|qt5|qt4|motif) __EOF__ } # -# parse arguments +# parse arguments # -for ARG in $@ +BUILD_TYPE="default" +for ARG in "$@" do case "$ARG" in - "--prefix="*) PREFIX=${ARG#--prefix=} ;; - "--exec-prefix="*) EPREFIX=${ARG#--exec-prefix=} ;; - "--bindir="*) BINDIR=${ARG#----bindir=} ;; - "--sbindir="*) SBINDIR=${ARG#--sbindir=} ;; - "--libdir="*) LIBDIR=${ARG#--libdir=} ;; - "--libexecdir="*) LIBEXECDIR=${ARG#--libexecdir=} ;; - "--datadir="*) DATADIR=${ARG#--datadir=} ;; - "--sysconfdir="*) SYSCONFDIR=${ARG#--sysconfdir=} ;; - "--sharedstatedir="*) SHAREDSTATEDIR=${ARG#--sharedstatedir=} ;; - "--localstatedir="*) LOCALSTATEDIR=${ARG#--localstatedir=} ;; - "--includedir="*) INCLUDEDIR=${ARG#--includedir=} ;; - "--infodir="*) INFODIR=${ARG#--infodir=} ;; - "--mandir"*) MANDIR=${ARG#--mandir} ;; - "--help"*) printhelp; exit 1 ;; - "--toolkit="*) OPT_TOOLKIT=${ARG#--toolkit=} ;; - "-"*) echo "unknown option: $ARG"; exit 1 ;; - esac + "--prefix="*) prefix=${ARG#--prefix=} ;; + "--exec-prefix="*) exec_prefix=${ARG#--exec-prefix=} ;; + "--bindir="*) bindir=${ARG#----bindir=} ;; + "--sbindir="*) sbindir=${ARG#--sbindir=} ;; + "--libdir="*) libdir=${ARG#--libdir=} ;; + "--libexecdir="*) libexecdir=${ARG#--libexecdir=} ;; + "--datarootdir="*) datarootdir=${ARG#--datarootdir=} ;; + "--datadir="*) datadir=${ARG#--datadir=} ;; + "--sysconfdir="*) sysconfdir=${ARG#--sysconfdir=} ;; + "--sharedstatedir="*) sharedstatedir=${ARG#--sharedstatedir=} ;; + "--localstatedir="*) localstatedir=${ARG#--localstatedir=} ;; + "--includedir="*) includedir=${ARG#--includedir=} ;; + "--infodir="*) infodir=${ARG#--infodir=} ;; + "--mandir"*) mandir=${ARG#--mandir} ;; + "--localedir"*) localedir=${ARG#--localedir} ;; + "--help"*) printhelp; abort_configure ;; + "--debug") BUILD_TYPE="debug" ;; + "--release") BUILD_TYPE="release" ;; + "--toolkit="*) OPT_TOOLKIT=${ARG#--toolkit=} ;; + "-"*) echo "unknown option: $ARG"; abort_configure ;; + esac done -# set dir variables -if [ -z "$BINDIR" ]; then - BINDIR=$EPREFIX/bin -fi -if [ -z "$SBINDIR" ]; then - SBINDIR=$EPREFIX/sbin -fi -if [ -z "$LIBDIR" ]; then - LIBDIR=$EPREFIX/lib -fi -if [ -z "$LIBEXEC" ]; then - LIBEXECDIR=$EPREFIX/libexec -fi -if [ -z "$DATADIR" ]; then - DATADIR=$PREFIX/share -fi -if [ -z "$SYSCONFDIR" ]; then - SYSCONFDIR=$PREFIX/etc -fi -if [ -z "$SHAREDSTATEDIR" ]; then - SHAREDSTATEDIR=$PREFIX/com -fi -if [ -z "$LOCALSTATEDIR" ]; then - LOCALSTATEDIR=$PREFIX/var -fi -if [ -z "$INCLUDEDIR" ]; then - INCLUDEDIR=$PREFIX/include -fi -if [ -z "$INFODIR" ]; then - INFODIR=$PREFIX/info -fi -if [ -z "$MANDIR" ]; then - MANDIR=$PREFIX/man + + +# set defaults for dir variables +: ${exec_prefix:="$prefix"} +: ${bindir:='${exec_prefix}/bin'} +: ${sbindir:='${exec_prefix}/sbin'} +: ${libdir:='${exec_prefix}/lib'} +: ${libexecdir:='${exec_prefix}/libexec'} +: ${datarootdir:='${prefix}/share'} +: ${datadir:='${datarootdir}'} +: ${sysconfdir:='${prefix}/etc'} +: ${sharedstatedir:='${prefix}/com'} +: ${localstatedir:='${prefix}/var'} +: ${runstatedir:='${localstatedir}/run'} +: ${includedir:='${prefix}/include'} +: ${infodir:='${datarootdir}/info'} +: ${mandir:='${datarootdir}/man'} +: ${localedir:='${datarootdir}/locale'} + +# check if a config.site exists and load it +if [ -n "$CONFIG_SITE" ]; then + # CONFIG_SITE may contain space separated file names + for cs in $CONFIG_SITE; do + printf "loading defaults from $cs... " + . "$cs" + echo ok + done +elif [ -f "$prefix/share/config.site" ]; then + printf "loading site defaults... " + . "$prefix/share/config.site" + echo ok +elif [ -f "$prefix/etc/config.site" ]; then + printf "loading site defaults... " + . "$prefix/etc/config.site" + echo ok fi -which pkg-config > /dev/null -if [ $? -eq 0 ]; then - PKG_CONFIG=pkg-config -else - PKG_CONFIG=false -fi +# Test for availability of pkg-config +PKG_CONFIG=`command -v pkg-config` +: ${PKG_CONFIG:="false"} # Simple uname based platform detection # $PLATFORM is used for platform dependent dependency selection +OS=`uname -s` +OS_VERSION=`uname -r` printf "detect platform... " -if [ $OS = SunOS ]; then +if [ "$OS" = "SunOS" ]; then PLATFORM="solaris sunos unix svr4" -fi -if [ $OS = Linux ]; then +elif [ "$OS" = "Linux" ]; then PLATFORM="linux unix" -fi -if [ $OS = FreeBSD ]; then +elif [ "$OS" = "FreeBSD" ]; then PLATFORM="freebsd bsd unix" -fi -if [ $OS = Darwin ]; then +elif [ "$OS" = "OpenBSD" ]; then + PLATFORM="openbsd bsd unix" +elif [ "$OS" = "NetBSD" ]; then + PLATFORM="netbsd bsd unix" +elif [ "$OS" = "Darwin" ]; then PLATFORM="macos osx bsd unix" -fi -echo $OS | grep "MINGW" > /dev/null -if [ $? -eq 0 ]; then +elif echo "$OS" | grep -i "MINGW" > /dev/null; then PLATFORM="windows mingw" fi - -if [ -z "$PLATFORM" ]; then - PLATFORM="unix" -fi +: ${PLATFORM:="unix"} -for p in $PLATFORM -do - PLATFORM_NAME=$p - break -done -echo $PLATFORM_NAME +PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -` +echo "$PLATFORM_NAME" isplatform() { for p in $PLATFORM do - if [ $p = $1 ]; then + if [ "$p" = "$1" ]; then return 0 fi done return 1 } -isnotplatform() +notisplatform() { for p in $PLATFORM do - if [ $p = $1 ]; then + if [ "$p" = "$1" ]; then + return 1 + fi + done + return 0 +} +istoolchain() +{ + for t in $TOOLCHAIN + do + if [ "$t" = "$1" ]; then + return 0 + fi + done + return 1 +} +notistoolchain() +{ + for t in $TOOLCHAIN + do + if [ "$t" = "$1" ]; then return 1 fi done return 0 } -# generate config.mk and config.h -cat > $TEMP_DIR/config.mk << __EOF__ -# -# config.mk generated by configure -# -# general vars - -PREFIX=$PREFIX -EPREFIX=$EPREFIX - -BINDIR=$BINDIR -SBINDIR=$SBINDIR -LIBDIR=$LIBDIR -LIBEXECDIR=$LIBEXECDIR -DATADIR=$DATADIR -SYSCONFDIR=$SYSCONFDIR -SHAREDSTATEDIR=$SHAREDSTATEDIR -LOCALSTATEDIR=$LOCALSTATEDIR -INCLUDEDIR=$INCLUDEDIR -INFODIR=$INFODIR -MANDIR=$MANDIR - +# generate vars.mk +cat > "$TEMP_DIR/vars.mk" << __EOF__ +prefix=$prefix +exec_prefix=$exec_prefix +bindir=$bindir +sbindir=$sbindir +libdir=$libdir +libexecdir=$libexecdir +datarootdir=$datarootdir +datadir=$datadir +sysconfdir=$sysconfdir +sharedstatedir=$sharedstatedir +localstatedir=$localstatedir +runstatedir=$runstatedir +includedir=$includedir +infodir=$infodir +mandir=$mandir +localedir=$localedir __EOF__ -echo > $TEMP_DIR/make.mk - -ENV_CFLAGS=$CFLAGS -ENV_LDFLAGS=$LDFLAGS -ENV_CXXFLAGS=$CXXFLAGS - -# Toolchain detection -# this will insert make vars to config.mk +# toolchain detection utilities . make/toolchain.sh -# add user specified flags to config.mk -echo >> $TEMP_DIR/config.mk -if [ ! -z "${ENV_CFLAGS}" ]; then - echo "CFLAGS += $ENV_CFLAGS" >> $TEMP_DIR/config.mk -fi -if [ ! -z "${ENV_CXXFLAGS}" ]; then - echo "CXXFLAGS += $ENV_CXXFLAGS" >> $TEMP_DIR/config.mk -fi -if [ ! -z "${ENV_LDFLAGS}" ]; then - echo "LDFLAGS += $ENV_LDFLAGS" >> $TEMP_DIR/config.mk -fi - # # DEPENDENCIES # -dependency_qt4() +# check languages +lang_c= +lang_cpp= +if detect_c_compiler ; then + lang_c=1 +fi + +# create buffer for make variables required by dependencies +echo > "$TEMP_DIR/make.mk" + +test_pkg_config() { - printf "checking for qt4... " - # dependency qt4 + if "$PKG_CONFIG" --exists "$1" ; then : + else return 1 ; fi + if [ -z "$2" ] || "$PKG_CONFIG" --atleast-version="$2" "$1" ; then : + else return 1 ; fi + if [ -z "$3" ] || "$PKG_CONFIG" --exact-version="$3" "$1" ; then : + else return 1 ; fi + if [ -z "$4" ] || "$PKG_CONFIG" --max-version="$4" "$1" ; then : + else return 1 ; fi + return 0 +} + +print_check_msg() +{ + if [ -z "$1" ]; then + shift + printf "$@" + fi +} + +dependency_error_gtk2legacy() +{ + print_check_msg "$dep_checked_gtk2legacy" "checking for gtk2legacy... " + # dependency gtk2legacy while true do - qmake-qt4 -o - /dev/null | grep DEFINES\ > /dev/null - if [ $? -eq 0 ]; then - CFLAGS="$CFLAGS `qmake-qt4 -o - /dev/null | grep DEFINES\ `" - else + if [ -z "$PKG_CONFIG" ]; then break fi - qmake-qt4 -o - /dev/null | grep INCPATH\ > /dev/null - if [ $? -eq 0 ]; then - CFLAGS="$CFLAGS `qmake-qt4 -o - /dev/null | grep INCPATH\ `" + if test_pkg_config "gtk+-2.0" "" "" "" ; then + TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags gtk+-2.0`" + TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs gtk+-2.0`" else break fi - > /dev/null - if [ $? -eq 0 ]; then - LDFLAGS="$LDFLAGS ``" + TEMP_CFLAGS="$TEMP_CFLAGS -DUI_GTK2 -DUI_GTK2LEGACY" + TEMP_LDFLAGS="$TEMP_LDFLAGS -lpthread" + print_check_msg "$dep_checked_gtk2legacy" "yes\n" + dep_checked_gtk2legacy=1 + return 1 + done + + print_check_msg "$dep_checked_gtk2legacy" "no\n" + dep_checked_gtk2legacy=1 + return 0 +} +dependency_error_curl() +{ + print_check_msg "$dep_checked_curl" "checking for curl... " + # dependency curl platform="macos" + while true + do + if notisplatform "macos"; then + break + fi + if tmp_flags=`curl-config --cflags` ; then + TEMP_CFLAGS="$TEMP_CFLAGS $tmp_flags" else break fi - which qmake-qt4 > /dev/null - if [ $? -ne 0 ]; then - break + if tmp_flags=`curl-config --ldflags` ; then + TEMP_LDFLAGS="$TEMP_LDFLAGS $tmp_flags" + else + break fi - echo yes - return 0 + print_check_msg "$dep_checked_curl" "yes\n" + dep_checked_curl=1 + return 1 done - - echo no - return 1 -} -dependency_gtk2legacy() -{ - printf "checking for gtk2legacy... " - # dependency gtk2legacy + + # dependency curl while true do if [ -z "$PKG_CONFIG" ]; then - break + break fi - $PKG_CONFIG gtk+-2.0 - if [ $? -ne 0 ] ; then + if test_pkg_config "libcurl" "" "" "" ; then + TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libcurl`" + TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs libcurl`" + else break fi - CFLAGS="$CFLAGS `$PKG_CONFIG --cflags gtk+-2.0`" - LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs gtk+-2.0`" - CFLAGS="$CFLAGS -DUI_GTK2 -DUI_GTK2LEGACY" - LDFLAGS="$LDFLAGS -lpthread" - echo yes - return 0 + print_check_msg "$dep_checked_curl" "yes\n" + dep_checked_curl=1 + return 1 done - - echo no - return 1 -} -dependency_qt5() -{ - printf "checking for qt5... " - # dependency qt5 + + # dependency curl while true do - qmake-qt5 -o - /dev/null | grep DEFINES\ > /dev/null - if [ $? -eq 0 ]; then - CFLAGS="$CFLAGS `qmake-qt5 -o - /dev/null | grep DEFINES\ `" + if tmp_flags=`curl-config --cflags` ; then + TEMP_CFLAGS="$TEMP_CFLAGS $tmp_flags" + else + break + fi + if tmp_flags=`curl-config --libs` ; then + TEMP_LDFLAGS="$TEMP_LDFLAGS $tmp_flags" else break fi - qmake-qt5 -o - /dev/null | grep INCPATH\ > /dev/null - if [ $? -eq 0 ]; then - CFLAGS="$CFLAGS `qmake-qt5 -o - /dev/null | grep INCPATH\ `" + print_check_msg "$dep_checked_curl" "yes\n" + dep_checked_curl=1 + return 1 + done + + print_check_msg "$dep_checked_curl" "no\n" + dep_checked_curl=1 + return 0 +} +dependency_error_gtk2() +{ + print_check_msg "$dep_checked_gtk2" "checking for gtk2... " + # dependency gtk2 + while true + do + if [ -z "$PKG_CONFIG" ]; then + break + fi + if pkg-config --atleast-version=2.20 gtk+-2.0 > /dev/null ; then + : else break fi - > /dev/null - if [ $? -eq 0 ]; then - LDFLAGS="$LDFLAGS ``" + if test_pkg_config "gtk+-2.0" "" "" "" ; then + TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags gtk+-2.0`" + TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs gtk+-2.0`" else break fi - which qmake-qt5 > /dev/null - if [ $? -ne 0 ]; then - break - fi - echo yes - return 0 + TEMP_CFLAGS="$TEMP_CFLAGS -DUI_GTK2" + TEMP_LDFLAGS="$TEMP_LDFLAGS -lpthread" + print_check_msg "$dep_checked_gtk2" "yes\n" + dep_checked_gtk2=1 + return 1 done - - echo no - return 1 + + print_check_msg "$dep_checked_gtk2" "no\n" + dep_checked_gtk2=1 + return 0 } -dependency_gtk2() +dependency_error_gtk3() { - printf "checking for gtk2... " - # dependency gtk2 + print_check_msg "$dep_checked_gtk3" "checking for gtk3... " + # dependency gtk3 + while true + do + if [ -z "$PKG_CONFIG" ]; then + break + fi + if test_pkg_config "gtk+-3.0" "" "" "" ; then + TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags gtk+-3.0`" + TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs gtk+-3.0`" + else + break + fi + TEMP_CFLAGS="$TEMP_CFLAGS -DUI_GTK3" + TEMP_LDFLAGS="$TEMP_LDFLAGS -lpthread" + print_check_msg "$dep_checked_gtk3" "yes\n" + dep_checked_gtk3=1 + return 1 + done + + print_check_msg "$dep_checked_gtk3" "no\n" + dep_checked_gtk3=1 + return 0 +} +dependency_error_gtk4() +{ + print_check_msg "$dep_checked_gtk4" "checking for gtk4... " + # dependency gtk4 while true do if [ -z "$PKG_CONFIG" ]; then - break + break + fi + if test_pkg_config "gtk+-4.0" "" "" "" ; then + TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags gtk+-4.0`" + TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs gtk+-4.0`" + else + break fi - $PKG_CONFIG gtk+-2.0 - if [ $? -ne 0 ] ; then + TEMP_CFLAGS="$TEMP_CFLAGS -DUI_GTK3" + TEMP_LDFLAGS="$TEMP_LDFLAGS -lpthread" + print_check_msg "$dep_checked_gtk4" "yes\n" + dep_checked_gtk4=1 + return 1 + done + + print_check_msg "$dep_checked_gtk4" "no\n" + dep_checked_gtk4=1 + return 0 +} +dependency_error_openssl() +{ + print_check_msg "$dep_checked_openssl" "checking for openssl... " + # dependency openssl platform="windows" + while true + do + if notisplatform "windows"; then break fi - CFLAGS="$CFLAGS `$PKG_CONFIG --cflags gtk+-2.0`" - LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs gtk+-2.0`" - CFLAGS="$CFLAGS -DUI_GTK2" - LDFLAGS="$LDFLAGS -lpthread" - pkg-config --atleast-version=2.20 gtk+-2.0 > /dev/null - if [ $? -ne 0 ]; then - break - fi - echo yes - return 0 + TEMP_LDFLAGS="$TEMP_LDFLAGS -lssl -lcrypto" + print_check_msg "$dep_checked_openssl" "yes\n" + dep_checked_openssl=1 + return 1 done - - echo no - return 1 -} -dependency_gtk3() -{ - printf "checking for gtk3... " - # dependency gtk3 + + # dependency openssl platform="macos" while true do - if [ -z "$PKG_CONFIG" ]; then - break - fi - $PKG_CONFIG gtk+-3.0 - if [ $? -ne 0 ] ; then + if notisplatform "macos"; then break fi - CFLAGS="$CFLAGS `$PKG_CONFIG --cflags gtk+-3.0`" - LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs gtk+-3.0`" - CFLAGS="$CFLAGS -DUI_GTK3" - LDFLAGS="$LDFLAGS -lpthread" - echo yes - return 0 + TEMP_LDFLAGS="$TEMP_LDFLAGS -framework CoreFoundation" + print_check_msg "$dep_checked_openssl" "yes\n" + dep_checked_openssl=1 + return 1 done - - echo no - return 1 -} -dependency_gtk4() -{ - printf "checking for gtk4... " - # dependency gtk4 + + # dependency openssl platform="bsd" + while true + do + if notisplatform "bsd"; then + break + fi + if isplatform "macos" || istoolchain "macos"; then + break + fi + TEMP_LDFLAGS="$TEMP_LDFLAGS -lssl -lcrypto" + print_check_msg "$dep_checked_openssl" "yes\n" + dep_checked_openssl=1 + return 1 + done + + # dependency openssl while true do if [ -z "$PKG_CONFIG" ]; then - break + break fi - $PKG_CONFIG gtk+-4.0 - if [ $? -ne 0 ] ; then + if test_pkg_config "openssl" "" "" "" ; then + TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags openssl`" + TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs openssl`" + else break fi - CFLAGS="$CFLAGS `$PKG_CONFIG --cflags gtk+-4.0`" - LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs gtk+-4.0`" - CFLAGS="$CFLAGS -DUI_GTK3" - LDFLAGS="$LDFLAGS -lpthread" - echo yes - return 0 + print_check_msg "$dep_checked_openssl" "yes\n" + dep_checked_openssl=1 + return 1 done - - echo no - return 1 + + print_check_msg "$dep_checked_openssl" "no\n" + dep_checked_openssl=1 + return 0 } -dependency_motif() +dependency_error_motif() { - printf "checking for motif... " + print_check_msg "$dep_checked_motif" "checking for motif... " # dependency motif platform="bsd" while true do - if isnotplatform "bsd"; then + if notisplatform "bsd"; then break fi - CFLAGS="$CFLAGS -DUI_MOTIF -I/usr/local/include/X11" - LDFLAGS="$LDFLAGS -lXm -lXt -lX11 -lpthread" - echo yes - return 0 + TEMP_CFLAGS="$TEMP_CFLAGS -DUI_MOTIF -I/usr/local/include/X11" + TEMP_LDFLAGS="$TEMP_LDFLAGS -lXm -lXt -lX11 -lpthread" + print_check_msg "$dep_checked_motif" "yes\n" + dep_checked_motif=1 + return 1 + done + + # dependency motif + while true + do + TEMP_CFLAGS="$TEMP_CFLAGS -DUI_MOTIF" + TEMP_LDFLAGS="$TEMP_LDFLAGS -lXm -lXt -lX11 -lpthread" + print_check_msg "$dep_checked_motif" "yes\n" + dep_checked_motif=1 + return 1 done - - # dependency motif + + print_check_msg "$dep_checked_motif" "no\n" + dep_checked_motif=1 + return 0 +} +dependency_error_libxml2() +{ + print_check_msg "$dep_checked_libxml2" "checking for libxml2... " + # dependency libxml2 platform="windows" + while true + do + if notisplatform "windows"; then + break + fi + if tmp_flags=`xml2-config --cflags` ; then + TEMP_CFLAGS="$TEMP_CFLAGS $tmp_flags" + else + break + fi + if tmp_flags=`xml2-config --libs` ; then + TEMP_LDFLAGS="$TEMP_LDFLAGS $tmp_flags" + else + break + fi + print_check_msg "$dep_checked_libxml2" "yes\n" + dep_checked_libxml2=1 + return 1 + done + + # dependency libxml2 platform="macos" while true do - CFLAGS="$CFLAGS -DUI_MOTIF" - LDFLAGS="$LDFLAGS -lXm -lXt -lX11 -lpthread" - echo yes - return 0 + if notisplatform "macos"; then + break + fi + if tmp_flags=`xml2-config --cflags` ; then + TEMP_CFLAGS="$TEMP_CFLAGS $tmp_flags" + else + break + fi + if tmp_flags=`xml2-config --libs` ; then + TEMP_LDFLAGS="$TEMP_LDFLAGS $tmp_flags" + else + break + fi + print_check_msg "$dep_checked_libxml2" "yes\n" + dep_checked_libxml2=1 + return 1 + done + + # dependency libxml2 + while true + do + if [ -z "$PKG_CONFIG" ]; then + break + fi + if test_pkg_config "libxml-2.0" "" "" "" ; then + TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libxml-2.0`" + TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs libxml-2.0`" + else + break + fi + print_check_msg "$dep_checked_libxml2" "yes\n" + dep_checked_libxml2=1 + return 1 done - - echo no - return 1 + + # dependency libxml2 + while true + do + if tmp_flags=`xml2-config --cflags` ; then + TEMP_CFLAGS="$TEMP_CFLAGS $tmp_flags" + else + break + fi + if tmp_flags=`xml2-config --libs` ; then + TEMP_LDFLAGS="$TEMP_LDFLAGS $tmp_flags" + else + break + fi + print_check_msg "$dep_checked_libxml2" "yes\n" + dep_checked_libxml2=1 + return 1 + done + + print_check_msg "$dep_checked_libxml2" "no\n" + dep_checked_libxml2=1 + return 0 } -dependency_winui() +dependency_error_cocoa() { - printf "checking for winui... " + print_check_msg "$dep_checked_cocoa" "checking for cocoa... " + # dependency cocoa platform="macos" + while true + do + if notisplatform "macos"; then + break + fi + TEMP_CFLAGS="$TEMP_CFLAGS -DUI_COCOA" + TEMP_LDFLAGS="$TEMP_LDFLAGS -lobjc -framework Cocoa" + print_check_msg "$dep_checked_cocoa" "yes\n" + dep_checked_cocoa=1 + return 1 + done + + print_check_msg "$dep_checked_cocoa" "no\n" + dep_checked_cocoa=1 + return 0 +} +dependency_error_winui() +{ + print_check_msg "$dep_checked_winui" "checking for winui... " # dependency winui platform="windows" while true do - if isnotplatform "windows"; then + if notisplatform "windows"; then break fi - CFLAGS="$CFLAGS -DUI_WINUI" - echo yes - return 0 + TEMP_CFLAGS="$TEMP_CFLAGS -DUI_WINUI" + print_check_msg "$dep_checked_winui" "yes\n" + dep_checked_winui=1 + return 1 done - - echo no - return 1 + + print_check_msg "$dep_checked_winui" "no\n" + dep_checked_winui=1 + return 0 } -dependency_cocoa() -{ - printf "checking for cocoa... " - # dependency cocoa platform="macos" - while true - do - if isnotplatform "macos"; then - break - fi - CFLAGS="$CFLAGS -DUI_COCOA" - LDFLAGS="$LDFLAGS -lobjc -framework Cocoa" - echo yes - return 0 - done - - echo no - return 1 -} + +# start collecting dependency information +echo > "$TEMP_DIR/flags.mk" DEPENDENCIES_FAILED= ERROR=0 -# general dependencies -CFLAGS= -LDFLAGS= +# unnamed dependencies +TEMP_CFLAGS= +TEMP_CXXFLAGS= +TEMP_LDFLAGS= while true do - if isnotplatform "macos"; then + while true + do + if [ -z "$lang_c" ] ; then + ERROR=1 + break + fi + + break + done + break +done +while true +do + if notisplatform "macos"; then break fi while true do - - cat >> $TEMP_DIR/make.mk << __EOF__ -OBJ_EXT = .o + + cat >> "$TEMP_DIR/make.mk" << __EOF__ +OBJ_EXT = o LIB_EXT = .a PACKAGE_SCRIPT = package_osx.sh - __EOF__ - break done - break done while true do - if isnotplatform "unix"; then + if notisplatform "unix"; then break fi - if isplatform "macos"; then + if isplatform "macos" || istoolchain "macos"; then break fi while true do - - cat >> $TEMP_DIR/make.mk << __EOF__ -OBJ_EXT = .o + + cat >> "$TEMP_DIR/make.mk" << __EOF__ +OBJ_EXT = o LIB_EXT = .a PACKAGE_SCRIPT = package_unix.sh - __EOF__ - break done - break done while true do - if isnotplatform "bsd"; then + if notisplatform "bsd"; then break fi while true do - - CFLAGS="$CFLAGS -I/usr/local/include" - LDFLAGS="$LDFLAGS -L/usr/local/lib" - + + TEMP_CFLAGS="$TEMP_CFLAGS -I/usr/local/include" + TEMP_LDFLAGS="$TEMP_LDFLAGS -L/usr/local/lib" break done - break done -# add general dependency flags to config.mk -echo >> $TEMP_DIR/config.mk -if [ ! -z "${CFLAGS}" ]; then - echo "CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk +# add general dependency flags to flags.mk +echo "# general flags" >> "$TEMP_DIR/flags.mk" +if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then + echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" fi -if [ ! -z "${CXXFLAGS}" ]; then - echo "CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk +if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then + echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" fi -if [ ! -z "${LDFLAGS}" ]; then - echo "LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk +if [ -n "${TEMP_LDFLAGS}" ]; then + echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" fi # @@ -545,274 +753,341 @@ # checkopt_toolkit_gtk4() { - VERR=0 - dependency_gtk4 - if [ $? -ne 0 ]; then - VERR=1 - fi - if [ $VERR -ne 0 ]; then - return 1 - fi - cat >> $TEMP_DIR/make.mk << __EOF__ + VERR=0 + if dependency_error_gtk4 ; then + VERR=1 + fi + if [ $VERR -ne 0 ]; then + return 1 + fi + cat >> "$TEMP_DIR/make.mk" << __EOF__ TOOLKIT = gtk GTKOBJ = draw_cairo.o - __EOF__ - return 0 + return 0 } checkopt_toolkit_gtk3() { - VERR=0 - dependency_gtk3 - if [ $? -ne 0 ]; then - VERR=1 - fi - if [ $VERR -ne 0 ]; then - return 1 - fi - cat >> $TEMP_DIR/make.mk << __EOF__ + VERR=0 + if dependency_error_gtk3 ; then + VERR=1 + fi + if [ $VERR -ne 0 ]; then + return 1 + fi + cat >> "$TEMP_DIR/make.mk" << __EOF__ TOOLKIT = gtk GTKOBJ = draw_cairo.o - __EOF__ - return 0 + return 0 } checkopt_toolkit_gtk2() { - VERR=0 - dependency_gtk2 - if [ $? -ne 0 ]; then - VERR=1 - fi - if [ $VERR -ne 0 ]; then - return 1 - fi - cat >> $TEMP_DIR/make.mk << __EOF__ + VERR=0 + if dependency_error_gtk2 ; then + VERR=1 + fi + if [ $VERR -ne 0 ]; then + return 1 + fi + cat >> "$TEMP_DIR/make.mk" << __EOF__ TOOLKIT = gtk GTKOBJ = draw_cairo.o - __EOF__ - return 0 + return 0 } checkopt_toolkit_gtk2legacy() { - VERR=0 - dependency_gtk2legacy - if [ $? -ne 0 ]; then - VERR=1 - fi - if [ $VERR -ne 0 ]; then - return 1 - fi - cat >> $TEMP_DIR/make.mk << __EOF__ + VERR=0 + if dependency_error_gtk2legacy ; then + VERR=1 + fi + if [ $VERR -ne 0 ]; then + return 1 + fi + cat >> "$TEMP_DIR/make.mk" << __EOF__ TOOLKIT = gtk GTKOBJ = draw_gdk.o - __EOF__ - return 0 + return 0 } checkopt_toolkit_qt5() { - VERR=0 - dependency_qt5 - if [ $? -ne 0 ]; then - VERR=1 - fi - if [ $VERR -ne 0 ]; then - return 1 - fi - cat >> $TEMP_DIR/make.mk << __EOF__ + VERR=0 + if dependency_error_qt5 ; then + VERR=1 + fi + if [ $VERR -ne 0 ]; then + return 1 + fi + cat >> "$TEMP_DIR/make.mk" << __EOF__ TOOLKIT = qt LD = $(CXX) - __EOF__ - return 0 + return 0 } checkopt_toolkit_qt4() { - VERR=0 - dependency_qt4 - if [ $? -ne 0 ]; then - VERR=1 - fi - if [ $VERR -ne 0 ]; then - return 1 - fi - cat >> $TEMP_DIR/make.mk << __EOF__ + VERR=0 + if dependency_error_qt4 ; then + VERR=1 + fi + if [ $VERR -ne 0 ]; then + return 1 + fi + cat >> "$TEMP_DIR/make.mk" << __EOF__ TOOLKIT = qt LD = $(CXX) - __EOF__ - return 0 + return 0 } checkopt_toolkit_motif() { - VERR=0 - dependency_motif - if [ $? -ne 0 ]; then - VERR=1 - fi - if [ $VERR -ne 0 ]; then - return 1 - fi - cat >> $TEMP_DIR/make.mk << __EOF__ + VERR=0 + if dependency_error_motif ; then + VERR=1 + fi + if [ $VERR -ne 0 ]; then + return 1 + fi + cat >> "$TEMP_DIR/make.mk" << __EOF__ TOOLKIT = motif - __EOF__ - return 0 + return 0 } # # TARGETS # -CFLAGS= -CXXFLAGS= -LDFLAGS= + +echo >> "$TEMP_DIR/flags.mk" +echo "configuring target: dav" +echo "# flags for target dav" >> "$TEMP_DIR/flags.mk" +TEMP_CFLAGS= +TEMP_CXXFLAGS= +TEMP_LDFLAGS= + +if dependency_error_curl; then + DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED curl " + ERROR=1 +fi +if dependency_error_libxml2; then + DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 " + ERROR=1 +fi +if dependency_error_openssl; then + DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED openssl " + ERROR=1 +fi + +# Features + -# Target: tk -CFLAGS= -LDFLAGS= -CXXFLAGS= +if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then + echo "DAV_CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" +fi +if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then + echo "DAV_CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" +fi +if [ "$BUILD_TYPE" = "debug" ]; then + if [ -n "$lang_c" ]; then + echo 'DAV_CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" + fi + if [ -n "$lang_cpp" ]; then + echo 'DAV_CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" + fi +fi +if [ "$BUILD_TYPE" = "release" ]; then + if [ -n "$lang_c" ]; then + echo 'DAV_CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" + fi + if [ -n "$lang_cpp" ]; then + echo 'DAV_CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" + fi +fi +if [ -n "${TEMP_LDFLAGS}" ]; then + echo "DAV_LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" +fi + +echo >> "$TEMP_DIR/flags.mk" +echo "configuring target: tk" +echo "# flags for target tk" >> "$TEMP_DIR/flags.mk" +TEMP_CFLAGS= +TEMP_CXXFLAGS= +TEMP_LDFLAGS= # Features # Option: --toolkit -if [ -z $OPT_TOOLKIT ]; then - SAVED_ERROR=$ERROR - SAVED_DEPENDENCIES_FAILED=$DEPENDENCIES_FAILED - ERROR=0 - while true - do - if isplatform "windows"; then - checkopt_toolkit_winui - if [ $? -eq 0 ]; then - echo " toolkit: winui" >> $TEMP_DIR/options - ERROR=0 - break - fi - fi - if isplatform "macos"; then - checkopt_toolkit_cocoa - if [ $? -eq 0 ]; then - echo " toolkit: cocoa" >> $TEMP_DIR/options - ERROR=0 - break - fi - fi - checkopt_toolkit_gtk3 - if [ $? -eq 0 ]; then - echo " toolkit: gtk3" >> $TEMP_DIR/options - ERROR=0 - break - fi - checkopt_toolkit_qt5 - if [ $? -eq 0 ]; then - echo " toolkit: qt5" >> $TEMP_DIR/options - ERROR=0 - break - fi - checkopt_toolkit_gtk2 - if [ $? -eq 0 ]; then - echo " toolkit: gtk2" >> $TEMP_DIR/options - ERROR=0 - break - fi - checkopt_toolkit_qt4 - if [ $? -eq 0 ]; then - echo " toolkit: qt4" >> $TEMP_DIR/options - ERROR=0 - break - fi - checkopt_toolkit_motif - if [ $? -eq 0 ]; then - echo " toolkit: motif" >> $TEMP_DIR/options - ERROR=0 - break - fi - break - done - if [ $ERROR -ne 0 ]; then - SAVED_ERROR=1 - fi - ERROR=$SAVED_ERROR - DEPENDENCIES_FAILED=$SAVED_DEPENDENCIES_FAILED= +if [ -z "$OPT_TOOLKIT" ]; then + echo "auto-detecting option 'toolkit'" + SAVED_ERROR="$ERROR" + SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED" + ERROR=1 + while true + do + if isplatform "windows"; then + if checkopt_toolkit_winui ; then + echo " toolkit: winui" >> "$TEMP_DIR/options" + ERROR=0 + break + fi + fi + if isplatform "macos"; then + if checkopt_toolkit_cocoa ; then + echo " toolkit: cocoa" >> "$TEMP_DIR/options" + ERROR=0 + break + fi + fi + if checkopt_toolkit_gtk3 ; then + echo " toolkit: gtk3" >> "$TEMP_DIR/options" + ERROR=0 + break + fi + if checkopt_toolkit_qt5 ; then + echo " toolkit: qt5" >> "$TEMP_DIR/options" + ERROR=0 + break + fi + if checkopt_toolkit_gtk2 ; then + echo " toolkit: gtk2" >> "$TEMP_DIR/options" + ERROR=0 + break + fi + if checkopt_toolkit_qt4 ; then + echo " toolkit: qt4" >> "$TEMP_DIR/options" + ERROR=0 + break + fi + if checkopt_toolkit_motif ; then + echo " toolkit: motif" >> "$TEMP_DIR/options" + ERROR=0 + break + fi + break + done + if [ $ERROR -ne 0 ]; then + SAVED_ERROR=1 + SAVED_DEPENDENCIES_FAILED="option 'toolkit' $SAVED_DEPENDENCIES_FAILED" + fi + ERROR="$SAVED_ERROR" + DEPENDENCIES_FAILED="$SAVED_DEPENDENCIES_FAILED" else - if false; then - false - elif [ $OPT_TOOLKIT = "gtk4" ]; then - echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options - checkopt_toolkit_gtk4 - if [ $? -ne 0 ]; then - ERROR=1 - fi - elif [ $OPT_TOOLKIT = "gtk3" ]; then - echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options - checkopt_toolkit_gtk3 - if [ $? -ne 0 ]; then - ERROR=1 - fi - elif [ $OPT_TOOLKIT = "gtk2" ]; then - echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options - checkopt_toolkit_gtk2 - if [ $? -ne 0 ]; then - ERROR=1 - fi - elif [ $OPT_TOOLKIT = "gtk2legacy" ]; then - echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options - checkopt_toolkit_gtk2legacy - if [ $? -ne 0 ]; then - ERROR=1 - fi - elif [ $OPT_TOOLKIT = "qt5" ]; then - echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options - checkopt_toolkit_qt5 - if [ $? -ne 0 ]; then - ERROR=1 - fi - elif [ $OPT_TOOLKIT = "qt4" ]; then - echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options - checkopt_toolkit_qt4 - if [ $? -ne 0 ]; then - ERROR=1 - fi - elif [ $OPT_TOOLKIT = "motif" ]; then - echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options - checkopt_toolkit_motif - if [ $? -ne 0 ]; then - ERROR=1 - fi - fi + echo "checking option toolkit = $OPT_TOOLKIT" + if false; then + false + elif [ "$OPT_TOOLKIT" = "gtk4" ]; then + echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options + if checkopt_toolkit_gtk4 ; then + : + else + ERROR=1 + DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED" + fi + elif [ "$OPT_TOOLKIT" = "gtk3" ]; then + echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options + if checkopt_toolkit_gtk3 ; then + : + else + ERROR=1 + DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED" + fi + elif [ "$OPT_TOOLKIT" = "gtk2" ]; then + echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options + if checkopt_toolkit_gtk2 ; then + : + else + ERROR=1 + DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED" + fi + elif [ "$OPT_TOOLKIT" = "gtk2legacy" ]; then + echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options + if checkopt_toolkit_gtk2legacy ; then + : + else + ERROR=1 + DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED" + fi + elif [ "$OPT_TOOLKIT" = "qt5" ]; then + echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options + if checkopt_toolkit_qt5 ; then + : + else + ERROR=1 + DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED" + fi + elif [ "$OPT_TOOLKIT" = "qt4" ]; then + echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options + if checkopt_toolkit_qt4 ; then + : + else + ERROR=1 + DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED" + fi + elif [ "$OPT_TOOLKIT" = "motif" ]; then + echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options + if checkopt_toolkit_motif ; then + : + else + ERROR=1 + DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED" + fi + fi fi -echo >> $TEMP_DIR/config.mk -if [ ! -z "${CFLAGS}" ]; then - echo "TK_CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk +if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then + echo "TK_CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" +fi +if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then + echo "TK_CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" fi -if [ ! -z "${CXXFLAGS}" ]; then - echo "TK_CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk +if [ "$BUILD_TYPE" = "debug" ]; then + if [ -n "$lang_c" ]; then + echo 'TK_CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" + fi + if [ -n "$lang_cpp" ]; then + echo 'TK_CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" + fi fi -if [ ! -z "${LDFLAGS}" ]; then - echo "TK_LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk +if [ "$BUILD_TYPE" = "release" ]; then + if [ -n "$lang_c" ]; then + echo 'TK_CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" + fi + if [ -n "$lang_cpp" ]; then + echo 'TK_CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" + fi +fi +if [ -n "${TEMP_LDFLAGS}" ]; then + echo "TK_LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" fi + +# final result if [ $ERROR -ne 0 ]; then - echo - echo "Error: Unresolved dependencies" - echo $DEPENDENCIES_FAILED - rm -Rf $TEMP_DIR - exit 1 + echo + echo "Error: Unresolved dependencies" + echo "$DEPENDENCIES_FAILED" + abort_configure fi echo "configure finished" echo echo "Build Config:" -echo " PREFIX: $PREFIX" -echo " TOOLCHAIN: $TOOLCHAIN_NAME" +echo " PREFIX: $prefix" +echo " TOOLCHAIN: $TOOLCHAIN_NAME" echo "Options:" -cat $TEMP_DIR/options +cat "$TEMP_DIR/options" echo -cat $TEMP_DIR/config.mk $TEMP_DIR/make.mk > config.mk -rm -Rf $TEMP_DIR +# generate the config.mk file +cat > "$TEMP_DIR/config.mk" << __EOF__ +# +# config.mk generated by configure +# +__EOF__ +write_toolchain_defaults "$TEMP_DIR/toolchain.mk" +cat "$TEMP_DIR/vars.mk" "$TEMP_DIR/toolchain.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk +rm -Rf "$TEMP_DIR"