#!/bin/sh ############################################################################# ## ## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ## All rights reserved. ## Contact: Nokia Corporation (qt-info@nokia.com) ## ## This file is the build configuration utility 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$ ## ############################################################################# #------------------------------------------------------------------------------- # 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` #------------------------------------------------------------------------------- # 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 # detect the "echo without newline" style. usage: echo $ECHO_N "$ECHO_C" if echo '\c' | grep '\c' >/dev/null; then ECHO_N=-n else ECHO_C='\c' fi PLATFORM_MAC=no if [ -d /System/Library/Frameworks/Carbon.framework ]; then PLATFORM_MAC=yes fi #------------------------------------------------------------------------------- # print some introductory text #------------------------------------------------------------------------------- cat </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 # export MAKE, we need it later in the config.tests export MAKE fi fi ### help #------------------------------------------------------------------------------- # find qmake and check that it is at least 4.6.0 #------------------------------------------------------------------------------- if [ -z "$OPT_QMAKE" ]; then OPT_QMAKE=`$WHICH qmake 2>/dev/null` if [ -z "$OPT_QMAKE" ]; then echo "$0: could not find qmake; specify the -qmake option" exit 1 fi fi QMAKE_VERSION=`$OPT_QMAKE -v 2>/dev/null | grep 'Using Qt version' | \ sed 's/^Using Qt version //' | \ sed 's/ in .*$//'` case "$QMAKE_VERSION" in 4.0.*|4.1.*|4.2.*|4.3.*|4.4.*|4.5.*) QMAKE_VERSION="" ;; 4.*) ;; *) QMAKE_VERSION="" ;; esac if [ -z "$QMAKE_VERSION" ]; then echo "$0: $OPT_QMAKE must be at least version 4.6.0" echo "Specify the correct qmake binary with the -qmake option" exit 1 fi #------------------------------------------------------------------------------- # 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 cat <] [-no-openclgl] [-verbose] Configure options: -qmake ...... Path to the qmake binary to use. (default is "qmake" on the PATH) -no-openclgl ....... Do not use OpenCL/OpenGL interoperability. * -openclgl .......... Use OpenCL/OpenGL interoperability. -gcov .............. Use gcov for coverage testing (g++ only). -I ........ Add an explicit include path for OpenCL. -L ........ Add an explicit library path for OpenCL. -l ........ Change the library name for OpenCL. -fw ....... Specify the Mac framework for OpenCL (default is "OpenCL"). -help, -h .......... Display this information. -verbose, -v ....... Print verbose information about each step of the configure process. EOF exit 0 fi # Help #------------------------------------------------------------------------------- # tests that need qmake #------------------------------------------------------------------------------- XQMAKESPEC="" QMAKE_CONFIG="" # if we don't have any -l flags, then assume -lOpenCL. if [ -z "$l_FLAGS" ] ; then if [ "$UNAME_SYSTEM" = "Linux" ] ; then l_FLAGS=" -lOpenCL" fi if [ "$PLATFORM_MAC" = "yes" ] ; then l_FLAGS=" -framework OpenCL" fi fi # detect OpenCL if "$unixtests/compile.test" "$OPT_QMAKE" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opencl "opencl" $L_FLAGS $I_FLAGS $l_FLAGS $D_FLAGS; then CFG_OPENCL=yes else CFG_OPENCL=no fi # detect OpenCL/OpenGL interoperation if [ "${CFG_OPENCLGL}" = "auto" ]; then if "$unixtests/compile.test" "$OPT_QMAKE" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/openclgl "openclgl" $L_FLAGS $I_FLAGS $l_FLAGS $D_FLAGS; then CFG_OPENCLGL=yes else CFG_OPENCLGL=no fi fi # detect OpenCL 1.1 if [ "${CFG_OPENCL_1_1}" = "auto" ]; then if "$unixtests/compile.test" "$OPT_QMAKE" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opencl11 "opencl11" $L_FLAGS $I_FLAGS $l_FLAGS $D_FLAGS; then CFG_OPENCL_1_1=yes else CFG_OPENCL_1_1=no fi fi #------------------------------------------------------------------------------- # give feedback on configuration #------------------------------------------------------------------------------- echo "Qt version ............. $QMAKE_VERSION" echo "qmake .................. $OPT_QMAKE" echo "OpenCL 1.0 ............. $CFG_OPENCL" echo "OpenCL 1.1 ............. $CFG_OPENCL_1_1" echo "OpenCL/OpenGL interop .. $CFG_OPENCLGL" echo "Extra QMAKE_CXXFLAGS ...$D_FLAGS" | sed 's/"//g' echo "Extra INCLUDEPATH ......$INCLUDEPATH" | sed 's/"//g' echo "Extra LIBS .............$L_FLAGS$l_FLAGS" | sed 's/"//g' echo "" if [ "x$CFG_OPENCL" != "xyes" ] ; then echo "Could not detect an OpenCL implementation ... aborting" if [ "x$OPT_VERBOSE" = "xno" ] ; then echo "Use the -verbose option for more information" fi exit 1 fi #------------------------------------------------------------------------------- # build makefiles based on the configuration #------------------------------------------------------------------------------- QMAKE_OPTIONS="" if [ "x$CFG_OPENCLGL" != "xyes" ] ; then QMAKE_OPTIONS="$QMAKE_OPTIONS CONFIG+=no_cl_gl" fi if [ "x$CFG_OPENCL_1_1" = "xyes" ] ; then QMAKE_OPTIONS="$QMAKE_OPTIONS CONFIG+=opencl_1_1" fi if [ "x$CFG_GCOV" = "xyes" ] ; then QMAKE_OPTIONS="$QMAKE_OPTIONS LIBS*=-fprofile-arcs" QMAKE_OPTIONS="$QMAKE_OPTIONS LIBS*=-ftest-coverage" QMAKE_OPTIONS="$QMAKE_OPTIONS QMAKE_CXXFLAGS*=-fprofile-arcs" QMAKE_OPTIONS="$QMAKE_OPTIONS QMAKE_CXXFLAGS*=-ftest-coverage" QMAKE_OPTIONS="$QMAKE_OPTIONS CONFIG+=gcov" fi QMAKE_OPTIONS="$QMAKE_OPTIONS CONFIG+=opencl_configure" if $OPT_QMAKE $QMAKE_OPTIONS \ "LIBS*=$L_FLAGS" \ "LIBS*=$l_FLAGS" \ "INCLUDEPATH*=$INCLUDEPATH" \ "QMAKE_CXXFLAGS*=$D_FLAGS" "$relpath/opencl.pro" ; then echo "QtOpenCL has been configured. Run '$MAKE' to build." echo "" exit 0 else exit 1 fi