android: work around android's linux/input.h being retarded.
[profile/ivi/qtbase.git] / configure
index 58bdc59..36576c2 100755 (executable)
--- a/configure
+++ b/configure
@@ -108,6 +108,21 @@ QMakeVar()
     echo "$2" "$eq" "$3" >> "$QMAKE_VARS_FILE"
 }
 
+shellArgumentListToQMakeListHelper()
+{
+    local retval
+    for arg in "$@"; do retval="$retval \"$arg\""; done
+    echo "$retval"
+}
+
+# Convert a string usable on a shell command line into word-by-word quoted
+# qmake list.
+shellArgumentListToQMakeList()
+{
+    # eval is needed for the shell to interpret the backslash escape sequences
+    eval shellArgumentListToQMakeListHelper "$@"
+}
+
 # Helper function for getQMakeConf. It parses include statements in
 # qmake.conf and prints out the expanded file
 getQMakeConf1()
@@ -772,7 +787,6 @@ CFG_RPATH=yes
 CFG_FRAMEWORK=auto
 MAC_CONFIG_TEST_COMMANDLINE=  # used to make the configure tests run with the correct arch's and SDK settings
 CFG_MAC_HARFBUZZ=no
-CFG_SXE=no
 CFG_PREFIX_INSTALL=yes
 CFG_SDK=
 DEFINES=
@@ -920,13 +934,7 @@ while [ "$#" -gt 0 ]; do
         VAL=no
         ;;
     #Qt style options that pass an argument
-    -qconfig)
-        CFG_QCONFIG="$VAL"
-        VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
-        shift
-        VAL=$1
-        ;;
-    -prefix|-docdir|-headerdir|-plugindir|-importdir|-datadir|-libdir|-bindir|-translationdir|-sysconfdir|-examplesdir|-testsdir|-depths|-make|-nomake|-platform|-xplatform|-device|-device-option|-sdk|-arch|-host-arch|-mysql_config|-sysroot|-hostdatadir|-hostbindir|-qpa)
+    -prefix|-docdir|-headerdir|-plugindir|-importdir|-datadir|-libdir|-bindir|-translationdir|-sysconfdir|-examplesdir|-testsdir|-depths|-make|-nomake|-platform|-xplatform|-device|-device-option|-sdk|-arch|-host-arch|-mysql_config|-sysroot|-hostdatadir|-hostbindir|-qpa|-qconfig)
         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
         shift
         VAL="$1"
@@ -1166,9 +1174,6 @@ while [ "$#" -gt 0 ]; do
     bindir)
         QT_INSTALL_BINS="$VAL"
         ;;
-    sxe)
-       CFG_SXE="$VAL"
-        ;;
     sse)
         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
             CFG_SSE="$VAL"
@@ -2120,6 +2125,9 @@ if [ "$OPT_SHADOW" = "yes" ]; then
     # save a pre-existing mkspecs/modules dir
     test -d "$outpath/mkspecs/modules" && \
         mv "$outpath/mkspecs/modules" "$outpath/mkspecs-modules"
+    # ditto for mkspecs/modules-inst
+    test -d "$outpath/mkspecs/modules-inst" && \
+        mv "$outpath/mkspecs/modules-inst" "$outpath/mkspecs-modules-inst"
 
     # symlink the mkspecs directory
     mkdir -p "$outpath/mkspecs"
@@ -2147,6 +2155,12 @@ if [ "$OPT_SHADOW" = "yes" ]; then
         ShadowMkspecs modules
     fi
 
+    # The modules-inst dir is not quite as special, but still.
+    if test -d "$outpath/mkspecs-modules-inst"; then
+        rm -rf "$outpath/mkspecs/modules-inst"
+        mv "$outpath/mkspecs-modules-inst" "$outpath/mkspecs/modules-inst"
+    fi
+
     # symlink the doc directory
     rm -rf "$outpath/doc"
     ln -s "$relpath/doc" "$outpath/doc"
@@ -3604,6 +3618,16 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ];
 fi # Build qmake
 
 #-------------------------------------------------------------------------------
+# create a qt.conf for the Qt build tree itself
+#-------------------------------------------------------------------------------
+
+QTCONFFILE="$outpath/bin/qt.conf"
+cat > "$QTCONFFILE" <<EOF
+[EffectivePaths]
+Prefix=..
+EOF
+
+#-------------------------------------------------------------------------------
 # Detect pkg-config
 #-------------------------------------------------------------------------------
 if [ -z "$PKG_CONFIG" ]; then
@@ -4518,9 +4542,9 @@ elif [ "$CFG_OPENGL" = "es2" ]; then
         QMAKE_LIBDIR_OPENGL_ES2=`$PKG_CONFIG --libs-only-L glesv2 2>/dev/null | sed -e 's,^-L,,g' -e 's, -L, ,g'`
         QMAKE_LIBS_OPENGL_ES2=`$PKG_CONFIG --libs glesv2 2>/dev/null`
         QMAKE_CFLAGS_OPENGL_ES2=`$PKG_CONFIG --cflags glesv2 2>/dev/null`
