diff options
Diffstat (limited to 'devel/qt4/files/configure')
-rw-r--r-- | devel/qt4/files/configure | 5398 |
1 files changed, 5398 insertions, 0 deletions
diff --git a/devel/qt4/files/configure b/devel/qt4/files/configure new file mode 100644 index 000000000000..bc33fab77af9 --- /dev/null +++ b/devel/qt4/files/configure @@ -0,0 +1,5398 @@ +#!/bin/sh +# +# Configures to build the Qt library +# +# Copyright (C) 1999-2006 Trolltech ASA. All rights reserved. +# +# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +# + +#------------------------------------------------------------------------------- +# script initialization +#------------------------------------------------------------------------------- + +# the name of this script +relconf=`basename $0` +# the directory of this script is the "source tree" +relpath=`dirname $0` +relpath=`(cd "$relpath"; /bin/pwd)` +# the current directory is the "build tree" or "object tree" +outpath=`/bin/pwd` + +# later cache the command line in config.status +OPT_CMDLINE=`echo $@ | sed "s,-v ,,g; s,-v$,,g"` + +# initialize global variables +QMAKE_SWITCHES= +QMAKE_VARS= +QMAKE_CONFIG= +QT_CONFIG= + +SUPPORTED= + +QMAKE_VARS_FILE=.qmake.vars +exec 5> "$QMAKE_VARS_FILE" + +#------------------------------------------------------------------------------- +# utility functions +#------------------------------------------------------------------------------- + +# Adds a new qmake variable to the cache +# Usage: QMakeVar mode varname contents +# where mode is one of: set, add, del +QMakeVar() +{ + case "$1" in + set) + eq="=" + ;; + add) + eq="+=" + ;; + del) + eq="-=" + ;; + *) + echo >&2 "BUG: wrong command to QMakeVar: $1" + ;; + esac + + echo >&5 "$2" "$eq" "$3" +} + +# relies on $QMAKESPEC being set correctly. parses include statements in +# qmake.conf and prints out the expanded file +getQMakeConf() +{ + tmpSPEC="$QMAKESPEC" + if [ -n "$1" ]; then + tmpSPEC="$1" + fi + $AWK -v "QMAKESPEC=$tmpSPEC" ' +/^include\(.+\)$/{ + fname = QMAKESPEC "/" substr($0, 9, length($0) - 9) + while ((getline line < fname) > 0) + print line + close(fname) + next +} +{ print }' "$tmpSPEC/qmake.conf" +} + +#------------------------------------------------------------------------------- +# operating system detection +#------------------------------------------------------------------------------- + +# need that throughout the script +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + + +#------------------------------------------------------------------------------- +# window system detection +#------------------------------------------------------------------------------- + +PLATFORM_X11=no +PLATFORM_MAC=no +PLATFORM_QWS=no + +if [ -f "$relpath"/src/gui/kernel/qapplication_mac.cpp ] && [ -d /System/Library/Frameworks/Carbon.framework ]; then + # Qt/Mac + # ~ the Carbon SDK exists + # ~ src/gui/base/qapplication_mac.cpp is present + # ~ this is the internal edition and Qt/Mac sources exist + PLATFORM_MAC=maybe +elif [ -f "$relpath"/src/gui/kernel/qapplication_qws.cpp ]; then + # Qtopia Core + # ~ src/gui/base/qapplication_qws.cpp is present + # ~ this is the free or commercial edition + # ~ this is the internal edition and Qtopia Core is explicitly enabled + PLATFORM_QWS=maybe +fi + +#----------------------------------------------------------------------------- +# Qt version detection +#----------------------------------------------------------------------------- +QT_VERSION=`grep '^# *define *QT_VERSION_STR' "$relpath"/src/corelib/global/qglobal.h` +QT_MAJOR_VERSION= +QT_MINOR_VERSION=0 +QT_PATCH_VERSION=0 +if [ -n "$QT_VERSION" ]; then + QT_VERSION=`echo $QT_VERSION | sed 's,^# *define *QT_VERSION_STR "*\([^ ]*\)"$,\1,'` + MAJOR=`echo $QT_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\1,'` + if [ -n "$MAJOR" ]; then + MINOR=`echo $QT_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\2,'` + PATCH=`echo $QT_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\3,'` + QT_MAJOR_VERSION="$MAJOR" + [ -z "$MINOR" ] || QT_MINOR_VERSION="$MINOR" + [ -z "$PATCH" ] || QT_PATCH_VERSION="$PATCH" + fi +fi +if [ -z "$QT_MAJOR_VERSION" ]; then + echo "Cannot process version from qglobal.h: $QT_VERSION" + echo "Cannot proceed." + exit 1 +fi + +QT_PACKAGEDATE=`grep '^# *define *QT_PACKAGEDATE_STR' "$relpath"/src/corelib/global/qglobal.h | sed -e 's,^# *define *QT_PACKAGEDATE_STR *"\([^ ]*\)"$,\1,' -e s,-,,g` +if [ -z "$QT_PACKAGEDATE" ]; then + echo "Unable to determine package date from qglobal.h: '$QT_PACKAGEDATE'" + echo "Cannot proceed" + exit 1 +fi + +#------------------------------------------------------------------------------- +# check the license +#------------------------------------------------------------------------------- + +if [ -f "$relpath"/LICENSE.Qtopia ]; then + # Qtopia Edition + [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes + Licensee="Qtopia" + Edition="Qtopia" + QT_EDITION="QT_EDITION_DESKTOP" +elif [ -f "$relpath"/LICENSE.QPL -o -f "$relpath"/LICENSE.GPL ]; then + # Open Source edition - may only be used under the terms of the QPL or GPL. + [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes + [ "$PLATFORM_QWS" = "maybe" ] && PLATFORM_QWS=yes + Licensee="Open Source" + Edition="OpenSource" + EditionString="Open Source" + QT_EDITION="QT_EDITION_OPENSOURCE" +elif [ -f "$relpath"/LICENSE.PREVIEW.OPENSOURCE ]; then + # tech preview - opensource + [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes + [ "$PLATFORM_QWS" = "maybe" ] && PLATFORM_QWS=yes + Licensee="Preview" + Edition="Preview" + QT_EDITION="QT_EDITION_OPENSOURCE" +elif [ -f "$relpath"/LICENSE.PREVIEW.COMMERCIAL ]; then + # tech preview - commercial + [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes + [ "$PLATFORM_QWS" = "maybe" ] && PLATFORM_QWS=yes + Licensee="Preview" + Edition="Preview" + QT_EDITION="QT_EDITION_DESKTOP" +elif [ -f "$relpath"/LICENSE.TROLL ]; then + # internal Trolltech edition + [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes + Licensee="Trolltech" + Edition="Trolltech" + QT_EDITION="QT_EDITION_DESKTOP" +else + # one of commercial editions + [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes + [ "$PLATFORM_QWS" = "maybe" ] && PLATFORM_QWS=yes + + # fix license file to quote the right side + newlicense=`cat "$HOME"/.qt-license | sed -e 's/=\([^\"]\)/=\"\1/g' -e 's/\([^\"]\)$/\1\"/g' ` + cat > "$HOME"/.qt-license-temp <<EOF +$newlicense +EOF + + # read in the license file + if [ -f "$HOME"/.qt-license ]; then + . "$HOME"/.qt-license >/dev/null 2>&1 + if [ -z "$LicenseKeyExt" ]; then + echo + echo "You are using an old license file." + echo + echo "Please install the license file supplied by Trolltech," + echo "or install the Qt Open Source Edition if you intend to" + echo "develop free software." + exit 1 + fi + if [ -z "$Licensee" ]; then + echo + echo "Invalid license key. Please check the license key." + exit 1 + fi + else + if [ -z "$LicenseKeyExt" ]; then + echo + if echo '\c' | grep '\c' >/dev/null; then + echo -n "Please enter your license key: " + else + echo "Please enter your license key: \c" + fi + read LicenseKeyExt + Licensee="Unknown user" + fi + fi + + # Key verification + echo "$LicenseKeyExt" | grep ".....*-....*-....*-....*-.....*-.....*-...." >/dev/null 2>&1 \ + && LicenseValid="yes" \ + || LicenseValid="no" + if [ "$LicenseValid" != "yes" ]; then + echo + echo "Invalid license key. Please check the license key." + exit 1 + fi + ProductCode=`echo $LicenseKeyExt | cut -f 1 -d - | cut -b 1` + PlatformCode=`echo $LicenseKeyExt | cut -f 2 -d - | cut -b 1` + LicenseTypeCode=`echo $LicenseKeyExt | cut -f 3 -d -` + LicenseFeatureCode=`echo $LicenseKeyExt | cut -f 4 -d - | cut -b 1` + + # determine which edition we are licensed to use + case "$LicenseTypeCode" in + F4M) + LicenseType="Commercial" + case $ProductCode in + F) + Edition="Universal" + QT_EDITION="QT_EDITION_UNIVERSAL" + ;; + B) + Edition="Desktop" + QT_EDITION="QT_EDITION_DESKTOP" + ;; + L) + Edition="DesktopLight" + EditionString="Desktop Light" + QT_EDITION="QT_EDITION_DESKTOPLIGHT" + ;; + R) + Edition="Console" + QT_EDITION="QT_EDITION_CONSOLE" + ;; + esac + ;; + Z4M|R4M|Q4M) + LicenseType="Evaluation" + case $ProductCode in + B) + Edition="Evaluation" + QT_EDITION="QT_EDITION_EVALUATION" + ;; + esac + ;; + 34M) + LicenseType="Academic" + case $ProductCode in + B) + Edition="Academic" + QT_EDITION="QT_EDITION_ACADEMIC" + ;; + esac + ;; + TBM) + LicenseType="Educational" + case $ProductCode in + B) + Edition="Educational" + QT_EDITION="QT_EDITION_EDUCATIONAL" + ;; + esac + ;; + esac + if [ -z "$LicenseType" -o -z "$Edition" -o -z "$QT_EDITION" ]; then + echo + echo "Invalid license key. Please check the license key." + exit 1 + fi + + # verify that we are licensed to use Qt on this platform + LICENSE_EXTENSION= + if [ "$PLATFORM_QWS" = "yes" ]; then + case $PlatformCode in + 4|8|V|P|G|Q|2|B) + LICENSE_EXTENSION="-QTOPIACORE" + # Qtopia Core + ;; + *) + echo + echo "You are not licensed for Qtopia Core." + echo + echo "Please contact sales@trolltech.com to upgrade your license" + echo "to include Qtopia Core, or install the" + echo "Qt Open Source Edition if you intend to develop free software." + exit 1 + ;; + esac + elif [ "$PLATFORM_MAC" = "yes" ]; then + case $PlatformCode in + 4|L|5|G|Y|2|F|B) + # Qt/Mac + ;; + *) + echo + echo "You are not licensed for the Qt/Mac platform." + echo + echo "Please contact sales@trolltech.com to upgrade your license" + echo "to include the Qt/Mac platform." + exit 1 + ;; + esac + else + case $PlatformCode in + 4|Z|V|T|5|Q|2|F) + # Qt/X11 + ;; + *) + echo + echo "You are not licensed for the Qt/X11 platform." + echo + echo "Please contact sales@trolltech.com to upgrade your license to" + echo "include the Qt/X11 platform, or install the Qt Open Source Edition" + echo "if you intend to develop free software." + exit 1 + ;; + esac + fi + case "$LicenseFeatureCode" in + G|L) + # US + case "$LicenseType" in + Commercial) + cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}-US" "$outpath/LICENSE" + ;; + Evaluation) + cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}-EVALUATION-US" "$outpath/LICENSE" + ;; + Academic) + cp -f "$relpath/.LICENSE-ACADEMIC-US" "$outpath/LICENSE" + ;; + Educational) + cp -f "$relpath/.LICENSE-EDUCATIONAL-US" "$outpath/LICENSE" + ;; + esac + ;; + 2|5) + # non-US + case "$LicenseType" in + Commercial) + cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}" "$outpath/LICENSE" + ;; + Evaluation) + cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}-EVALUATION" "$outpath/LICENSE" + ;; + Academic) + cp -f "$relpath/.LICENSE-ACADEMIC" "$outpath/LICENSE" + ;; + Educational) + cp -f "$relpath/.LICENSE-EDUCATIONAL" "$outpath/LICENSE" + ;; + esac + ;; + *) + echo + echo "Invalid license key. Please check the license key." + exit 1 + ;; + esac + case "$LicenseFeatureCode" in + G|2) + # delete qtusagereporter for non-metered licenses + rm -f "$relpath/bin/qtusagereporter" + ;; + L|5) + # copy qtusagereporter for metered licenses + if [ '!' -f "$outpath/bin/qtusagereporter" ]; then + mkdir -p "$outpath/bin" + cp -f "$relpath/bin/qtusagereporter" "$outpath/bin/qtusagereporter" + fi + QT_CONFIG="$QT_CONFIG qtusagereporter" + ;; + *) + echo + echo "Invalid license key. Please check the license key." + exit 1 + ;; + esac + if [ '!' -f "$outpath/LICENSE" ]; then + echo "The LICENSE, LICENSE.QPL, or LICENSE.GPL file shipped with" + echo "this software has disappeared." + echo + echo "Sorry, you are not licensed to use this software." + echo "Try re-installing." + echo + exit 1 + fi +fi + +if [ "$PLATFORM_QWS" = "yes" ]; then + Platform="Qtopia Core" +elif [ "$PLATFORM_MAC" = "yes" ]; then + Platform="Qt/Mac" +else + PLATFORM_X11=yes + Platform="Qt/X11" +fi + +echo +echo "This is the $Platform ${EditionString-$Edition} Edition." +echo + +#------------------------------------------------------------------------------- +# initalize variables +#------------------------------------------------------------------------------- + +SYSTEM_VARIABLES="CC CXX CFLAGS CXXFLAGS LDFLAGS" +for varname in $SYSTEM_VARIABLES; do + cmd=`echo \ +'if [ -n "\$'${varname}'" ]; then + QMakeVar set QMAKE_'${varname}' "\$'${varname}'" +fi'` + eval "$cmd" +done + +QMakeVar add styles "cde mac motif plastique cleanlooks windows" +QMakeVar add decorations "default windows styled" +QMakeVar add gfx-drivers "linuxfb" +QMakeVar add kbd-drivers "tty" +QMakeVar add mouse-drivers "pc" + +if [ "$Edition" = "Trolltech" ]; then + QMakeVar add kbd-drivers "um" + QMakeVar add mouse-drivers "linuxtp" # adjust below as well +fi + +# QTDIR may be set and point to an old or system-wide Qt installation +unset QTDIR + +# the minimum version of libdbus-1 that we require: +MIN_DBUS_1_VERSION=0.62 + +# initalize internal variables +CFG_CONFIGURE_EXIT_ON_ERROR=yes +CFG_PROFILE=no +CFG_EXCEPTIONS=unspecified +CFG_INCREMENTAL=auto +CFG_QCONFIG=full +CFG_EMBEDDED=no +CFG_DEBUG=auto +CFG_DEBUG_RELEASE=no +CFG_SHARED=yes +CFG_SM=auto +CFG_XSHAPE=auto +CFG_XINERAMA=auto +CFG_ZLIB=auto +CFG_SQLITE=qt +CFG_GIF=no +CFG_PNG=yes +CFG_LIBPNG=auto +CFG_JPEG=auto +CFG_LIBJPEG=auto +CFG_MNG=auto +CFG_LIBMNG=auto +CFG_XCURSOR=auto +CFG_XRANDR=auto +CFG_XRENDER=auto +CFG_OPENGL=auto +CFG_FONTCONFIG=auto +CFG_QWS_FREETYPE=auto +CFG_LIBFREETYPE=auto +CFG_SQL_AVAILABLE= +QT_DEFAULT_BUILD_PARTS="libs tools examples" +CFG_BUILD_PARTS="" +CFG_NOBUILD_PARTS="" + +CFG_GFX_AVAILABLE="linuxfb transformed qvfb vnc" +CFG_GFX_ON="linuxfb" +CFG_GFX_PLUGIN_AVAILABLE= +CFG_GFX_PLUGIN= +CFG_GFX_OFF= +CFG_KBD_AVAILABLE="tty usb sl5000 yopy vr41xx qvfb" +CFG_KBD_ON="tty" #default, see QMakeVar above +CFG_MOUSE_AVAILABLE="pc bus linuxtp yopy vr41xx tslib qvfb" +CFG_MOUSE_ON="pc linuxtp" #default, see QMakeVar above + +if [ "$Edition" = "Trolltech" ]; then + CFG_KBD_AVAILABLE="${CFG_KBD_AVAILABLE} um" + CFG_KBD_ON="${CFG_KBD_ON} um" +fi + +CFG_KBD_OFF= +CFG_MOUSE_PLUGIN_AVAILABLE= +CFG_MOUSE_PLUGIN= +CFG_MOUSE_OFF= +CFG_USE_GNUMAKE=no +CFG_IM=yes +CFG_DECORATION_AVAILABLE="styled windows default" +CFG_DECORATION_ON="${CFG_DECORATION_AVAILABLE}" # all on by default +CFG_DECORATION_PLUGIN_AVAILABLE= +CFG_DECORATION_PLUGIN= +CFG_TABLET=auto +CFG_XKB=auto +CFG_NIS=auto +CFG_CUPS=auto +CFG_ICONV=auto +CFG_QDBUS=auto +CFG_GLIB=auto +CFG_LARGEFILE=auto +CFG_STL=auto +CFG_PRECOMPILE=no +CFG_SEPARATE_DEBUG_INFO=auto +CFG_REDUCE_EXPORTS=auto +CFG_IPV6=auto +CFG_NAS=no +CFG_QWS_DEPTHS=prompted +CFG_USER_BUILD_KEY= +CFG_ACCESSIBILITY=auto +CFG_QT3SUPPORT=yes +CFG_ENDIAN=auto +CFG_IWMMXT=no +CFG_GETADDRINFO=auto +CFG_IPV6IFNAME=auto +CFG_GETIFADDRS=auto +CFG_INOTIFY=auto +CFG_RPATH=yes +CFG_FRAMEWORK=auto +CFG_UNIVERSAL_BINARY=auto +CFG_SXE=no +CFG_PREFIX_INSTALL=yes +CFG_SDK= +D_FLAGS= +I_FLAGS= +L_FLAGS= +RPATH_FLAGS= +l_FLAGS= +QCONFIG_FLAGS= +XPLATFORM= +PLATFORM=$QMAKESPEC +OPT_CONFIRM_LICENSE=no +OPT_SHADOW=maybe +OPT_FAST=auto +OPT_VERBOSE=no +OPT_HELP= +CFG_SILENT=no + +# initalize variables used for installation +QT_INSTALL_PREFIX= +QT_INSTALL_DOCS= +QT_INSTALL_HEADERS= +QT_INSTALL_LIBS= +QT_INSTALL_BINS= +QT_INSTALL_PLUGINS= +QT_INSTALL_DATA= +QT_INSTALL_TRANSLATIONS= +QT_INSTALL_SETTINGS= +QT_INSTALL_EXAMPLES= +QT_INSTALL_DEMOS= + +#flags for SQL drivers +QT_CFLAGS_PSQL= +QT_LFLAGS_PSQL= +QT_CFLAGS_MYSQL= +QT_LFLAGS_MYSQL= +QT_LFLAGS_MYSQL_R= +QT_CFLAGS_SQLITE= +QT_LFLAGS_SQLITE= + +# flags for libdbus-1 +QT_CFLAGS_DBUS= +QT_LIBS_DBUS= + +# flags for Glib (X11 only) +QT_CFLAGS_GLIB= +QT_LIBS_GLIB= + +#------------------------------------------------------------------------------- +# check SQL drivers, mouse drivers and decorations available in this package +#------------------------------------------------------------------------------- + +# opensource version removes some drivers, so force them to be off +CFG_SQL_tds=no +CFG_SQL_oci=no +CFG_SQL_db2=no + +CFG_SQL_AVAILABLE=`find "$relpath"/src/plugins/sqldrivers/* -prune -type d -exec basename {} \;` +CFG_SQL_AVAILABLE=`echo $CFG_SQL_AVAILABLE` # normalize whitespace +# by default, auto-detect which sql drivers can be built +for i in $CFG_SQL_AVAILABLE; do + eval "CFG_SQL_$i=auto" +done + +CFG_DECORATION_PLUGIN_AVAILABLE="" +if [ -d "$relpath/src/plugins/decorations" ]; then + CFG_DECORATION_PLUGIN_AVAILABLE=`find "$relpath"/src/plugins/decorations/* -prune -type d -exec basename {} \;` + CFG_DECORATION_PLUGIN_AVAILABLE=`echo $CFG_DECORATION_PLUGIN_AVAILABLE` # normalize whitespace +fi + +CFG_MOUSE_PLUGIN_AVAILABLE="" +if [ -d "$relpath/src/plugins/mousedrivers" ]; then + CFG_MOUSE_PLUGIN_AVAILABLE=`find "$relpath"/src/plugins/mousedrivers/* -prune -type d -exec basename {} \;` + CFG_MOUSE_PLUGIN_AVAILABLE=`echo $CFG_MOUSE_PLUGIN_AVAILABLE` # normalize whitespace +fi + +CFG_GFX_PLUGIN_AVAILABLE="" +if [ -d "$relpath/src/plugins/gfxdrivers" ]; then + CFG_GFX_PLUGIN_AVAILABLE=`find "$relpath"/src/plugins/gfxdrivers/* -prune -type d -exec basename {} \;` + CFG_GFX_PLUGIN_AVAILABLE=`echo $CFG_GFX_PLUGIN_AVAILABLE` # normalize whitespace + CFG_GFX_OFF="$CFG_GFX_AVAILABLE" # assume all off +fi + +#------------------------------------------------------------------------------- +# parse command line arguments +#------------------------------------------------------------------------------- + +# parse the arguments, setting things to "yes" or "no" +while [ "$#" -gt 0 ]; do + CURRENT_OPT="$1" + UNKNOWN_ARG=no + case "$1" in + #Autoconf style options + --enable-*) + VAR=`echo $1 | sed "s,^--enable-\(.*\),\1,"` + VAL=yes + ;; + --disable-*) + VAR=`echo $1 | sed "s,^--disable-\(.*\),\1,"` + VAL=no + ;; + --*=*) + VAR=`echo $1 | sed "s,^--\(.*\)=.*,\1,"` + VAL=`echo $1 | sed "s,^--.*=\(.*\),\1,"` + ;; + --no-*) + VAR=`echo $1 | sed "s,^--no-\(.*\),\1,"` + VAL=no + ;; + --*) + VAR=`echo $1 | sed "s,^--\(.*\),\1,"` + VAL=yes + ;; + #Qt plugin options + -no-*-*|-plugin-*-*|-qt-*-*) + VAR=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"` + VAL=`echo $1 | sed "s,^-\([^-]*\).*,\1,"` + ;; + #Qt style no options + -no-*) + VAR=`echo $1 | sed "s,^-no-\(.*\),\1,"` + VAL=no + ;; + #Qt style yes options + -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-tablet|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-fontconfig|-xkb|-nis|-qdbus|-glib|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-opengl|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-universal|-prefix-install|-silent) + VAR=`echo $1 | sed "s,^-\(.*\),\1,"` + VAL=yes + ;; + #Qt style options that pass an argument + -qconfig) + if [ "$PLATFORM_QWS" = "yes" ]; then + CFG_QCONFIG="$VAL" + VAR=`echo $1 | sed "s,^-\(.*\),\1,"` + shift + VAL=$1 + else + UNKNOWN_ARG=yes + fi + ;; + -prefix|-docdir|-headerdir|-plugindir|-datadir|-libdir|-bindir|-translationdir|-sysconfdir|-examplesdir|-demosdir|-depths|-make|-nomake|-platform|-xplatform|-buildkey|-sdk) + VAR=`echo $1 | sed "s,^-\(.*\),\1,"` + shift + VAL="$1" + ;; + #Qt style complex options in one command + -enable-*|-disable-*) + VAR=`echo $1 | sed "s,^-\([^-]*\)-.*,\1,"` + VAL=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"` + ;; + #Qt Builtin/System style options + -no-*|-system-*|-qt-*) + VAR=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"` + VAL=`echo $1 | sed "s,^-\([^-]*\)-.*,\1,"` + ;; + #Options that cannot be generalized + -k|-continue) + VAR=fatal_error + VAL=no + ;; + -embedded) + VAR=embedded + # this option may or may not be followed by an argument + if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then + VAL=auto + else + shift; + VAL=$1 + fi + ;; + -iwmmxt) + CFG_IWMMXT="yes" + ;; + -*-endian) + VAR=endian + VAL=`echo $1 | sed "s,^-\(.*\)-.*,\1,"` + ;; + -D?*|-D) + VAR="add_define" + if [ "$1" = "-D" ]; then + shift + VAL="$1" + else + VAL=`echo $1 | sed 's,-D,,'` + fi + ;; + -I?*|-I) + VAR="add_ipath" + if [ "$1" = "-I" ]; then + shift + VAL="$1" + else + VAL=`echo $1 | sed 's,-I,,'` + fi + ;; + -L?*|-L) + VAR="add_lpath" + if [ "$1" = "-L" ]; then + shift + VAL="$1" + else + VAL=`echo $1 | sed 's,-L,,'` + fi + ;; + -R?*|-R) + VAR="add_rpath" + if [ "$1" = "-R" ]; then + shift + VAL="$1" + else + VAL=`echo $1 | sed 's,-R,,'` + fi + ;; + -l?*) + VAR="add_link" + VAL=`echo $1 | sed 's,-l,,'` + ;; + -F?*|-F) + VAR="add_fpath" + if [ "$1" = "-F" ]; then + shift + VAL="$1" + else + VAL=`echo $1 | sed 's,-F,,'` + fi + ;; + -fw?*|-fw) + VAR="add_framework" + if [ "$1" = "-fw" ]; then + shift + VAL="$1" + else + VAL=`echo $1 | sed 's,-fw,,'` + fi + ;; + -*) + VAR=`echo $1 | sed "s,^-\(.*\),\1,"` + VAL="unknown" + ;; + *) + UNKNOWN_ARG=yes + ;; + esac + if [ "$UNKNOWN_ARG" = "yes" ]; then + echo "$1: unknown argument" + OPT_HELP=yes + ERROR=yes + shift + continue + fi + shift + + UNKNOWN_OPT=no + case "$VAR" in + qt3support) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_QT3SUPPORT="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + accessibility) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_ACCESSIBILITY="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + gnumake) + CFG_USE_GNUMAKE="$VAL" + ;; + prefix) + QT_INSTALL_PREFIX="$VAL" + ;; + docdir) + QT_INSTALL_DOCS="$VAL" + ;; + headerdir) + QT_INSTALL_HEADERS="$VAL" + ;; + plugindir) + QT_INSTALL_PLUGINS="$VAL" + ;; + datadir) + QT_INSTALL_DATA="$VAL" + ;; + libdir) + QT_INSTALL_LIBS="$VAL" + ;; + translationdir) + QT_INSTALL_TRANSLATIONS="$VAL" + ;; + sysconfdir|settingsdir) + QT_INSTALL_SETTINGS="$VAL" + ;; + examplesdir) + QT_INSTALL_EXAMPLES="$VAL" + ;; + demosdir) + QT_INSTALL_DEMOS="$VAL" + ;; + qconfig) + CFG_QCONFIG="$VAL" + ;; + bindir) + QT_INSTALL_BINS="$VAL" + ;; + buildkey) + CFG_USER_BUILD_KEY="$VAL" + ;; + sxe) + CFG_SXE="$VAL" + ;; + embedded) + CFG_EMBEDDED="$VAL" + if [ "$PLATFORM_QWS" != "no" ]; then + if [ "$PLATFORM_QWS" = "maybe" ]; then + PLATFORM_X11=no + PLATFORM_MAC=no + PLATFORM_QWS=yes + fi + else + echo "No license exists to enable Qtopia Core. Disabling." + CFG_EMBEDDED=no + fi + ;; + endian) + if [ "$VAL" = "little" ]; then + CFG_ENDIAN="Q_LITTLE_ENDIAN" + elif [ "$VAL" = "big" ]; then + CFG_ENDIAN="Q_BIG_ENDIAN" + else + UNKNOWN_OPT=yes + fi + ;; + depths) + CFG_QWS_DEPTHS="$VAL" + ;; + opengl) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_OPENGL="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + qvfb) # left for commandline compatibility, not documented + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + if [ "$VAL" = "yes" ]; then + QMakeVar add gfx-drivers qvfb + QMakeVar add kbd-drivers qvfb + QMakeVar add mouse-drivers qvfb + CFG_GFX_ON="$CFG_GFX_ON qvfb" + CFG_KBD_ON="$CFG_KBD_ON qvfb" + CFG_MOUSE_ON="$CFG_MOUSE_ON qvfb" + fi + else + UNKNOWN_OPT=yes + fi + ;; + nomake) + CFG_NOBUILD_PARTS="$CFG_NOBUILD_PARTS $VAL" + ;; + make) + CFG_BUILD_PARTS="$CFG_BUILD_PARTS $VAL" + ;; + x11) + if [ "$Edition" = "Trolltech" ] && [ "$VAL" = "yes" ]; then + if [ "$PLATFORM_MAC" = "yes" ]; then + PLATFORM_MAC=no + elif [ "$PLATFORM_QWS" = "yes" ]; then + PLATFORM_QWS=no + fi + PLATFORM_X11=yes + else + UNKNOWN_OPT=yes + fi + ;; + sdk) + if [ "$PLATFORM_MAC" = "yes" ]; then + CFG_SDK="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + universal) + if [ "$PLATFORM_MAC" = "yes" ]; then + CFG_UNIVERSAL_BINARY="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + framework) + if [ "$PLATFORM_MAC" = "yes" ]; then + CFG_FRAMEWORK="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + profile) + if [ "$VAL" = "yes" ]; then + CFG_PROFILE=yes + QMakeVar add QMAKE_CFLAGS -pg + QMakeVar add QMAKE_CXXFLAGS -pg + QMakeVar add QMAKE_LFLAGS -pg + QMAKE_VARS="$QMAKE_VARS CONFIG+=nostrip" + else + UNKNOWN_OPT=yes + fi + ;; + exceptions|g++-exceptions) + if [ "$VAL" = "no" ]; then + CFG_EXCEPTIONS=no + elif [ "$VAL" = "yes" ]; then + CFG_EXCEPTIONS=yes + else + UNKNOWN_OPT=yes + fi + ;; + platform) + PLATFORM="$VAL" + # keep compatibility with old platform names + case $PLATFORM in + aix-64) + PLATFORM=aix-xlc-64 + ;; + hpux-o64) + PLATFORM=hpux-acc-o64 + ;; + hpux-n64) + PLATFORM=hpux-acc-64 + ;; + hpux-acc-n64) + PLATFORM=hpux-acc-64 + ;; + irix-n32) + PLATFORM=irix-cc + ;; + irix-64) + PLATFORM=irix-cc-64 + ;; + irix-cc-n64) + PLATFORM=irix-cc-64 + ;; + reliant-64) + PLATFORM=reliant-cds-64 + ;; + solaris-64) + PLATFORM=solaris-cc-64 + ;; + solaris-64) + PLATFORM=solaris-cc-64 + ;; + openunix-cc) + PLATFORM=unixware-cc + ;; + openunix-g++) + PLATFORM=unixware-g++ + ;; + unixware7-cc) + PLATFORM=unixware-cc + ;; + unixware7-g++) + PLATFORM=unixware-g++ + ;; + esac + ;; + xplatform) + XPLATFORM="$VAL" + ;; + debug-and-release) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_DEBUG_RELEASE="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + release) + if [ "$VAL" = "yes" ]; then + CFG_DEBUG=no + elif [ "$VAL" = "no" ]; then + CFG_DEBUG=yes + else + UNKNOWN_OPT=yes + fi + ;; + prefix-install) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_PREFIX_INSTALL="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + debug) + CFG_DEBUG="$VAL" + ;; + static) + if [ "$VAL" = "yes" ]; then + CFG_SHARED=no + elif [ "$VAL" = "no" ]; then + CFG_SHARED=yes + else + UNKNOWN_OPT=yes + fi + ;; + incremental) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_INCREMENTAL="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + fatal_error) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_CONFIGURE_EXIT_ON_ERROR="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + feature-*) + if [ "$PLATFORM_QWS" = "yes" ]; then + FEATURE=`echo $VAR | sed "s,^[^-]*-\([^-]*\),\1," | tr 'abcdefghijklmnopqrstuvwxyz-' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + if [ "$VAL" = "no" ]; then + QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_$FEATURE" + elif [ "$VAL" = "yes" ] || [ "$VAL" = "unknown" ]; then + QCONFIG_FLAGS="$QCONFIG_FLAGS QT_$FEATURE" + else + UNKNOWN_OPT=yes + fi + else + UNKNOWN_OPT=yes + fi + ;; + shared) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_SHARED="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + gif) + [ "$VAL" = "qt" ] && VAL=yes + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_GIF="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + sm) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_SM="$VAL" + else + UNKNOWN_OPT=yes + fi + + ;; + xinerama) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_XINERAMA="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + xshape) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_XSHAPE="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + tablet) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_TABLET="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + stl) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_STL="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + pch) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_PRECOMPILE="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + separate-debug-info) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_SEPARATE_DEBUG_INFO="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + reduce-exports) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_REDUCE_EXPORTS="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + freetype) + [ "$VAL" = "qt" ] && VAL=yes + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then + CFG_QWS_FREETYPE="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + zlib) + [ "$VAL" = "qt" ] && VAL=yes + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then + CFG_ZLIB="$VAL" + else + UNKNOWN_OPT=yes + fi + [ "$VAL" = "no" ] && CFG_LIBPNG=no + ;; + sqlite) + if [ "$VAL" = "system" ]; then + CFG_SQLITE=system + else + UNKNOWN_OPT=yes + fi + ;; + libpng) + [ "$VAL" = "yes" ] && VAL=qt + if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then + CFG_LIBPNG="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + libjpeg) + [ "$VAL" = "yes" ] && VAL=qt + if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then + CFG_LIBJPEG="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + libmng) + [ "$VAL" = "yes" ] && VAL=qt + if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then + CFG_LIBMNG="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + nas-sound) + if [ "$VAL" = "system" ] || [ "$VAL" = "no" ]; then + CFG_NAS="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + xcursor) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_XCURSOR="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + xfixes) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_XFIXES="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + xrandr) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_XRANDR="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + xrender) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_XRENDER="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + fontconfig) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_FONTCONFIG="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + xkb) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_XKB="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + cups) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_CUPS="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + iconv) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_ICONV="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + glib) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_GLIB="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + qdbus) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_QDBUS="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + nis) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_NIS="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + largefile) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_LARGEFILE="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + confirm-license) + if [ "$VAL" = "yes" ]; then + OPT_CONFIRM_LICENSE="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + h|help) + if [ "$VAL" = "yes" ]; then + OPT_HELP="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + sql-*|gfx-*|decoration-*|kbd-*|mouse-*) + # if Qt style options were used, $VAL can be "no", "qt", or "plugin" + # if autoconf style options were used, $VAL can be "yes" or "no" + [ "$VAL" = "yes" ] && VAL=qt + # now $VAL should be "no", "qt", or "plugin"... double-check + if [ "$VAL" != "no" ] && [ "$VAL" != "qt" ] && [ "$VAL" != "plugin" ]; then + UNKNOWN_OPT=yes + fi + # now $VAL is "no", "qt", or "plugin" + OPT="$VAL" + VAL=`echo $VAR | sed "s,^[^-]*-\([^-]*\).*,\1,"` + VAR=`echo $VAR | sed "s,^\([^-]*\).*,\1,"` + + # Grab the available values + case "$VAR" in + sql) + avail="$CFG_SQL_AVAILABLE" + ;; + gfx) + avail="$CFG_GFX_AVAILABLE" + if [ "$OPT" = "plugin" ]; then + avail="$CFG_GFX_PLUGIN_AVAILABLE" + fi + ;; + decoration) + avail="$CFG_DECORATION_AVAILABLE" + if [ "$OPT" = "plugin" ]; then + avail="$CFG_DECORATION_PLUGIN_AVAILABLE" + fi + ;; + kbd) + avail="$CFG_KBD_AVAILABLE" + ;; + mouse) + avail="$CFG_MOUSE_AVAILABLE" + if [ "$OPT" = "plugin" ]; then + avail="$CFG_MOUSE_PLUGIN_AVAILABLE" + fi + ;; + *) + avail="" + echo "BUG: Unhandled type $VAR used in $CURRENT_OPT" + ;; + esac + + # Check that that user's value is available. + found=no + for d in $avail; do + if [ "$VAL" = "$d" ]; then + found=yes + break + fi + done + [ "$found" = yes ] || ERROR=yes + + if [ "$VAR" = "sql" ]; then + # set the CFG_SQL_driver + eval "CFG_SQL_$VAL=\$OPT" + continue + fi + + if [ "$OPT" = "plugin" ] || [ "$OPT" = "qt" ]; then + if [ "$OPT" = "plugin" ]; then + [ "$VAR" = "decoration" ] && QMakeVar del "${VAR}s" "$VAL" + [ "$VAR" = "decoration" ] && CFG_DECORATION_ON=`echo "${CFG_DECORATION_ON} " | sed "s,${VAL} ,,g"` && CFG_DECORATION_PLUGIN="$CFG_DECORATION_PLUGIN ${VAL}" + [ "$VAR" = "mouse" ] && QMakeVar del "${VAR}s" "$VAL" + [ "$VAR" = "mouse" ] && CFG_MOUSE_ON=`echo "${CFG_MOUSE_ON} " | sed "s,${VAL} ,,g"` && CFG_MOUSE_PLUGIN="$CFG_MOUSE_PLUGIN ${VAL}" + [ "$VAR" = "gfx" ] && QMakeVar del "${VAR}s" "$VAL" + [ "$VAR" = "gfx" ] && CFG_GFX_ON=`echo "${CFG_GFX_ON} " | sed "s,${VAL} ,,g"` && CFG_GFX_PLUGIN="${CFG_GFX_PLUGIN} ${VAL}" + VAR="${VAR}-${OPT}" + else + if [ "$VAR" = "gfx" ] || [ "$VAR" = "kbd" ] || [ "$VAR" = "decoration" ] || [ "$VAR" = "mouse" ]; then + [ "$VAR" = "gfx" ] && CFG_GFX_ON="$CFG_GFX_ON $VAL" + [ "$VAR" = "kbd" ] && CFG_KBD_ON="$CFG_KBD_ON $VAL" + [ "$VAR" = "decoration" ] && CFG_DECORATION_ON="$CFG_DECORATION_ON $VAL" + [ "$VAR" = "mouse" ] && CFG_MOUSE_ON="$CFG_MOUSE_ON $VAL" + VAR="${VAR}-driver" + fi + fi + QMakeVar add "${VAR}s" "${VAL}" + elif [ "$OPT" = "no" ]; then + PLUG_VAR="${VAR}-plugin" + if [ "$VAR" = "gfx" ] || [ "$VAR" = "kbd" ] || [ "$VAR" = "mouse" ]; then + IN_VAR="${VAR}-driver" + else + IN_VAR="${VAR}" + fi + [ "$VAR" = "decoration" ] && CFG_DECORATION_ON=`echo "${CFG_DECORATION_ON} " | sed "s,${VAL} ,,g"` + [ "$VAR" = "gfx" ] && CFG_GFX_ON=`echo "${CFG_GFX_ON} " | sed "s,${VAL} ,,g"` + [ "$VAR" = "kbd" ] && CFG_KBD_ON=`echo "${CFG_KBD_ON} " | sed "s,${VAL} ,,g"` + [ "$VAR" = "mouse" ] && CFG_MOUSE_ON=`echo "${CFG_MOUSE_ON} " | sed "s,${VAL} ,,g"` + QMakeVar del "${IN_VAR}s" "$VAL" + QMakeVar del "${PLUG_VAR}s" "$VAL" + fi + if [ "$ERROR" = "yes" ]; then + echo "$CURRENT_OPT: unknown argument" + OPT_HELP=yes + fi + ;; + v|verbose) + if [ "$VAL" = "yes" ]; then + if [ "$OPT_VERBOSE" = "$VAL" ]; then # takes two verboses to turn on qmake debugs + QMAKE_SWITCHES="$QMAKE_SWITCHES -d" + else + OPT_VERBOSE=yes + fi + elif [ "$VAL" = "no" ]; then + if [ "$OPT_VERBOSE" = "$VAL" ] && echo "$QMAKE_SWITCHES" | grep ' -d' >/dev/null 2>&1; then + QMAKE_SWITCHES=`echo $QMAKE_SWITCHES | sed "s, -d,,"` + else + OPT_VERBOSE=no + fi + else + UNKNOWN_OPT=yes + fi + ;; + fast) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + OPT_FAST="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + rpath) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_RPATH="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; + add_define) + D_FLAGS="$D_FLAGS \"$VAL\"" + ;; + add_ipath) + I_FLAGS="$I_FLAGS -I\"${VAL}\"" + ;; + add_lpath) + L_FLAGS="$L_FLAGS -L\"${VAL}\"" + ;; + add_rpath) + RPATH_FLAGS="$RPATH_FLAGS \"${VAL}\"" + ;; + add_link) + l_FLAGS="$l_FLAGS -l\"${VAL}\"" + ;; + add_fpath) + if [ "$PLATFORM_MAC" = "yes" ]; then + L_FLAGS="$L_FLAGS -F\"${VAL}\"" + I_FLAGS="$I_FLAGS -F\"${VAL}\"" + else + UNKNOWN_OPT=yes + fi + ;; + add_framework) + if [ "$PLATFORM_MAC" = "yes" ]; then + l_FLAGS="$l_FLAGS -framework \"${VAL}\"" + else + UNKNOWN_OPT=yes + fi + ;; + silent) + CFG_SILENT="$VAL" + ;; + *) + UNKNOWN_OPT=yes + ;; + esac + if [ "$UNKNOWN_OPT" = "yes" ]; then + echo "${CURRENT_OPT}: invalid command-line switch" + OPT_HELP=yes + ERROR=yes + fi +done + +if [ "$CFG_QCONFIG" != "full" ] && [ "$CFG_QT3SUPPORT" = "yes" ]; then + echo "Warning: '-qconfig $CFG_QCONFIG' will disable the qt3support library." + CFG_QT3SUPPORT="no" +fi + +#------------------------------------------------------------------------------- +# build tree initialization +#------------------------------------------------------------------------------- + +# where to find which.. +unixtests="$relpath/config.tests/unix" +WHICH="$unixtests/which.test" + +# find out which awk we want to use, prefer gawk, then nawk, then regular awk +AWK= +for e in gawk nawk awk; do + if "$WHICH" $e >/dev/null 2>&1 && ( $e -f /dev/null /dev/null ) >/dev/null 2>&1; then + AWK=$e + break + fi +done + +### skip this if the user just needs help... +if [ "$OPT_HELP" != "yes" ]; then + +# is this a shadow build? +if [ "$OPT_SHADOW" = "maybe" ]; then + OPT_SHADOW=no + if [ "$relpath" != "$outpath" ] && [ '!' -f "$outpath/configure" ]; then + if [ -h "$outpath" ]; then + [ "$relpath" -ef "$outpath" ] || OPT_SHADOW=yes + else + OPT_SHADOW=yes + fi + fi +fi +if [ "$OPT_SHADOW" = "yes" ]; then + if [ -f "$relpath/.qmake.cache" -o -f "$relpath/src/corelib/global/qconfig.h" ]; then + echo >&2 "You cannot make a shadow build from a source tree containing a previous build." + echo >&2 "Cannot proceed." + exit 1 + fi + [ "$OPT_VERBOSE" = "yes" ] && echo "Performing shadow build..." +fi + +if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "yes" ]; then + echo + echo "WARNING: -debug-and-release is not supported anymore on Qt/X11 and Qtopia Core" + echo "By default, Qt is built in release mode with separate debug information, so" + echo "-debug-and-release is not necessary anymore" + echo +fi + +# detect build style +if [ "$CFG_DEBUG" = "auto" ]; then + if [ "$PLATFORM_MAC" = "yes" ]; then + CFG_DEBUG_RELEASE=yes + CFG_DEBUG=yes + elif [ "$Edition" = "Trolltech" ]; then + CFG_DEBUG_RELEASE=no + CFG_DEBUG=yes + else + CFG_DEBUG_RELEASE=no + CFG_DEBUG=no + fi +fi +if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then + QMAKE_CONFIG="$QMAKE_CONFIG build_all" +fi + +if [ "$CFG_SILENT" = "yes" ]; then + QMAKE_CONFIG="$QMAKE_CONFIG silent" +fi + +# if the source tree is different from the build tree, +# symlink or copy part of the sources +if [ "$OPT_SHADOW" = "yes" ]; then + echo "Preparing build tree..." + [ -d "$outpath/bin" ] || mkdir -p "$outpath/bin" + + # symlink the qmake directory + find "$relpath/qmake" | while read a; do + my_a=`echo "$a" | sed "s,^${relpath}/,${outpath}/,"` + if [ '!' -f "$my_a" ]; then + if [ -d "$a" ]; then + # directories are created... + mkdir -p "$my_a" + else + a_dir=`dirname "$my_a"` + [ -d "$a_dir" ] || mkdir -p "$a_dir" + # ... and files are symlinked + case `basename "$a"` in + *.o|*.d|GNUmakefile*|qmake) + ;; + *) + rm -f "$my_a" + ln -s "$a" "$my_a" + ;; + esac + fi + fi + done + + # make a syncqt script that can be used in the shadow + rm -f "$outpath/bin/syncqt" + if [ -x "/usr/bin/perl" ] && [ -x "$relpath/bin/syncqt" ]; then + mkdir -p "$outpath/bin" + echo "#!/bin/sh" >"$outpath/bin/syncqt" + echo "QTDIR=\"$relpath\"; export QTDIR" >>"$outpath/bin/syncqt" + [ "$Edition" = "Trolltech" ] && echo "perl \"$relpath/bin/syncqt\" -outdir \"$relpath\"" >>"$outpath/bin/syncqt" + echo "perl \"$relpath/bin/syncqt\" -outdir \"$outpath\"" >>"$outpath/bin/syncqt" + chmod 755 "$outpath/bin/syncqt" + fi + + # symlink the doc directory + rm -rf "$outpath/doc" + ln -s "$relpath/doc" "$outpath/doc" + + # make sure q3porting.xml can be found + mkdir -p "$outpath/tools/porting/src" + rm -f "$outpath/tools/porting/src/q3porting.xml" + ln -s "$relpath/tools/porting/src/q3porting.xml" "$outpath/tools/porting/src" +fi + +# symlink files from src/gui/embedded neccessary to build qvfb +if [ "$Edition" = "Trolltech" -o "$Edition" = "Qtopia" ]; then + for f in qvfbhdr.h qlock_p.h qlock.cpp qwssignalhandler_p.h qwssignalhandler.cpp; do + dest="${relpath}/tools/qvfb/${f}" + rm -f "$dest" + ln -s "${relpath}/src/gui/embedded/${f}" "${dest}" + done +fi + +if [ "$OPT_FAST" = "auto" ]; then + if [ '!' -z "$AWK" ] && [ "$Edition" = "Trolltech" ]; then + OPT_FAST=yes + else + OPT_FAST=no + fi +fi + +# find a make command +if [ -z "$MAKE" ]; then + MAKE= + for mk in make; do + if "$WHICH" $mk >/dev/null 2>&1; then + MAKE=`$WHICH $mk` + break + fi + done + if [ -z "$MAKE" ]; then + echo >&2 "You don't seem to have 'make' or 'gmake' in your PATH." + echo >&2 "Cannot proceed." + exit 1 + fi +fi + +fi ### help + +#------------------------------------------------------------------------------- +# auto-detect all that hasn't been specified in the arguments +#------------------------------------------------------------------------------- + +[ "$PLATFORM_QWS" = "yes" -a "$CFG_EMBEDDED" = "no" ] && CFG_EMBEDDED=auto +if [ "$CFG_EMBEDDED" != "no" ]; then + case "$UNAME_SYSTEM:$UNAME_RELEASE" in + Darwin:*) + [ -z "$PLATFORM" ] && PLATFORM=qws/macx-generic-g++ + if [ -z "$XPLATFORM" ]; then + [ "$CFG_EMBEDDED" = "auto" ] && CFG_EMBEDDED=generic + XPLATFORM="qws/macx-$CFG_EMBEDDED-g++" + fi + ;; + FreeBSD:*) + [ -z "$PLATFORM" ] && PLATFORM=qws/freebsd-generic-g++ + if [ -z "$XPLATFORM" ]; then + [ "$CFG_EMBEDDED" = "auto" ] && CFG_EMBEDDED=generic + XPLATFORM="qws/freebsd-$CFG_EMBEDDED-g++" + fi + ;; + SunOS:5*) + [ -z "$PLATFORM" ] && PLATFORM=qws/solaris-generic-g++ + if [ -z "$XPLATFORM" ]; then + [ "$CFG_EMBEDDED" = "auto" ] && CFG_EMBEDDED=generic + XPLATFORM="qws/solaris-$CFG_EMBEDDED-g++" + fi + ;; + Linux:*) + if [ -z "$PLATFORM" ]; then + case "$UNAME_MACHINE" in + *86) + PLATFORM=qws/linux-x86-g++ + ;; + *86_64) + PLATFORM=qws/linux-x86_64-g++ + ;; + *) + PLATFORM=qws/linux-generic-g++ + ;; + esac + fi + if [ -z "$XPLATFORM" ]; then + if [ "$CFG_EMBEDDED" = "auto" ]; then + case "$UNAME_MACHINE" in + *86) + CFG_EMBEDDED=x86 + ;; + *86_64) + CFG_EMBEDDED=x86_64 + ;; + *) + CFG_EMBEDDED=generic + ;; + esac + fi + XPLATFORM="qws/linux-$CFG_EMBEDDED-g++" + fi + ;; + *) + echo "Qtopia Core is not supported on this platform. Disabling." + CFG_EMBEDDED=no + PLATFORM_QWS=no + ;; + esac +fi +if [ -z "$PLATFORM" ]; then + PLATFORM_NOTES= + case "$UNAME_SYSTEM:$UNAME_RELEASE" in + Darwin:*) + if [ "$PLATFORM_MAC" = "yes" ]; then + PLATFORM=macx-g++ + # PLATFORM=macx-xcode + else + PLATFORM=darwin-g++ + fi + ;; + AIX:*) + #PLATFORM=aix-g++ + #PLATFORM=aix-g++-64 + PLATFORM=aix-xlc + #PLATFORM=aix-xlc-64 + PLATFORM_NOTES=" + - Also available for AIX: aix-g++ aix-g++-64 aix-xlc-64 + " + ;; + GNU:*) + PLATFORM=hurd-g++ + ;; + dgux:*) + PLATFORM=dgux-g++ + ;; +# DYNIX/ptx:4*) +# PLATFORM=dynix-g++ +# ;; + ULTRIX:*) + PLATFORM=ultrix-g++ + ;; + FreeBSD:*) + PLATFORM=freebsd-g++ + PLATFORM_NOTES=" + - Also available for FreeBSD: freebsd-icc + " + ;; + OpenBSD:*) + PLATFORM=openbsd-g++ + ;; + NetBSD:*) + PLATFORM=netbsd-g++ + ;; + BSD/OS:*|BSD/386:*) + PLATFORM=bsdi-g++ + ;; + IRIX*:*) + #PLATFORM=irix-g++ + PLATFORM=irix-cc + #PLATFORM=irix-cc-64 + PLATFORM_NOTES=" + - Also available for IRIX: irix-g++ irix-cc-64 + " + ;; + HP-UX:*) + #PLATFORM=hpux-g++ + PLATFORM=hpux-acc + #PLATFORM=hpux-acc-64 + #PLATFORM=hpux-cc + #PLATFORM=hpux-acc-o64 + PLATFORM_NOTES=" + - Also available for HP-UX: hpux-g++ hpux-acc-64 hpux-acc-o64 + " + ;; + OSF1:*) + #PLATFORM=tru64-g++ + PLATFORM=tru64-cxx + PLATFORM_NOTES=" + - Also available for Tru64: tru64-g++ + " + ;; + Linux:*) + case "$UNAME_MACHINE" in + x86_64|s390x) + PLATFORM=linux-g++-64 + ;; + *) + PLATFORM=linux-g++ + ;; + esac + PLATFORM_NOTES=" + - Also available for Linux: linux-kcc linux-icc linux-cxx + " + ;; + SunOS:5*) + #PLATFORM=solaris-g++ + PLATFORM=solaris-cc + #PLATFORM=solaris-cc64 + PLATFORM_NOTES=" + - Also available for Solaris: solaris-g++ solaris-cc-64 + " + ;; + ReliantUNIX-*:*|SINIX-*:*) + PLATFORM=reliant-cds + #PLATFORM=reliant-cds-64 + PLATFORM_NOTES=" + - Also available for Reliant UNIX: reliant-cds-64 + " + ;; + CYGWIN*:*) + PLATFORM=cygwin-g++ + ;; + LynxOS*:*) + PLATFORM=lynxos-g++ + ;; + OpenUNIX:*) + #PLATFORM=unixware-g++ + PLATFORM=unixware-cc + PLATFORM_NOTES=" + - Also available for OpenUNIX: unixware-g++ + " + ;; + UnixWare:*) + #PLATFORM=unixware-g++ + PLATFORM=unixware-cc + PLATFORM_NOTES=" + - Also available for UnixWare: unixware-g++ + " + ;; + SCO_SV:*) + #PLATFORM=sco-g++ + PLATFORM=sco-cc + PLATFORM_NOTES=" + - Also available for SCO OpenServer: sco-g++ + " + ;; + UNIX_SV:*) + PLATFORM=unixware-g++ + ;; + *) + if [ "$OPT_HELP" != "yes" ]; then + echo + for p in $PLATFORMS; do + echo " $relconf $* -platform $p" + done + echo >&2 + echo " The build script does not currently recognize all" >&2 + echo " platforms supported by Qt." >&2 + echo " Rerun this script with a -platform option listed to" >&2 + echo " set the system/compiler combination you use." >&2 + echo >&2 + exit 2 + fi + esac +fi + +[ -z "$XPLATFORM" ] && XPLATFORM="$PLATFORM" +if [ -d "$PLATFORM" ]; then + QMAKESPEC="$PLATFORM" +else + QMAKESPEC="$relpath/mkspecs/${PLATFORM}" +fi +if [ -d "$XPLATFORM" ]; then + XQMAKESPEC="$XPLATFORM" +else + XQMAKESPEC="$relpath/mkspecs/${XPLATFORM}" +fi +if [ "$PLATFORM" != "$XPLATFORM" ]; then + QMAKE_CONFIG="$QMAKE_CONFIG cross_compile" +fi + +if [ "$PLATFORM_MAC" = "yes" ]; then + if [ `basename $QMAKESPEC` = "macx-xcode" ] || [ `basename $XQMAKESPEC` = "macx-xcode" ]; then + echo >&2 + echo " Platform 'macx-xcode' should not be used when building Qt/Mac." >&2 + echo " Please build Qt/Mac with 'macx-g++', then if you would like to" >&2 + echo " use mac-xcode on your application code it can link to a Qt/Mac" >&2 + echo " built with 'macx-g++'" >&2 + echo >&2 + exit 2 + fi +fi + +# check specified platforms are supported +if [ '!' -d "$QMAKESPEC" ]; then + echo + echo " The specified system/compiler is not supported:" + echo + echo " $QMAKESPEC" + echo + echo " Please see the README file for a complete list." + echo + exit 2 +fi +if [ '!' -d "$XQMAKESPEC" ]; then + echo + echo " The specified system/compiler is not supported:" + echo + echo " $XQMAKESPEC" + echo + echo " Please see the README file for a complete list." + echo + exit 2 +fi +if [ '!' -f "${XQMAKESPEC}/qplatformdefs.h" ]; then + echo + echo " The specified system/compiler port is not complete:" + echo + echo " $XQMAKESPEC/qplatformdefs.h" + echo + echo " Please contact qt-bugs@trolltech.com." + echo + exit 2 +fi + +# now look at the configs and figure out what platform we are config'd for +[ '!' -z "`getQMakeConf \"$XQMAKESPEC\" | grep QMAKE_LIBS_X11 | awk '{print $3;}'`" ] && PLATFORM_X11=yes +### echo "$XQMAKESPEC" | grep mkspecs/qws >/dev/null 2>&1 && PLATFORM_QWS=yes + +if [ "$UNAME_SYSTEM" = "SunOS" ]; then + # Solaris 2.5 and 2.6 have libposix4, which was renamed to librt for Solaris 7 and up + if echo $UNAME_RELEASE | grep "^5\.[5|6]" >/dev/null 2>&1; then + sed -e "s,-lrt,-lposix4," "$XQMAKESPEC/qmake.conf" > "$XQMAKESPEC/qmake.conf.new" + mv "$XQMAKESPEC/qmake.conf.new" "$XQMAKESPEC/qmake.conf" + fi +fi + +#------------------------------------------------------------------------------- +# determine the system architecture +#------------------------------------------------------------------------------- +if [ "$OPT_VERBOSE" = "yes" ]; then + echo "Determining system architecture... ($UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_MACHINE)" +fi + +if [ "$PLATFORM" != "$XPLATFORM" -a "$CFG_EMBEDDED" != "no" ]; then + case "$CFG_EMBEDDED" in + x86) + ARCH=i386 + ;; + x86_64) + ARCH=x86_64 + ;; + ipaq|sharp) + ARCH=arm + ;; + *) + ARCH="$CFG_EMBEDDED" + ;; + esac +else + case "$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_MACHINE" in + IRIX*:*:*) + ARCH=`uname -p` + if [ "$OPT_VERBOSE" = "yes" ]; then + echo " SGI ($ARCH)" + fi + ;; + SunOS:5*:*) + case "$UNAME_MACHINE" in + sun4u*) + if [ "$OPT_VERBOSE" = "yes" ]; then + echo " Sun SPARC (sparc)" + fi + ARCH=sparc + ;; + i86pc) + case "$PLATFORM" in + *-64) + if [ "$OPT_VERBOSE" = "yes" ]; then + echo " 64-bit AMD 80x86 (x86_64)" + fi + ARCH=x86_64 + ;; + *) + if [ "$OPT_VERBOSE" = "yes" ]; then + echo " 32-bit Intel 80x86 (i386)" + fi + ARCH=i386 + ;; + esac + esac + ;; + Darwin:*:*) + case "$UNAME_MACHINE" in + Power?Macintosh) + if [ "$OPT_VERBOSE" = "yes" ]; then + echo " 32-bit Apple PowerPC (powerpc)" + fi + ;; + x86) + if [ "$OPT_VERBOSE" = "yes" ]; then + echo " 32-bit Intel 80x86 (i386)" + fi + ;; + esac + ARCH=macosx + ;; + AIX:*:00????????00) + if [ "$OPT_VERBOSE" = "yes" ]; then + echo " 64-bit IBM PowerPC (powerpc)" + fi + ARCH=powerpc + ;; + HP-UX:*:9000*) + if [ "$OPT_VERBOSE" = "yes" ]; then + echo " HP PA-RISC (parisc)" + fi + ARCH=parisc + ;; + *:*:i?86) + if [ "$OPT_VERBOSE" = "yes" ]; then + echo " 32-bit Intel 80x86 (i386)" + fi + ARCH=i386 + ;; + *:*:x86_64|*:*:amd64) + if [ "$PLATFORM" = "linux-g++-32" ]; then + if [ "$OPT_VERBOSE" = "yes" ]; then + echo " 32 bit on 64-bit AMD 80x86 (i386)" + fi + ARCH=i386 + else + if [ "$OPT_VERBOSE" = "yes" ]; then + echo " 64-bit AMD 80x86 (x86_64)" + fi + ARCH=x86_64 + fi + ;; + *:*:ppc) + if [ "$OPT_VERBOSE" = "yes" ]; then + echo " 32-bit PowerPC (powerpc)" + fi + ARCH=powerpc + ;; + *:*:ppc64) + if [ "$OPT_VERBOSE" = "yes" ]; then + echo " 64-bit PowerPC (powerpc)" + fi + ARCH=powerpc + ;; + *:*:s390*) + if [ "$OPT_VERBOSE" = "yes" ]; then + echo " IBM S/390 (s390)" + fi + ARCH=s390 + ;; + *:*:*) + if [ "$OPT_VERBOSE" = "yes" ]; then + echo " Trying '$UNAME_MACHINE'..." + fi + ARCH="$UNAME_MACHINE" + ;; + esac +fi + +if [ -d "$relpath/src/corelib/arch/$ARCH" ]; then + if [ "$OPT_VERBOSE" = "yes" ]; then + echo " '$ARCH' is supported" + fi +else + if [ "$OPT_VERBOSE" = "yes" ]; then + echo " '$ARCH' is unsupported, using 'generic'" + fi + ARCH=generic +fi + +if [ "$OPT_VERBOSE" = "yes" ]; then + echo "System architecture: '$ARCH'" +fi + +#------------------------------------------------------------------------------- +# tests that don't need qmake (must be run before displaying help) +#------------------------------------------------------------------------------- + +# find the default framework value +if [ "$PLATFORM_MAC" = "yes" ] && [ "$PLATFORM" != "macx-xlc" ]; then + if [ "$CFG_FRAMEWORK" = "auto" ]; then + CFG_FRAMEWORK="$CFG_SHARED" + elif [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_SHARED" = "no" ]; then + echo + echo "WARNING: Using static linking will disable the use of Mac frameworks." + echo + CFG_FRAMEWORK="no" + fi +else + CFG_FRAMEWORK=no +fi + +# find the default universal value +if [ "$PLATFORM_MAC" = "yes" ]; then + if [ "$CFG_UNIVERSAL_BINARY" = "auto" ]; then + CFG_UNIVERSAL_BINARY="no" #any other default? ### + fi +else + CFG_UNIVERSAL_BINARY="no" +fi + +TEST_COMPILER=`getQMakeConf "$XQMAKESPEC" | grep "^QMAKE_CC[^_A-Z0-9]" | sed "s,.* *= *\(.*\)$,\1,"` + +# auto-detect precompiled header support +if [ "$CFG_PRECOMPILE" = "auto" ]; then + if [ "$CFG_UNIVERSAL_BINARY" = "yes" ]; then + CFG_PRECOMPILE=no + elif "$unixtests/precomp.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then + CFG_PRECOMPILE=no + else + CFG_PRECOMPILE=yes + fi +elif [ "$CFG_PRECOMPILE" = "yes" ] && [ "$CFG_UNIVERSAL_BINARY" = "yes" ]; then + echo + echo "WARNING: Using universal binaries disables precompiled headers." + echo + CFG_PRECOMPILE=no +fi + +# auto-detect support for separate debug info in objcopy +if [ "$CFG_SEPARATE_DEBUG_INFO" = "auto" ] && [ "$CFG_SHARED" = "yes" ]; then + COMPILER_WITH_FLAGS="$TEST_COMPILER `getQMakeConf | sed -n -e 's/QMAKE_CFLAGS[^_].*=//p'`" + if "$unixtests/objcopy.test" "$COMPILER_WITH_FLAGS" "$OPT_VERBOSE"; then + CFG_SEPARATE_DEBUG_INFO=no + else + case "$PLATFORM" in + hpux-*) + # binutils on HP-UX is buggy; default to no. + CFG_SEPARATE_DEBUG_INFO=no + ;; + *) + CFG_SEPARATE_DEBUG_INFO=yes + ;; + esac + fi +fi + +# auto-detect -fvisibility support +if [ "$CFG_REDUCE_EXPORTS" = "auto" ]; then + if "$unixtests/fvisibility.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then + CFG_REDUCE_EXPORTS=no + else + CFG_REDUCE_EXPORTS=yes + fi +fi + +# detect sse support +if "$unixtests/sse.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then + CFG_HAVE_SSE=no +else + CFG_HAVE_SSE=yes +fi + +# check iwmmxt support +if [ "$CFG_IWMMXT" = "yes" ]; then + if ! "$unixtests/iwmmxt.test" "$XQMAKESPEC" "$OPT_VERBOSE"; then + echo "The iwmmxt functionality test failed!" + echo " Please make sure your compiler supports iwmmxt intrinsics!" + exit 1 + fi +fi + +#auto-detect GNU make support +if [ "$CFG_USE_GNUMAKE" = "auto" ] && "$MAKE" -v | grep "GNU Make" >/dev/null 2>&1; then + CFG_USE_GNUMAKE=yes +fi + +#mac +if [ "$PLATFORM_MAC" = "yes" ]; then + if [ "$CFG_OPENGL" = "auto" ]; then + CFG_OPENGL=yes + fi +fi + +# find the default framework value +if [ "$PLATFORM_MAC" = "yes" ] && [ "$PLATFORM" != "macx-xlc" ]; then + if [ "$CFG_FRAMEWORK" = "auto" ]; then + CFG_FRAMEWORK="$CFG_SHARED" + elif [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_SHARED" = "no" ]; then + echo + echo "WARNING: Using static linking will disable the use of Mac frameworks." + echo + CFG_FRAMEWORK="no" + fi +else + CFG_FRAMEWORK=no +fi + +# find the default universal value +if [ "$PLATFORM_MAC" = "yes" ]; then + if [ "$CFG_UNIVERSAL_BINARY" = "auto" ]; then + CFG_UNIVERSAL_BINARY="no" #any other default? ### + fi +else + CFG_UNIVERSAL_BINARY="no" +fi + +#x11 tests are done after qmake is built + +# embedded +if [ "$PLATFORM_QWS" = "yes" ]; then + + # No OpenGL by default for Qtopia Core + if [ "$CFG_OPENGL" = "auto" ]; then + CFG_OPENGL=no + fi + +fi # QWS + +#setup the build parts +if [ -z "$CFG_BUILD_PARTS" ]; then + CFG_BUILD_PARTS="$QT_DEFAULT_BUILD_PARTS" + + # don't build tools by default when cross-compiling + if [ "$PLATFORM" != "$XPLATFORM" ]; then + CFG_BUILD_PARTS=`echo "$CFG_BUILD_PARTS" | sed "s, tools,,g"` + fi +fi +for nobuild in $CFG_NOBUILD_PARTS; do + CFG_BUILD_PARTS=`echo "$CFG_BUILD_PARTS" | sed "s, $nobuild,,g"` +done +if echo $CFG_BUILD_PARTS | grep -v libs >/dev/null 2>&1; then +# echo +# echo "WARNING: libs is a required part of the build." +# echo + CFG_BUILD_PARTS="$CFG_BUILD_PARTS libs" +fi + +#------------------------------------------------------------------------------- +# post process QT_INSTALL_* variables +#------------------------------------------------------------------------------- + +#prefix +if [ -z "$QT_INSTALL_PREFIX" ]; then + if [ "$Edition" = "Trolltech" ]; then + QT_INSTALL_PREFIX="$outpath" # At Trolltech, we use sandboxed builds by default + elif [ "$PLATFORM_QWS" = "yes" ]; then + QT_INSTALL_PREFIX="/usr/local/Trolltech/QtopiaCore-${QT_VERSION}" + if [ "$PLATFORM" != "$XPLATFORM" ]; then + QT_INSTALL_PREFIX="${QT_INSTALL_PREFIX}-${ARCH}" + fi + else + QT_INSTALL_PREFIX="/usr/local/Trolltech/Qt-${QT_VERSION}" # the default install prefix is /usr/local/Trolltech/Qt-$QT_VERSION + fi +fi +QT_INSTALL_PREFIX=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_PREFIX"` + +#docs +if [ -z "$QT_INSTALL_DOCS" ]; then #default + if [ "$CFG_PREFIX_INSTALL" = "no" ]; then + if [ "$PLATFORM_MAC" = "yes" ]; then + QT_INSTALL_DOCS="/Developer/Documentation/Qt" + fi + fi + [ -z "$QT_INSTALL_DOCS" ] && QT_INSTALL_DOCS="$QT_INSTALL_PREFIX/doc" #fallback + +fi +QT_INSTALL_DOCS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_DOCS"` + +#headers +if [ -z "$QT_INSTALL_HEADERS" ]; then #default + if [ "$CFG_PREFIX_INSTALL" = "no" ]; then + if [ "$PLATFORM_MAC" = "yes" ]; then + if [ "$CFG_FRAMEWORK" = "yes" ]; then + QT_INSTALL_HEADERS= + fi + fi + fi + [ -z "$QT_INSTALL_HEADERS" ] && QT_INSTALL_HEADERS="$QT_INSTALL_PREFIX/include" + +fi +QT_INSTALL_HEADERS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_HEADERS"` + +#libs +if [ -z "$QT_INSTALL_LIBS" ]; then #default + if [ "$CFG_PREFIX_INSTALL" = "no" ]; then + if [ "$PLATFORM_MAC" = "yes" ]; then + if [ "$CFG_FRAMEWORK" = "yes" ]; then + QT_INSTALL_LIBS="/Libraries/Frameworks" + fi + fi + fi + [ -z "$QT_INSTALL_LIBS" ] && QT_INSTALL_LIBS="$QT_INSTALL_PREFIX/lib" #fallback +fi +QT_INSTALL_LIBS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_LIBS"` + +#bins +if [ -z "$QT_INSTALL_BINS" ]; then #default + if [ "$CFG_PREFIX_INSTALL" = "no" ]; then + if [ "$PLATFORM_MAC" = "yes" ]; then + QT_INSTALL_BINS="/Developer/Applications/Qt" + fi + fi + [ -z "$QT_INSTALL_BINS" ] && QT_INSTALL_BINS="$QT_INSTALL_PREFIX/bin" #fallback + +fi +QT_INSTALL_BINS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_BINS"` + +#plugins +if [ -z "$QT_INSTALL_PLUGINS" ]; then #default + if [ "$CFG_PREFIX_INSTALL" = "no" ]; then + if [ "$PLATFORM_MAC" = "yes" ]; then + QT_INSTALL_PLUGINS="/Developer/Applications/Qt/plugins" + fi + fi + [ -z "$QT_INSTALL_PLUGINS" ] && QT_INSTALL_PLUGINS="$QT_INSTALL_PREFIX/plugins" #fallback +fi +QT_INSTALL_PLUGINS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_PLUGINS"` + +#data +if [ -z "$QT_INSTALL_DATA" ]; then #default + QT_INSTALL_DATA="$QT_INSTALL_PREFIX" +fi +QT_INSTALL_DATA=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_DATA"` + +#translations +if [ -z "$QT_INSTALL_TRANSLATIONS" ]; then #default + QT_INSTALL_TRANSLATIONS="$QT_INSTALL_PREFIX/translations" +fi +QT_INSTALL_TRANSLATIONS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_TRANSLATIONS"` + +#settings +if [ -z "$QT_INSTALL_SETTINGS" ]; then #default + if [ "$PLATFORM_MAC" = "yes" ]; then + QT_INSTALL_SETTINGS=/Library/Preferences/Qt + else + QT_INSTALL_SETTINGS=/etc/xdg + fi +fi +QT_INSTALL_SETTINGS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_SETTINGS"` + +#examples +if [ -z "$QT_INSTALL_EXAMPLES" ]; then #default + if [ "$CFG_PREFIX_INSTALL" = "no" ]; then + if [ "$PLATFORM_MAC" = "yes" ]; then + QT_INSTALL_EXAMPLES="/Developer/Examples/Qt" + fi + fi + [ -z "$QT_INSTALL_EXAMPLES" ] && QT_INSTALL_EXAMPLES="$QT_INSTALL_PREFIX/examples" #fallback +fi +QT_INSTALL_EXAMPLES=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_EXAMPLES"` + +#demos +if [ -z "$QT_INSTALL_DEMOS" ]; then #default + if [ "$CFG_PREFIX_INSTALL" = "no" ]; then + if [ "$PLATFORM_MAC" = "yes" ]; then + QT_INSTALL_DEMOS="/Developer/Examples/Qt/Demos" + fi + fi + [ -z "$QT_INSTALL_DEMOS" ] && QT_INSTALL_DEMOS="$QT_INSTALL_PREFIX/demos" +fi +QT_INSTALL_DEMOS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_DEMOS"` + +#------------------------------------------------------------------------------- +# help - interactive parts of the script _after_ this section please +#------------------------------------------------------------------------------- + +# next, emit a usage message if something failed. +if [ "$OPT_HELP" = "yes" ]; then + [ "x$ERROR" = "xyes" ] && echo + if [ "$CFG_NIS" = "no" ]; then + NSY=" " + NSN="*" + else + NSY="*" + NSN=" " + fi + if [ "$CFG_CUPS" = "no" ]; then + CUY=" " + CUN="*" + else + CUY="*" + CUN=" " + fi + if [ "$CFG_ICONV" = "no" ]; then + CIY=" " + CIN="*" + else + CIY="*" + CIN=" " + fi + if [ "$CFG_LARGEFILE" = "no" ]; then + LFSY=" " + LFSN="*" + else + LFSY="*" + LFSN=" " + fi + if [ "$CFG_STL" = "auto" ] || [ "$CFG_STL" = "yes" ]; then + SHY="*" + SHN=" " + else + SHY=" " + SHN="*" + fi + if [ "$CFG_IPV6" = "auto" ]; then + I6Y="*" + I6N=" " + fi + if [ "$CFG_PRECOMPILE" = "auto" ] || [ "$CFG_PRECOMPILE" = "no" ]; then + PHY=" " + PHN="*" + else + PHY="*" + PHN=" " + fi + if [ "$CFG_SEPARATE_DEBUG_INFO" = "auto" ] || [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then + SBY="*" + SBN=" " + else + SBY=" " + SBN="*" + fi + + cat <<EOF +Usage: $relconf [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-libdir <dir>] + [-docdir <dir>] [-headerdir <dir>] [-plugindir <dir> ] [-datadir <dir>] + [-translationdir <dir>] [-sysconfdir <dir>] [-examplesdir <dir>] + [-demosdir <dir>] [-buildkey <key>] [-release] [-debug] + [-debug-and-release] [-shared] [-static] [-no-fast] [-fast] [-no-largefile] + [-largefile] [-no-exceptions] [-exceptions] [-no-accessibility] + [-accessibility] [-no-stl] [-stl] [-no-sql-<driver>] [-sql-<driver>] + [-plugin-sql-<driver>] [-system-sqlite] [-no-qt3support] [-qt3support] + [-platform] [-D <string>] [-I <string>] [-L <string>] [-help] [-no-zlib] + [-qt-zlib] [-system-zlib] [-no-gif] [-qt-gif] [-no-libpng] [-qt-libpng] + [-system-libpng] [-no-libmng] [-qt-libmng] [-system-libmng] [-no-libjpeg] + [-qt-libjpeg] [-system-libjpeg] [-make <part>] [-no-make <part>] + [-R <string>] [-l <string>] [-no-rpath] [-rpath] [-continue] + [-verbose] [-v] [-silent] [-no-nis] [-nis] [-no-cups] [-cups] [-no-iconv] + [-iconv] [-no-pch] [-pch] [-no-qdbus] [-qdbus] [-no-separate-debug-info] + [-separate-debug-info] + + [additional platform specific options (see below)] + + +Installation options: + + These are optional, but you may specify install directories. + + -prefix <dir> ...... This will install everything relative to <dir> + (default $QT_INSTALL_PREFIX) + + * -prefix-install .... Force a sandboxed "local" installation of + Qt. This will install into + $QT_INSTALL_PREFIX, if this option is + disabled then some platforms will attempt a + "system" install by placing default values to + be placed in a system location other than + PREFIX. + + You may use these to separate different parts of the install: + + -bindir <dir> ......... Executables will be installed to <dir> + (default PREFIX/bin) + -libdir <dir> ......... Libraries will be installed to <dir> + (default PREFIX/lib) + -docdir <dir> ......... Documentation will be installed to <dir> + (default PREFIX/doc) + -headerdir <dir> ...... Headers will be installed to <dir> + (default PREFIX/include) + -plugindir <dir> ...... Plugins will be installed to <dir> + (default PREFIX/plugins) + -datadir <dir> ........ Data used by Qt programs will be installed to <dir> + (default PREFIX) + -translationdir <dir>.. Translations of Qt programs will be installed to <dir> + (default PREFIX/translations) + -sysconfdir <dir> ..... Settings used by Qt programs will be looked for in <dir> + (default PREFIX/etc/settings) + -examplesdir <dir> .... Examples will be installed to <dir> + (default PREFIX/examples) + -demosdir <dir> ....... Demos will be installed to <dir> + (default PREFIX/demos) + + You may use these options to turn on strict plugin loading. + + -buildkey <key> .... Build the Qt library and plugins using the specified + <key>. When the library loads plugins, it will only + load those that have a matching key. + +Configure options: + + The defaults (*) are usually acceptable. A plus (+) denotes a default value + that needs to be evaluated. If the evaluation succeeds, the feature is + included. Here is a short explanation of each option: + + * -release ........... Compile and link Qt with debugging turned off. + -debug ............. Compile and link Qt with debugging turned on. + -debug-and-release . Compile and link two versions of Qt, with and without + debugging turned on. [Mac only] + + * -shared ............ Create and use shared Qt libraries. + -static ............ Create and use static Qt libraries. + + * -no-fast ........... Configure Qt normally by generating Makefiles for all + project files. + -fast .............. Configure Qt quickly by generating Makefiles only for + library and subdirectory targets. All other Makefiles + are created as wrappers, which will in turn run qmake. + + -no-largefile....... Disables large file support. + + -largefile.......... Enables Qt to access files larger than 4 GB. + +EOF +if [ "$PLATFORM_QWS" = "yes" ]; then + EXCN="*" + EXCY=" " +else + EXCN=" " + EXCY="*" +fi +if [ "$CFG_QDBUS" = "no" ]; then + DBY=" " + DBN="+" +else + DBY="+" + DBN=" " +fi + cat << EOF + $EXCN -no-exceptions ..... Disable exceptions on compilers that support it. + $EXCY -exceptions ........ Enable exceptions on compilers that support it. + + -no-accessibility .. Do not compile Accessibility support. + * -accessibility ..... Compile Accessibility support. + + $SHN -no-stl ............ Do not compile STL support. + $SHY -stl ............... Compile STL support. + + -no-sql-<driver> ... Disable SQL <driver> entirely. + -qt-sql-<driver> ... Enable a SQL <driver> in the QtSql library, by default + none are turned on. + -plugin-sql-<driver> Enable SQL <driver> as a plugin to be linked to + at run time. + + Possible values for <driver>: + [ $CFG_SQL_AVAILABLE ] + + -system-sqlite ..... Use sqlite from the operating system. + + -no-qt3support ..... Disables the Qt 3 support functionality. + * -qt3support ........ Enables the Qt 3 support functionality. + + -platform target ... The operating system and compiler you are building + on ($PLATFORM). + + See the README file for a list of supported + operating systems and compilers. + + -D <string> ........ Add an explicit define to the preprocessor. + -I <string> ........ Add an explicit include path. + -L <string> ........ Add an explicit library path. + + -help, -h .......... Display this information. + +Third Party Libraries: + + -no-zlib ........... Do not compile in ZLIB support. Implies -no-libpng. + -qt-zlib ........... Use the zlib bundled with Qt. + + -system-zlib ....... Use zlib from the operating system. + See http://www.gzip.org/zlib + + * -no-gif ............ Do not compile the plugin for GIF reading support. + -qt-gif ............ Compile the plugin for GIF reading support. + See also src/plugins/imageformats/gif/qgifhandler.h + + -no-libpng ......... Do not compile in PNG support. + -qt-libpng ......... Use the libpng bundled with Qt. + + -system-libpng ..... Use libpng from the operating system. + See http://www.libpng.org/pub/png + + -no-libmng ......... Do not compile the plugin for MNG support. + -qt-libmng ......... Use the libmng bundled with Qt. + + -system-libmng ..... Use libmng from the operating system. + See http://www.libmng.com + + -no-libjpeg ........ Do not compile the plugin for JPEG support. + -qt-libjpeg ........ Use the libjpeg bundled with Qt. + + -system-libjpeg .... Use libjpeg from the operating system. + See http://www.ijg.org + +Additional options: + + -make <part> ....... Add part to the list of parts to be built at make time. + ($QT_DEFAULT_BUILD_PARTS) + -nomake <part> ..... Exclude part from the list of parts to be built. + + -R <string> ........ Add an explicit runtime library path to the Qt + libraries. + -l <string> ........ Add an explicit library. + + -no-rpath .......... Do not use the library install path as a runtime + library path. + + -rpath ............. Link Qt libraries and executables using the library + install path as a runtime library path. Equivalent + to -R install_libpath + + -continue........... Continue as far as possible if an error occurs. + + -verbose, -v ....... Print verbose information about each step of the + configure process. + + -silent ............ Reduce the build output so that warnings and errors + can be seen more easily. + + $NSN -no-nis ............ Do not compile NIS support. + $NSY -nis ............... Compile NIS support. + + $CUN -no-cups............ Do not compile CUPS support. + $CUY -cups .............. Compile CUPS support. + + $CIN -no-iconv........... Do not compile support for iconv(3). + $CIY -iconv.............. Compile support for iconv(3). + + $PHN -no-pch ............ Do not use precompiled header support. + $PHY -pch ............... Use precompiled header support. + + $DBN -no-qdbus........... Do not compile the QtDBus module. + $DBY -qdbus.............. Compile the QtDBus module. + + $SBN -no-separate-debug-info Do not store debug information in a separate file + $SBY -separate-debug-info Strip debug information into a separate .debug file + +EOF + +if [ "$PLATFORM_X11" = "yes" ]; then + if [ "$CFG_SM" = "no" ]; then + SMY=" " + SMN="*" + else + SMY="*" + SMN=" " + fi + if [ "$CFG_XSHAPE" = "no" ]; then + SHY=" " + SHN="*" + else + SHY="*" + SHN=" " + fi + if [ "$CFG_XINERAMA" = "no" ]; then + XRY=" " + XRN="*" + else + XRY="*" + XRN=" " + fi + if [ "$CFG_FONTCONFIG" = "no" ]; then + FCGY=" " + FCGN="*" + else + FCGY="*" + FCGN=" " + fi + if [ "$CFG_XCURSOR" = "no" ]; then + XCY=" " + XCN="*" + else + XCY="*" + XCN=" " + fi + if [ "$CFG_XRANDR" = "no" ]; then + XZY=" " + XZN="*" + else + XZY="*" + XZN=" " + fi + if [ "$CFG_XRENDER" = "no" ]; then + XRY=" " + XRN="*" + else + XRY="*" + XRN=" " + fi + if [ "$CFG_TABLET" = "no" ]; then + XIY=" " + XIN="*" + else + XIY="*" + XIN=" " + fi + if [ "$CFG_XKB" = "no" ]; then + XKY=" " + XKN="*" + else + XKY="*" + XKN=" " + fi + if [ "$CFG_IM" = "no" ]; then + IMY=" " + IMN="*" + else + IMY="*" + IMN=" " + fi + if [ "$CFG_GLIB" = "no" ]; then + GBY=" " + GBN="+" + else + GBY="+" + GBN=" " + fi + cat << EOF + +Qt/X11 only: + + * -no-nas-sound ...... Do not compile in NAS sound support. + -system-nas-sound .. Use NAS libaudio from the operating system. + See http://radscan.com/nas.html + + -no-opengl.......... Do not support OpenGL. + + -opengl............. Enable OpenGL support. + + $SMN -no-sm ............. Do not support X Session Management. + $SMY -sm ................ Support X Session Management, links in -lSM -lICE. + + $SHN -no-xshape ......... Do not compile XShape support. + $SHY -xshape ............ Compile XShape support. + Requires X11/extensions/shape.h. + + $XRN -no-xinerama ....... Do not compile Xinerama (multihead) support. + $XRY -xinerama .......... Compile Xinerama support. + Requires X11/extensions/Xinerama.h and libXinerama. + + $XCN -no-xcursor ........ Do not compile Xcursor support. + $XCY -xcursor ........... Compile Xcursor support. + Requires X11/Xcursor/Xcursor.h and libXcursor. + + $XCN -no-xfixes ......... Do not compile Xfixes support. + $XCY -xfixes ............ Compile Xfixes support. + Requires X11/extensions/Xfixes.h and libXfixes. + + $XZN -no-xrandr ......... Do not compile Xrandr (resize and rotate) support. + $XZY -xrandr ............ Compile Xrandr support. + Requires X11/extensions/Xrandr.h and libXrandr. + + $XRN -no-xrender ........ Do not compile Xrender support. + $XRY -xrender ........... Compile Xrender support. + Requires X11/extensions/Xrender.h and libXrender + + $FCGN -no-fontconfig ..... Do not compile FontConfig (anti-aliased font) support. + $FCGY -fontconfig ........ Compile FontConfig support. + Requires fontconfig/fontconfig.h, libfontconfig, + freetype.h and libfreetype. + + $XIN -no-tablet ......... Do not compile Tablet support. + $XIY -tablet ............ Compile Tablet support. + Requires IRIX with wacom.h and libXi or + XFree86 with X11/extensions/XInput.h and libXi. + + $XKN -no-xkb ............ Do not compile XKB (X KeyBoard extension) support. + $XKY -xkb ............... Compile XKB support. + + $GBN -no-glib............ Do not compile Glib support. + $GBY -glib............... Compile Glib support. + +EOF +fi + +if [ "$PLATFORM_MAC" = "yes" ]; then + cat << EOF + +Qt/Mac only: + + -Fstring ........... Add an explicit framework path. + -fw string ......... Add an explicit framework. + + * -framework ......... Build Qt as a series of frameworks and + link tools against those frameworks. + -no-framework ...... Do not build Qt as a series of frameworks. + + -universal ......... Build Qt as a universal binary to work on intel + as well as PPC platforms. + * -no-universal ...... Build Qt and its tools to work only on this host platform. + + -sdk <sdk>.......... Build Qt using Apple provided SDK <sdk>. + +EOF +fi + +if [ "$PLATFORM_QWS" = "yes" ]; then + cat << EOF + +Qtopia Core only: + + -xplatform target ... The target platform when cross-compiling. + + -no-feature-<feature> Do not compile in <feature>. + -feature-<feature> .. Compile in <feature>. The available features + are described in src/corelib/global/qfeatures.txt + + -embedded <arch>..... This will enable the embedded build, you must have a + proper license for this switch to work. + Example values for <arch>: arm mips x86 generic + + -little-endian ...... Target platform is little endian (LSB first). + -big-endian ......... Target platform is big endian (MSB first). + + You only need to specify the endianness when + cross-compiling, otherwise the host + endianness will be used. + + -no-freetype ........ Do not compile in Freetype2 support. + -qt-freetype ........ Use the libfreetype bundled with Qt. + * -system-libfreetype. Use libfreetype from the operating system. + See http://www.freetype.org/ + + -qconfig local ...... Use src/corelib/global/qconfig-local.h rather than the + default ($CFG_QCONFIG). + + -depths <list> ...... Comma-separated list of supported bit-per-pixel + depths, from: 4, 8, 16, 18, 24, and 32. + + -qt-decoration-<style> ....Enable a decoration <style> in the QtGui library, + by default all available decorations are on. + Possible values for <style>: [ $CFG_DECORATION_AVAILABLE ] + -plugin-decoration-<style> Enable decoration <style> as a plugin to be + linked to at run time. + Possible values for <style>: [ $CFG_DECORATION_PLUGIN_AVAILABLE ] + -no-decoration-<style> ....Disable decoration <style> entirely. + Possible values for <style>: [ $CFG_DECORATION_AVAILABLE ] + + -qt-gfx-<driver> ... Enable a graphics <driver> in the QtGui library. + Possible values for <driver>: [ $CFG_GFX_AVAILABLE ] + -plugin-gfx-<driver> Enable graphics <driver> as a plugin to be + linked to at run time. + Possible values for <driver>: [ $CFG_GFX_PLUGIN_AVAILABLE ] + -no-gfx-<driver> ... Disable graphics <driver> entirely. + Possible values for <driver>: [ $CFG_GFX_AVAILABLE ] + + -qt-kbd-<driver> ... Enable a keyboard <driver> in the QtGui library. + -no-kbd-<driver> ... Disable keyboard <driver> entirely. + + Possible values for <driver>: [ $CFG_KBD_AVAILABLE ] + + -qt-mouse-<driver> ... Enable a mouse <driver> in the QtGui library. + Possible values for <driver>: [ $CFG_MOUSE_AVAILABLE ] + -plugin-mouse-<driver> Enable mouse <driver> as a plugin to be + linked to at runtime. + Possible values for <driver>: [ $CFG_MOUSE_PLUGIN_AVAILABLE ] + -no-mouse-<driver> ... Disable mouse <driver> entirely. + Possible values for <driver>: [ $CFG_MOUSE_AVAILABLE ] + + -iwmmxt............. Compile using the iWMMXt instruction set + (available on some XScale CPUs). + +EOF +fi + + [ "x$ERROR" = "xyes" ] && exit 1 + exit 0 +fi # Help + + +# ----------------------------------------------------------------------------- +# LICENSING, INTERACTIVE PART +# ----------------------------------------------------------------------------- + +if [ "$Edition" = "Qtopia" ]; then + TheLicense=`head -n 1 "$relpath/LICENSE.Qtopia"` + while true; do + if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then + echo "You have already accepted the terms of the $TheLicense license." + acceptance=yes + else + echo "You are licensed to use this software under the terms of" + echo "the $TheLicense" + echo + echo "Type '?' to read the $TheLicense" + echo "Type 'yes' to accept this license offer." + echo "Type 'no' to decline this license offer." + echo + if echo '\c' | grep '\c' >/dev/null; then + echo -n "Do you accept the terms of the license? " + else + echo "Do you accept the terms of the license? \c" + fi + read acceptance + fi + echo + if [ "$acceptance" = "yes" ]; then + break + elif [ "$acceptance" = "no" ] ;then + echo "You are not licensed to use this software." + echo + exit 0 + elif [ "$acceptance" = "?" ]; then + more "$relpath/LICENSE.Qtopia" + fi + done +elif [ "$Edition" = "OpenSource" ]; then + while true; do + if [ "$PLATFORM_QWS" = "yes" ]; then + echo "You are licensed to use this software under the terms of" + echo "the GNU General Public License (GPL)." + echo + affix="the" + elif [ "$PLATFORM_MAC" = "yes" ]; then + echo "You are licensed to use this software under the terms of" + echo "the GNU General Public License (GPL)." + echo + affix="the" + elif [ "$PLATFORM_X11" = "yes" ]; then + echo "You are licensed to use this software under the terms of either" + echo "the Q Public License (QPL) or the GNU General Public License (GPL)." + echo + [ "$OPT_CONFIRM_LICENSE" = "no" ] && echo "Type 'Q' to view the Q Public License." + affix="either" + fi + if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then + echo "You have already accepted the terms of the $LicenseType license." + acceptance=yes + else + echo "Type 'G' to view the GNU General Public License." + echo "Type 'yes' to accept this license offer." + echo "Type 'no' to decline this license offer." + echo + if echo '\c' | grep '\c' >/dev/null; then + echo -n "Do you accept the terms of $affix license? " + else + echo "Do you accept the terms of $affix license? \c" + fi + read acceptance + fi + echo + if [ "$acceptance" = "yes" ]; then + break + elif [ "$acceptance" = "no" ]; then + echo "You are not licensed to use this software." + echo + exit 1 + elif [ "$acceptance" = "G" -o "$acceptance" = "g" ]; then + more "$relpath/LICENSE.GPL" + elif [ "$acceptance" = "Q" -o "$acceptance" = "q" ]; then + if [ "$PLATFORM_QWS" != "yes" ]; then + more "$relpath/LICENSE.QPL" + fi + fi + done +elif [ "$Edition" = "Preview" ]; then + while true; do + if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then + echo "You have already accepted the terms of the $LicenseType license." + acceptance=yes + else + echo "You are licensed to use this software under the terms of" + echo "the Qt PREVIEW VERSION LICENSE AGREEMENT" + echo + echo "Type '?' to read the Preview License." + echo "Type 'yes' to accept this license offer." + echo "Type 'no' to decline this license offer." + echo + if echo '\c' | grep '\c' >/dev/null; then + echo -n "Do you accept the terms of the license? " + else + echo "Do you accept the terms of the license? \c" + fi + read acceptance + fi + echo + if [ "$acceptance" = "yes" ]; then + break + elif [ "$acceptance" = "no" ] ;then + echo "You are not licensed to use this software." + echo + exit 0 + elif [ "$acceptance" = "?" ]; then + if [ "$QT_EDITION" = "QT_EDITION_OPENSOURCE" ]; then + more "$relpath/LICENSE.PREVIEW.OPENSOURCE" + else + more "$relpath/LICENSE.PREVIEW.COMMERCIAL" + fi + fi + done +elif [ "$Edition" != "Trolltech" ]; then + if [ -n "$ExpiryDate" ]; then + ExpiryDate=`echo $ExpiryDate | sed -e "s,-,,g" | tr -d "\n\r"` + [ -z "$ExpiryDate" ] && ExpiryDate="0" + Today=`date +%Y%m%d` + if [ "$Today" -gt "$ExpiryDate" ]; then + case "$LicenseType" in + Commercial|Academic|Educational) + if [ "$QT_PACKAGEDATE" -gt "$ExpiryDate" ]; then + echo + echo "NOTICE NOTICE NOTICE NOTICE" + echo + echo " Your support and upgrade period has expired." + echo + echo " You are no longer licensed to use this version of Qt." + echo " Please contact sales@trolltech.com to renew your support" + echo " and upgrades for this license." + echo + echo "NOTICE NOTICE NOTICE NOTICE" + echo + exit 1 + else + echo + echo "WARNING WARNING WARNING WARNING" + echo + echo " Your support and upgrade period has expired." + echo + echo " You may continue to use your last licensed release" + echo " of Qt under the terms of your existing license" + echo " agreement. But you are not entitled to technical" + echo " support, nor are you entitled to use any more recent" + echo " Qt releases." + echo + echo " Please contact sales@trolltech.com to renew your" + echo " support and upgrades for this license." + echo + echo "WARNING WARNING WARNING WARNING" + echo + sleep 3 + fi + ;; + Evaluation|*) + echo + echo "NOTICE NOTICE NOTICE NOTICE" + echo + echo " Your Evaluation license has expired." + echo + echo " You are no longer licensed to use this software. Please" + echo " contact sales@trolltech.com to purchase license, or install" + echo " the Qt Open Source Edition if you intend to develop free" + echo " software." + echo + echo "NOTICE NOTICE NOTICE NOTICE" + echo + exit 1 + ;; + esac + fi + fi + TheLicense=`head -n 1 "$outpath/LICENSE"` + while true; do + if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then + echo "You have already accepted the terms of the $TheLicense." + acceptance=yes + else + echo "You are licensed to use this software under the terms of" + echo "the $TheLicense." + echo + echo "Type '?' to view the $TheLicense." + echo "Type 'yes' to accept this license offer." + echo "Type 'no' to decline this license offer." + echo + if echo '\c' | grep '\c' >/dev/null; then + echo -n "Do you accept the terms of the $TheLicense? " + else + echo "Do you accept the terms of the $TheLicense? \c" + fi + read acceptance + fi + echo + if [ "$acceptance" = "yes" ]; then + break + elif [ "$acceptance" = "no" ]; then + echo "You are not licensed to use this software." + echo + exit 1 + else [ "$acceptance" = "?" ] + more "$outpath/LICENSE" + fi + done +fi + +# this should be moved somewhere else +case "$PLATFORM" in +aix-*) + AIX_VERSION=`uname -v` + if [ "$AIX_VERSION" -lt "5" ]; then + QMakeVar add QMAKE_LIBS_X11 -lbind + fi + ;; +*) + ;; +esac + +#------------------------------------------------------------------------------- +# generate qconfig.cpp +#------------------------------------------------------------------------------- +[ -d "$outpath/src/corelib/global" ] || mkdir -p "$outpath/src/corelib/global" + +LICENSE_USER_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_lcnsuser=$Licensee" "\\0"` +LICENSE_PRODUCTS_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_lcnsprod=$Edition" "\\0"` +PREFIX_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_prfxpath=$QT_INSTALL_PREFIX" "\\0"` +DOCUMENTATION_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_docspath=$QT_INSTALL_DOCS" "\\0"` +HEADERS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_hdrspath=$QT_INSTALL_HEADERS" "\\0"` +LIBRARIES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_libspath=$QT_INSTALL_LIBS" "\\0"` +BINARIES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_binspath=$QT_INSTALL_BINS" "\\0"` +PLUGINS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_plugpath=$QT_INSTALL_PLUGINS" "\\0"` +DATA_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_datapath=$QT_INSTALL_DATA" "\\0"` +TRANSLATIONS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_trnspath=$QT_INSTALL_TRANSLATIONS" "\\0"` +SETTINGS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_stngpath=$QT_INSTALL_SETTINGS" "\\0"` +EXAMPLES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_xmplpath=$QT_INSTALL_EXAMPLES" "\\0"` +DEMOS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_demopath=$QT_INSTALL_DEMOS" "\\0"` + +cat > "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF +/* License Info */ +static const char qt_configure_licensee_str [256 + 12] = "$LICENSE_USER_STR"; +static const char qt_configure_licensed_products_str [256 + 12] = "$LICENSE_PRODUCTS_STR"; +/* Installation Info */ +static const char qt_configure_prefix_path_str [256 + 12] = "$PREFIX_PATH_STR"; +static const char qt_configure_documentation_path_str[256 + 12] = "$DOCUMENTATION_PATH_STR"; +static const char qt_configure_headers_path_str [256 + 12] = "$HEADERS_PATH_STR"; +static const char qt_configure_libraries_path_str [256 + 12] = "$LIBRARIES_PATH_STR"; +static const char qt_configure_binaries_path_str [256 + 12] = "$BINARIES_PATH_STR"; +static const char qt_configure_plugins_path_str [256 + 12] = "$PLUGINS_PATH_STR"; +static const char qt_configure_data_path_str [256 + 12] = "$DATA_PATH_STR"; +static const char qt_configure_translations_path_str [256 + 12] = "$TRANSLATIONS_PATH_STR"; +static const char qt_configure_settings_path_str [256 + 12] = "$SETTINGS_PATH_STR"; +static const char qt_configure_examples_path_str [256 + 12] = "$EXAMPLES_PATH_STR"; +static const char qt_configure_demos_path_str [256 + 12] = "$DEMOS_PATH_STR"; +/* strlen( "qt_lcnsxxxx" ) == 12 */ +#define QT_CONFIGURE_LICENSEE qt_configure_licensee_str + 12; +#define QT_CONFIGURE_LICENSED_PRODUCTS qt_configure_licensed_products_str + 12; +#define QT_CONFIGURE_PREFIX_PATH qt_configure_prefix_path_str + 12; +#define QT_CONFIGURE_DOCUMENTATION_PATH qt_configure_documentation_path_str + 12; +#define QT_CONFIGURE_HEADERS_PATH qt_configure_headers_path_str + 12; +#define QT_CONFIGURE_LIBRARIES_PATH qt_configure_libraries_path_str + 12; +#define QT_CONFIGURE_BINARIES_PATH qt_configure_binaries_path_str + 12; +#define QT_CONFIGURE_PLUGINS_PATH qt_configure_plugins_path_str + 12; +#define QT_CONFIGURE_DATA_PATH qt_configure_data_path_str + 12; +#define QT_CONFIGURE_TRANSLATIONS_PATH qt_configure_translations_path_str + 12; +#define QT_CONFIGURE_SETTINGS_PATH qt_configure_settings_path_str + 12; +#define QT_CONFIGURE_EXAMPLES_PATH qt_configure_examples_path_str + 12; +#define QT_CONFIGURE_DEMOS_PATH qt_configure_demos_path_str + 12; +EOF + +# avoid unecessary rebuilds by copying only if qconfig.cpp has changed +if cmp -s "$outpath/src/corelib/global/qconfig.cpp" "$outpath/src/corelib/global/qconfig.cpp.new"; then + rm -f "$outpath/src/corelib/global/qconfig.cpp.new" +else + [ -f "$outpath/src/corelib/global/qconfig.cpp" ] && chmod +w "$outpath/src/corelib/global/qconfig.cpp" + mv "$outpath/src/corelib/global/qconfig.cpp.new" "$outpath/src/corelib/global/qconfig.cpp" + chmod -w "$outpath/src/corelib/global/qconfig.cpp" +fi + +# ----------------------------------------------------------------------------- +# build qmake +# ----------------------------------------------------------------------------- + +# symlink includes +if [ -x "/usr/bin/perl" ] && [ -x "$relpath/bin/syncqt" ]; then + SYNCQT_OPTS= + [ "$Edition" = "Trolltech" ] && SYNCQT_OPTS="$SYNCQT_OPTS -check-includes" + if [ "$OPT_SHADOW" = "yes" ]; then + "$outpath/bin/syncqt" $SYNCQT_OPTS + elif [ "$Edition" = "Trolltech" ]; then + QTDIR="$relpath" perl "$outpath/bin/syncqt" $SYNCQT_OPTS + fi +fi + +if [ "$OPT_SHADOW" = "yes" ]; then + # we are doing a shadow build, so we need to use the includes from + # $outpath/include as well + QMakeVar add INCLUDEPATH "\"${outpath}/include\"" +fi + +# $1: variable name +# $2: optional transformation +# relies on $QMAKESPEC, $COMPILER_CONF and $mkfile being set correctly, as the latter +# is where the resulting variable is written to +setBootstrapVariable() +{ + variableRegExp="$1[^_A-Z0-9]" + getQMakeConf | grep "$variableRegExp" | ( [ -n "$2" ] && sed "$2" ; [ -z "$2" ] && cat ) | $AWK ' +{ + varLength = index($0, "=") - 1 + valStart = varLength + 2 + if (substr($0, varLength, 1) == "+") { + varLength = varLength - 1 + valStart = valStart + 1 + } + var = substr($0, 0, varLength) + gsub("[ \t]+", "", var) + val = substr($0, valStart) + printf "%s_%s = %s\n", var, NR, val +} +END { + if (length(var) > 0) { + printf "%s = ", var + for (i = 1; i <= NR; ++i) + printf "$(%s_%s) ", var, i + printf "\n" + } +}' >> "$mkfile" +} + +# build qmake +if false; then ###[ '!' -f "$outpath/bin/qmake" ]; + echo "Creating qmake. Please wait..." + + OLD_QCONFIG_H= + QCONFIG_H="$outpath/src/corelib/global/qconfig.h" + QMAKE_QCONFIG_H="${QCONFIG_H}.qmake" + if [ -f "$QCONFIG_H" ]; then + OLD_QCONFIG_H=$QCONFIG_H + mv -f "$OLD_QCONFIG_H" "${OLD_QCONFIG_H}.old" + fi + + # create temporary qconfig.h for compiling qmake, if it doesn't exist + # when building qmake, we use #defines for the install paths, + # however they are real functions in the library + if [ '!' -f "$QMAKE_QCONFIG_H" ]; then + mkdir -p "$outpath/src/corelib/global" + [ -f "$QCONFIG_H" ] && chmod +w "$QCONFIG_H" + echo "/* All features enabled while building qmake */" >"$QMAKE_QCONFIG_H" + fi + + mv -f "$QMAKE_QCONFIG_H" "$QCONFIG_H" + for conf in "$outpath/include/QtCore/qconfig.h" "$outpath/include/Qt/qconfig.h"; do + if [ '!' -f "$conf" ]; then + ln -s "$QCONFIG_H" "$conf" + fi + done + + #mkspecs/default is used as a (gasp!) default mkspec so QMAKESPEC needn't be set once configured + rm -f mkspecs/default + ln -s `echo $XQMAKESPEC | sed "s,^${relpath}/mkspecs/,,"` mkspecs/default + # fix makefiles + for mkfile in GNUmakefile Makefile; do + EXTRA_LFLAGS= + EXTRA_CFLAGS= + in_mkfile="${mkfile}.in" + if [ "$mkfile" = "Makefile" ]; then +# if which qmake >/dev/null 2>&1 && [ -f qmake/qmake.pro ]; then +# (cd qmake && qmake) >/dev/null 2>&1 && continue +# fi + in_mkfile="${mkfile}.unix" + fi + in_mkfile="$relpath/qmake/$in_mkfile" + mkfile="$outpath/qmake/$mkfile" + if [ -f "$mkfile" ]; then + [ "$Edition" = "Trolltech" ] && "$WHICH" chflags >/dev/null 2>&1 && chflags nouchg "$mkfile" + rm -f "$mkfile" + fi + [ -f "$in_mkfile" ] || continue + + echo "########################################################################" >$mkfile + echo "## This file was autogenerated by configure, all changes will be lost ##" >>$mkfile + echo "########################################################################" >>$mkfile + EXTRA_OBJS= + EXTRA_SRCS= + EXTRA_CFLAGS="\$(QMAKE_CFLAGS)" + EXTRA_CXXFLAGS="\$(QMAKE_CXXFLAGS)" + EXTRA_LFLAGS="\$(QMAKE_LFLAGS)" + + if [ "$CFG_SILENT" = "yes" ]; then + setBootstrapVariable QMAKE_CC 's,QMAKE_CC.*=,CC=\@,' + setBootstrapVariable QMAKE_CXX 's,QMAKE_CXX.*=,CXX=\@,' + else + setBootstrapVariable QMAKE_CC 's,QMAKE_CC,CC,' + setBootstrapVariable QMAKE_CXX 's,QMAKE_CXX,CXX,' + fi + setBootstrapVariable QMAKE_CFLAGS + setBootstrapVariable QMAKE_CXXFLAGS 's,\$\$QMAKE_CFLAGS,\$(QMAKE_CFLAGS),' + setBootstrapVariable QMAKE_LFLAGS + + if [ $QT_EDITION = "QT_EDITION_OPENSOURCE" ]; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -DQMAKE_OPENSOURCE_EDITION" + EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -DQMAKE_OPENSOURCE_EDITION" + else + echo "include Makefile.commercial" >>"$mkfile" + fi + if [ "$CFG_DEBUG" = "yes" ]; then + setBootstrapVariable QMAKE_CFLAGS_DEBUG + setBootstrapVariable QMAKE_CXXFLAGS_DEBUG 's,\$\$QMAKE_CFLAGS_DEBUG,\$(QMAKE_CFLAGS_DEBUG),' + EXTRA_CFLAGS="$EXTRA_CFLAGS \$(QMAKE_CFLAGS_DEBUG)" + EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(QMAKE_CXXFLAGS_DEBUG)" + fi + if [ '!' -z "$RPATH_FLAGS" ] && [ '!' -z "`getQMakeConf \"$QMAKESPEC\" | grep QMAKE_RPATH | awk '{print $3;}'`" ]; then + setBootstrapVariable QMAKE_RPATH 's,\$\$LITERAL_WHITESPACE, ,' + for rpath in $RPATH_FLAGS; do + EXTRA_LFLAGS="\$(QMAKE_RPATH)\"$rpath\" $EXTRA_LFLAGS" + done + fi + if [ "$PLATFORM_MAC" = "yes" ]; then + echo "export MACOSX_DEPLOYMENT_TARGET = 10.2" >>"$mkfile" + echo "CARBON_LFLAGS =-framework CoreServices -framework CoreFoundation" >>"$mkfile" + EXTRA_LFLAGS="$EXTRA_LFLAGS \$(CARBON_LFLAGS)" + EXTRA_CFLAGS="$EXTRA_CFLAGS \$(CARBON_CFLAGS)" + EXTRA_CXXFLAGS="$EXTRA_CFLAGS \$(CARBON_CXXFLAGS)" + EXTRA_OBJS="qsettings_mac.o qcore_mac.o" + EXTRA_SRCS="\"$relpath/src/corelib/io/qsettings_mac.cpp\" \"$relpath/src/corelib/kernel/qcore_mac.cpp\"" + if [ "$CFG_UNIVERSAL_BINARY" = "yes" ]; then + X86_CFLAGS=`getQMakeConf "$XQMAKESPEC" | grep "^QMAKE_CFLAGS_X86[^_A-Z0-9]" | sed "s,.* *= *\(.*\)$,\1,"` + X86_LFLAGS=`getQMakeConf "$XQMAKESPEC" | grep "^QMAKE_LFLAGS_X86[^_A-Z0-9]" | sed "s,.* *= *\(.*\)$,\1,"` + PPC_CFLAGS=`getQMakeConf "$XQMAKESPEC" | grep "^QMAKE_CFLAGS_PPC[^_A-Z0-9]" | sed "s,.* *= *\(.*\)$,\1,"` + PPC_LFLAGS=`getQMakeConf "$XQMAKESPEC" | grep "^QMAKE_LFLAGS_PPC[^_A-Z0-9]" | sed "s,.* *= *\(.*\)$,\1,"` + EXTRA_CFLAGS="$X86_CFLAGS $PPC_CFLAGS $EXTRA_CFLAGS" + EXTRA_CXXFLAGS="$X86_CFLAGS $PPC_CFLAGS $EXTRA_CXXFLAGS" + EXTRA_LFLAGS="$EXTRA_LFLAGS $X86_LFLAGS $PPC_LFLAGS" + fi + if [ '!' -z "$CFG_SDK" ]; then + echo "SDK_LFLAGS =-Wl,-syslibroot,$CFG_SDK" >>"$mkfile" + echo "SDK_CFLAGS =-isysroot $CFG_SDK" >>"$mkfile" + EXTRA_CFLAGS="$EXTRA_CFLAGS \$(SDK_CFLAGS)" + EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(SDK_CFLAGS)" + EXTRA_LFLAGS="$EXTRA_LFLAGS \$(SDK_LFLAGS)" + fi + fi + [ "$CFG_EMBEDDED" != "no" ] && EXTRA_CFLAGS="$EXTRA_CFLAGS -DQWS" + if [ '!' -z "$D_FLAGS" ]; then + for DEF in $D_FLAGS; do + EXTRA_CFLAGS="$EXTRA_CFLAGS \"-D${DEF}\"" + done + fi + QMAKE_BIN_DIR="$QT_INSTALL_BINS" + [ -z "$QMAKE_BIN_DIR" ] && QMAKE_BIN_DIR="${QT_INSTALL_PREFIX}/bin" + QMAKE_DATA_DIR="$QT_INSTALL_DATA" + [ -z "$QMAKE_DATA_DIR" ] && QMAKE_DATA_DIR="${QT_INSTALL_PREFIX}" + echo >>"$mkfile" + adjrelpath=`echo "$relpath" | sed 's/ /\\\\\\\\ /g'` + adjoutpath=`echo "$outpath" | sed 's/ /\\\\\\\\ /g'` + sed -e "s,@SOURCE_PATH@,$adjrelpath,g" -e "s,@BUILD_PATH@,$adjoutpath,g" \ + -e "s,@QMAKE_CFLAGS@,$EXTRA_CFLAGS,g" -e "s,@QMAKE_LFLAGS@,$EXTRA_LFLAGS,g" \ + -e "s,@QMAKE_CXXFLAGS@,$EXTRA_CXXFLAGS,g" \ + -e "s,@QT_INSTALL_BINS@,\$(INSTALL_ROOT)$QMAKE_BIN_DIR,g" \ + -e "s,@QT_INSTALL_DATA@,\$(INSTALL_ROOT)$QMAKE_DATA_DIR,g" \ + -e "s,@QMAKE_QTOBJS@,$EXTRA_OBJS,g" -e "s,@QMAKE_QTSRCS@,$EXTRA_SRCS,g" \ + -e "s,@QMAKESPEC@,$QMAKESPEC,g" "$in_mkfile" >>"$mkfile" + + if "$WHICH" makedepend >/dev/null 2>&1 && grep 'depend:' "$mkfile" >/dev/null 2>&1; then + (cd "$outpath/qmake" && "$MAKE" -f "$mkfile" depend) >/dev/null 2>&1 + sed "s,^.*/\([^/]*.o\):,\1:,g" "$mkfile" >"${mkfile}.tmp" + mv "${mkfile}.tmp" "${mkfile}" + fi + done + + QMAKE_BUILD_ERROR=no + (cd "$outpath/qmake"; "$MAKE") || QMAKE_BUILD_ERROR=yes + [ '!' -z "$QCONFIG_H" ] && mv -f "$QCONFIG_H" "$QMAKE_QCONFIG_H" #move qmake's qconfig.h to qconfig.h.qmake + [ '!' -z "$OLD_QCONFIG_H" ] && mv -f "${OLD_QCONFIG_H}.old" "$OLD_QCONFIG_H" #put back qconfig.h + [ "$QMAKE_BUILD_ERROR" = "yes" ] && exit 2 +fi # Build qmake + +#------------------------------------------------------------------------------- +# tests that need qmake +#------------------------------------------------------------------------------- + +# detect zlib +if [ "$CFG_ZLIB" = "auto" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/zlib "zlib" $L_FLAGS $I_FLAGS $l_FLAGS; then + CFG_ZLIB=system + else + CFG_ZLIB=yes + fi +fi + +# detect how jpeg should be built +if [ "$CFG_JPEG" = "auto" ]; then + if [ "$CFG_SHARED" = "yes" ]; then + CFG_JPEG=plugin + else + CFG_JPEG=yes + fi +fi +# detect jpeg +if [ "$CFG_LIBJPEG" = "auto" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libjpeg "libjpeg" $L_FLAGS $I_FLAGS $l_FLAGS; then + CFG_LIBJPEG=system + else + CFG_LIBJPEG=qt + fi +fi + +# detect how mng should be built +if [ "$CFG_MNG" = "auto" ]; then + if [ "$CFG_SHARED" = "yes" ]; then + CFG_MNG=plugin + else + CFG_MNG=yes + fi +fi +# detect mng +if [ "$CFG_LIBMNG" = "auto" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libmng "libmng" $L_FLAGS $I_FLAGS $l_FLAGS; then + CFG_LIBMNG=system + else + CFG_LIBMNG=qt + fi +fi + +# detect png +if [ "$CFG_LIBPNG" = "auto" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libpng "libpng" $L_FLAGS $I_FLAGS $l_FLAGS; then + CFG_LIBPNG=system + else + CFG_LIBPNG=qt + fi +fi + +# detect accessibility +if [ "$CFG_ACCESSIBILITY" = "auto" ]; then + CFG_ACCESSIBILITY=yes +fi + +# auto-detect SQL-modules support +for _SQLDR in $CFG_SQL_AVAILABLE; do + case $_SQLDR in + mysql) + if [ "$CFG_SQL_mysql" != "no" ]; then + if "$WHICH" mysql_config >/dev/null 2>&1; then + QT_CFLAGS_MYSQL=`mysql_config --include 2>/dev/null` + QT_LFLAGS_MYSQL_R=`mysql_config --libs_r 2>/dev/null` + QT_LFLAGS_MYSQL=`mysql_config --libs 2>/dev/null` + QT_MYSQL_VERSION=`mysql_config --version | cut -d . -f 1` + fi + if [ -n "$QT_MYSQL_VERSION" ] && [ "$QT_MYSQL_VERSION" -lt 4 ]; then + if [ "$CFG_SQL_mysql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "This version of MySql is not supported (`mysql_config --version`)." + echo " You need MySql 4 or higher." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_SQL_mysql="no" + QT_LFLAGS_MYSQL="" + QT_LFLAGS_MYSQL_R="" + QT_CFLAGS_MYSQL="" + fi + else + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mysql_r "MySQL (thread-safe)" $QT_LFLAGS_MYSQL_R $L_FLAGS $QT_CFLAGS_MYSQL $I_FLAGS $l_FLAGS; then + QMakeVar add CONFIG use_libmysqlclient_r + if [ "$CFG_SQL_mysql" = "auto" ]; then + CFG_SQL_mysql=plugin + fi + QT_LFLAGS_MYSQL="$QT_LFLAGS_MYSQL_R" + elif "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mysql "MySQL (thread-unsafe)" $QT_LFLAGS_MYSQL $L_FLAGS $QT_CFLAGS_MYSQL $I_FLAGS $l_FLAGS; then + if [ "$CFG_SQL_mysql" = "auto" ]; then + CFG_SQL_mysql=plugin + fi + else + if [ "$CFG_SQL_mysql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "MySQL support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_SQL_mysql=no + QT_LFLAGS_MYSQL="" + QT_LFLAGS_MYSQL_R="" + QT_CFLAGS_MYSQL="" + fi + fi + fi + fi + ;; + psql) + if [ "$CFG_SQL_psql" != "no" ]; then + if "$WHICH" pg_config >/dev/null 2>&1; then + QT_CFLAGS_PSQL=`pg_config --includedir 2>/dev/null` + QT_LFLAGS_PSQL=`pg_config --libdir 2>/dev/null` + fi + [ -z "$QT_CFLAGS_PSQL" ] || QT_CFLAGS_PSQL="-I$QT_CFLAGS_PSQL" + [ -z "$QT_LFLAGS_PSQL" ] || QT_LFLAGS_PSQL="-L$QT_LFLAGS_PSQL" + if "$unixtests/compile.test" $XQMAKESPEC $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/psql "PostgreSQL" $QT_LFLAGS_PSQL $L_FLAGS $QT_CFLAGS_PSQL $I_FLAGS $l_FLAGS; then + if [ "$CFG_SQL_psql" = "auto" ]; then + CFG_SQL_psql=plugin + fi + else + if [ "$CFG_SQL_psql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "PostgreSQL support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_SQL_psql=no + QT_CFLAGS_PSQL="" + QT_LFLAGS_PSQL="" + fi + fi + fi + ;; + odbc) + if [ "$CFG_SQL_odbc" != "no" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/odbc "ODBC" $L_FLAGS $I_FLAGS $l_FLAGS; then + if [ "$CFG_SQL_odbc" = "auto" ]; then + CFG_SQL_odbc=plugin + fi + else + if [ "$CFG_SQL_odbc" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "ODBC support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_SQL_odbc=no + fi + fi + fi + ;; + oci) + if [ "$CFG_SQL_oci" != "no" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/oci "OCI" $L_FLAGS $I_FLAGS $l_FLAGS; then + if [ "$CFG_SQL_oci" = "auto" ]; then + CFG_SQL_oci=plugin + fi + else + if [ "$CFG_SQL_oci" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "Oracle (OCI) support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_SQL_oci=no + fi + fi + fi + ;; + tds) + if [ "$CFG_SQL_tds" != "no" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/tds "TDS" $L_FLAGS $I_FLAGS $l_FLAGS; then + if [ "$CFG_SQL_tds" = "auto" ]; then + CFG_SQL_tds=plugin + fi + else + if [ "$CFG_SQL_tds" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "TDS support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_SQL_tds=no + fi + fi + fi + ;; + db2) + if [ "$CFG_SQL_db2" != "no" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/db2 "DB2" $L_FLAGS $I_FLAGS $l_FLAGS; then + if [ "$CFG_SQL_db2" = "auto" ]; then + CFG_SQL_db2=plugin + fi + else + if [ "$CFG_SQL_db2" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "ODBC support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_SQL_db2=no + fi + fi + fi + ;; + ibase) + if [ "$CFG_SQL_ibase" != "no" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ibase "InterBase" $L_FLAGS $I_FLAGS $l_FLAGS; then + if [ "$CFG_SQL_ibase" = "auto" ]; then + CFG_SQL_ibase=plugin + fi + else + if [ "$CFG_SQL_ibase" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "InterBase support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_SQL_ibase=no + fi + fi + fi + ;; + sqlite2) + if [ "$CFG_SQL_sqlite2" != "no" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sqlite2 "SQLite2" $L_FLAGS $I_FLAGS $l_FLAGS; then + if [ "$CFG_SQL_sqlite2" = "auto" ]; then + CFG_SQL_sqlite2=plugin + fi + else + if [ "$CFG_SQL_sqlite2" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "SQLite2 support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_SQL_sqlite2=no + fi + fi + fi + ;; + sqlite) + if [ "$CFG_SQL_sqlite" != "no" ]; then + SQLITE_AUTODETECT_FAILED="no" + if [ "$CFG_SQLITE" = "system" ]; then + if $WHICH pkg-config >/dev/null 2>&1; then + QT_CFLAGS_SQLITE=`pkg-config --cflags sqlite3` + QT_LFLAGS_SQLITE=`pkg-config --libs sqlite3` + fi + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sqlite "SQLite" $QT_LFLAGS_SQLITE $L_FLAGS $QT_CFLAGS_SQLITE $I_FLAGS $l_FLAGS; then + if [ "$CFG_SQL_sqlite" = "auto" ]; then + CFG_SQL_sqlite=plugin + QMAKE_CONFIG="$QMAKE_CONFIG system-sqlite" + fi + else + SQLITE_AUTODETECT_FAILED="yes" + CFG_SQL_sqlite=no + fi + elif [ -f "$relpath/src/3rdparty/sqlite/sqlite3.h" ]; then + if [ "$CFG_SQL_sqlite" = "auto" ]; then + CFG_SQL_sqlite=plugin + fi + else + SQLITE_AUTODETECT_FAILED="yes" + CFG_SQL_sqlite=no + fi + + if [ "$SQLITE_AUTODETECT_FAILED" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "SQLite support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + fi + fi + ;; + *) + if [ "$OPT_VERBOSE" = "yes" ]; then + echo "unknown SQL driver: $_SQLDR" + fi + ;; + esac +done + +# auto-detect NIS support +if [ "$CFG_NIS" != "no" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/nis "NIS" $L_FLAGS $I_FLAGS $l_FLAGS; then + CFG_NIS=yes + else + if [ "$CFG_NIS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "NIS support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_NIS=no + fi + fi +fi + +# auto-detect CUPS support +if [ "$CFG_CUPS" != "no" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/cups "Cups" $L_FLAGS $I_FLAGS $l_FLAGS; then + CFG_CUPS=yes + else + if [ "$CFG_CUPS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "Cups support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_CUPS=no + fi + fi +fi + +# auto-detect iconv(3) support +if [ "$CFG_ICONV" != "no" ]; then + if [ "$PLATFORM_QWS" = "yes" ]; then + CFG_ICONV=no + elif "$unixtests/compile.test" "$XQMAKESPEC" "$OPT_VERBOSE" "$relpath" "$outpath" "config.tests/unix/iconv" "POSIX iconv" "$L_FLAGS" "$I_FLAGS" "$l_FLAGS"; then + CFG_ICONV=yes + elif "$unixtests/compile.test" "$XQMAKESPEC" "$OPT_VERBOSE" "$relpath" "$outpath" "config.tests/unix/gnu-libiconv" "GNU libiconv" "$L_FLAGS" "$I_FLAGS" "$l_FLAGS"; then + CFG_ICONV=gnu + else + if [ "$CFG_ICONV" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "Iconv support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_ICONV=no + fi + fi +fi + +# auto-detect libdbus-1 support +if [ "$CFG_QDBUS" != "no" ]; then + if "$WHICH" pkg-config >/dev/null 2>&1 && \ + pkg-config --atleast-version="$MIN_DBUS_1_VERSION" dbus-1 2>/dev/null; then + QT_CFLAGS_DBUS=`pkg-config --cflags dbus-1` + QT_LIBS_DBUS=`pkg-config --libs dbus-1` + fi + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/dbus "dbus" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_DBUS $QT_LIBS_DBUS; then + CFG_QDBUS=yes + QMakeVar set QT_CFLAGS_DBUS "$QT_CFLAGS_DBUS" + QMakeVar set QT_LIBS_DBUS "$QT_LIBS_DBUS" + else + if [ "$CFG_QDBUS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "The QtDBus module cannot be enabled because libdbus-1 version $MIN_DBUS_1_VERSION was not found." + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_QDBUS=no + fi + fi +fi + +# x11 +if [ "$PLATFORM_X11" = "yes" ]; then + x11tests="$relpath/config.tests/x11" + X11TESTS_FLAGS= + + # work around broken X11 headers when using GCC 2.95 or later + NOTYPE=no + "$x11tests/notype.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" && NOTYPE=yes + if [ $NOTYPE = "yes" ]; then + QMakeVar add QMAKE_CXXFLAGS -fpermissive + X11TESTS_FLAGS="$X11TESTS_FLAGS -fpermissive" + fi + + # auto-detect OpenGL support + if [ "$CFG_OPENGL" = "auto" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/opengl "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then + CFG_OPENGL=yes + else + CFG_OPENGL=no + fi + fi + + # auto-detect Xcursor support + if [ "$CFG_XCURSOR" != "no" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xcursor "Xcursor" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then + CFG_XCURSOR=yes + else + if [ "$CFG_XCURSOR" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "Xcursor support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_XCURSOR=no + fi + fi + fi + + # auto-detect Xfixes support + if [ "$CFG_XFIXES" != "no" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xfixes "Xfixes" $L_FLAGS $I_FLAGS $X11TESTS_FLAGS; then + CFG_XFIXES=yes + else + if [ "$CFG_XFIXES" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "Xfixes support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_XFIXES=no + fi + fi + fi + + # auto-detect Xrandr support (resize and rotate extension) + if [ "$CFG_XRANDR" != "no" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xrandr "Xrandr" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then + CFG_XRANDR=yes + else + if [ "$CFG_XRANDR" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "Xrandr support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_XRANDR=no + fi + fi + fi + + # auto-detect Xrender support + if [ "$CFG_XRENDER" != "no" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xrender "Xrender" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then + CFG_XRENDER=yes + else + if [ "$CFG_XRENDER" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "Xrender support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_XRENDER=no + fi + fi + fi + + # auto-detect FontConfig support + if [ "$CFG_FONTCONFIG" != "no" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/fontconfig "FontConfig" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then + CFG_FONTCONFIG=yes + QMakeVar set QMAKE_LIBS_X11 '-lfreetype -lfontconfig $$QMAKE_LIBS_X11' + CFG_LIBFREETYPE=system + else + if [ "$CFG_FONTCONFIG" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "FontConfig support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_FONTCONFIG=no + fi + fi + fi + + # auto-detect Session Management support + if [ "$CFG_SM" = "auto" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/sm "Session Management" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then + CFG_SM=yes + else + if [ "$CFG_SM" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "Session Management support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_SM=no + fi + fi + fi + + # auto-detect SHAPE support + if [ "$CFG_XSHAPE" != "no" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xshape "XShape" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then + CFG_XSHAPE=yes + else + if [ "$CFG_XSHAPE" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "XShape support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_XSHAPE=no + fi + fi + fi + + # auto-detect Xinerama support + if [ "$CFG_XINERAMA" != "no" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xinerama "Xinerama" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then + CFG_XINERAMA=yes + else + if [ "$CFG_XINERAMA" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "Xinerama support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_XINERAMA=no + fi + fi + fi + + # auto-detect tablet support (currenlty only in IRIX) + if [ "$CFG_TABLET" != "no" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xinput "Tablet (XInput)" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then + CFG_TABLET=yes + else + if [ "$CFG_TABLET" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "Tablet support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_TABLET=no + fi + fi + fi + + # auto-detect XKB support + if [ "$CFG_XKB" != "no" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xkb "XKB" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then + CFG_XKB=yes + else + if [ "$CFG_XKB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "XKB support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_XKB=no + fi + fi + fi + +fi # X11 + +if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" ]; then + # auto-detect Glib support + if [ "$CFG_GLIB" != "no" ]; then + if "$WHICH" pkg-config >/dev/null 2>&1; then + QT_CFLAGS_GLIB=`pkg-config --cflags glib-2.0` + QT_LIBS_GLIB=`pkg-config --libs glib-2.0` + fi + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/glib "Glib" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_GLIB $QT_LIBS_GLIB $X11TESTS_FLAGS; then + CFG_GLIB=yes + QMakeVar set QT_CFLAGS_GLIB "$QT_CFLAGS_GLIB" + QMakeVar set QT_LIBS_GLIB "$QT_LIBS_GLIB" + else + if [ "$CFG_GLIB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "Glib support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_GLIB=no + fi + fi + fi +fi # X11/QWS + +# QWS +if [ "$PLATFORM_QWS" = "yes" ]; then + + # mouse drivers + for mouse in ${CFG_MOUSE_ON} ${CFG_MOUSE_PLUGIN}; do + if [ "${mouse}" = "tslib" ] && [ "${CFG_CONFIGURE_EXIT_ON_ERROR}" = "yes" ]; then + if ! "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/tslib "tslib" $L_FLAGS $I_FLAGS $l_FLAGS; then + echo "The tslib functionality test failed!" + echo " You might need to add additional include and library search paths" + echo " by passing the -I and -L switches to $0." + exit 1 + fi + fi + done + +fi # QWS + +# freetype support +[ "x$CFG_EMBEDDED" != "xno" ] && CFG_LIBFREETYPE="$CFG_QWS_FREETYPE" +[ "x$PLATFORM_MAC" = "xyes" ] && CFG_LIBFREETYPE=no +if [ "$CFG_LIBFREETYPE" = "auto" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/freetype "FreeType" $L_FLAGS $I_FLAGS $l_FLAGS ; then + CFG_LIBFREETYPE=system + else + CFG_LIBFREETYPE=yes + fi +fi + + +if [ "$CFG_ENDIAN" = "auto" ]; then + if [ "$PLATFORM_MAC" = "yes" ]; then + true #leave as auto + else + "$unixtests/endian.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" + F="$?" + if [ "$F" -eq 0 ]; then + CFG_ENDIAN="Q_LITTLE_ENDIAN" + elif [ "$F" -eq 1 ]; then + CFG_ENDIAN="Q_BIG_ENDIAN" + else + echo + echo "The system byte order could not be detected!" + echo "Turn on verbose messaging (-v) to see the final report." + echo "You can use the -little-endian or -big-endian switch to" + echo "$0 to continue." + exit 101 + fi + fi +fi + +if [ "$CFG_STL" != "no" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/stl "STL" $L_FLAGS $I_FLAGS $l_FLAGS; then + CFG_STL=yes + else + if [ "$CFG_STL" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "STL support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_STL=no + fi + fi +fi + +# find if the platform supports IPv6 +if [ "$CFG_IPV6" != "no" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ipv6 "IPv6" $L_FLAGS $I_FLAGS $l_FLAGS; then + CFG_IPV6=yes + else + if [ "$CFG_IPV6" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "IPv6 support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_IPV6=no + fi + fi +fi + +# find if the platform provides getaddrinfo (ipv6 dns lookups) +if [ "$CFG_GETADDRINFO" != "no" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/getaddrinfo "getaddrinfo" $L_FLAGS $I_FLAGS $l_FLAGS; then + CFG_GETADDRINFO=yes + else + if [ "$CFG_GETADDRINFO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "getaddrinfo support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_GETADDRINFO=no + fi + fi +fi + +# find if the platform provides inotify +if [ "$CFG_INOTIFY" != "no" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/inotify "inotify" $L_FLAGS $I_FLAGS $l_FLAGS; then + CFG_INOTIFY=yes + else + if [ "$CFG_INOTIFY" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "inotify support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_INOTIFY=no + fi + fi +fi + +# find if the platform provides if_nametoindex (ipv6 interface name support) +if [ "$CFG_IPV6IFNAME" != "no" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ipv6ifname "IPv6 interface name" $L_FLAGS $I_FLAGS $l_FLAGS; then + CFG_IPV6IFNAME=yes + else + if [ "$CFG_IPV6IFNAME" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "IPv6 interface name support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_IPV6IFNAME=no + fi + fi +fi + +# find if the platform provides getifaddrs (network interface enumeration) +if [ "$CFG_GETIFADDRS" != "no" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/getifaddrs "getifaddrs" $L_FLAGS $I_FLAGS $l_FLAGS; then + CFG_GETIFADDRS=yes + else + if [ "$CFG_GETIFADDRS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "getifaddrs support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_GETIFADDRS=no + fi + fi +fi + +# find if the platform supports X/Open Large File compilation environment +if [ "$CFG_LARGEFILE" != "no" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/largefile "X/Open Large File" $L_FLAGS $I_FLAGS $l_FLAGS; then + CFG_LARGEFILE=yes + else + if [ "$CFG_LARGEFILE" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "X/Open Large File support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_LARGEFILE=no + fi + fi +fi + +#------------------------------------------------------------------------------- +# ask for all that hasn't been auto-detected or specified in the arguments +#------------------------------------------------------------------------------- + +### fix this: user input should be validated in a loop +if [ "$CFG_QWS_DEPTHS" = "prompted" -a "$PLATFORM_QWS" = "yes" ]; then + echo + echo "Choose pixel-depths to support:" + echo + echo " 8. 8bpp" + echo " 16. 16bpp" + echo " 18. 18bpp" + echo " 24. 24bpp" + echo " 32. 32bpp" + echo + echo "Your choices (default 8,16,32):" + read CFG_QWS_DEPTHS + if [ -z "$CFG_QWS_DEPTHS" ] || [ "$CFG_QWS_DEPTHS" = "yes" ]; then + CFG_QWS_DEPTHS=8,16,32 + fi +fi +if [ -n "$CFG_QWS_DEPTHS" -a "$PLATFORM_QWS" = "yes" ]; then + for D in `echo "$CFG_QWS_DEPTHS" | sed -e 's/,/ /g'`; do + case $D in + 4|8|16|18|24|32) QCONFIG_FLAGS="$QCONFIG_FLAGS QT_QWS_DEPTH_$D";; + esac + done +fi + +# enable Qt 3 support functionality +if [ "$CFG_QT3SUPPORT" = "yes" ]; then + QT_CONFIG="$QT_CONFIG qt3support" +fi + +# disable accessibility +if [ "$CFG_ACCESSIBILITY" = "no" ]; then + QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ACCESSIBILITY" +else + QT_CONFIG="$QT_CONFIG accessibility" +fi + +# enable opengl +if [ "$CFG_OPENGL" = "no" ]; then + QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENGL" +else + QT_CONFIG="$QT_CONFIG opengl" +fi + +# safe execution environment +if [ "$CFG_SXE" != "no" ]; then + QT_CONFIG="$QT_CONFIG sxe" +fi + +# update QT_CONFIG to show our current predefined configuration +case "$CFG_QCONFIG" in +minimal|small|medium|large|full) + # these are a sequence of increasing functionality + for c in minimal small medium large full; do + QT_CONFIG="$QT_CONFIG $c-config" + [ "$CFG_QCONFIG" = $c ] && break + done + ;; +*) + # not known to be sufficient for anything + if [ '!' -f "$relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h" ]; then + echo >&2 "No such configuration: $CFG_QCONFIG" + OPT_HELP=yes + fi +esac + +# build up the variables for output +if [ "$CFG_DEBUG" = "yes" ]; then + QMAKE_OUTDIR="${QMAKE_OUTDIR}debug" + QMAKE_CONFIG="$QMAKE_CONFIG debug" +elif [ "$CFG_DEBUG" = "no" ]; then + QMAKE_OUTDIR="${QMAKE_OUTDIR}release" + QMAKE_CONFIG="$QMAKE_CONFIG release" +fi +if [ "$CFG_SHARED" = "yes" ]; then + QMAKE_OUTDIR="${QMAKE_OUTDIR}-shared" + QMAKE_CONFIG="$QMAKE_CONFIG shared dll" +elif [ "$CFG_SHARED" = "no" ]; then + QMAKE_OUTDIR="${QMAKE_OUTDIR}-static" + QMAKE_CONFIG="$QMAKE_CONFIG static" +fi +if [ "$PLATFORM_QWS" = "yes" ]; then + QMAKE_OUTDIR="${QMAKE_OUTDIR}-emb-$CFG_EMBEDDED" + QMAKE_CONFIG="$QMAKE_CONFIG embedded" + QT_CONFIG="$QT_CONFIG embedded" + rm -f "src/.moc/$QMAKE_OUTDIR/allmoc.cpp" # needs remaking if config changes +fi +QMakeVar set OBJECTS_DIR ".obj/$QMAKE_OUTDIR" +QMakeVar set MOC_DIR ".moc/$QMAKE_OUTDIR" +QMakeVar set RCC_DIR ".rcc/$QMAKE_OUTDIR" +QMakeVar set UI_DIR ".uic/$QMAKE_OUTDIR" +if [ "$CFG_LARGEFILE" = "yes" ]; then + QMAKE_CONFIG="$QMAKE_CONFIG largefile" +fi +if [ "$CFG_STL" = "no" ]; then + QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_STL" +else + QMAKE_CONFIG="$QMAKE_CONFIG stl" +fi +if [ "$CFG_USE_GNUMAKE" = "yes" ]; then + QMAKE_CONFIG="$QMAKE_CONFIG GNUmake" +fi +[ "$CFG_REDUCE_EXPORTS" = "yes" ] && QT_CONFIG="$QT_CONFIG reduce_exports" +[ "$CFG_PRECOMPILE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG precompile_header" +if [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then + QMakeVar add QMAKE_CFLAGS -g + QMakeVar add QMAKE_CXXFLAGS -g + QMAKE_CONFIG="$QMAKE_CONFIG separate_debug_info" +fi +[ "$CFG_HAVE_SSE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse" +[ "$CFG_IWMMXT" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG iwmmxt" +[ "$CFG_UNIVERSAL_BINARY" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG x86 ppc" +if [ "$CFG_IPV6" = "yes" ]; then + QT_CONFIG="$QT_CONFIG ipv6" +fi +if [ "$CFG_GETADDRINFO" = "yes" ]; then + QT_CONFIG="$QT_CONFIG getaddrinfo" +fi +if [ "$CFG_IPV6IFNAME" = "yes" ]; then + QT_CONFIG="$QT_CONFIG ipv6ifname" +fi +if [ "$CFG_GETIFADDRS" = "yes" ]; then + QT_CONFIG="$QT_CONFIG getifaddrs" +fi +if [ "$CFG_INOTIFY" = "yes" ]; then + QT_CONFIG="$QT_CONFIG inotify" +fi +if [ "$CFG_LIBJPEG" = "system" ]; then + QT_CONFIG="$QT_CONFIG system-jpeg" +fi +if [ "$CFG_JPEG" = "no" ]; then + QT_CONFIG="$QT_CONFIG no-jpeg" +elif [ "$CFG_JPEG" = "yes" ]; then + QT_CONFIG="$QT_CONFIG jpeg" +fi +if [ "$CFG_LIBMNG" = "system" ]; then + QT_CONFIG="$QT_CONFIG system-mng" +fi +if [ "$CFG_MNG" = "no" ]; then + QT_CONFIG="$QT_CONFIG no-mng" +elif [ "$CFG_MNG" = "yes" ]; then + QT_CONFIG="$QT_CONFIG mng" +fi +if [ "$CFG_LIBPNG" = "no" ]; then + CFG_PNG="no" +fi +if [ "$CFG_LIBPNG" = "system" ]; then + QT_CONFIG="$QT_CONFIG system-png" +fi +if [ "$CFG_PNG" = "no" ]; then + QT_CONFIG="$QT_CONFIG no-png" +elif [ "$CFG_PNG" = "yes" ]; then + QT_CONFIG="$QT_CONFIG png" +fi +if [ "$CFG_GIF" = "no" ]; then + QT_CONFIG="$QT_CONFIG no-gif" +elif [ "$CFG_GIF" = "yes" ]; then + QT_CONFIG="$QT_CONFIG gif" +fi +if [ "$CFG_LIBFREETYPE" = "no" ]; then + QT_CONFIG="$QT_CONFIG no-freetype" +elif [ "$CFG_LIBFREETYPE" = "system" ]; then + QT_CONFIG="$QT_CONFIG system-freetype" +else + QT_CONFIG="$QT_CONFIG freetype" +fi + +if [ "x$PLATFORM_MAC" = "xyes" ]; then + #On Mac we implicitly link against libz, so we + #never use the 3rdparty stuff. + [ "$CFG_ZLIB" = "yes" ] && CFG_ZLIB="system" +fi +if [ "$CFG_ZLIB" = "no" ]; then + QT_CONFIG="$QT_CONFIG no-zlib" + QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_COMPRESS" +elif [ "$CFG_ZLIB" = "yes" ]; then + QT_CONFIG="$QT_CONFIG zlib" +elif [ "$CFG_ZLIB" = "system" ]; then + QT_CONFIG="$QT_CONFIG system-zlib" +fi + +[ "$CFG_NIS" = "yes" ] && QT_CONFIG="$QT_CONFIG nis" +[ "$CFG_CUPS" = "yes" ] && QT_CONFIG="$QT_CONFIG cups" +[ "$CFG_ICONV" = "yes" ] && QT_CONFIG="$QT_CONFIG iconv" +[ "$CFG_ICONV" = "gnu" ] && QT_CONFIG="$QT_CONFIG gnu-libiconv" +[ "$CFG_GLIB" = "yes" ] && QT_CONFIG="$QT_CONFIG glib" +[ "$CFG_QDBUS" = "yes" ] && QT_CONFIG="$QT_CONFIG qdbus" +[ "$CFG_NAS" = "system" ] && QT_CONFIG="$QT_CONFIG nas" + +if [ "$PLATFORM_X11" = "yes" ]; then + [ "$CFG_SM" = "yes" ] && QT_CONFIG="$QT_CONFIG x11sm" + + # for some reason, the following libraries are not always built shared, + # so *every* program/lib (including Qt) has to link against them + if [ "$CFG_XSHAPE" = "yes" ]; then + QT_CONFIG="$QT_CONFIG xshape" + fi + if [ "$CFG_XINERAMA" = "yes" ]; then + QT_CONFIG="$QT_CONFIG xinerama" + QMakeVar set QMAKE_LIBS_X11 '-lXinerama $$QMAKE_LIBS_X11' + fi + if [ "$CFG_XCURSOR" = "yes" ]; then + QT_CONFIG="$QT_CONFIG xcursor" + QMakeVar set QMAKE_LIBS_X11 '-lXcursor $$QMAKE_LIBS_X11' + fi + if [ "$CFG_XFIXES" = "yes" ]; then + QT_CONFIG="$QT_CONFIG xfixes" + QMakeVar set QMAKE_LIBS_X11 '-lXfixes $$QMAKE_LIBS_X11' + fi + if [ "$CFG_XRANDR" = "yes" ]; then + QT_CONFIG="$QT_CONFIG xrandr" + if [ "$CFG_XRENDER" != "yes" ]; then + # libXrandr uses 1 function from libXrender, so we always have to have it :/ + QMakeVar set QMAKE_LIBS_X11 '-lXrandr -lXrender $$QMAKE_LIBS_X11' + else + QMakeVar set QMAKE_LIBS_X11 '-lXrandr $$QMAKE_LIBS_X11' + fi + fi + if [ "$CFG_XRENDER" = "yes" ]; then + QT_CONFIG="$QT_CONFIG xrender" + QMakeVar set QMAKE_LIBS_X11 '-lXrender $$QMAKE_LIBS_X11' + fi + if [ "$CFG_FONTCONFIG" = "yes" ]; then + QT_CONFIG="$QT_CONFIG fontconfig" + fi + if [ "$CFG_TABLET" = "yes" ]; then + QT_CONFIG="$QT_CONFIG tablet" + QMakeVar set QMAKE_LIBS_X11 '-lXi $$QMAKE_LIBS_X11' + fi + if [ "$CFG_XKB" = "yes" ]; then + QT_CONFIG="$QT_CONFIG xkb" + fi + +elif [ "$PLATFORM_MAC" = "yes" ]; then + if [ "$CFG_TABLET" = "yes" ]; then + QT_CONFIG="$QT_CONFIG tablet" + fi +fi + +[ '!' -z "$D_FLAGS" ] && QMakeVar add DEFINES "$D_FLAGS" +[ '!' -z "$L_FLAGS" ] && QMakeVar add QMAKE_LIBDIR_FLAGS "$L_FLAGS" +[ '!' -z "$l_FLAGS" ] && QMakeVar add LIBS "$l_FLAGS" + +if [ "$PLATFORM_MAC" = "yes" ]; then + if [ "$CFG_RPATH" = "yes" ]; then + QMAKE_CONFIG="$QMAKE_CONFIG absolute_library_soname" + fi +elif [ -z "`getQMakeConf \"$XQMAKESPEC\" | grep QMAKE_RPATH | awk '{print $3;}'`" ]; then + if [ -n "$RPATH_FLAGS" ]; then + echo + echo "ERROR: -R cannot be used on this platform as \$QMAKE_RPATH is" + echo " undefined." + echo + exit 1 + elif [ "$CFG_RPATH" = "yes" ]; then + RPATH_MESSAGE=" NOTE: This platform does not support runtime library paths, using -no-rpath." + CFG_RPATH=no + fi +else + if [ "$CFG_RPATH" = "yes" ]; then + # set the default rpath to the library installation directory + RPATH_FLAGS="\"$QT_INSTALL_LIBS\" $RPATH_FLAGS" + fi + if [ -n "$RPATH_FLAGS" ]; then + # add the user defined rpaths + QMakeVar add QMAKE_RPATHDIR "$RPATH_FLAGS" + fi +fi + +if [ '!' -z "$I_FLAGS" ]; then + # add the user define include paths + QMakeVar add INCPATH `echo $I_FLAGS | sed s,-I,,g` +fi + +# turn off exceptions for the compilers that support it +if [ "$PLATFORM_QWS" = "yes" ]; then + COMPILER=`echo $PLATFORM | cut -f 3- -d-` +else + COMPILER=`echo $PLATFORM | cut -f 2- -d-` +fi +if [ "$CFG_EXCEPTIONS" = "unspecified" -a "$PLATFORM_QWS" = "yes" ]; then + CFG_EXCEPTIONS=no +fi + +if [ "$CFG_EXCEPTIONS" = "no" ]; then + case "$COMPILER" in + g++*) + QMakeVar add QMAKE_CFLAGS -fno-exceptions + QMakeVar add QMAKE_CXXFLAGS -fno-exceptions + QMakeVar add QMAKE_LFLAGS -fno-exceptions + ;; + cc*) + case "$PLATFORM" in + irix-cc*) + QMakeVar add QMAKE_CFLAGS -LANG:exceptions=off + QMakeVar add QMAKE_CXXFLAGS -LANG:exceptions=off + QMakeVar add QMAKE_LFLAGS -LANG:exceptions=off + ;; + *) ;; + esac + ;; + *) ;; + esac +fi + +#------------------------------------------------------------------------------- +# generate QT_BUILD_KEY +#------------------------------------------------------------------------------- + +# some compilers generate binary incompatible code between different versions, +# so we need to generate a build key that is different between these compilers +case "$COMPILER" in +g++*) + # GNU C++ + QMAKE_CONF_COMPILER=`getQMakeConf | grep "^QMAKE_CXX[^_A-Z0-9]" | sed "s,.* *= *\(.*\)$,\1,"` + COMPILER_VERSION=`${QMAKE_CONF_COMPILER} --version 2>/dev/null` + case "$COMPILER_VERSION" in + *2.95.*) + COMPILER_VERSION="2.95.*" + ;; + *3.*) + COMPILER_VERSION="3.*" + ;; + *4.*) + COMPILER_VERSION="4" + ;; + *) + ;; + esac + [ '!' -z "$COMPILER_VERSION" ] && COMPILER="g++-${COMPILER_VERSION}" + ;; +*) + # + ;; +esac + +# QT_CONFIG can contain the following: +# +# Things that affect the Qt API/ABI: +# +# Options: +# minimal-config small-config medium-config large-config full-config +# +# Different edition modules: +# network canvas table xml opengl sql +# +# Options: +# stl +# +# Things that do not affect the Qt API/ABI: +# system-jpeg no-jpeg jpeg +# system-mng no-mng mng +# system-png no-png png +# system-zlib no-zlib zlib +# no-gif gif +# debug release +# dll staticlib +# +# internal +# nocrosscompiler +# GNUmake +# largefile +# nis +# nas +# tablet +# ipv6 +# +# X11 : x11sm xinerama xcursor xfixes xrandr xrender fontconfig xkb +# Embedded: embedded freetype +# +ALL_OPTIONS="stl" +BUILD_CONFIG= +BUILD_OPTIONS= + +# determine the build options +for config_option in $QMAKE_CONFIG $QT_CONFIG; do + SKIP="yes" + case "$config_option" in + *-config) + # take the last *-config setting. this is the highest config being used, + # and is the one that we will use for tagging plugins + BUILD_CONFIG="$config_option" + ;; + + stl) + # these config options affect the Qt API/ABI. they should influence + # the generation of the buildkey, so we don't skip them + SKIP="no" + ;; + + *) # skip all other options since they don't affect the Qt API/ABI. + ;; + esac + + if [ "$SKIP" = "no" ]; then + BUILD_OPTIONS="$BUILD_OPTIONS $config_option" + fi +done + +# put the options that we are missing into .options +rm -f .options +for opt in `echo $ALL_OPTIONS`; do + SKIP="no" + if echo $BUILD_OPTIONS | grep $opt >/dev/null 2>&1; then + SKIP="yes" + fi + if [ "$SKIP" = "no" ]; then + echo "$opt" >> .options + fi +done + +# reconstruct BUILD_OPTIONS with a sorted negative feature list +# (ie. only things that are missing are will be put into the build key) +BUILD_OPTIONS= +if [ -f .options ]; then + for opt in `sort -f .options | uniq`; do + BUILD_OPTIONS="$BUILD_OPTIONS no-$opt" + done +fi +rm -f .options + +# QT_NO* defines affect the Qt API (and binary compatibility). they need +# to be included in the build key +for build_option in $D_FLAGS; do + build_option=`echo $build_option | cut -d \" -f 2 -` + case "$build_option" in + QT_NO*) + echo "$build_option" >> .options + ;; + *) + # skip all other compiler defines + ;; + esac +done + +# sort the compile time defines (helps ensure that changes in this configure +# script don't affect the QT_BUILD_KEY generation) +if [ -f .options ]; then + for opt in `sort -f .options | uniq`; do + BUILD_OPTIONS="$BUILD_OPTIONS $opt" + done +fi +rm -f .options + +BUILD_OPTIONS="$BUILD_CONFIG $BUILD_OPTIONS" +QT_BUILD_KEY="$CFG_USER_BUILD_KEY $UNAME_MACHINE $UNAME_SYSTEM $COMPILER $BUILD_OPTIONS" +# strip out leading/trailing/extra whitespace +QT_BUILD_KEY=`echo $QT_BUILD_KEY | sed -e "s, *, ,g" -e "s,^ *,," -e "s, *$,,"` + +#------------------------------------------------------------------------------- +# part of configuration information goes into qconfig.h +#------------------------------------------------------------------------------- + +case "$CFG_QCONFIG" in +full) + echo "/* Everything */" >"$outpath/src/corelib/global/qconfig.h.new" + ;; +*) + tmpconfig="$outpath/src/corelib/global/qconfig.h.new" + echo "#ifndef QT_BOOTSTRAPPED" >"$tmpconfig" + cat "$relpath/src/corelib/global/qconfig-$CFG_QCONFIG.h" >>"$tmpconfig" + echo "#endif" >>"$tmpconfig" + ;; +esac +cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF + +/* Qt Edition */ +#ifndef QT_EDITION +# define QT_EDITION $QT_EDITION +#endif + +#define QT_BUILD_KEY "$QT_BUILD_KEY" + +/* Machine byte-order */ +#define Q_BIG_ENDIAN 4321 +#define Q_LITTLE_ENDIAN 1234 +EOF +if [ "$CFG_ENDIAN" = "auto" ]; then + cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF +#if defined(__BIG_ENDIAN__) +# define Q_BYTE_ORDER Q_BIG_ENDIAN +#elif defined(__LITTLE_ENDIAN__) +# define Q_BYTE_ORDER Q_LITTLE_ENDIAN +#else +# message "Unable to determine byte order!" +#endif +EOF +else + echo "#define Q_BYTE_ORDER $CFG_ENDIAN" >>"$outpath/src/corelib/global/qconfig.h.new" +fi + +echo '/* Machine Architecture */' >>"$outpath/src/corelib/global/qconfig.h.new" +ARCH_STR=`echo $ARCH | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` +echo "#define QT_ARCH_${ARCH_STR}" >>"$outpath/src/corelib/global/qconfig.h.new" + +echo '/* Compile time features */' >>"$outpath/src/corelib/global/qconfig.h.new" +[ '!' -z "$LicenseKeyExt" ] && echo "#define QT_PRODUCT_LICENSEKEY \"$LicenseKeyExt\"" >>"$outpath/src/corelib/global/qconfig.h.new" + +if [ "$CFG_LARGEFILE" = "yes" ]; then + echo "#define QT_LARGEFILE_SUPPORT 64" >>"$outpath/src/corelib/global/qconfig.h.new" +fi + +if [ "$CFG_FRAMEWORK" = "yes" ]; then + echo "#define QT_MAC_FRAMEWORK_BUILD" >>"$outpath/src/corelib/global/qconfig.h.new" +fi + +"$unixtests/ptrsize.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" +echo "#define QT_POINTER_SIZE $?" >>"$outpath/src/corelib/global/qconfig.h.new" +echo "" >>"$outpath/src/corelib/global/qconfig.h.new" + +if [ "$Edition" = "Trolltech" ]; then + echo "#define QT_BUILD_INTERNAL" >>"$outpath/src/corelib/global/qconfig.h.new" +fi + +# Embedded compile time options +if [ "$PLATFORM_QWS" = "yes" ]; then + # Add QWS to config.h + QCONFIG_FLAGS="$QCONFIG_FLAGS Q_WS_QWS" + + # Add excluded decorations to $QCONFIG_FLAGS + decors=`grep '^decorations -= ' "$QMAKE_VARS_FILE" | ${AWK} '{print $3}'` + for decor in $decors; do + NODECORATION=`echo $decor | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + QCONFIG_FLAGS="${QCONFIG_FLAGS} QT_NO_QWS_DECORATION_${NODECORATION}" + done + + # Figure which embedded drivers which are turned off + CFG_GFX_OFF="$CFG_GFX_AVAILABLE" + for ADRIVER in $CFG_GFX_ON; do + CFG_GFX_OFF=`echo "${CFG_GFX_OFF} " | sed "s,${ADRIVER} ,,g"` + done + + CFG_KBD_OFF="$CFG_KBD_AVAILABLE" + for ADRIVER in $CFG_KBD_ON; do + CFG_KBD_OFF=`echo "${CFG_KBD_OFF} " | sed "s,${ADRIVER} ,,g"` + done + + CFG_MOUSE_OFF="$CFG_MOUSE_AVAILABLE" + for ADRIVER in $CFG_MOUSE_ON; do + CFG_MOUSE_OFF=`echo "${CFG_MOUSE_OFF} " | sed "s,${ADRIVER} ,,g"` + done + + for DRIVER in $CFG_GFX_OFF; do + NODRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_QWS_$NODRIVER" + done + + for DRIVER in $CFG_KBD_OFF; do + NODRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_QWS_KBD_$NODRIVER" + done + + for DRIVER in $CFG_MOUSE_OFF; do + NODRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_QWS_MOUSE_$NODRIVER" + done +fi # QWS + +# Add turned on SQL drivers +for DRIVER in $CFG_SQL_AVAILABLE; do + eval "VAL=\$CFG_SQL_$DRIVER" + case "$VAL" in + qt) + ONDRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + QCONFIG_FLAGS="$QCONFIG_FLAGS QT_SQL_$ONDRIVER" + SQL_DRIVERS="$SQL_DRIVERS $DRIVER" + ;; + plugin) + SQL_PLUGINS="$SQL_PLUGINS $DRIVER" + ;; + esac +done + +QMakeVar set sql-drivers "$SQL_DRIVERS" +QMakeVar set sql-plugins "$SQL_PLUGINS" + +# Add other configuration options to the qconfig.h file +[ "$CFG_GIF" = "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_BUILTIN_GIF_READER=1" +[ "$CFG_PNG" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_PNG" +[ "$CFG_JPEG" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_JPEG" +[ "$CFG_MNG" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_MNG" +[ "$CFG_ZLIB" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ZLIB" +[ "$CFG_EXCEPTIONS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EXCEPTIONS" +[ "$CFG_TABLET" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_TABLET" +[ "$CFG_IPV6" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IPV6" +[ "$CFG_SXE" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SXE" +[ "$CFG_QDBUS" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_DBUS" + +# X11/Unix/Mac only configs +[ "$CFG_CUPS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CUPS" +[ "$CFG_ICONV" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ICONV" +[ "$CFG_GLIB" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GLIB" +[ "$CFG_GETADDRINFO" = "no" ]&& QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GETADDRINFO" +[ "$CFG_IPV6IFNAME" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IPV6IFNAME" +[ "$CFG_GETIFADDRS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GETIFADDRS" +[ "$CFG_INOTIFY" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_INOTIFY" +[ "$CFG_NAS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_NAS" +[ "$CFG_NIS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_NIS" +[ "$CFG_SM" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SESSIONMANAGER" +[ "$CFG_XCURSOR" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XCURSOR" +[ "$CFG_XFIXES" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XFIXES" +[ "$CFG_FONTCONFIG" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_FONTCONFIG" +[ "$CFG_XINERAMA" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XINERAMA" +[ "$CFG_XKB" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XKB" +[ "$CFG_XRANDR" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XRANDR" +[ "$CFG_XRENDER" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XRENDER" +[ "$CFG_XSHAPE" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SHAPE" + +# sort QCONFIG_FLAGS for neatness if we can +[ '!' -z "$AWK" ] && QCONFIG_FLAGS=`echo $QCONFIG_FLAGS | $AWK '{ gsub(" ", "\n"); print }' | sort | uniq` +QCONFIG_FLAGS=`echo $QCONFIG_FLAGS` + +if [ -n "$QCONFIG_FLAGS" ]; then + for cfg in $QCONFIG_FLAGS; do + cfgd=`echo $cfg | sed 's/=.*$//'` # trim pushed 'Foo=Bar' defines + cfg=`echo $cfg | sed 's/=/ /'` # turn first '=' into a space + # figure out define logic, so we can output the correct + # ifdefs to override the global defines in a project + cfgdNeg= + if [ true ] && echo "$cfgd" | grep 'QT_NO_' >/dev/null 2>&1; then + # QT_NO_option can be forcefully turned on by QT_option + cfgdNeg=`echo $cfgd | sed "s,QT_NO_,QT_,"` + elif [ true ] && echo "$cfgd" | grep 'QT_' >/dev/null 2>&1; then + # QT_option can be forcefully turned off by QT_NO_option + cfgdNeg=`echo $cfgd | sed "s,QT_,QT_NO_,"` + fi + + if [ -z $cfgdNeg ]; then +cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF +#ifndef $cfgd +# define $cfg +#endif + +EOF + else +cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF +#if defined($cfgd) && defined($cfgdNeg) +# undef $cfgd +#elif !defined($cfgd) && !defined($cfgdNeg) +# define $cfg +#endif + +EOF + fi + done +fi + +if [ "$CFG_REDUCE_EXPORTS" = "yes" ]; then +cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF +#define QT_VISIBILITY_AVAILABLE + +EOF +fi + +# avoid unecessary rebuilds by copying only if qconfig.h has changed +if cmp -s "$outpath/src/corelib/global/qconfig.h" "$outpath/src/corelib/global/qconfig.h.new"; then + rm -f "$outpath/src/corelib/global/qconfig.h.new" +else + [ -f "$outpath/src/corelib/global/qconfig.h" ] && chmod +w "$outpath/src/corelib/global/qconfig.h" + mv "$outpath/src/corelib/global/qconfig.h.new" "$outpath/src/corelib/global/qconfig.h" + chmod -w "$outpath/src/corelib/global/qconfig.h" + for conf in "$outpath/include/QtCore/qconfig.h" "$outpath/include/Qt/qconfig.h"; do + if [ '!' -f "$conf" ]; then + ln -s "$outpath/src/corelib/global/qconfig.h" "$conf" + fi + done +fi + +#------------------------------------------------------------------------------- +# save configuration into qconfig.pri +#------------------------------------------------------------------------------- + +QTCONFIG="$outpath/mkspecs/qconfig.pri" +[ -f "$QTCONFIG.tmp" ] && rm -f "$QTCONFIG.tmp" +QTCONFIG_CONFIG= +if [ "$CFG_DEBUG" = "yes" ]; then + QTCONFIG_CONFIG="$QTCONFIG_CONFIG debug" + if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then + QT_CONFIG="$QT_CONFIG release" + fi + QT_CONFIG="$QT_CONFIG debug" +elif [ "$CFG_DEBUG" = "no" ]; then + QTCONFIG_CONFIG="$QTCONFIG_CONFIG release" + if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then + QT_CONFIG="$QT_CONFIG debug" + fi + QT_CONFIG="$QT_CONFIG release" +fi +if [ "$CFG_STL" = "yes" ]; then + QTCONFIG_CONFIG="$QTCONFIG_CONFIG stl" +fi +if [ "$CFG_FRAMEWORK" = "no" ]; then + QTCONFIG_CONFIG="$QTCONFIG_CONFIG qt_no_framework" +else + QT_CONFIG="$QT_CONFIG qt_framework" + QTCONFIG_CONFIG="$QTCONFIG_CONFIG qt_framework" +fi +if [ "$CFG_UNIVERSAL_BINARY" = "yes" ]; then + QT_CONFIG="$QT_CONFIG x86 ppc" +fi +cat >>"$QTCONFIG.tmp" <<EOF +#configuration +CONFIG += $QTCONFIG_CONFIG +QT_ARCH = $ARCH +QT_EDITION = $Edition +QT_CONFIG += $QT_CONFIG + +#versioning +QT_VERSION = $QT_VERSION +QT_MAJOR_VERSION = $QT_MAJOR_VERSION +QT_MINOR_VERSION = $QT_MINOR_VERSION +QT_PATCH_VERSION = $QT_PATCH_VERSION + +EOF +if [ "$CFG_RPATH" = "yes" ]; then + echo "QMAKE_RPATHDIR += \"$QT_INSTALL_LIBS\"" >> "$QTCONFIG.tmp" +fi +# replace qconfig.pri if it differs from the newly created temp file +if cmp -s "$QTCONFIG.tmp" "$QTCONFIG"; then + rm -f "$QTCONFIG.tmp" +else + mv -f "$QTCONFIG.tmp" "$QTCONFIG" +fi + +#------------------------------------------------------------------------------- +# save configuration into .qmake.cache +#------------------------------------------------------------------------------- + +CACHEFILE="$outpath/.qmake.cache" +[ -f "$CACHEFILE.tmp" ] && rm -f "$CACHEFILE.tmp" +cat >>"$CACHEFILE.tmp" <<EOF +CONFIG += $QMAKE_CONFIG dylib create_prl link_prl depend_includepath fix_output_dirs QTDIR_build +QT_SOURCE_TREE = \$\$quote($relpath) +QT_BUILD_TREE = \$\$quote($outpath) +QT_BUILD_PARTS = $CFG_BUILD_PARTS +QMAKE_ABSOLUTE_SOURCE_ROOT = \$\$QT_SOURCE_TREE +QMAKE_MOC_SRC = \$\$QT_BUILD_TREE/src/moc + +#local paths that cannot be queried from the QT_INSTALL_* properties while building QTDIR +QMAKE_MOC = \$\$QT_BUILD_TREE/bin/moc +QMAKE_UIC = \$\$QT_BUILD_TREE/bin/uic +QMAKE_UIC3 = \$\$QT_BUILD_TREE/bin/uic3 +QMAKE_RCC = \$\$QT_BUILD_TREE/bin/rcc +QMAKE_QDBUSXML2CPP = \$\$QT_BUILD_TREE/bin/qdbusxml2cpp +QMAKE_INCDIR_QT = \$\$QT_BUILD_TREE/include +QMAKE_LIBDIR_QT = \$\$QT_BUILD_TREE/lib + +EOF + +if [ -n "$QT_CFLAGS_PSQL" ]; then + echo "QT_CFLAGS_PSQL = $QT_CFLAGS_PSQL" >> "$CACHEFILE.tmp" +fi +if [ -n "$QT_LFLAGS_PSQL" ]; then + echo "QT_LFLAGS_PSQL = $QT_LFLAGS_PSQL" >> "$CACHEFILE.tmp" +fi +if [ -n "$QT_CFLAGS_MYSQL" ]; then + echo "QT_CFLAGS_MYSQL = $QT_CFLAGS_MYSQL" >> "$CACHEFILE.tmp" +fi +if [ -n "$QT_LFLAGS_MYSQL" ]; then + echo "QT_LFLAGS_MYSQL = $QT_LFLAGS_MYSQL" >> "$CACHEFILE.tmp" +fi +if [ -n "$QT_CFLAGS_SQLITE" ]; then + echo "QT_CFLAGS_SQLITE = $QT_CFLAGS_SQLITE" >> "$CACHEFILE.tmp" +fi +if [ -n "$QT_LFLAGS_SQLITE" ]; then + echo "QT_LFLAGS_SQLITE = $QT_LFLAGS_SQLITE" >> "$CACHEFILE.tmp" +fi + +if [ "$QT_EDITION" != "QT_EDITION_OPENSOURCE" ]; then + echo "DEFINES *= QT_EDITION=QT_EDITION_DESKTOP" >> "$CACHEFILE.tmp" +fi + +#dump in the SDK info +if [ '!' -z "$CFG_SDK" ]; then + echo "QMAKE_MAC_SDK = $CFG_SDK" >> "$CACHEFILE.tmp" +fi + +#dump the qmake spec +if [ -d "$outpath/mkspecs/$XPLATFORM" ]; then + echo "QMAKESPEC = \$\$QT_BUILD_TREE/mkspecs/$XPLATFORM" >> "$CACHEFILE.tmp" +else + echo "QMAKESPEC = $XPLATFORM" >> "$CACHEFILE.tmp" +fi + +# cmdline args +cat "$QMAKE_VARS_FILE" >> "$CACHEFILE.tmp" +rm -f "$QMAKE_VARS_FILE" 2>/dev/null + +# incrementals +INCREMENTAL="" +[ "$CFG_INCREMENTAL" = "auto" ] && "$WHICH" p4 >/dev/null 2>&1 && [ "$Edition" = "Trolltech" ] && CFG_INCREMENTAL="yes" +if [ "$CFG_INCREMENTAL" = "yes" ]; then + find "$relpath" -perm u+w -mtime -3 | grep 'cpp$' | while read f; do + # don't need to worry about generated files + [ -r `echo $f | sed "s,cpp$,ui,"` ] && continue + basename "$f" | grep '^moc_' >/dev/null 2>&1 && continue + # done + INCREMENTAL="$INCREMENTAL `basename \"$f\" | sed 's,.cpp,.o,'`" + done + [ '!' -z "$INCREMENTAL" ] && echo "QMAKE_INCREMENTAL += $INCREMENTAL" >> "$CACHEFILE.tmp" + [ -r "$outpath/.qmake.incremental" ] && echo "include($outpath/.qmake.incremental)" >> "$CACHEFILE.tmp" +fi + +# replace .qmake.cache if it differs from the newly created temp file +if cmp -s "$CACHEFILE.tmp" "$CACHEFILE"; then + rm -f "$CACHEFILE.tmp" +else + mv -f "$CACHEFILE.tmp" "$CACHEFILE" +fi + +#------------------------------------------------------------------------------- +# give feedback on configuration +#------------------------------------------------------------------------------- + +case "$COMPILER" in +g++*) + if [ "$CFG_EXCEPTIONS" != "no" ]; then + cat <<EOF + + This target is using the GNU C++ compiler ($PLATFORM). + + Recent versions of this compiler automatically include code for + exceptions, which increase both the size of the Qt libraries and + the amount of memory taken by your applications. + + You may choose to re-run `basename $0` with the -no-exceptions + option to compile Qt without exceptions. This is completely binary + compatible, and existing applications will continue to work. + +EOF + fi + ;; +cc*) + case "$PLATFORM" in + irix-cc*) + if [ "$CFG_EXCEPTIONS" != "no" ]; then + cat <<EOF + + This target is using the MIPSpro C++ compiler ($PLATFORM). + + You may choose to re-run `basename $0` with the -no-exceptions + option to compile Qt without exceptions. This will make the + size of the Qt library smaller and reduce the amount of memory + taken by your applications. + +EOF + fi + ;; + *) ;; + esac + ;; +*) ;; +esac + +echo +if [ "$XPLATFORM" = "$PLATFORM" ]; then + echo "Build type: $PLATFORM" +else + echo "Building on: $PLATFORM" + echo "Building for: $XPLATFORM" +fi +echo "Architecture: $ARCH" + +if [ -n "$PLATFORM_NOTES" ]; then + echo "Platform notes:" + echo "$PLATFORM_NOTES" +else + echo +fi + +if [ "$OPT_VERBOSE" = "yes" ]; then + if echo '\c' | grep '\c' >/dev/null; then + echo -n "qmake vars ...... " + else + echo "qmake vars ...... \c" + fi + cat "$QMAKE_VARS_FILE" | tr '\n' ' ' + echo "qmake switches .. $QMAKE_SWITCHES" +fi + +[ "$CFG_INCREMENTAL" = "yes" ] && [ '!' -z "$INCREMENTAL" ] && echo "Incremental ......... $INCREMENTAL" +echo "Build ............... $CFG_BUILD_PARTS" +echo "Configuration ....... $QMAKE_CONFIG $QT_CONFIG" +if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then + echo "Debug................ yes (combined)" + if [ "$CFG_DEBUG" = "yes" ]; then + echo "Default Link......... debug" + else + echo "Default Link......... release" + fi +else + echo "Debug................ $CFG_DEBUG" +fi +echo "Qt 3 compatibility... $CFG_QT3SUPPORT" +echo "QtDBus module........ $CFG_QDBUS" +echo "STL support ......... $CFG_STL" +echo "PCH support ......... $CFG_PRECOMPILE" +echo "MMX/SSE support ..... $CFG_HAVE_SSE" +echo "IPv6 support ........ $CFG_IPV6" +echo "IPv6 ifname support . $CFG_IPV6IFNAME" +echo "getaddrinfo support . $CFG_GETADDRINFO" +echo "getifaddrs support... $CFG_GETIFADDRS" +echo "Accessibility ....... $CFG_ACCESSIBILITY" +echo "NIS support ......... $CFG_NIS" +echo "CUPS support ........ $CFG_CUPS" +echo "Iconv support ....... $CFG_ICONV" +echo "Glib support ........ $CFG_GLIB" +echo "Large File support .. $CFG_LARGEFILE" +echo "GIF support ......... $CFG_GIF" +if [ "$CFG_JPEG" = "no" ]; then + echo "JPEG support ........ $CFG_JPEG" +else + echo "JPEG support ........ $CFG_JPEG ($CFG_LIBJPEG)" +fi +if [ "$CFG_PNG" = "no" ]; then + echo "PNG support ......... $CFG_PNG" +else + echo "PNG support ......... $CFG_PNG ($CFG_LIBPNG)" +fi +if [ "$CFG_MNG" = "no" ]; then + echo "MNG support ......... $CFG_MNG" +else + echo "MNG support ......... $CFG_MNG ($CFG_LIBMNG)" +fi +echo "zlib support ........ $CFG_ZLIB" +if [ "$PLATFORM_QWS" = "yes" ]; then + echo "Embedded support .... $CFG_EMBEDDED" + if [ "$CFG_QWS_FREETYPE" = "auto" ]; then + echo "Freetype2 support ... $CFG_QWS_FREETYPE ($CFG_LIBFREETYPE)" + else + echo "Freetype2 support ... $CFG_QWS_FREETYPE" + fi + # Normalize the decoration output first + CFG_GFX_ON=`echo ${CFG_GFX_ON}` + CFG_GFX_PLUGIN=`echo ${CFG_GFX_PLUGIN}` + echo "Graphics (qt) ....... ${CFG_GFX_ON}" + echo "Graphics (plugin) ... ${CFG_GFX_PLUGIN}" + CFG_DECORATION_ON=`echo ${CFG_DECORATION_ON}` + CFG_DECORATION_PLUGIN=`echo ${CFG_DECORATION_PLUGIN}` + echo "Decorations (qt) .... $CFG_DECORATION_ON" + echo "Decorations (plugin) $CFG_DECORATION_PLUGIN" + CFG_KBD_ON=`echo ${CFG_KBD_ON}` + echo "Keyboard driver ..... ${CFG_KBD_ON}" + CFG_MOUSE_ON=`echo ${CFG_MOUSE_ON}` + CFG_MOUSE_PLUGIN=`echo ${CFG_MOUSE_PLUGIN}` + echo "Mouse driver (qt) ... $CFG_MOUSE_ON" + echo "Mouse driver (plugin) $CFG_MOUSE_PLUGIN" +fi + echo "OpenGL support ...... $CFG_OPENGL" +if [ "$PLATFORM_X11" = "yes" ]; then + echo "NAS sound support ... $CFG_NAS" + echo "Session management .. $CFG_SM" + echo "XShape support ...... $CFG_XSHAPE" + echo "Xinerama support .... $CFG_XINERAMA" + echo "Xcursor support ..... $CFG_XCURSOR" + echo "Xfixes support ...... $CFG_XFIXES" + echo "Xrandr support ...... $CFG_XRANDR" + echo "Xrender support ..... $CFG_XRENDER" + echo "FontConfig support .. $CFG_FONTCONFIG" + echo "XKB Support ......... $CFG_XKB" + echo "immodule support .... $CFG_IM" +fi +[ "$CFG_SQL_mysql" != "no" ] && echo "MySQL support ....... $CFG_SQL_mysql" +[ "$CFG_SQL_psql" != "no" ] && echo "PostgreSQL support .. $CFG_SQL_psql" +[ "$CFG_SQL_odbc" != "no" ] && echo "ODBC support ........ $CFG_SQL_odbc" +[ "$CFG_SQL_oci" != "no" ] && echo "OCI support ......... $CFG_SQL_oci" +[ "$CFG_SQL_tds" != "no" ] && echo "TDS support ......... $CFG_SQL_tds" +[ "$CFG_SQL_db2" != "no" ] && echo "DB2 support ......... $CFG_SQL_db2" +[ "$CFG_SQL_ibase" != "no" ] && echo "InterBase support ... $CFG_SQL_ibase" +[ "$CFG_SQL_sqlite2" != "no" ] && echo "SQLite 2 support .... $CFG_SQL_sqlite2" +[ "$CFG_SQL_sqlite" != "no" ] && echo "SQLite support ...... $CFG_SQL_sqlite ($CFG_SQLITE)" + +# complain about not being able to use dynamic plugins if we are using a static build +if [ "$CFG_SHARED" = "no" ]; then + echo + echo "WARNING: Using static linking will disable the use of dynamically" + echo "loaded plugins. Make sure to import all needed static plugins," + echo "or compile needed modules into the library." + echo +fi +if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_DEBUG" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "no" ]; then + echo + echo "NOTE: Mac OS X frameworks implicitly build debug and release Qt libraries." + echo +fi +echo + +sepath=`echo "$relpath" | sed -e 's/\\./\\\\./g'` +PROCS=1 +EXEC="" + + +#------------------------------------------------------------------------------- +# build makefiles based on the configuration +#------------------------------------------------------------------------------- + +echo "Finding project files. Please wait..." +"$outpath/bin/qmake" -prl -r "${relpath}/projects.pro" +if [ -z "$QMAKE_PROJECTS" ]; then + QMAKE_PROJECTS=`find "$relpath/." -name '*.pro' -print | sed 's-/\./-/-'` +else + QT_PROJECTS= + for a in `echo $QMAKE_PROJECTS`; do + put_in="$a" + for leave_out in `echo $QMAKE_IGNORE_PROJECTS`; do + if [ "$put_in" = "$leave_out" ]; then + put_in= + break; + fi + done + [ '!' -z "$put_in" ] && QT_PROJECTS="$QT_PROJECTS $put_in" + done +fi +if [ -f "${relpath}/projects.pro" ]; then + mkfile="${outpath}/Makefile" + [ -f "$mkfile" ] && chmod +w "$mkfile" + QTDIR="$outpath" "$outpath/bin/qmake" "QT_PROJECTS=$CFG_BUILD_PARTS" -spec "$XQMAKESPEC" "${relpath}/projects.pro" -o "$mkfile" + QTDIR="$outpath" qmake-qt4 "QT_PROJECTS=$CFG_BUILD_PARTS" -spec "$XQMAKESPEC" "${relpath}/projects.pro" -o "$mkfile" +fi + +# .projects -> projects to process +# .projects.1 -> qt and moc +# .projects.2 -> subdirs and libs +# .projects.3 -> the rest +rm -f .projects .projects.1 .projects.2 .projects.3 + +if [ -z "$AWK" ]; then + for p in `echo $QMAKE_PROJECTS`; do + echo "$p" >> .projects + done +else + cat >projects.awk <<EOF +BEGIN { + files = 0 + target_file = "" + input_file = "" + + first = "./.projects.1.tmp" + second = "./.projects.2.tmp" + third = "./.projects.3.tmp" +} + +FNR == 1 { + if ( input_file ) { + if ( ! target_file ) + target_file = third + print input_file >target_file + } + + matched_target = 0 + template_lib = 0 + input_file = FILENAME + target_file = "" +} + +/^(TARGET.*=)/ { + if ( \$3 == "moc" || \$3 ~ /^Qt/ ) { + target_file = first + matched_target = 1 + } +} + +matched_target == 0 && /^(TEMPLATE.*=)/ { + if ( \$3 == "subdirs" ) + target_file = second + else if ( \$3 == "lib" ) + template_lib = 1 + else + target_file = third +} + +matched_target == 0 && template_lib == 1 && /^(CONFIG.*=)/ { + if ( \$0 ~ /plugin/ ) + target_file = third + else + target_file = second +} + +END { + if ( input_file ) { + if ( ! target_file ) + target_file = third + print input_file >>target_file + } +} + +EOF + + rm -f .projects.all + for p in `echo $QMAKE_PROJECTS`; do + echo "$p" >> .projects.all + done + + # if you get errors about the length of the command line to awk, change the -l arg + # to split below + split -l 100 .projects.all .projects.all. + for p in .projects.all.*; do + "$AWK" -f projects.awk `cat $p` + [ -f .projects.1.tmp ] && cat .projects.1.tmp >> .projects.1 + [ -f .projects.2.tmp ] && cat .projects.2.tmp >> .projects.2 + [ -f .projects.3.tmp ] && cat .projects.3.tmp >> .projects.3 + rm -f .projects.1.tmp .projects.2.tmp .projects.3.tmp $p + done + rm -f .projects.all* projects.awk + + [ -f .projects.1 ] && cat .projects.1 >>.projects + [ -f .projects.2 ] && cat .projects.2 >>.projects + rm -f .projects.1 .projects.2 + if [ -f .projects.3 ] && [ "$OPT_FAST" = "no" ]; then + cat .projects.3 >>.projects + rm -f .projects.3 + fi +fi +# don't sort Qt and MOC in with the other project files +# also work around a segfaulting uniq(1) +if [ -f .sorted.projects.2 ]; then + sort .sorted.projects.2 > .sorted.projects.2.new + mv -f .sorted.projects.2.new .sorted.projects.2 + cat .sorted.projects.2 >> .sorted.projects.1 +fi +[ -f .sorted.projects.1 ] && sort .sorted.projects.1 >> .sorted.projects +rm -f .sorted.projects.2 .sorted.projects.1 + +NORM_PROJECTS=0 +FAST_PROJECTS=0 +if [ -f .projects ]; then + uniq .projects >.tmp + mv -f .tmp .projects + NORM_PROJECTS=`cat .projects | wc -l | sed -e "s, ,,g"` +fi +if [ -f .projects.3 ]; then + uniq .projects.3 >.tmp + mv -f .tmp .projects.3 + FAST_PROJECTS=`cat .projects.3 | wc -l | sed -e "s, ,,g"` +fi +echo " `expr $NORM_PROJECTS + $FAST_PROJECTS` projects found." +echo + +PART_ROOTS= +for part in $CFG_BUILD_PARTS; do + case "$part" in + tools) PART_ROOTS="$PART_ROOTS tools" ;; + libs) PART_ROOTS="$PART_ROOTS src" ;; + examples) PART_ROOTS="$PART_ROOTS examples demos" ;; + *) ;; + esac +done + +if [ "$Edition" = "Trolltech" ]; then + PART_ROOTS="$PART_ROOTS tests" +fi + +echo "Creating makefiles. Please wait..." +for file in .projects .projects.3; do + [ '!' -f "$file" ] && continue + for a in `cat $file`; do + IN_ROOT=no + for r in $PART_ROOTS; do + if echo "$a" | grep "^$r" >/dev/null 2>&1 || echo "$a" | grep "^$relpath/$r" >/dev/null 2>&1; then + IN_ROOT=yes + break + fi + done + [ "$IN_ROOT" = "no" ] && continue + + case $a in + *winmain/winmain.pro) continue ;; + */qmake/qmake.pro) continue ;; + *moc*|*rcc*|*uic*) SPEC=$QMAKESPEC ;; + *) SPEC=$XQMAKESPEC ;; + esac + dir=`dirname $a | sed -e "s;$sepath;.;g"` + test -d "$dir" || mkdir -p "$dir" + OUTDIR="$outpath/$dir" + if [ -f "${OUTDIR}/Makefile" ] && [ "$OPT_FAST" = "yes" ]; then + # fast configure - the makefile exists, skip it + # since the makefile exists, it was generated by qmake, which means we + # can skip it, since qmake has a rule to regenerate the makefile if the .pro + # file changes... + [ "$OPT_VERBOSE" = "yes" ] && echo " skipping $a" + continue; + fi + QMAKE_SPEC_ARGS="-spec $SPEC" + if echo '\c' | grep '\c' >/dev/null; then + echo -n " for $a" + else + echo " for $a\c" + fi + + QMAKE="qmake-qt4" + QMAKE_ARGS="$QMAKE_SWITCHES $QMAKE_SPEC_ARGS" + if [ "$file" = ".projects.3" ]; then + if echo '\c' | grep '\c' >/dev/null; then + echo -n " (fast)" + else + echo " (fast)\c" + fi + echo + + cat >"${OUTDIR}/Makefile" <<EOF +# ${OUTDIR}/Makefile: generated by configure +# +# WARNING: This makefile will be replaced with a real makefile. +# All changes made to this file will be lost. +EOF + [ "$CFG_DEBUG_RELEASE" = "no" ] && echo "first_target: first" >>${OUTDIR}/Makefile + + cat >>"${OUTDIR}/Makefile" <<EOF +QMAKE = "$QMAKE" +all clean install qmake first Makefile: FORCE + \$(QMAKE) $QMAKE_ARGS -o "$OUTDIR" "$a" + cd "$OUTDIR" + \$(MAKE) \$@ + +FORCE: + +EOF + else + if [ "$OPT_VERBOSE" = "yes" ]; then + echo " (`basename $SPEC`)" + echo "$QMAKE" $QMAKE_ARGS -o "$OUTDIR" "$a" + else + echo + fi + + [ -f "${OUTDIR}/Makefile" ] && chmod +w "${OUTDIR}/Makefile" + QTDIR="$outpath" "$QMAKE" $QMAKE_ARGS -o "$OUTDIR" "$a" + fi + done +done +rm -f .projects .projects.3 + +#------------------------------------------------------------------------------- +# XShape is important, DnD in the Designer doens't work without it +#------------------------------------------------------------------------------- +if [ "$PLATFORM_X11" = "yes" ] && [ "$CFG_XSHAPE" = "no" ]; then + cat <<EOF + + NOTICE: Qt will not be built with XShape support. + + As a result, drag-and-drop in the Qt Designer will NOT + work. We recommend that you enable XShape support by passing + the -xshape switch to $0. +EOF +fi + +#------------------------------------------------------------------------------- +# check for platforms that we don't yet know about +#------------------------------------------------------------------------------- +if [ "$ARCH" = "generic" ]; then +cat <<EOF + + NOTICE: Atomic operations are not yet supported for this + architecture. + + Qt will use the 'generic' architecture instead, which will use + non-atomic operations instead. Applications that rely on atomic + operation support will NOT work with this library! +EOF +fi + +#------------------------------------------------------------------------------- +# finally save the executed command to another script +#------------------------------------------------------------------------------- +if [ `basename $0` != "config.status" ]; then + CONFIG_STATUS="$relpath/$relconf $OPT_CMDLINE" + + # add the system variables + for varname in $SYSTEM_VARIABLES; do + cmd=`echo \ +'if [ -n "\$'${varname}'" ]; then + CONFIG_STATUS="'${varname}'='"'\\\$${varname}'"' \$CONFIG_STATUS" +fi'` + eval "$cmd" + done + + echo "$CONFIG_STATUS" | grep '\-confirm\-license' >/dev/null 2>&1 || CONFIG_STATUS="$CONFIG_STATUS -confirm-license" + + [ -f "$outpath/config.status" ] && rm -f "$outpath/config.status" + echo "#!/bin/sh" > "$outpath/config.status" + echo "if [ \"\$#\" -gt 0 ]; then" >> "$outpath/config.status" + echo " $CONFIG_STATUS \"\$@\"" >> "$outpath/config.status" + echo "else" >> "$outpath/config.status" + echo " $CONFIG_STATUS" >> "$outpath/config.status" + echo "fi" >> "$outpath/config.status" + chmod +x "$outpath/config.status" +fi + +if [ -n "$RPATH_MESSAGE" ]; then + echo + echo "$RPATH_MESSAGE" +fi + +MAKE=`basename $MAKE` +echo +echo Qt is now configured for building. Just run \'$MAKE\'. +if [ "$relpath" = "$QT_INSTALL_PREFIX" ]; then + echo Once everything is built, Qt is installed. + echo You should not run \'$MAKE install\'. +else + echo Once everything is built, you must run \'$MAKE install\'. + echo Qt will be installed into $QT_INSTALL_PREFIX +fi +echo +echo To reconfigure, run \'$MAKE confclean\' and \'configure\'. +echo |