From: Olaf Wintermann Date: Tue, 24 Dec 2024 12:00:10 +0000 (+0100) Subject: update uwproj X-Git-Url: https://uap-core.de/gitweb/?a=commitdiff_plain;h=14cc525e11c404b36650bb901948f7823ea86179;p=mizunara.git update uwproj --- diff --git a/configure b/configure index 6f2b13a..f2a69f8 100755 --- a/configure +++ b/configure @@ -1,34 +1,84 @@ #!/bin/sh -PREFIX=/usr -EPREFIX=$PREFIX - -BINDIR= -SBINDIR= -LIBDIR= -LIBEXECDIR= -DATADIR= -SYSCONFDIR= -SHAREDSTATEDIR= -LOCALSTATEDIR= -INCLUDEDIR= -INFODIR= -MANDIR= +# some utility functions +isplatform() +{ + for p in $PLATFORM + do + if [ "$p" = "$1" ]; then + return 0 + fi + done + return 1 +} +notisplatform() +{ + for p in $PLATFORM + do + 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 +} + +# clean abort +abort_configure() +{ + rm -Rf "$TEMP_DIR" + exit 1 +} + +# 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` - -TEMP_DIR=".tmp-`uname -n`" -mkdir -p "$TEMP_DIR" -if [ $? -ne 0 ]; then - echo "Cannot create tmp dir" - echo "Abort" +printf "detect platform... " +if [ "$OS" = "SunOS" ]; then + PLATFORM="solaris sunos unix svr4" +elif [ "$OS" = "Linux" ]; then + PLATFORM="linux unix" +elif [ "$OS" = "FreeBSD" ]; then + PLATFORM="freebsd bsd unix" +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" +elif echo "$OS" | grep -i "MINGW" > /dev/null; then + PLATFORM="windows mingw" fi -touch "$TEMP_DIR/options" -touch "$TEMP_DIR/features" +: ${PLATFORM:="unix"} + +PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -` +echo "$PLATFORM_NAME" -# features # help text printhelp() @@ -37,7 +87,7 @@ printhelp() cat << __EOF__ Installation directories: --prefix=PREFIX path prefix for architecture-independent files - [/usr] + [$prefix] --exec-prefix=EPREFIX path prefix for architecture-dependent files [PREFIX] @@ -47,224 +97,236 @@ Installation directories: --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] + +Build Types: +--debug add extra compile flags for debug builds +--release add extra compile flags for release builds Options: - --toolkit=(gtk3|motif) + --toolkit=(libadwaita|gtk4|gtk3|gtk2|gtk2legacy|qt5|qt4|motif) __EOF__ } +# 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" + +# 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= + +# custom variables + +# features + # # parse arguments # +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; rm -Rf "$TEMP_DIR"; exit 1 ;; + "--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"; rm -Rf "$TEMP_DIR"; exit 1 ;; + "--toolkit") echo "option '$ARG' needs a value:"; echo " $ARG=(libadwaita|gtk4|gtk3|gtk2|gtk2legacy|qt5|qt4|motif)"; abort_configure ;; + "-"*) 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 -fi -which pkg-config > /dev/null -if [ $? -eq 0 ]; then - PKG_CONFIG=pkg-config -else - PKG_CONFIG=false -fi -# Simple uname based platform detection -# $PLATFORM is used for platform dependent dependency selection -printf "detect platform... " -if [ "$OS" = "SunOS" ]; then - PLATFORM="solaris sunos unix svr4" -fi -if [ "$OS" = "Linux" ]; then - PLATFORM="linux unix" -fi -if [ "$OS" = "FreeBSD" ]; then - PLATFORM="freebsd bsd unix" -fi -if [ "$OS" = "Darwin" ]; then - PLATFORM="macos osx bsd unix" -fi -echo "$OS" | grep -i "MINGW" > /dev/null -if [ $? -eq 0 ]; then - PLATFORM="windows mingw" +# 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 -if [ -z "$PLATFORM" ]; then - PLATFORM="unix" -fi -for p in $PLATFORM -do - PLATFORM_NAME=$p - break -done -echo $PLATFORM_NAME +# 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__ -isplatform() -{ - for p in $PLATFORM - do - if [ "$p" = "$1" ]; then - return 0 - fi - done - return 1 -} -isnotplatform() -{ - for p in $PLATFORM - do - if [ "$p" = "$1" ]; then - return 1 - fi - done - return 0 -} +# toolchain detection utilities +. make/toolchain.sh -# generate config.mk and config.h -cat > "$TEMP_DIR/config.mk" << __EOF__ # -# config.mk generated by configure +# DEPENDENCIES # -# 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 - -__EOF__ +# 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" -ENV_CFLAGS=$CFLAGS -ENV_LDFLAGS=$LDFLAGS -ENV_CXXFLAGS=$CXXFLAGS - -# Toolchain detection -# this will insert make vars to config.mk -. make/toolchain.sh - -# add user specified flags to config.mk -echo "# project specific flags" >> "$TEMP_DIR/config.mk" -if [ -n "${ENV_CFLAGS}" ]; then - echo "CFLAGS += $ENV_CFLAGS" >> "$TEMP_DIR/config.mk" -fi -if [ -n "${ENV_CXXFLAGS}" ]; then - echo "CXXFLAGS += $ENV_CXXFLAGS" >> "$TEMP_DIR/config.mk" -fi -if [ -n "${ENV_LDFLAGS}" ]; then - echo "LDFLAGS += $ENV_LDFLAGS" >> "$TEMP_DIR/config.mk" -fi +test_pkg_config() +{ + 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 +} -# -# DEPENDENCIES -# +print_check_msg() +{ + if [ -z "$1" ]; then + shift + printf "$@" + fi +} -dependency_curl() +dependency_error_gtk2legacy() { - printf "checking for curl... " - # dependency curl platform="windows" + print_check_msg "$dep_checked_gtk2legacy" "checking for gtk2legacy... " + # dependency gtk2legacy while true do - if isnotplatform "windows"; then + if [ -z "$PKG_CONFIG" ]; then break fi - TEMP_CFLAGS="$TEMP_CFLAGS -I/mingw/include" - TEMP_LDFLAGS="$TEMP_LDFLAGS -lcurl" - echo yes - return 0 + 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 + 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 isnotplatform "macos"; then + if notisplatform "macos"; then break fi - curl-config --cflags > /dev/null - if [ $? -eq 0 ]; then - TEMP_CFLAGS="$TEMP_CFLAGS `curl-config --cflags`" + if tmp_flags=`curl-config --cflags` ; then + TEMP_CFLAGS="$TEMP_CFLAGS $tmp_flags" else break fi - curl-config --ldflags > /dev/null - if [ $? -eq 0 ]; then - TEMP_LDFLAGS="$TEMP_LDFLAGS `curl-config --ldflags`" + 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 # dependency curl @@ -273,103 +335,162 @@ dependency_curl() if [ -z "$PKG_CONFIG" ]; then break fi - $PKG_CONFIG libcurl - 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 - TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags libcurl`" - TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs libcurl`" - echo yes - return 0 + print_check_msg "$dep_checked_curl" "yes\n" + dep_checked_curl=1 + return 1 done # dependency curl while true do - which curl-config > /dev/null - if [ $? -ne 0 ]; then - break + 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 + 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 - curl-config --cflags > /dev/null - if [ $? -eq 0 ]; then - TEMP_CFLAGS="$TEMP_CFLAGS `curl-config --cflags`" + if pkg-config --atleast-version=2.20 gtk+-2.0 > /dev/null ; then + : else break fi - curl-config --ldflags > /dev/null - if [ $? -eq 0 ]; then - TEMP_LDFLAGS="$TEMP_LDFLAGS `curl-config --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 - 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_gtk3() +dependency_error_gtk3() { - printf "checking for gtk3... " + print_check_msg "$dep_checked_gtk3" "checking for gtk3... " # dependency gtk3 while true do if [ -z "$PKG_CONFIG" ]; then break fi - $PKG_CONFIG gtk+-3.0 - if [ $? -ne 0 ] ; then + 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 `$PKG_CONFIG --cflags gtk+-3.0`" - TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs gtk+-3.0`" TEMP_CFLAGS="$TEMP_CFLAGS -DUI_GTK3" TEMP_LDFLAGS="$TEMP_LDFLAGS -lpthread" - echo yes - return 0 + print_check_msg "$dep_checked_gtk3" "yes\n" + dep_checked_gtk3=1 + return 1 done - echo no - return 1 + 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 + fi + if test_pkg_config "gtk4" "" "" "" ; then + TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags gtk4`" + TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs gtk4`" + else + break + fi + 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_openssl() +dependency_error_openssl() { - printf "checking for openssl... " + print_check_msg "$dep_checked_openssl" "checking for openssl... " # dependency openssl platform="windows" while true do - if isnotplatform "windows"; then + if notisplatform "windows"; then break fi TEMP_LDFLAGS="$TEMP_LDFLAGS -lssl -lcrypto" - echo yes - return 0 + print_check_msg "$dep_checked_openssl" "yes\n" + dep_checked_openssl=1 + return 1 done # dependency openssl platform="macos" while true do - if isnotplatform "macos"; then + if notisplatform "macos"; then break fi TEMP_LDFLAGS="$TEMP_LDFLAGS -framework CoreFoundation" - echo yes - return 0 + print_check_msg "$dep_checked_openssl" "yes\n" + dep_checked_openssl=1 + return 1 done # dependency openssl platform="bsd" while true do - if isnotplatform "bsd"; then + if notisplatform "bsd"; then break fi - if isplatform "macos"; then + if isplatform "macos" || istoolchain "macos"; then break fi TEMP_LDFLAGS="$TEMP_LDFLAGS -lssl -lcrypto" - echo yes - return 0 + print_check_msg "$dep_checked_openssl" "yes\n" + dep_checked_openssl=1 + return 1 done # dependency openssl @@ -378,64 +499,120 @@ dependency_openssl() if [ -z "$PKG_CONFIG" ]; then break fi - $PKG_CONFIG openssl - 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 - TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags openssl`" - TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs openssl`" - 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_error_libadwaita() +{ + print_check_msg "$dep_checked_libadwaita" "checking for libadwaita... " + # dependency libadwaita + while true + do + if [ -z "$PKG_CONFIG" ]; then + break + fi + if test_pkg_config "libadwaita-1" "" "" "" ; then + TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libadwaita-1`" + TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs libadwaita-1`" + else + break + fi + TEMP_CFLAGS="$TEMP_CFLAGS -DUI_GTK4 -DUI_LIBADWAITA" + TEMP_LDFLAGS="$TEMP_LDFLAGS -lpthread" + print_check_msg "$dep_checked_libadwaita" "yes\n" + dep_checked_libadwaita=1 + return 1 + done + + print_check_msg "$dep_checked_libadwaita" "no\n" + dep_checked_libadwaita=1 + return 0 +} +dependency_error_motif() +{ + print_check_msg "$dep_checked_motif" "checking for motif... " + # dependency motif platform="bsd" + while true + do + if notisplatform "bsd"; then + break + fi + 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 + + print_check_msg "$dep_checked_motif" "no\n" + dep_checked_motif=1 + return 0 } -dependency_libxml2() +dependency_error_libxml2() { - printf "checking for libxml2... " + print_check_msg "$dep_checked_libxml2" "checking for libxml2... " # dependency libxml2 platform="windows" while true do - if isnotplatform "windows"; then + if notisplatform "windows"; then break fi - xml2-config --cflags > /dev/null - if [ $? -eq 0 ]; then - TEMP_CFLAGS="$TEMP_CFLAGS `xml2-config --cflags`" + if tmp_flags=`xml2-config --cflags` ; then + TEMP_CFLAGS="$TEMP_CFLAGS $tmp_flags" else break fi - xml2-config --libs > /dev/null - if [ $? -eq 0 ]; then - TEMP_LDFLAGS="$TEMP_LDFLAGS `xml2-config --libs`" + if tmp_flags=`xml2-config --libs` ; then + TEMP_LDFLAGS="$TEMP_LDFLAGS $tmp_flags" else break fi - echo yes - return 0 + print_check_msg "$dep_checked_libxml2" "yes\n" + dep_checked_libxml2=1 + return 1 done # dependency libxml2 platform="macos" while true do - if isnotplatform "macos"; then + if notisplatform "macos"; then break fi - xml2-config --cflags > /dev/null - if [ $? -eq 0 ]; then - TEMP_CFLAGS="$TEMP_CFLAGS `xml2-config --cflags`" + if tmp_flags=`xml2-config --cflags` ; then + TEMP_CFLAGS="$TEMP_CFLAGS $tmp_flags" else break fi - xml2-config --libs > /dev/null - if [ $? -eq 0 ]; then - TEMP_LDFLAGS="$TEMP_LDFLAGS `xml2-config --libs`" + if tmp_flags=`xml2-config --libs` ; then + TEMP_LDFLAGS="$TEMP_LDFLAGS $tmp_flags" else break fi - echo yes - return 0 + print_check_msg "$dep_checked_libxml2" "yes\n" + dep_checked_libxml2=1 + return 1 done # dependency libxml2 @@ -444,100 +621,141 @@ dependency_libxml2() if [ -z "$PKG_CONFIG" ]; then break fi - $PKG_CONFIG libxml-2.0 - if [ $? -ne 0 ] ; then + 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 - TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags libxml-2.0`" - TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs libxml-2.0`" - echo yes - return 0 + print_check_msg "$dep_checked_libxml2" "yes\n" + dep_checked_libxml2=1 + return 1 done # dependency libxml2 while true do - xml2-config --cflags > /dev/null - if [ $? -eq 0 ]; then - TEMP_CFLAGS="$TEMP_CFLAGS `xml2-config --cflags`" + if tmp_flags=`xml2-config --cflags` ; then + TEMP_CFLAGS="$TEMP_CFLAGS $tmp_flags" else break fi - xml2-config --libs > /dev/null - if [ $? -eq 0 ]; then - TEMP_LDFLAGS="$TEMP_LDFLAGS `xml2-config --libs`" + if tmp_flags=`xml2-config --libs` ; then + TEMP_LDFLAGS="$TEMP_LDFLAGS $tmp_flags" else break fi - echo yes - return 0 + print_check_msg "$dep_checked_libxml2" "yes\n" + dep_checked_libxml2=1 + return 1 done - echo no - return 1 + print_check_msg "$dep_checked_libxml2" "no\n" + dep_checked_libxml2=1 + return 0 } -dependency_motif() +dependency_error_cocoa() { - printf "checking for motif... " - # dependency motif + print_check_msg "$dep_checked_cocoa" "checking for cocoa... " + # dependency cocoa platform="macos" while true do - TEMP_CFLAGS="$TEMP_CFLAGS -DUI_MOTIF" - TEMP_LDFLAGS="$TEMP_LDFLAGS -lXm -lXt -lX11 -lpthread" - echo yes - return 0 + 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 - echo no - return 1 + 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 notisplatform "windows"; then + break + fi + TEMP_CFLAGS="$TEMP_CFLAGS -DUI_WINUI" + print_check_msg "$dep_checked_winui" "yes\n" + dep_checked_winui=1 + return 1 + done + + print_check_msg "$dep_checked_winui" "no\n" + dep_checked_winui=1 + return 0 } +# start collecting dependency information +echo > "$TEMP_DIR/flags.mk" + DEPENDENCIES_FAILED= ERROR=0 -# general dependencies -TEMP_CFLAGS= -TEMP_LDFLAGS= +# unnamed dependencies +TEMP_CFLAGS="$CFLAGS" +TEMP_CXXFLAGS="$CXXFLAGS" +TEMP_LDFLAGS="$LDFLAGS" while true do - if isnotplatform "unix"; then + while true + do + if [ -z "$lang_c" ] ; then + ERROR=1 + break + fi + break - fi - if isplatform "macos"; then + done + break +done +while true +do + if notisplatform "macos"; then break fi while true do cat >> "$TEMP_DIR/make.mk" << __EOF__ -OBJ_EXT = o -LIB_EXT = a -PACKAGE_SCRIPT = package_unix.sh - +OBJ_EXT = .o +LIB_EXT = .a +PACKAGE_SCRIPT = package_osx.sh __EOF__ - break done - break done while true do + if notisplatform "unix"; then + break + fi + if isplatform "macos" || istoolchain "macos"; then + break + fi while true do - TEMP_LDFLAGS="$TEMP_LDFLAGS -lpthread" - + 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 - break - fi - if isplatform "macos"; then + if notisplatform "bsd"; then break fi while true @@ -545,33 +763,60 @@ do 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 [ -n "${TEMP_CFLAGS}" ]; then - echo "CFLAGS += $TEMP_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 [ -n "${TEMP_CXXFLAGS}" ]; then - echo "CXXFLAGS += $TEMP_CXXFLAGS" >> $TEMP_DIR/config.mk +if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then + echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" fi if [ -n "${TEMP_LDFLAGS}" ]; then - echo "LDFLAGS += $TEMP_LDFLAGS" >> $TEMP_DIR/config.mk + echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" fi # # OPTION VALUES # +checkopt_toolkit_libadwaita() +{ + VERR=0 + if dependency_error_libadwaita ; 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 +} +checkopt_toolkit_gtk4() +{ + 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 +} checkopt_toolkit_gtk3() { VERR=0 - dependency_gtk3 - if [ $? -ne 0 ]; then + if dependency_error_gtk3 ; then VERR=1 fi if [ $VERR -ne 0 ]; then @@ -580,17 +825,73 @@ checkopt_toolkit_gtk3() cat >> "$TEMP_DIR/make.mk" << __EOF__ TOOLKIT = gtk GTKOBJ = draw_cairo.o -MZUI = gtk_pathbar.c -MZUI += gtk_browser.c - +__EOF__ + return 0 +} +checkopt_toolkit_gtk2() +{ + 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 +} +checkopt_toolkit_gtk2legacy() +{ + 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 +} +checkopt_toolkit_qt5() +{ + 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 +} +checkopt_toolkit_qt4() +{ + 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 } checkopt_toolkit_motif() { VERR=0 - dependency_motif - if [ $? -ne 0 ]; then + if dependency_error_motif ; then VERR=1 fi if [ $VERR -ne 0 ]; then @@ -598,9 +899,6 @@ checkopt_toolkit_motif() fi cat >> "$TEMP_DIR/make.mk" << __EOF__ TOOLKIT = motif -MZUI = motif_pathbar.c -MZUI += motif_browser.c - __EOF__ return 0 } @@ -608,125 +906,253 @@ __EOF__ # # TARGETS # + +echo >> "$TEMP_DIR/flags.mk" +echo "configuring target: dav" +echo "# flags for target dav" >> "$TEMP_DIR/flags.mk" TEMP_CFLAGS= TEMP_CXXFLAGS= TEMP_LDFLAGS= -# Target: tk +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 + + +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_LDFLAGS= TEMP_CXXFLAGS= +TEMP_LDFLAGS= # Features # Option: --toolkit -if [ -z $OPT_TOOLKIT ]; then +if [ -z "$OPT_TOOLKIT" ]; then + echo "auto-detecting option 'toolkit'" SAVED_ERROR="$ERROR" SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED" - ERROR=0 + ERROR=1 while true do - checkopt_toolkit_motif - if [ $? -eq 0 ]; then - echo " toolkit: motif" >> "$TEMP_DIR/options" + 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_gtk4 ; then + echo " toolkit: gtk4" >> "$TEMP_DIR/options" ERROR=0 break fi - checkopt_toolkit_gtk3 - if [ $? -eq 0 ]; then + 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 + echo "checking option toolkit = $OPT_TOOLKIT" if false; then false + elif [ "$OPT_TOOLKIT" = "libadwaita" ]; then + echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options + if checkopt_toolkit_libadwaita ; then + : + else + ERROR=1 + DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED" + fi + 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 - checkopt_toolkit_gtk3 - if [ $? -ne 0 ]; then + 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 - checkopt_toolkit_motif - if [ $? -ne 0 ]; then + if checkopt_toolkit_motif ; then + : + else ERROR=1 + DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED" fi + else + echo + echo "Invalid option value - usage:" + echo " --toolkit=(libadwaita|gtk4|gtk3|gtk2|gtk2legacy|qt5|qt4|motif)" + abort_configure fi fi -echo >> "$TEMP_DIR/config.mk" -if [ -n "${TEMP_CFLAGS}" ]; then - echo "TK_CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/config.mk" -fi -if [ -n "${TEMP_CXXFLAGS}" ]; then - echo "TK_CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/config.mk" -fi -if [ -n "${TEMP_LDFLAGS}" ]; then - echo "TK_LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk" -fi - -# Target: dav -TEMP_CFLAGS= -TEMP_LDFLAGS= -TEMP_CXXFLAGS= - -dependency_curl -if [ $? -ne 0 ]; then - DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED curl " - ERROR=1 +if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then + echo "TK_CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" fi -dependency_libxml2 -if [ $? -ne 0 ]; then - DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 " - ERROR=1 -fi -dependency_openssl -if [ $? -ne 0 ]; then - DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED openssl " - ERROR=1 +if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then + echo "TK_CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" fi - -# Features - - -echo >> "$TEMP_DIR/config.mk" -if [ -n "${TEMP_CFLAGS}" ]; then - echo "DAV_CFLAGS += $TEMP_CFLAGS" >> "$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 [ -n "${TEMP_CXXFLAGS}" ]; then - echo "DAV_CXXFLAGS += $TEMP_CXXFLAGS" >> "$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 "DAV_LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk" + 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 + 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" 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" diff --git a/make/configure.vm b/make/configure.vm index 5c88ee9..54ffdc1 100644 --- a/make/configure.vm +++ b/make/configure.vm @@ -1,72 +1,85 @@ #!/bin/sh -#foreach( $var in $vars ) -#if( $var.exec ) -${var.varName}=`${var.value}` -#else -${var.varName}=${var.value} -#end -#end +#set( $D = '$' ) +#[[ +# some utility functions +isplatform() +{ + for p in $PLATFORM + do + if [ "$p" = "$1" ]; then + return 0 + fi + done + return 1 +} +notisplatform() +{ + for p in $PLATFORM + do + 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 +} -#if ( ! $project.hasVar("PREFIX") ) -PREFIX=/usr -#end -#if ( ! $project.hasVar("EPREFIX") ) -EPREFIX=$PREFIX -#end +# clean abort +abort_configure() +{ + rm -Rf "$TEMP_DIR" + exit 1 +} -#if ( ! $project.hasVar("BINDIR") ) -BINDIR= -#end -#if ( ! $project.hasVar("SBINDIR") ) -SBINDIR= -#end -#if ( ! $project.hasVar("LIBDIR") ) -LIBDIR= -#end -#if ( ! $project.hasVar("LIBEXECDIR") ) -LIBEXECDIR= -#end -#if ( ! $project.hasVar("DATADIR") ) -DATADIR= -#end -#if ( ! $project.hasVar("SYSCONFDIR") ) -SYSCONFDIR= -#end -#if ( ! $project.hasVar("SHAREDSTATEDIR") ) -SHAREDSTATEDIR= -#end -#if ( ! $project.hasVar("LOCALSTATEDIR") ) -LOCALSTATEDIR= -#end -#if ( ! $project.hasVar("INCLUDEDIR") ) -INCLUDEDIR= -#end -#if ( ! $project.hasVar("INFODIR") ) -INFODIR= -#end -#if ( ! $project.hasVar("MANDIR") ) -MANDIR= -#end +# 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` - -TEMP_DIR=".tmp-`uname -n`" -mkdir -p "$TEMP_DIR" -if [ $? -ne 0 ]; then - echo "Cannot create tmp dir" - echo "Abort" +printf "detect platform... " +if [ "$OS" = "SunOS" ]; then + PLATFORM="solaris sunos unix svr4" +elif [ "$OS" = "Linux" ]; then + PLATFORM="linux unix" +elif [ "$OS" = "FreeBSD" ]; then + PLATFORM="freebsd bsd unix" +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" +elif echo "$OS" | grep -i "MINGW" > /dev/null; then + PLATFORM="windows mingw" fi -touch "$TEMP_DIR/options" -touch "$TEMP_DIR/features" +: ${PLATFORM:="unix"} -# features -#foreach( $feature in $features ) -#if( ${feature.isDefault()} ) -${feature.getVarName()}=on -#end -#end +PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -` +echo "$PLATFORM_NAME" +]]# # help text printhelp() @@ -75,7 +88,7 @@ printhelp() cat << __EOF__ Installation directories: --prefix=PREFIX path prefix for architecture-independent files - [/usr] + [${D}prefix] --exec-prefix=EPREFIX path prefix for architecture-dependent files [PREFIX] @@ -85,255 +98,260 @@ Installation directories: --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] +Build Types: +--debug add extra compile flags for debug builds +--release add extra compile flags for release builds #if( $options.size() > 0 ) + Options: #foreach( $opt in $options ) - --${opt.getArgument()}=${opt.getValuesString()} + --${opt.argument}=${opt.valuesString} #end - #end #if( $features.size() > 0 ) + Optional Features: #foreach( $feature in $features ) -#if( $feature.default ) - --disable-${feature.arg} -#else - --enable-${feature.arg} +${feature.helpText} #end #end -#end __EOF__ } +# 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" + +# 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= + +# custom variables +#foreach( $cfg in $config ) +if true \ +#if( $cfg.platform ) + && isplatform "${cfg.platform}" \ +#end +#foreach( $np in $cfg.notList ) + && notisplatform "${np}" \ +#end + ; then + #foreach( $var in $cfg.vars ) + #if( $var.exec ) + ${var.varName}=`${var.value}` + #else + ${var.varName}="${var.value}" + #end + #end +fi +#end + +# features +#foreach( $feature in $features ) +#if( ${feature.auto} ) +${feature.varName}=auto +#end +#end + # # parse arguments # -#set( $D = '$' ) +BUILD_TYPE="default" for ARG in "$@" do case "$ARG" in - "--prefix="*) PREFIX=${D}{ARG#--prefix=} ;; - "--exec-prefix="*) EPREFIX=${D}{ARG#--exec-prefix=} ;; - "--bindir="*) BINDIR=${D}{ARG#----bindir=} ;; - "--sbindir="*) SBINDIR=${D}{ARG#--sbindir=} ;; - "--libdir="*) LIBDIR=${D}{ARG#--libdir=} ;; - "--libexecdir="*) LIBEXECDIR=${D}{ARG#--libexecdir=} ;; - "--datadir="*) DATADIR=${D}{ARG#--datadir=} ;; - "--sysconfdir="*) SYSCONFDIR=${D}{ARG#--sysconfdir=} ;; - "--sharedstatedir="*) SHAREDSTATEDIR=${D}{ARG#--sharedstatedir=} ;; - "--localstatedir="*) LOCALSTATEDIR=${D}{ARG#--localstatedir=} ;; - "--includedir="*) INCLUDEDIR=${D}{ARG#--includedir=} ;; - "--infodir="*) INFODIR=${D}{ARG#--infodir=} ;; - "--mandir"*) MANDIR=${D}{ARG#--mandir} ;; - "--help"*) printhelp; rm -Rf "$TEMP_DIR"; exit 1 ;; + "--prefix="*) prefix=${D}{ARG#--prefix=} ;; + "--exec-prefix="*) exec_prefix=${D}{ARG#--exec-prefix=} ;; + "--bindir="*) bindir=${D}{ARG#----bindir=} ;; + "--sbindir="*) sbindir=${D}{ARG#--sbindir=} ;; + "--libdir="*) libdir=${D}{ARG#--libdir=} ;; + "--libexecdir="*) libexecdir=${D}{ARG#--libexecdir=} ;; + "--datarootdir="*) datarootdir=${D}{ARG#--datarootdir=} ;; + "--datadir="*) datadir=${D}{ARG#--datadir=} ;; + "--sysconfdir="*) sysconfdir=${D}{ARG#--sysconfdir=} ;; + "--sharedstatedir="*) sharedstatedir=${D}{ARG#--sharedstatedir=} ;; + "--localstatedir="*) localstatedir=${D}{ARG#--localstatedir=} ;; + "--includedir="*) includedir=${D}{ARG#--includedir=} ;; + "--infodir="*) infodir=${D}{ARG#--infodir=} ;; + "--mandir"*) mandir=${D}{ARG#--mandir} ;; + "--localedir"*) localedir=${D}{ARG#--localedir} ;; + "--help"*) printhelp; abort_configure ;; + "--debug") BUILD_TYPE="debug" ;; + "--release") BUILD_TYPE="release" ;; #foreach( $opt in $options ) - "--${opt.getArgument()}="*) ${opt.getVarName()}=${D}{ARG#--${opt.getArgument()}=} ;; + "--${opt.argument}="*) ${opt.varName}=${D}{ARG#--${opt.argument}=} ;; + "--${opt.argument}") echo "option '$ARG' needs a value:"; echo " $ARG=${opt.valuesString}"; abort_configure ;; #end #foreach( $feature in $features ) - "--enable-${feature.arg}") ${feature.getVarName()}=on ;; - "--disable-${feature.arg}") unset ${feature.getVarName()} ;; + "--enable-${feature.arg}") ${feature.varName}=on ;; + "--disable-${feature.arg}") unset ${feature.varName} ;; #end - "-"*) echo "unknown option: $ARG"; rm -Rf "$TEMP_DIR"; exit 1 ;; + "-"*) 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 -fi - -which pkg-config > /dev/null -if [ $? -eq 0 ]; then - PKG_CONFIG=pkg-config -else - PKG_CONFIG=false -fi - -# Simple uname based platform detection -# $PLATFORM is used for platform dependent dependency selection -printf "detect platform... " -if [ "$OS" = "SunOS" ]; then - PLATFORM="solaris sunos unix svr4" -fi -if [ "$OS" = "Linux" ]; then - PLATFORM="linux unix" -fi -if [ "$OS" = "FreeBSD" ]; then - PLATFORM="freebsd bsd unix" -fi -if [ "$OS" = "Darwin" ]; then - PLATFORM="macos osx bsd unix" -fi -echo "$OS" | grep -i "MINGW" > /dev/null -if [ $? -eq 0 ]; then - PLATFORM="windows mingw" -fi - -if [ -z "$PLATFORM" ]; then - PLATFORM="unix" -fi - -for p in $PLATFORM -do - PLATFORM_NAME=$p - break -done -echo $PLATFORM_NAME - -isplatform() -{ - for p in $PLATFORM - do - if [ "$p" = "$1" ]; then - return 0 - fi +## Begin unparsed content. ** +#[[ + +# 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 - return 1 -} -isnotplatform() -{ - for p in $PLATFORM - do - if [ "$p" = "$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 +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 +]]# +## End of unparsed content ** + +# 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 #foreach( $var in $vars ) -${var.varName}=$${var.varName} -#end - -#if ( ! $project.hasVar("PREFIX") ) -PREFIX=$PREFIX -#end -#if ( ! $project.hasVar("EPREFIX") ) -EPREFIX=$EPREFIX -#end - -#if ( ! $project.hasVar("BINDIR") ) -BINDIR=$BINDIR -#end -#if ( ! $project.hasVar("SBINDIR") ) -SBINDIR=$SBINDIR -#end -#if ( ! $project.hasVar("LIBDIR") ) -LIBDIR=$LIBDIR +${var.varName}=${D}${var.varName} #end -#if ( ! $project.hasVar("LIBEXECDIR") ) -LIBEXECDIR=$LIBEXECDIR -#end -#if ( ! $project.hasVar("DATADIR") ) -DATADIR=$DATADIR -#end -#if ( ! $project.hasVar("SYSCONFDIR") ) -SYSCONFDIR=$SYSCONFDIR -#end -#if ( ! $project.hasVar("SHAREDSTATEDIR") ) -SHAREDSTATEDIR=$SHAREDSTATEDIR -#end -#if ( ! $project.hasVar("LOCALSTATEDIR") ) -LOCALSTATEDIR=$LOCALSTATEDIR -#end -#if ( ! $project.hasVar("INCLUDEDIR") ) -INCLUDEDIR=$INCLUDEDIR -#end -#if ( ! $project.hasVar("INFODIR") ) -INFODIR=$INFODIR -#end -#if ( ! $project.hasVar("MANDIR") ) -MANDIR=$MANDIR -#end - __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 "# project specific flags" >> "$TEMP_DIR/config.mk" -if [ -n "${ENV_CFLAGS}" ]; then - echo "CFLAGS += $ENV_CFLAGS" >> "$TEMP_DIR/config.mk" -fi -if [ -n "${ENV_CXXFLAGS}" ]; then - echo "CXXFLAGS += $ENV_CXXFLAGS" >> "$TEMP_DIR/config.mk" -fi -if [ -n "${ENV_LDFLAGS}" ]; then - echo "LDFLAGS += $ENV_LDFLAGS" >> "$TEMP_DIR/config.mk" -fi - # # DEPENDENCIES # +# check languages +lang_c= +lang_cpp= +#foreach( $lang in $languages ) +if detect_${lang}_compiler ; then + lang_${lang}=1 +fi +#end + +# create buffer for make variables required by dependencies +echo > "$TEMP_DIR/make.mk" + +test_pkg_config() +{ + 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 +} + #foreach( $dependency in $namedDependencies ) -dependency_${dependency.name}() +dependency_error_${dependency.id}() { - printf "checking for ${dependency.name}... " - #foreach( $sub in $dependency.getSubdependencies() ) - # dependency $sub.getFullName() + print_check_msg "${D}dep_checked_${dependency.id}" "checking for ${dependency.name}... " + #foreach( $sub in $dependency.subdependencies ) + # dependency $sub.fullName while true do #if( $sub.platform ) - if isnotplatform "${sub.platform}"; then + if notisplatform "${sub.platform}"; then break fi #end - #foreach( $not in $sub.getNotList() ) - if isplatform "${not}"; then + #if( $sub.toolchain ) + if notistoolchain "${sub.toolchain}"; then + break + fi + #end + #foreach( $np in $sub.notList ) + if isplatform "${np}" || istoolchain "${np}"; then + break + fi + #end + #foreach( $lang in $sub.lang ) + if [ -z "$lang_${lang}" ] ; then break fi #end @@ -343,24 +361,24 @@ dependency_${dependency.name}() fi #end #foreach( $test in $sub.tests ) - $test > /dev/null - if [ $? -ne 0 ]; then - break + if $test > /dev/null ; then + : + else + break fi #end #foreach( $pkg in $sub.pkgconfig ) - $pkg.getPkgConfigTestQuery() - if [ $? -ne 0 ] ; then + if test_pkg_config "$pkg.name" "$pkg.atleast" "$pkg.exact" "$pkg.max" ; then + TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags $pkg.name`" + TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs $pkg.name`" + else break fi - TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags $pkg.name`" - TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs $pkg.name`" #end #foreach( $flags in $sub.flags ) #if( $flags.exec ) - $flags.value > /dev/null - if [ $? -eq 0 ]; then - TEMP_$flags.varName="$TEMP_$flags.varName `$flags.value`" + if tmp_flags=`$flags.value` ; then + TEMP_$flags.varName="$TEMP_$flags.varName $tmp_flags" else break fi @@ -374,37 +392,54 @@ dependency_${dependency.name}() $sub.make __EOF__ #end - echo yes - return 0 + print_check_msg "${D}dep_checked_${dependency.id}" "yes\n" + dep_checked_${dependency.id}=1 + return 1 done #end - echo no - return 1 + print_check_msg "${D}dep_checked_${dependency.id}" "no\n" + dep_checked_${dependency.id}=1 + return 0 } #end +# start collecting dependency information +echo > "$TEMP_DIR/flags.mk" + DEPENDENCIES_FAILED= ERROR=0 #if( $dependencies.size() > 0 ) -# general dependencies -TEMP_CFLAGS= -TEMP_LDFLAGS= +# unnamed dependencies +TEMP_CFLAGS="$CFLAGS" +TEMP_CXXFLAGS="$CXXFLAGS" +TEMP_LDFLAGS="$LDFLAGS" #foreach( $dependency in $dependencies ) while true do #if( $dependency.platform ) - if isnotplatform "${dependency.platform}"; then + if notisplatform "${dependency.platform}"; then break fi #end - #foreach( $not in $dependency.getNotList() ) - if isplatform "${not}"; then + #if( $dependency.toolchain ) + if notistoolchain "${dependency.toolchain}"; then + break + fi + #end + #foreach( $np in $dependency.notList ) + if isplatform "${np}" || istoolchain "${np}"; then break fi #end while true do + #foreach( $lang in $dependency.lang ) + if [ -z "$lang_${lang}" ] ; then + ERROR=1 + break + fi + #end #if( $dependency.pkgconfig.size() > 0 ) if [ -z "$PKG_CONFIG" ]; then ERROR=1 @@ -412,23 +447,25 @@ do fi #end #foreach( $pkg in $dependency.pkgconfig ) - printf "checking for pkg-config package $pkg.name... " - $pkg.getPkgConfigTestQuery() - if [ $? -ne 0 ]; then - echo no + print_check_msg "${D}dep_pkgconfig_checked_${pkg.id}" "checking for pkg-config package $pkg.name... " + if test_pkg_config "$pkg.name" "$pkg.atleast" "$pkg.exact" "$pkg.max" ; then + print_check_msg "${D}dep_pkgconfig_checked_${pkg.id}" "yes\n" + dep_pkgconfig_checked_${pkg.id}=1 + TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags $pkg.name`" + TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs $pkg.name`" + else + print_check_msg "${D}dep_pkgconfig_checked_${pkg.id}" "no\n" + dep_pkgconfig_checked_${pkg.id}=1 ERROR=1 break fi - echo yes - TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags $pkg.name`" - TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs $pkg.name`" #end #foreach( $flags in $dependency.flags ) #if( $flags.exec ) $flags.value > /dev/null - if [ $? -ne 0 ]; then - TEMP_$flags.varName="$TEMP_$flags.varName `$flags.value`" + if tmp_flags=`$flags.value` ; then + TEMP_$flags.varName="$TEMP_$flags.varName $tmp_flags" else ERROR=1 break @@ -442,24 +479,22 @@ do $dependency.make __EOF__ #end - break done - break done #end -# add general dependency flags to config.mk -echo >> "$TEMP_DIR/config.mk" -if [ -n "${TEMP_CFLAGS}" ]; then - echo "CFLAGS += $TEMP_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 [ -n "${TEMP_CXXFLAGS}" ]; then - echo "CXXFLAGS += $TEMP_CXXFLAGS" >> $TEMP_DIR/config.mk +if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then + echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" fi if [ -n "${TEMP_LDFLAGS}" ]; then - echo "LDFLAGS += $TEMP_LDFLAGS" >> $TEMP_DIR/config.mk + echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" fi #end @@ -472,8 +507,7 @@ ${val.func}() { VERR=0 #foreach( $dep in $val.dependencies ) - dependency_$dep - if [ $? -ne 0 ]; then + if dependency_error_$dep ; then VERR=1 fi #end @@ -482,6 +516,7 @@ ${val.func}() fi #foreach( $def in $val.defines ) TEMP_CFLAGS="$TEMP_CFLAGS ${def.toFlags()}" + TEMP_CXXFLAGS="$TEMP_CXXFLAGS ${def.toFlags()}" #end #if( $val.hasMake() ) cat >> "$TEMP_DIR/make.mk" << __EOF__ @@ -496,23 +531,22 @@ __EOF__ # # TARGETS # -TEMP_CFLAGS= -TEMP_CXXFLAGS= -TEMP_LDFLAGS= #foreach( $target in $targets ) +echo >> "$TEMP_DIR/flags.mk" #if ( $target.name ) -# Target: $target.name +echo "configuring target: $target.name" +echo "# flags for target $target.name" >> "$TEMP_DIR/flags.mk" #else -# Target +echo "configuring global target" +echo "# flags for unnamed target" >> "$TEMP_DIR/flags.mk" #end TEMP_CFLAGS= -TEMP_LDFLAGS= TEMP_CXXFLAGS= +TEMP_LDFLAGS= #foreach( $dependency in $target.dependencies ) -dependency_$dependency -if [ $? -ne 0 ]; then +if dependency_error_$dependency; then DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} " ERROR=1 fi @@ -520,35 +554,68 @@ fi # Features #foreach( $feature in $target.features ) -if [ -n "$${feature.getVarName()}" ]; then +if [ -n "${D}${feature.varName}" ]; then #foreach( $dependency in $feature.dependencies ) # check dependency - dependency_$dependency - if [ $? -ne 0 ]; then + if dependency_error_$dependency ; then # "auto" features can fail and are just disabled in this case - if [ "$${feature.getVarName()}" != "auto" ]; then + if [ "${D}${feature.varName}" = "auto" ]; then + DISABLE_${feature.varName}=1 + else DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} " ERROR=1 fi fi +#end + if [ -n "$DISABLE_${feature.varName}" ]; then + unset ${feature.varName} + fi +fi +if [ -n "${D}${feature.varName}" ]; then + : +#foreach( $def in $feature.defines ) + TEMP_CFLAGS="$TEMP_CFLAGS ${def.toFlags()}" + TEMP_CXXFLAGS="$TEMP_CXXFLAGS ${def.toFlags()}" +#end +#if( $feature.hasMake() ) + cat >> "$TEMP_DIR/make.mk" << __EOF__ +$feature.make +__EOF__ +#end +else + : +#foreach( $def in $feature.disabled.defines ) + TEMP_CFLAGS="$TEMP_CFLAGS ${def.toFlags()}" + TEMP_CXXFLAGS="$TEMP_CXXFLAGS ${def.toFlags()}" +#end +#if( $feature.disabled.hasMake() ) + cat >> "$TEMP_DIR/make.mk" << __EOF__ +$feature.disabled.make +__EOF__ +#end +#foreach( $dependency in $feature.disabled.dependencies ) + if dependency_error_$dependency ; then + DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} " + ERROR=1 + fi #end fi #end #foreach( $opt in $target.options ) # Option: --${opt.argument} -if [ -z ${D}${opt.getVarName()} ]; then +if [ -z "${D}${opt.varName}" ]; then + echo "auto-detecting option '${opt.argument}'" SAVED_ERROR="$ERROR" SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED" - ERROR=0 + ERROR=1 while true do #foreach( $optdef in $opt.defaults ) #if( $optdef.platform ) if isplatform "$optdef.platform"; then #end - $optdef.func - if [ $? -eq 0 ]; then + if $optdef.func ; then echo " ${opt.argument}: ${optdef.valueName}" >> "$TEMP_DIR/options" ERROR=0 break @@ -561,55 +628,97 @@ if [ -z ${D}${opt.getVarName()} ]; then done if [ $ERROR -ne 0 ]; then SAVED_ERROR=1 + SAVED_DEPENDENCIES_FAILED="option '${opt.argument}' $SAVED_DEPENDENCIES_FAILED" fi ERROR="$SAVED_ERROR" DEPENDENCIES_FAILED="$SAVED_DEPENDENCIES_FAILED" else + echo "checking option ${opt.argument} = ${D}${opt.varName}" if false; then false #foreach( $optval in $opt.values ) - elif [ "${D}${opt.getVarName()}" = "${optval.value}" ]; then - echo " ${opt.argument}: ${D}${opt.getVarName()}" >> $TEMP_DIR/options - $optval.func - if [ $? -ne 0 ]; then + elif [ "${D}${opt.varName}" = "${optval.value}" ]; then + echo " ${opt.argument}: ${D}${opt.varName}" >> $TEMP_DIR/options + if $optval.func ; then + : + else ERROR=1 + DEPENDENCIES_FAILED="option '${opt.argument}' $DEPENDENCIES_FAILED" fi #end + else + echo + echo "Invalid option value - usage:" + echo " --${opt.argument}=${opt.valuesString}" + abort_configure fi fi #end -echo >> "$TEMP_DIR/config.mk" -if [ -n "${TEMP_CFLAGS}" ]; then - echo "${target.getCFlags()} += $TEMP_CFLAGS" >> "$TEMP_DIR/config.mk" +if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then + echo "${target.cFlags} += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" +fi +if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then + echo "${target.cxxFlags} += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" fi -if [ -n "${TEMP_CXXFLAGS}" ]; then - echo "${target.getCXXFlags()} += $TEMP_CXXFLAGS" >> "$TEMP_DIR/config.mk" +if [ "$BUILD_TYPE" = "debug" ]; then + if [ -n "$lang_c" ]; then + echo '${target.cFlags} += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" + fi + if [ -n "$lang_cpp" ]; then + echo '${target.cxxFlags} += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" + fi +fi +if [ "$BUILD_TYPE" = "release" ]; then + if [ -n "$lang_c" ]; then + echo '${target.cFlags} += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" + fi + if [ -n "$lang_cpp" ]; then + echo '${target.cxxFlags} += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" + fi fi if [ -n "${TEMP_LDFLAGS}" ]; then - echo "${target.getLDFlags()} += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk" + echo "${target.ldFlags} += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" fi #end + +# final result if [ $ERROR -ne 0 ]; then echo echo "Error: Unresolved dependencies" echo "$DEPENDENCIES_FAILED" - rm -Rf "$TEMP_DIR" - exit 1 + abort_configure fi echo "configure finished" echo echo "Build Config:" -echo " PREFIX: $PREFIX" -echo " TOOLCHAIN: $TOOLCHAIN_NAME" +echo " PREFIX: $prefix" +echo " TOOLCHAIN: $TOOLCHAIN_NAME" #if ( $options.size() > 0 ) echo "Options:" cat "$TEMP_DIR/options" #end +#if ( $features.size() > 0 ) +echo "Features:" +#foreach( $feature in $features ) +if [ -n "${D}${feature.varName}" ]; then +echo " $feature.name: on" +else +echo " $feature.name: off" +fi +#end +#end 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" diff --git a/make/project.xml b/make/project.xml index d1087da..c2010cd 100644 --- a/make/project.xml +++ b/make/project.xml @@ -1,27 +1,9 @@ - - - - gtk+-3.0 - -DUI_GTK3 - -lpthread - - - - -DUI_MOTIF - -lXm -lXt -lX11 -lpthread + + + c - - -I/mingw/include - -lcurl - curl-config --cflags curl-config --ldflags @@ -30,9 +12,8 @@ libcurl - which curl-config curl-config --cflags - curl-config --ldflags + curl-config --libs @@ -64,46 +45,103 @@ openssl + + libadwaita-1 + -DUI_GTK4 -DUI_LIBADWAITA + -lpthread + + + gtk4 + -DUI_GTK3 + -lpthread + + + gtk+-3.0 + -DUI_GTK3 + -lpthread + + + pkg-config --atleast-version=2.20 gtk+-2.0 + gtk+-2.0 + -DUI_GTK2 + -lpthread + + + gtk+-2.0 + -DUI_GTK2 -DUI_GTK2LEGACY + -lpthread + + + -DUI_WINUI + + + + -DUI_COCOA + -lobjc -framework Cocoa + + + + -DUI_MOTIF -I/usr/local/include/X11 + -lXm -lXt -lX11 -lpthread + + + + -DUI_MOTIF + -lXm -lXt -lX11 -lpthread + + - OBJ_EXT = o - LIB_EXT = a + OBJ_EXT = .o + LIB_EXT = .a PACKAGE_SCRIPT = package_osx.sh - --> - OBJ_EXT = o - LIB_EXT = a + OBJ_EXT = .o + LIB_EXT = .a PACKAGE_SCRIPT = package_unix.sh - - -lpthread - - - + -I/usr/local/include -L/usr/local/lib + + curl,libxml2,openssl + + - - - curl,libxml2,openssl - diff --git a/make/toolchain.sh b/make/toolchain.sh index 8e9a529..ac5fb68 100644 --- a/make/toolchain.sh +++ b/make/toolchain.sh @@ -3,179 +3,198 @@ # toolchain detection # -C_COMPILERS="cc gcc clang suncc" -CPP_COMPILERS="CC g++ clang++ sunCC" -unset CC_ARG_CHECKED -unset TOOLCHAIN_DETECTION_ERROR +if isplatform "bsd" && notisplatform "openbsd"; then + C_COMPILERS="clang gcc cc" + CPP_COMPILERS="clang++ g++ CC" +else + C_COMPILERS="gcc clang suncc cc" + CPP_COMPILERS="g++ clang++ sunCC CC" +fi +unset TOOLCHAIN unset TOOLCHAIN_NAME +unset TOOLCHAIN_CC +unset TOOLCHAIN_CXX check_c_compiler() { - cat > $TEMP_DIR/test.c << __EOF__ + cat > "$TEMP_DIR/test.c" << __EOF__ /* test file */ #include int main(int argc, char **argv) { -#if defined(__clang__) - printf("clang\n"); +#if defined(_MSC_VER) + printf("msc\n"); +#elif defined(__clang__) + printf("clang gnuc\n"); #elif defined(__GNUC__) - printf("gcc\n"); + printf("gcc gnuc\n"); #elif defined(__sun) - printf("suncc\n"); + printf("suncc\n"); #else - printf("unknown\n"); + printf("unknown\n"); #endif - return 0; + return 0; } __EOF__ - rm -f $TEMP_DIR/checkcc - $1 -o $TEMP_DIR/checkcc $CFLAGS $LDFLAGS $TEMP_DIR/test.c 2> /dev/null - - if [ $? -ne 0 ]; then - return 1 - fi - return 0 + rm -f "$TEMP_DIR/checkcc" + $1 -o "$TEMP_DIR/checkcc" $CFLAGS $LDFLAGS "$TEMP_DIR/test.c" 2> /dev/null } check_cpp_compiler() { - cat > $TEMP_DIR/test.cpp << __EOF__ + cat > "$TEMP_DIR/test.cpp" << __EOF__ /* test file */ #include int main(int argc, char **argv) { -#if defined(__clang__) - std::cout << "clang" << std::endl; +#if defined(_MSC_VER) + std::cout << "msc" << std::endl; +#elif defined(__clang__) + std::cout << "clang gnuc" << std::endl; #elif defined(__GNUC__) - std::cout << "gcc" << std::endl; + std::cout << "gcc gnuc" << std::endl; #elif defined(__sun) - std::cout << "suncc" << std::endl; + std::cout << "suncc" << std::endl; #else - std::cout << "unknown" << std::endl; + std::cout << "cc" << std::endl; #endif - return 0; + return 0; } __EOF__ - rm -f $TEMP_DIR/checkcc - $1 -o $TEMP_DIR/checkcc $CXXFLAGS $LDFLAGS $TEMP_DIR/test.cpp 2> /dev/null - - if [ $? -ne 0 ]; then - return 1 - fi - return 0 + rm -f "$TEMP_DIR/checkcc" + $1 -o "$TEMP_DIR/checkcc" $CXXFLAGS $LDFLAGS "$TEMP_DIR/test.cpp" 2> /dev/null } -printf "detect C compiler... " +create_libtest_source() +{ + # $1: filename + # $2: optional include + cat > "$TEMP_DIR/$1" << __EOF__ +/* libtest file */ +int main(int argc, char **argv) { + return 0; +} +__EOF__ + if [ -n "$2" ]; then + echo "#include <$2>" >> "$TEMP_DIR/$1" + fi +} -for COMP in $C_COMPILERS -do - check_c_compiler $COMP - if [ $? -ne 0 ]; then - if [ ! -z "$CC" ]; then - if [ $COMP = $CC ]; then - echo "$CC is not a working C Compiler" - TOOLCHAIN_DETECTION_ERROR="error" - break - fi - fi - else - TOOLCHAIN_NAME=`$TEMP_DIR/checkcc` - USE_TOOLCHAIN=$TOOLCHAIN_NAME - if [ $COMP = "cc" ]; then - # we have found a working compiler, but in case - # the compiler is gcc or clang, we try to use - # these commands and not 'cc' - TOOLCHAIN_NAME=`$TEMP_DIR/checkcc` - if [ $TOOLCHAIN_NAME = "gcc" ]; then - check_c_compiler "gcc" - if [ $? -eq 0 ]; then - COMP=gcc - USE_TOOLCHAIN="gcc" - fi - fi - if [ $TOOLCHAIN_NAME = "clang" ]; then - check_c_compiler "clang" - if [ $? -eq 0 ]; then - COMP=clang - USE_TOOLCHAIN="clang" - fi - fi - fi - - TOOLCHAIN_NAME=$USE_TOOLCHAIN - TOOLCHAIN_CC=$COMP - echo $COMP - break - fi -done -if [ -z $TOOLCHAIN_CC ]; then - echo "not found" -fi +check_c_lib() +{ + # $1: libname + # $2: optional include + if [ -z "$TOOLCHAIN_CC" ]; then + return 1 + fi + create_libtest_source "test.c" "$2" + rm -f "$TEMP_DIR/checklib" + $TOOLCHAIN_CC -o "$TEMP_DIR/checklib" $CFLAGS $LDFLAGS "-l$1" "$TEMP_DIR/test.c" 2> /dev/null +} -printf "detect C++ compiler... " +check_cpp_lib() +{ + # $1: libname + # $2: optional include + if [ -z "$TOOLCHAIN_CXX" ]; then + return 1 + fi + create_libtest_source "test.cpp" "$2" + rm -f "$TEMP_DIR/checklib" + $TOOLCHAIN_CXX -o "$TEMP_DIR/checklib" $CXXFLAGS $LDFLAGS "-l$1" "$TEMP_DIR/test.cpp" 2> /dev/null +} -for COMP in $CPP_COMPILERS -do - check_cpp_compiler $COMP - if [ $? -ne 0 ]; then - if [ ! -z "$CXX" ]; then - if [ $COMP = $CXX ]; then - echo "$CC is not a working C++ Compiler" - TOOLCHAIN_DETECTION_ERROR="error" - break - fi - fi - else - if [ $COMP = "CC" ]; then - # we have found a working compiler, but in case - # the compiler is gcc or clang, we try to use - # these commands and not 'cc' - TOOLCHAIN_NAME=`$TEMP_DIR/checkcc` - USE_TOOLCHAIN=$TOOLCHAIN_NAME - if [ $TOOLCHAIN_NAME = "gcc" ]; then - check_cpp_compiler "g++" - if [ $? -eq 0 ]; then - COMP=g++ - USE_TOOLCHAIN="gcc" - fi - fi - if [ $TOOLCHAIN_NAME = "clang" ]; then - check_cpp_compiler "clang++" - if [ $? -eq 0 ]; then - COMP=clang++ - USE_TOOLCHAIN="clang" - fi - fi - fi - - TOOLCHAIN_NAME=$USE_TOOLCHAIN - TOOLCHAIN_CXX=$COMP - echo $COMP - break - fi -done -if [ -z $TOOLCHAIN_CXX ]; then - echo "not found" -fi +check_lib() +{ + # $1: libname + # $2: optional include + if [ -n "$TOOLCHAIN_CC" ]; then + check_c_lib "$1" "$2" + elif [ -n "$TOOLCHAIN_CXX" ]; then + check_cpp_lib "$1" "$2" + fi +} -TOOLCHAIN_LD=$TOOLCHAIN_CC +detect_c_compiler() +{ + if [ -n "$TOOLCHAIN_CC" ]; then + return 0 + fi + printf "detect C compiler... " + if [ -n "$CC" ]; then + if check_c_compiler "$CC"; then + TOOLCHAIN_CC=$CC + TOOLCHAIN=`"$TEMP_DIR/checkcc"` + TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -` + echo "$CC" + return 0 + else + echo "$CC is not a working C compiler" + return 1 + fi + else + for COMP in $C_COMPILERS + do + if check_c_compiler "$COMP"; then + TOOLCHAIN_CC=$COMP + TOOLCHAIN=`"$TEMP_DIR/checkcc"` + TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -` + echo "$COMP" + return 0 + fi + done + echo "not found" + return 1 + fi +} -if [ -z "$TOOLCHAIN_NAME" ]; then - TOOLCHAIN_DETECTION_ERROR="error" -else - cat >> $TEMP_DIR/config.mk << __EOF__ -# toolchain -__EOF__ - echo "CC = ${TOOLCHAIN_CC}" >> $TEMP_DIR/config.mk - if [ ! -z "$TOOLCHAIN_CXX" ]; then - echo "CXX = ${TOOLCHAIN_CXX}" >> $TEMP_DIR/config.mk - fi - echo "LD = ${TOOLCHAIN_LD}" >> $TEMP_DIR/config.mk - echo >> $TEMP_DIR/config.mk - - cat "make/${TOOLCHAIN_NAME}.mk" > /dev/null 2>&1 - if [ $? -eq 0 ]; then - echo "include \$(BUILD_ROOT)/make/${TOOLCHAIN_NAME}.mk" >> $TEMP_DIR/config.mk - else - echo "SHLIB_CFLAGS = -fPIC" >> $TEMP_DIR/config.mk - echo "SHLIB_LDFLAGS = -shared" >> $TEMP_DIR/config.mk - fi -fi +detect_cpp_compiler() +{ + if [ -n "$TOOLCHAIN_CXX" ]; then + return 0 + fi + printf "detect C++ compiler... " + + if [ -n "$CXX" ]; then + if check_cpp_compiler "$CXX"; then + TOOLCHAIN_CXX=$CXX + TOOLCHAIN=`"$TEMP_DIR/checkcc"` + TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -` + echo "$CXX" + return 0 + else + echo "$CXX is not a working C++ compiler" + return 1 + fi + else + for COMP in $CPP_COMPILERS + do + if check_cpp_compiler "$COMP"; then + TOOLCHAIN_CXX=$COMP + TOOLCHAIN=`"$TEMP_DIR/checkcc"` + TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -` + echo "$COMP" + return 0 + fi + done + echo "${TOOLCHAIN_CXX:-"not found"}" + return 1 + fi +} + +write_toolchain_defaults() +{ + echo "# toolchain" >> "$1" + if [ -n "$TOOLCHAIN_CC" ]; then + echo "CC = ${TOOLCHAIN_CC}" >> "$1" + fi + if [ -n "$TOOLCHAIN_CXX" ]; then + echo "CXX = ${TOOLCHAIN_CXX}" >> "$1" + fi + echo >> "$1" + if [ -f "make/${TOOLCHAIN_NAME}.mk" ]; then + cat "make/${TOOLCHAIN_NAME}.mk" >> "$1" + elif [ -f "make/cc.mk" ]; then + cat "make/cc.mk" >> "$1" + else + echo "!!! WARNING !!! Default toolchain flags not found. Configuration might be incomplete." + fi +} diff --git a/make/uwproj.xsd b/make/uwproj.xsd new file mode 100644 index 0000000..a62ddb2 --- /dev/null +++ b/make/uwproj.xsd @@ -0,0 +1,308 @@ + + + + + + + + The root element of an uwproj project. + Consists of an optional config element + and an arbitrary number of dependency + and target elements. + + + + + + + + + + + + + +