-        QMakeVar set QMAKE_INCDIR_OPENGL_ES2 "$QMAKE_INCDIR_OPENGL_ES2"
-        QMakeVar set QMAKE_LIBDIR_OPENGL_ES2 "$QMAKE_LIBDIR_OPENGL_ES2"
-        QMakeVar set QMAKE_LIBS_OPENGL_ES2 "$QMAKE_LIBS_OPENGL_ES2"
+        QMakeVar set QMAKE_INCDIR_OPENGL_ES2 "`shellArgumentListToQMakeList "$QMAKE_INCDIR_OPENGL_ES2"`"
+        QMakeVar set QMAKE_LIBDIR_OPENGL_ES2 "`shellArgumentListToQMakeList "$QMAKE_LIBDIR_OPENGL_ES2"`"
+        QMakeVar set QMAKE_LIBS_OPENGL_ES2 "`shellArgumentListToQMakeList "$QMAKE_LIBS_OPENGL_ES2"`"
     fi
 
     "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS $QMAKE_LIBS_OPENGL_ES2 $QMAKE_CFLAGS_OPENGL_ES2
@@ -4644,22 +4668,20 @@ if [ "$CFG_XCB" != "no" ]; then
             QT_CONFIG="$QT_CONFIG xcb-xlib"
         fi
 
