#!/bin/sh
-# 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
+# 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()
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`
+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
+: ${PLATFORM:="unix"}
+
+PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -`
+echo "$PLATFORM_NAME"
+
+
# help text
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]
--mandir=DIR man documentation [DATAROOTDIR/man]
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
-Options:
+Build Types:
--debug add extra compile flags for debug builds
--release add extra compile flags for release builds
+
+Options:
--toolkit=(libadwaita|gtk4|gtk3|cocoa|qt5|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
#
"--infodir="*) infodir=${ARG#--infodir=} ;;
"--mandir"*) mandir=${ARG#--mandir} ;;
"--localedir"*) localedir=${ARG#--localedir} ;;
- "--help"*) printhelp; abort_configure ;;
- "--debug") BUILD_TYPE="debug" ;;
- "--release") BUILD_TYPE="release" ;;
+ "--help"*) printhelp; abort_configure ;;
+ "--debug") BUILD_TYPE="debug" ;;
+ "--release") BUILD_TYPE="release" ;;
"--toolkit="*) OPT_TOOLKIT=${ARG#--toolkit=} ;;
+ "--toolkit") echo "option '$ARG' needs a value:"; echo " $ARG=(libadwaita|gtk4|gtk3|cocoa|qt5|motif)"; abort_configure ;;
"-"*) echo "unknown option: $ARG"; abort_configure ;;
esac
done
: ${mandir:='${datarootdir}/man'}
: ${localedir:='${datarootdir}/locale'}
+# remember the above values and compare them later
+orig_bindir="$bindir"
+orig_sbindir="$sbindir"
+orig_libdir="$libdir"
+orig_libexecdir="$libexecdir"
+orig_datarootdir="$datarootdir"
+orig_datadir="$datadir"
+orig_sysconfdir="$sysconfdir"
+orig_sharedstatedir="$sharedstatedir"
+orig_localstatedir="$localstatedir"
+orig_runstatedir="$runstatedir"
+orig_includedir="$includedir"
+orig_infodir="$infodir"
+orig_mandir="$mandir"
+orig_localedir="$localedir"
+
# check if a config.site exists and load it
if [ -n "$CONFIG_SITE" ]; then
# CONFIG_SITE may contain space separated file names
echo ok
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
- 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
-: ${PLATFORM:="unix"}
-
-PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -`
-echo "$PLATFORM_NAME"
-
-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
-}
-
# generate vars.mk
cat > "$TEMP_DIR/vars.mk" << __EOF__
DEPENDENCIES_FAILED=
ERROR=0
# unnamed dependencies
-TEMP_CFLAGS=
-TEMP_CXXFLAGS=
-TEMP_LDFLAGS=
+TEMP_CFLAGS="$CFLAGS"
+TEMP_CXXFLAGS="$CXXFLAGS"
+TEMP_LDFLAGS="$LDFLAGS"
while true
do
while true
break
done
+# build type
+if [ "$BUILD_TYPE" = "debug" ]; then
+ TEMP_CFLAGS="\${DEBUG_CFLAGS} $TEMP_CFLAGS"
+ TEMP_CXXFLAGS="\${DEBUG_CXXFLAGS} $TEMP_CXXFLAGS"
+fi
+if [ "$BUILD_TYPE" = "release" ]; then
+ TEMP_CFLAGS="\${RELEASE_CFLAGS} $TEMP_CFLAGS"
+ TEMP_CXXFLAGS="\${RELEASE_CXXFLAGS} $TEMP_CXXFLAGS"
+fi
+
# add general dependency flags to flags.mk
echo "# general flags" >> "$TEMP_DIR/flags.mk"
if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then
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
if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then
echo "DBU_CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
fi
-if [ "$BUILD_TYPE" = "debug" ]; then
- if [ -n "$lang_c" ]; then
- echo 'DBU_CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
- fi
- if [ -n "$lang_cpp" ]; then
- echo 'DBU_CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
- fi
-fi
-if [ "$BUILD_TYPE" = "release" ]; then
- if [ -n "$lang_c" ]; then
- echo 'DBU_CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
- fi
- if [ -n "$lang_cpp" ]; then
- echo 'DBU_CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
- fi
-fi
if [ -n "${TEMP_LDFLAGS}" ]; then
echo "DBU_LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
fi
ERROR=1
DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED"
fi
+ else
+ echo
+ echo "Invalid option value - usage:"
+ echo " --toolkit=(libadwaita|gtk4|gtk3|cocoa|qt5|motif)"
+ abort_configure
fi
fi
if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then
echo "TK_CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
fi
-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 [ "$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
echo "configure finished"
echo
+echo "Toolchain"
+echo " name: $TOOLCHAIN_NAME"
+if [ -n "$TOOLCHAIN_CC" ]; then
+ echo " cc: $TOOLCHAIN_CC"
+fi
+if [ -n "$TOOLCHAIN_CXX" ]; then
+ echo " cxx: $TOOLCHAIN_CXX"
+fi
+if [ -n "$TOOLCHAIN_WSIZE" ]; then
+ echo " word size: $TOOLCHAIN_WSIZE bit"
+fi
+if [ -n "$TOOLCHAIN_CSTD" ]; then
+ echo " default C std: $TOOLCHAIN_CSTD"
+fi
+echo
echo "Build Config:"
-echo " PREFIX: $prefix"
-echo " TOOLCHAIN: $TOOLCHAIN_NAME"
+echo " prefix: $prefix"
+echo " exec_prefix: $exec_prefix"
+if [ "$orig_bindir" != "$bindir" ]; then
+ echo " bindir: $bindir"
+fi
+if [ "$orig_sbindir" != "$sbindir" ]; then
+ echo " sbindir: $sbindir"
+fi
+if [ "$orig_libdir" != "$libdir" ]; then
+ echo " libdir: $libdir"
+fi
+if [ "$orig_libexecdir" != "$libexecdir" ]; then
+ echo " libexecdir: $libexecdir"
+fi
+if [ "$orig_datarootdir" != "$datarootdir" ]; then
+ echo " datarootdir: $datarootdir"
+fi
+if [ "$orig_datadir" != "$datadir" ]; then
+ echo " datadir: $datadir"
+fi
+if [ "$orig_sysconfdir" != "$sysconfdir" ]; then
+ echo " sysconfdir: $sysconfdir"
+fi
+if [ "$orig_sharedstatedir" != "$sharedstatedir" ]; then
+ echo " sharedstatedir: $sharedstatedir"
+fi
+if [ "$orig_localstatedir" != "$localstatedir" ]; then
+ echo " localstatedir: $localstatedir"
+fi
+if [ "$orig_runstatedir" != "$runstatedir" ]; then
+ echo " runstatedir: $runstatedir"
+fi
+if [ "$orig_includedir" != "$includedir" ]; then
+ echo " includedir: $includedir"
+fi
+if [ "$orig_infodir" != "$infodir" ]; then
+ echo " infodir: $infodir"
+fi
+if [ "$orig_mandir" != "$mandir" ]; then
+ echo " mandir: $mandir"
+fi
+if [ "$orig_localedir" != "$localedir" ]; then
+ echo " localedir: $localedir"
+fi
+echo
echo "Options:"
cat "$TEMP_DIR/options"
echo
# generate the config.mk file
+pwd=`pwd`
cat > "$TEMP_DIR/config.mk" << __EOF__
#
-# config.mk generated by configure
+# config.mk generated by:
+# pwd: $pwd
+# $0 $@
#
__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
+cat "$TEMP_DIR/config.mk" "$TEMP_DIR/vars.mk" "$TEMP_DIR/toolchain.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk
rm -Rf "$TEMP_DIR"
#!/bin/sh
-# 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( $var in $vars )
-#if( $var.exec )
-${var.varName}=`${var.value}`
-#else
-${var.varName}="${var.value}"
-#end
-#end
-
-# features
-#foreach( $feature in $features )
-#if( ${feature.auto} )
-${feature.varName}=auto
-#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
+}
# clean abort
abort_configure()
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`
+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
+: ${PLATFORM:="unix"}
+
+PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -`
+echo "$PLATFORM_NAME"
+]]#
+
# help text
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]
--mandir=DIR man documentation [DATAROOTDIR/man]
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
-#if( $options.size() > 0 )
-Options:
+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.argument}=${opt.valuesString}
#end
-
#end
#if( $features.size() > 0 )
+
Optional Features:
#foreach( $feature in $features )
${feature.helpText}
#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
#
BUILD_TYPE="default"
-#set( $D = '$' )
for ARG in "$@"
do
case "$ARG" in
"--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" ;;
+ "--help"*) printhelp; abort_configure ;;
+ "--debug") BUILD_TYPE="debug" ;;
+ "--release") BUILD_TYPE="release" ;;
#foreach( $opt in $options )
"--${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.varName}=on ;;
: ${mandir:='${datarootdir}/man'}
: ${localedir:='${datarootdir}/locale'}
+# remember the above values and compare them later
+orig_bindir="$bindir"
+orig_sbindir="$sbindir"
+orig_libdir="$libdir"
+orig_libexecdir="$libexecdir"
+orig_datarootdir="$datarootdir"
+orig_datadir="$datadir"
+orig_sysconfdir="$sysconfdir"
+orig_sharedstatedir="$sharedstatedir"
+orig_localstatedir="$localstatedir"
+orig_runstatedir="$runstatedir"
+orig_includedir="$includedir"
+orig_infodir="$infodir"
+orig_mandir="$mandir"
+orig_localedir="$localedir"
+
# check if a config.site exists and load it
if [ -n "$CONFIG_SITE" ]; then
# CONFIG_SITE may contain space separated file names
. "$prefix/etc/config.site"
echo ok
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
- 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
-: ${PLATFORM:="unix"}
-
-PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -`
-echo "$PLATFORM_NAME"
-
-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
-}
]]#
## End of unparsed content **
ERROR=0
#if( $dependencies.size() > 0 )
# unnamed dependencies
-TEMP_CFLAGS=
-TEMP_CXXFLAGS=
-TEMP_LDFLAGS=
+TEMP_CFLAGS="$CFLAGS"
+TEMP_CXXFLAGS="$CXXFLAGS"
+TEMP_LDFLAGS="$LDFLAGS"
#foreach( $dependency in $dependencies )
while true
do
done
#end
+# build type
+if [ "$BUILD_TYPE" = "debug" ]; then
+ TEMP_CFLAGS="\${DEBUG_CFLAGS} $TEMP_CFLAGS"
+ TEMP_CXXFLAGS="\${DEBUG_CXXFLAGS} $TEMP_CXXFLAGS"
+fi
+if [ "$BUILD_TYPE" = "release" ]; then
+ TEMP_CFLAGS="\${RELEASE_CFLAGS} $TEMP_CFLAGS"
+ TEMP_CXXFLAGS="\${RELEASE_CXXFLAGS} $TEMP_CXXFLAGS"
+fi
+
# add general dependency flags to flags.mk
echo "# general flags" >> "$TEMP_DIR/flags.mk"
if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; 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 )
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
if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then
echo "${target.cxxFlags} += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
fi
-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.ldFlags} += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
fi
echo "configure finished"
echo
+echo "Toolchain"
+echo " name: $TOOLCHAIN_NAME"
+if [ -n "$TOOLCHAIN_CC" ]; then
+ echo " cc: $TOOLCHAIN_CC"
+fi
+if [ -n "$TOOLCHAIN_CXX" ]; then
+ echo " cxx: $TOOLCHAIN_CXX"
+fi
+if [ -n "$TOOLCHAIN_WSIZE" ]; then
+ echo " word size: $TOOLCHAIN_WSIZE bit"
+fi
+if [ -n "$TOOLCHAIN_CSTD" ]; then
+ echo " default C std: $TOOLCHAIN_CSTD"
+fi
+echo
echo "Build Config:"
-echo " PREFIX: $prefix"
-echo " TOOLCHAIN: $TOOLCHAIN_NAME"
+echo " prefix: $prefix"
+echo " exec_prefix: $exec_prefix"
+if [ "$orig_bindir" != "$bindir" ]; then
+ echo " bindir: $bindir"
+fi
+if [ "$orig_sbindir" != "$sbindir" ]; then
+ echo " sbindir: $sbindir"
+fi
+if [ "$orig_libdir" != "$libdir" ]; then
+ echo " libdir: $libdir"
+fi
+if [ "$orig_libexecdir" != "$libexecdir" ]; then
+ echo " libexecdir: $libexecdir"
+fi
+if [ "$orig_datarootdir" != "$datarootdir" ]; then
+ echo " datarootdir: $datarootdir"
+fi
+if [ "$orig_datadir" != "$datadir" ]; then
+ echo " datadir: $datadir"
+fi
+if [ "$orig_sysconfdir" != "$sysconfdir" ]; then
+ echo " sysconfdir: $sysconfdir"
+fi
+if [ "$orig_sharedstatedir" != "$sharedstatedir" ]; then
+ echo " sharedstatedir: $sharedstatedir"
+fi
+if [ "$orig_localstatedir" != "$localstatedir" ]; then
+ echo " localstatedir: $localstatedir"
+fi
+if [ "$orig_runstatedir" != "$runstatedir" ]; then
+ echo " runstatedir: $runstatedir"
+fi
+if [ "$orig_includedir" != "$includedir" ]; then
+ echo " includedir: $includedir"
+fi
+if [ "$orig_infodir" != "$infodir" ]; then
+ echo " infodir: $infodir"
+fi
+if [ "$orig_mandir" != "$mandir" ]; then
+ echo " mandir: $mandir"
+fi
+if [ "$orig_localedir" != "$localedir" ]; then
+ echo " localedir: $localedir"
+fi
#if ( $options.size() > 0 )
+echo
echo "Options:"
cat "$TEMP_DIR/options"
#end
#if ( $features.size() > 0 )
+echo
echo "Features:"
#foreach( $feature in $features )
if [ -n "${D}${feature.varName}" ]; then
echo
# generate the config.mk file
+pwd=`pwd`
cat > "$TEMP_DIR/config.mk" << __EOF__
#
-# config.mk generated by configure
+# config.mk generated by:
+# pwd: $pwd
+# $0 $@
#
__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
+cat "$TEMP_DIR/config.mk" "$TEMP_DIR/vars.mk" "$TEMP_DIR/toolchain.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk
rm -Rf "$TEMP_DIR"
check_c_compiler()
{
+ command -v $1 2>&1 >/dev/null
+ if [ $? -ne 0 ]; then
+ return 1
+ fi
cat > "$TEMP_DIR/test.c" << __EOF__
/* test file */
#include <stdio.h>
int main(int argc, char **argv) {
#if defined(_MSC_VER)
- printf("msc\n");
+ printf("toolchain:msc\n");
#elif defined(__clang__)
- printf("clang gnuc\n");
+ printf("toolchain:clang gnuc\n");
#elif defined(__GNUC__)
- printf("gcc gnuc\n");
+ printf("toolchain:gcc gnuc\n");
#elif defined(__sun)
- printf("suncc\n");
+ printf("toolchain:suncc\n");
#else
- printf("unknown\n");
+ printf("toolchain:unknown\n");
+#endif
+ printf("wsize:%d\n", (int)sizeof(void*)*8);
+#ifdef __STDC_VERSION__
+ printf("stdcversion:%d\n", __STDC_VERSION__);
#endif
return 0;
}
check_cpp_compiler()
{
+ command -v $1 2>&1 >/dev/null
+ if [ $? -ne 0 ]; then
+ return 1
+ fi
cat > "$TEMP_DIR/test.cpp" << __EOF__
/* test file */
#include <iostream>
int main(int argc, char **argv) {
#if defined(_MSC_VER)
- std::cout << "msc" << std::endl;
+ std::cout << "toolchain:msc" << std::endl;
#elif defined(__clang__)
- std::cout << "clang gnuc" << std::endl;
+ std::cout << "toolchain:clang gnuc" << std::endl;
#elif defined(__GNUC__)
- std::cout << "gcc gnuc" << std::endl;
+ std::cout << "toolchain:gcc gnuc" << std::endl;
#elif defined(__sun)
- std::cout << "suncc" << std::endl;
+ std::cout << "toolchain:suncc" << std::endl;
#else
- std::cout << "cc" << std::endl;
+ std::cout << "toolchain:unknown" << std::endl;
#endif
+ std::cout << "wsize:" << sizeof(void*)*8 << std::endl;
return 0;
}
__EOF__
fi
}
+parse_toolchain_properties()
+{
+ info_file="$1"
+ TOOLCHAIN=`grep '^toolchain:' "$info_file" | tail -c +11`
+ TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -`
+ TOOLCHAIN_WSIZE=`grep '^wsize:' "$info_file" | tail -c +7`
+}
+
detect_c_compiler()
{
if [ -n "$TOOLCHAIN_CC" ]; then
if [ -n "$CC" ]; then
if check_c_compiler "$CC"; then
TOOLCHAIN_CC=$CC
- TOOLCHAIN=`"$TEMP_DIR/checkcc"`
- TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -`
+ "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out"
+ parse_toolchain_properties "$TEMP_DIR/checkcc_out"
+ TOOLCHAIN_CSTD=`grep '^stdcversion:' "$TEMP_DIR/checkcc_out" | tail -c +13`
echo "$CC"
return 0
else
do
if check_c_compiler "$COMP"; then
TOOLCHAIN_CC=$COMP
- TOOLCHAIN=`"$TEMP_DIR/checkcc"`
- TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -`
+ "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out"
+ parse_toolchain_properties "$TEMP_DIR/checkcc_out"
+ TOOLCHAIN_CSTD=`grep '^stdcversion:' "$TEMP_DIR/checkcc_out" | tail -c +13`
echo "$COMP"
return 0
fi
if [ -n "$CXX" ]; then
if check_cpp_compiler "$CXX"; then
TOOLCHAIN_CXX=$CXX
- TOOLCHAIN=`"$TEMP_DIR/checkcc"`
- TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -`
+ "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out"
+ parse_toolchain_properties "$TEMP_DIR/checkcc_out"
echo "$CXX"
return 0
else
do
if check_cpp_compiler "$COMP"; then
TOOLCHAIN_CXX=$COMP
- TOOLCHAIN=`"$TEMP_DIR/checkcc"`
- TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -`
+ "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out"
+ parse_toolchain_properties "$TEMP_DIR/checkcc_out"
echo "$COMP"
return 0
fi
xmlns="http://unixwork.de/uwproj"
targetNamespace="http://unixwork.de/uwproj"
elementFormDefault="qualified"
- version="0.2"
+ version="0.3"
>
<xs:element name="project" type="ProjectType"/>
</xs:documentation>
</xs:annotation>
<xs:sequence>
- <xs:element name="config" type="ConfigType" minOccurs="0"/>
+ <xs:element name="config" type="ConfigType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="dependency" type="DependencyType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="target" type="TargetType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
+ <xs:attribute name="version" type="xs:string" use="required" />
</xs:complexType>
<xs:complexType name="ConfigType">
<xs:annotation>
<xs:documentation>
- The configuration section.
- Consists of an arbitrary number of <code>var</code> elements.
+ <p>
+ The configuration section.
+ Consists of an arbitrary number of <code>var</code> elements.
+ </p>
+ <p>
+ The optional <code>platform</code> attribute may specify a <em>single</em> platform identifier and
+ the optional <code>not</code> 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.
+ </p>
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="var" type="ConfigVarType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
+ <xs:attribute name="platform" type="xs:string"/>
+ <xs:attribute name="not" type="xs:string"/>
</xs:complexType>
<xs:complexType name="ConfigVarType">
<code>dependencies</code> are satisfied.
If a feature is enabled, all <code>define</code> and <code>make</code> definitions are
supposed to be applied to the config file.
+ If a feature is disabled, an optional <code>disabled</code> element may specify which
+ <code>define</code> and <code>make</code> definitions are supposed to be applied.
+ There might also be <code>dependencies</code> when the feature is disabled (e.g. specifying a fallback).
In case the optional <code>default</code> 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
</xs:annotation>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:group ref="TargetDataGroup"/>
+ <xs:element name="desc" type="xs:string"/>
+ <xs:element name="disabled">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:group ref="TargetDataGroup"/>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
</xs:choice>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="arg" type="xs:string"/>
<xs:attribute name="default" type="xs:boolean" default="false"/>
- <xs:element name="desc" type="xs:string"/>
</xs:complexType>
<xs:complexType name="OptionType">