+ The configuration section. + Consists of an arbitrary number of var elements. +

+

+ The optional platform attribute may specify a single platform identifier and + the optional not attribute may specify a comma-separated list of platform identifiers. + The configure script shall skip this config declaration if the detected platform is not matching + the filter specification of these attributes. +

+
+
+ + + + + +
+ + + + + The definition of a configuration variable. +

+ Configuration variables are supposed to be used in the configure script and are also + written to the resulting config file (in contrast to make variables, which are only + written to the config file). + The name attribute is mandatory, the value is defined by the text body of the element. + The optional Boolean exec attribute (false by default) controls, whether the entire + definition is automatically executed under command substitution. +

+
+
+ + + + + + +
+ + + + + Instructs configure to invoke pkg-config, if present on the system, to determine + compiler and linker flags. The text body of this element defines the package name to search. + To constrain the allowed versions, use the attributes atleast, exact, max. + + + + + + + + + + + + + + + Requests a compiler for the specified language. Allowed values are + c, cpp. + + + + + + + + + + + + Declares a dependency. +

+ If the optional name attribute is omitted, the dependency is global + and must be satisfied, otherwise configuration shall fail. + A named dependency can be referenced by a target (or is implicitly referenced + by the default target, if no targets are specified). + Multiple declarations for the same named dependency may exist, in which case each declaration + is checked one after another, until one block is satisfied. The result of the first satisfied + dependency declaration is supposed to be applied to the config file. +