-        if [ "$XPLATFORM_MAEMO" = "yes" ]; then
-            # auto-detect XInput2/Xinput support
-            if [ "$CFG_XINPUT2" != "no" ]; then
-                if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xinput2 "XInput2" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS; then
-                    CFG_XINPUT2=yes
-                    CFG_XINPUT=no
+        # auto-detect XInput2 support. Needed by xcb too.
+        if [ "$CFG_XINPUT2" != "no" ]; then
+            if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xinput2 "XInput2" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS; then
+                CFG_XINPUT2=yes
+                CFG_XINPUT=no
+            else
+                if [ "$CFG_XINPUT2" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
+                    echo "XInput2 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
-                    if [ "$CFG_XINPUT2" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
-                        echo "XInput2 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_XINPUT2=no
-                    fi
+                    CFG_XINPUT2=no
                 fi
             fi
         fi
@@ -4679,7 +4701,7 @@ if [ "$CFG_DIRECTFB" != "no" ]; then
     if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists directfb 2>/dev/null; then
         QMAKE_CFLAGS_DIRECTFB=`$PKG_CONFIG --cflags directfb 2>/dev/null`
         QMAKE_LIBS_DIRECTFB=`$PKG_CONFIG --libs directfb 2>/dev/null`
-        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/directfb" "DirectFB" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS $QMAKE_CFLAGS_DIRECTFB $QMAKE_LIBS_DIRECTFB; then
+        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/qpa/directfb" "DirectFB" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS $QMAKE_CFLAGS_DIRECTFB $QMAKE_LIBS_DIRECTFB; then
             CFG_DIRECTFB=yes
         elif [ "$CFG_DIRECTFB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
             echo " DirectFB support cannot be enabled due to functionality tests!"
@@ -5086,11 +5108,6 @@ if [ "$CFG_OPENGL" = "es2" ]; then
     QT_CONFIG="$QT_CONFIG opengles2"
 fi
 
-# safe execution environment
-if [ "$CFG_SXE" != "no" ]; then
-    QT_CONFIG="$QT_CONFIG sxe"
-fi
-
 # build up the variables for output
 if [ "$CFG_DEBUG" = "yes" ]; then
     QMAKE_OUTDIR="${QMAKE_OUTDIR}debug"
@@ -5099,10 +5116,10 @@ elif [ "$CFG_DEBUG" = "no" ]; then
 fi
 if [ "$CFG_SHARED" = "yes" ]; then
     QMAKE_OUTDIR="${QMAKE_OUTDIR}-shared"
-    QMAKE_CONFIG="$QMAKE_CONFIG shared dll"
+    QT_CONFIG="$QT_CONFIG shared"
 elif [ "$CFG_SHARED" = "no" ]; then
     QMAKE_OUTDIR="${QMAKE_OUTDIR}-static"
-    QMAKE_CONFIG="$QMAKE_CONFIG static"
+    QT_CONFIG="$QT_CONFIG static"
 fi
 
 #FIXME: qpa is implicit this should all be removed
@@ -5548,6 +5565,16 @@ EOF
 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_SHARED" = "no" ]; then
+    cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
+/* Qt was configured for a static build */
+#if !defined(QT_SHARED) && !defined(QT_STATIC)
+# define QT_STATIC
+#endif
+
+EOF
+fi
+
 if [ "$CFG_LARGEFILE" = "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
     echo "#define QT_LARGEFILE_SUPPORT 64" >>"$outpath/src/corelib/global/qconfig.h.new"
 fi
@@ -5612,7 +5639,6 @@ QMakeVar set sql-plugins "$SQL_PLUGINS"
 [ "$CFG_PNG" != "yes" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_PNG"
 [ "$CFG_JPEG" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_JPEG"
 [ "$CFG_ZLIB" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ZLIB"
-[ "$CFG_SXE" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SXE"
 [ "$CFG_DBUS" = "no" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_DBUS"
 
 # X11/Unix/Mac only configs
@@ -5789,7 +5815,7 @@ fi
 
 if [ -n "$CFG_SYSROOT" ]; then
     echo "# sysroot" >>"$QTCONFIG.tmp"
-    echo `basename "$XQMAKESPEC"` \{ >>"$QTCONFIG.tmp"
+    echo "!host_build {" >>"$QTCONFIG.tmp"
     echo "    QMAKE_CFLAGS    += --sysroot=\$\$[QT_SYSROOT]" >>"$QTCONFIG.tmp"
     echo "    QMAKE_CXXFLAGS  += --sysroot=\$\$[QT_SYSROOT]" >>"$QTCONFIG.tmp"
     echo "    QMAKE_LFLAGS    += --sysroot=\$\$[QT_SYSROOT]" >>"$QTCONFIG.tmp"
@@ -5807,7 +5833,7 @@ fi
 
 if [ -n "$QMAKE_INCDIR_OPENGL_ES2" ]; then
     echo "#Qt opengl include path" >> "$QTCONFIG.tmp"
-    echo "QMAKE_INCDIR_OPENGL_ES2 = \"$QMAKE_INCDIR_OPENGL_ES2\"" >> "$QTCONFIG.tmp"
+    echo "QMAKE_INCDIR_OPENGL_ES2 = `shellArgumentListToQMakeList "$QMAKE_INCDIR_OPENGL_ES2"`" >> "$QTCONFIG.tmp"
 fi
 
 # replace qconfig.pri if it differs from the newly created temp file
@@ -5823,6 +5849,7 @@ fi
 QTMODULE="$outpath/mkspecs/qmodule.pri"
 
 echo "CONFIG += $QMAKE_CONFIG create_prl link_prl" >> "$QTMODULE.tmp"
+echo "QT_BUILD_PARTS = $CFG_BUILD_PARTS" >> "$QTMODULE.tmp"
 
 # Ensure we can link to uninistalled libraries
 if [ "$BUILD_ON_MAC" != "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ] && linkerSupportsFlag -rpath-link "$outpath/lib"; then
@@ -5890,29 +5917,12 @@ cat >>"$CACHEFILE.tmp" <<EOF
 #paths
 QT_SOURCE_TREE = \$\$quote($relpath)
 QT_BUILD_TREE = \$\$quote($outpath)
-QT_BUILD_PARTS = $CFG_BUILD_PARTS
-
-#local paths that cannot be queried from the QT_INSTALL_* properties while building QTDIR
-QMAKE_INCDIR_QT  = \$\$QT_BUILD_TREE/include
-QMAKE_LIBDIR_QT  = \$\$QT_BUILD_TREE/lib
 
 include(\$\$PWD/mkspecs/qmodule.pri)
 CONFIG += dylib depend_includepath fix_output_dirs no_private_qt_headers_warning QTDIR_build
 
 EOF
 
-#dump the qmake spec
-if [ -d "$outpath/mkspecs/$XPLATFORM" ]; then
-   echo "XQMAKESPEC = \$\$QT_BUILD_TREE/mkspecs/$XPLATFORM" >> "$CACHEFILE.tmp"
-else
-   echo "XQMAKESPEC = $XPLATFORM" >> "$CACHEFILE.tmp"
-fi
-if [ -d "$outpath/mkspecs/$PLATFORM" ]; then
-   echo "QMAKESPEC = \$\$QT_BUILD_TREE/mkspecs/$PLATFORM" >> "$CACHEFILE.tmp"
-else
-   echo "QMAKESPEC = $PLATFORM" >> "$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"
@@ -6042,6 +6052,7 @@ echo "Xcursor support ........ $CFG_XCURSOR"
 echo "Xfixes support ......... $CFG_XFIXES"
 echo "Xrandr support ......... $CFG_XRANDR"
 echo "Xi support ............. $CFG_XINPUT"
+echo "Xi2 support ............ $CFG_XINPUT2"
 echo "MIT-SHM support ........ $CFG_MITSHM"
 echo "FontConfig support ..... $CFG_FONTCONFIG"
 echo "XKB Support ............ $CFG_XKB"