From 9957e85e37345e946ecc67196d65fbca867a2001 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com>
Date: Wed, 3 Mar 2010 10:34:44 +0100
Subject: Add config.test for multimedia/qml

using pkg-config from pri file is not good for cross-compiling

Reviewed-by: paul
---
 config.tests/unix/pulseaudio/pulseaudio.pro     |  4 ++
 config.tests/unix/pulseaudio/pulseaudiotest.cpp | 49 +++++++++++++++++++++++++
 configure                                       | 15 ++++++++
 src/multimedia/qml/qml.pri                      | 20 +++++-----
 4 files changed, 79 insertions(+), 9 deletions(-)
 create mode 100644 config.tests/unix/pulseaudio/pulseaudio.pro
 create mode 100644 config.tests/unix/pulseaudio/pulseaudiotest.cpp

diff --git a/config.tests/unix/pulseaudio/pulseaudio.pro b/config.tests/unix/pulseaudio/pulseaudio.pro
new file mode 100644
index 0000000..698a35f
--- /dev/null
+++ b/config.tests/unix/pulseaudio/pulseaudio.pro
@@ -0,0 +1,4 @@
+SOURCES = pulseaudiotest.cpp
+LIBS+=-lpulse
+CONFIG -= qt dylib
+mac:CONFIG -= app_bundle
diff --git a/config.tests/unix/pulseaudio/pulseaudiotest.cpp b/config.tests/unix/pulseaudio/pulseaudiotest.cpp
new file mode 100644
index 0000000..eed88da
--- /dev/null
+++ b/config.tests/unix/pulseaudio/pulseaudiotest.cpp
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <pulse/pulseaudio.h>
+
+int main(int ,char **)
+{
+    pa_threaded_mainloop *mainloop = pa_threaded_mainloop_new();
+    return 0;
+}
+
diff --git a/configure b/configure
index 2312165..7ac4ff0 100755
--- a/configure
+++ b/configure
@@ -784,6 +784,7 @@ OPT_HELP=
 CFG_SILENT=no
 CFG_GRAPHICS_SYSTEM=default
 CFG_ALSA=auto
+CFG_PULSEAUDIO=auto
 CFG_NETWORKMANAGER=auto
 CFG_COREWLAN=auto
 
@@ -5945,6 +5946,14 @@ if [ "$CFG_ALSA" = "auto" ]; then
     fi
 fi
 
+if [ "$CFG_PULSEAUDIO" = "auto" ]; then
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/pulseaudio "pulseaudio" $L_FLAGS $I_FLAGS $l_FLAGS; then
+        CFG_PULSEAUDIO=yes
+    else
+        CFG_PULSEAUDIO=no
+    fi
+fi
+
 if [ "$CFG_NETWORKMANAGER" = "auto" ]; then
     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/networkmanager "NetworkManager" $L_FLAGS $I_FLAGS $l_FLAGS; then
         CFG_NETWORKMANAGER=yes
@@ -6439,6 +6448,10 @@ if [ "$CFG_ALSA" = "yes" ]; then
     QT_CONFIG="$QT_CONFIG alsa"
 fi
 
+if [ "$CFG_PULSEAUDIO" = "yes" ]; then
+    QT_CONFIG="$QT_CONFIG pulseaudio"
+fi
+
 if [ "$CFG_NETWORKMANAGER" = "yes" ]; then
     QT_CONFIG="$QT_CONFIG networkmanager"
 fi
@@ -7154,6 +7167,7 @@ fi
 [ "$CFG_XRANDR" = "runtime" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XRANDR"
 [ "$CFG_XINPUT" = "runtime" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XINPUT"
 [ "$CFG_ALSA" = "no" ]           && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ALSA"
+[ "$CFG_PULSEAUDIO" = "no" ]          && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_PULSEAUDIO"
 [ "$CFG_NETWORKMANAGER" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_NETWORKMANAGER"
 [ "$CFG_COREWLAN" = "no" ]       && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_COREWLAN"
 
@@ -7657,6 +7671,7 @@ elif [ "$CFG_OPENSSL" = "linked" ]; then
 fi
 echo "OpenSSL support ........ $CFG_OPENSSL $OPENSSL_LINKAGE"
 echo "Alsa support ........... $CFG_ALSA"
+echo "Pulse Audio support .... $CFG_PULSEAUDIO"
 echo "NetworkManager support . $CFG_NETWORKMANAGER"
 if [ "$PLATFORM_MAC" = "yes" ]; then
     echo "CoreWlan support ....... $CFG_COREWLAN"
diff --git a/src/multimedia/qml/qml.pri b/src/multimedia/qml/qml.pri
index d0ff71d..d7aef1a 100644
--- a/src/multimedia/qml/qml.pri
+++ b/src/multimedia/qml/qml.pri
@@ -2,15 +2,17 @@
 contains(QT_CONFIG, declarative) {
     QT += declarative
 
-    system(pkg-config --exists \'libpulse >= 0.9.10\') {
-        DEFINES += QT_MULTIMEDIA_PULSEAUDIO
-        HEADERS += $$PWD/qsoundeffect_pulse_p.h
-        SOURCES += $$PWD/qsoundeffect_pulse_p.cpp
-        LIBS += -lpulse
-    } else:x11 {
-        DEFINES += QT_MULTIMEDIA_QMEDIAPLAYER
-        HEADERS += $$PWD/qsoundeffect_qmedia_p.h
-        SOURCES += $$PWD/qsoundeffect_qmedia_p.cpp
+   unix { 
+       unix:contains(QT_CONFIG, pulseaudio) {
+            DEFINES += QT_MULTIMEDIA_PULSEAUDIO
+            HEADERS += $$PWD/qsoundeffect_pulse_p.h
+            SOURCES += $$PWD/qsoundeffect_pulse_p.cpp
+            LIBS += -lpulse
+        } else {
+            DEFINES += QT_MULTIMEDIA_QMEDIAPLAYER
+            HEADERS += $$PWD/qsoundeffect_qmedia_p.h
+            SOURCES += $$PWD/qsoundeffect_qmedia_p.cpp
+        } 
     } else {
         HEADERS += $$PWD/qsoundeffect_qsound_p.h
         SOURCES += $$PWD/qsoundeffect_qsound_p.cpp
-- 
cgit v0.12