+

+ The optional platform attribute may specify a single platform identifier and + the optional toolchain attribute may specify a single toolchain. + The optional not attribute may specify a comma-separated list of platform and/or + toolchain identifiers. + The configure script shall skip this dependency declaration if the detected platform and toolchain + is not matching the filter specification of these attributes. +

+
+
+ + + + + + + + + + Specifies a custom command that shall be executed to test whether this dependency is satisfied. + + + + + + + + + +
+ + + + + Instructs configure to append the contents of the element's body to the respective flags variable. + If the optional exec flag is set to true, the contents are supposed to be + executed under command substitution at configuration time before they are applied. + + + + + + + + + + + + + Declares a build target that is supposed to be configured. +

+ If no build target is declared explicitly, an implicit default + target is generated, which has the alldependencies + flag set. +

+

+ The optional name attribute is also used to generate a prefix + for the compiler and linker flags variables. + Furthermore, a target may consist of an arbitrary number of feature, + option, and define elements. + Named dependencies can be listed (separated by comma) in the dependencies + element. If this target shall use all available named dependencies, the empty + element alldependencies can be used as a shortcut. +

+
+
+ + + + + + + + + + +
+ + + + + Declares an optional feature, that can be enabled during configuration, if all + dependencies are satisfied. + If a feature is enabled, all define and make definitions are + supposed to be applied to the config file. + If a feature is disabled, an optional disabled element may specify which + define and make definitions are supposed to be applied. + There might also be dependencies when the feature is disabled (e.g. specifying a fallback). + In case the optional default attribute is set to true, the feature is enabled by default + and is supposed to be automatically disabled (without error) when the dependencies are not satisfied. + The name that is supposed to be used for the --enable and --disable arguments can be optionally + specified with the arg attribute. Otherwise, the name is used by default. + Optionally, a description for the help text of the resulting configure script can be specified by + adding a desc element. + + + + + + + + + + + + + + + + + + + + + + Declares a configuration option. + The option argument name is specified with the arg attribute. + Then, the children of this element specify possible values by defining the conditions + (in terms of dependencies) and effects (in terms of defines and make variables) of each value. + Finally, a set of defaults is specified which supposed to automagically select the most + appropriate value for a specific platform under the available dependencies (in case the option is not + explicitly specified by using the command line argument). + + + + + + + + + + + + + Declares a possible value for the option (in the str attribute) and + the conditions (dependencies) and effects, the value has. + + + + + + + + + + + + Specifies a default value for this option. Multiple default values can be specified, in which case + they are checked one after another for availability. With the optional platform attribute, + the default value can be constrained to a single specific platform and is supposed to be + skipped by configure, when this platform is not detected. + + + + + + + + + + + + + + + + + + Specifies C/C++ pre-processor definitions that are supposed to + be appended to the compiler flags, if supported. + (Note: for example, Fortran also supports C/C++ style pre-processor definitions under + certain circumstances) + + + + + + + + + A comma-separated list of named dependencies. + + + + + + + + The text contents in the body of this element are supposed to be appended literally + to the config file without prior processing. + + + + +