#!/bin/sh if [ "$help" = "1" ] then cat << EOF QImage options: --force-qt3 - Force compile against Qt3 if Qt4 is present on the system --qimage-libdir - Location of QT lib directory [/usr/lib/qt4 or /usr/lib/qt3] --qimage-includedir - Location of QT include directory [/usr/include/qt4 or /usr/include/qt3] --kde-libdir - Location of KDE lib directory [/usr/lib] --kde-includedir - Location of KDE include directory [/usr/include/kde] --exif-libdir - Location of libexif lib directory [/usr/lib] --exif-includedir - Location of libexif include directory [/usr/include/libexif] --without-kde - Don't link to KDE libraries EOF else targetos=$(uname -s) case $targetos in MINGW32*) export LIBSUF=.dll ;; Darwin) export LIBSUF=.dylib ;; Linux|FreeBSD|NetBSD) export LIBSUF=.so ;; *) ;; esac qimage_includedir= qimage_libdir= if [ "$QTDIR" != "" ] then qimage_includedir="$QTDIR/include" qimage_libdir="$QTDIR/lib" fi export force_qt3= export qt4_found= export without_kde= for i in "$@" do case $i in --qimage-libdir=* ) qimage_libdir="${i#--qimage-libdir=}" ;; --qimage-includedir=* ) qimage_includedir="${i#--qimage-includedir=}" ;; --kde-libdir=* ) kde_libdir="${i#--kde-libdir=}" ;; --kde-includedir=* ) kde_includedir="${i#--kde-includedir=}" ;; --exif-libdir=* ) exif_libdir="${i#--exif-libdir=}" ;; --exif-includedir=* ) exif_includedir="${i#--exif-includedir=}" ;; --force-qt3 ) force_qt3="true" ;; --without-kde ) without_kde="true" ;; esac done echo > config.h echo > config.mak pkg-config --exists 'libexif' if [ $? -eq 0 ] then echo "Libexif found, enabling auto rotate" echo "#define USE_EXIF" >> config.h echo "USE_EXIF=1" >> config.mak echo EXIFCXXFLAGS=$(pkg-config --cflags libexif ) >> config.mak echo EXIFLIBS=$(pkg-config --libs libexif) >> config.mak elif [ -d "$exif_libdir" -a -d "$exif_includedir" ] then # test if we have a libexif if [ -f "$exif_libdir/exif-data.h" ] then echo "Libexif found, enabling auto rotate" echo "#define USE_EXIF" >> config.h echo "USE_EXIF=1" >> config.mak echo EXIFCXXFLAGS=-I$exif_includedir >> config.mak echo EXIFLIBS=-L$exif_libdir lexif >> config.mak else echo "Libexif not found, disabling exif features (auto rotate)" fi fi if [ -d "$qimage_libdir" -a -d "$qimage_includedir" ] then # test if we have a Qt3 or Qt4 if [ -f "$qimage_libdir/libQtCore.so" ] || [ -d "$qimage_libdir/QtGui.framework" ] || [ -f "$qimage_libdir/libQtCore4.a" ] && [ "$force_qt3" = "" ] then echo "Qt version 4.x detected, will compile Qt4 qimage producer" qt4_found=true else echo "Qt version 3.x detected, will compile Qt3 qimage producer" fi echo "Include directory: " $qimage_includedir if [ "$qt4_found" != "" ] && [ "$force_qt3" = "" ] then echo "#define USE_QT4" >> config.h echo "USE_QT4=1" >> config.mak if [ -d "$qimage_libdir/QtGui.framework" ] then echo QTCXXFLAGS=$(pkg-config --cflags QtCore QtGui QtXml QtSvg QtOpenGL) >> config.mak echo QTLIBS=$(pkg-config --libs QtCore QtGui QtXml QtSvg QtOpenGL) >> config.mak elif [ -f "$qimage_libdir/libQtCore4.a" ] then echo QTCXXFLAGS=-I$qimage_includedir >> config.mak echo QTLIBS=-Wl,-enable-auto-import -L$qimage_libdir -lQtCore4 -lQtGui4 -lQtXml4 -lQtSvg4 -lQtOpenGL4 >> config.mak else echo QTCXXFLAGS=-I$qimage_includedir >> config.mak echo QTLIBS=-L$qimage_libdir -lQtCore -lQtGui -lQtXml -lQtSvg -lQtOpenGL >> config.mak fi else if [ "$without_kde" = "" ] && [ -d "$kde_includedir" ] then echo "#define USE_KDE3" >> config.h echo "USE_KDE3=1" >> config.mak echo "#define USE_QT3" >> config.h echo "USE_QT3=1" >> config.mak echo QTCXXFLAGS=-I$qimage_includedir -I$kde_includedir -DQT_THREAD_SUPPORT >> config.mak echo QTLIBS=-L$qimage_libdir -L$kde_libdir -lqt-mt >> config.mak else echo "qimage: KDE environment not found or disabled by request - disabling extra image formats" echo "#define USE_QT3" >> config.h echo "USE_QT3=1" >> config.mak echo QTCXXFLAGS=-I$qimage_includedir -DQT_THREAD_SUPPORT>> config.mak echo QTLIBS=-L$qimage_libdir -lqt-mt >> config.mak fi fi else pkg-config --exists 'QtGui >= 4' if [ $? -eq 0 ] && [ "$force_qt3" = "" ] then echo "Qt version 4.x detected, will compile Qt4 qimage producer" qt4_found=true echo "#define USE_QT4" >> config.h echo "USE_QT4=1" >> config.mak echo QTCXXFLAGS=$(pkg-config --cflags QtCore QtGui QtXml QtSvg QtOpenGL) >> config.mak echo QTLIBS=$(pkg-config --libs QtCore QtGui QtXml QtSvg QtOpenGL) >> config.mak else echo "qimage: QT environment not found - disabling" touch ../disable-qimage fi fi if [ "$without_kde" = "" ] then kde4-config if [ $? -eq 0 ] && [ "$qt4_found" != "" ] then # test if we have KDE4, required on some systems to get QImage extra formats (xcf, ...) if [ "$kde_includedir" = "" ] then kde_includedir=`kde4-config --install include` fi if [ "$kde_libdir" = "" ] then kde_libdir=`kde4-config --install lib` fi if [ -d "$kde_includedir" ] && [ -d "$kde_libdir" ] then echo "KDE version 4.x detected, will enable extra image formats" echo "#define USE_KDE4" >> config.h echo "USE_KDE4=1" >> config.mak echo KDECXXFLAGS=-I$kde_includedir >> config.mak # the -L with kde4/devel is for Fedora echo KDELIBS=-L$kde_libdir -L${kde_libdir}/kde4/devel -lkdecore >> config.mak fi fi fi [ "$gpl3" = "true" ] && echo GPL3=1 >> config.mak exit 0 fi