]> git.sesse.net Git - mlt/blob - src/modules/qimage/configure
Enable build on NetBSD (3090684)
[mlt] / src / modules / qimage / configure
1 #!/bin/sh
2
3 if [ "$help" = "1" ]
4 then
5         cat << EOF
6 QImage options:
7
8   --force-qt3             - Force compile against Qt3 if Qt4 is present on the system
9   --qimage-libdir         - Location of QT lib directory [/usr/lib/qt4 or /usr/lib/qt3]
10   --qimage-includedir     - Location of QT include directory [/usr/include/qt4 or /usr/include/qt3]
11   --kde-libdir            - Location of KDE lib directory [/usr/lib]
12   --kde-includedir        - Location of KDE include directory [/usr/include/kde]
13   --exif-libdir           - Location of libexif lib directory [/usr/lib]
14   --exif-includedir       - Location of libexif include directory [/usr/include/libexif]
15
16 EOF
17
18 else
19         targetos=$(uname -s)
20         case $targetos in
21         MINGW32*)
22                 export LIBSUF=.dll
23                 ;;
24         Darwin)
25                 export LIBSUF=.dylib
26                 ;;
27         Linux|FreeBSD|NetBSD)
28                 export LIBSUF=.so
29                 ;;
30         *)
31                 ;;
32         esac
33
34         qimage_includedir=/usr/include/qt4
35         qimage_libdir=/usr/lib/qt4
36
37         if [ ! -d "$qimage_libdir" -o ! -d "$qimage_includedir" ]
38         then
39                 qimage_includedir=/usr/include/qt3
40                 qimage_libdir=/usr/lib/qt3
41                 kde_includedir=/usr/include/kde
42                 kde_libdir=/usr/lib
43                 if [ "$KDEDIR" != "" ]
44                 then
45                         kde_includedir="$KDEDIR/include"
46                         kde_libdir="$KDEDIR/lib"
47                 fi
48         fi
49
50         if [ "$QTDIR" != "" ]
51         then
52                 qimage_includedir="$QTDIR/include"
53                 qimage_libdir="$QTDIR/lib"
54         fi
55
56         export force_qt3=
57         export qt4_found=
58
59         for i in "$@"
60         do
61                 case $i in
62                         --qimage-libdir=* )     qimage_libdir="${i#--qimage-libdir=}" ;;
63                         --qimage-includedir=* ) qimage_includedir="${i#--qimage-includedir=}" ;;
64                         --kde-libdir=* )        kde_libdir="${i#--kde-libdir=}" ;;
65                         --kde-includedir=* )    kde_includedir="${i#--kde-includedir=}" ;;
66                         --exif-libdir=* )       exif_libdir="${i#--exif-libdir=}" ;;
67                         --exif-includedir=* )   exif_includedir="${i#--exif-includedir=}" ;;
68                         --force-qt3 )           force_qt3="true" ;;
69                 esac
70         done
71
72         echo > config.h
73         echo > config.mak
74
75         pkg-config --exists 'libexif'
76         if [ $? -eq 0 ]
77         then
78             echo "Libexif found, enabling auto rotate"
79             echo "#define USE_EXIF" >> config.h
80             echo "USE_EXIF=1" >> config.mak
81             echo EXIFCXXFLAGS=$(pkg-config --cflags libexif ) >> config.mak
82             echo EXIFLIBS=$(pkg-config --libs libexif) >> config.mak
83         elif [ -d "$exif_libdir" -a -d "$exif_includedir" ]
84         then
85                 # test if we have a libexif
86                 if [ -f "$exif_libdir/exif-data.h" ]
87                 then
88                         echo "Libexif found, enabling auto rotate"
89                         echo "#define USE_EXIF" >> config.h
90                         echo "USE_EXIF=1" >> config.mak
91                         echo EXIFCXXFLAGS=-I$exif_includedir >> config.mak
92                         echo EXIFLIBS=-L$exif_libdir lexif >> config.mak
93                 else
94                         echo "Libexif not found, disabling exif features (auto rotate)"
95                 fi
96         fi
97
98         pkg-config --exists 'QtGui >= 4'
99         if [ $? -eq 0 ] && [ "$force_qt3" = "" ]
100         then
101                 echo "Qt version 4.x detected, will compile Qt4 qimage producer"
102                 qt4_found=true
103                 echo "#define USE_QT4" >> config.h
104                 echo "USE_QT4=1" >> config.mak
105                 echo QTCXXFLAGS=$(pkg-config --cflags QtCore QtGui QtXml QtSvg ) >> config.mak
106                 echo QTLIBS=$(pkg-config --libs QtCore QtGui QtXml QtSvg) >> config.mak
107                 
108         elif [ -d "$qimage_libdir" -a -d "$qimage_includedir" ]
109         then
110
111                 # test if we have a Qt3 or Qt4
112                 if [ -f "$qimage_libdir/libQtCore.so" ] || [ -d "$qimage_libdir/QtGui.framework" ] && [ "$force_qt3" = "" ]
113                 then
114                         echo "Qt version 4.x detected, will compile Qt4 qimage producer"
115                         qt4_found=true
116                 else
117                         echo "Qt version 3.x detected, will compile Qt3 qimage producer"
118                 fi
119
120                 echo "Include directory: " $qimage_includedir
121
122                 if [ "$qt4_found" != "" ] && [ "$force_qt3" = "" ]
123                 then
124                         echo "#define USE_QT4" >> config.h
125                         echo "USE_QT4=1" >> config.mak
126                         if [ -d "$qimage_libdir/QtGui.framework" ]
127                         then
128                                 echo QTCXXFLAGS=$(pkg-config --cflags QtCore QtGui QtXml QtSvg ) >> config.mak
129                                 echo QTLIBS=$(pkg-config --libs QtCore QtGui QtXml QtSvg) >> config.mak
130                         else
131                                 echo QTCXXFLAGS=-I$qimage_includedir >> config.mak
132                                 echo QTLIBS=-L$qimage_libdir -lQtCore -lQtGui -lQtXml -lQtSvg >> config.mak
133                         fi
134                 else 
135                     if [ -d "$kde_includedir" ]
136                     then 
137                             echo "#define USE_KDE" >> config.h
138                             echo "USE_KDE=1" >> config.mak
139                             echo "#define USE_QT3" >> config.h
140                             echo "USE_QT3=1" >> config.mak
141                             echo QTCXXFLAGS=-I$qimage_includedir -I$kde_includedir -DQT_THREAD_SUPPORT >> config.mak
142                                 echo QTLIBS=-L$qimage_libdir -L$kde_libdir -lqt-mt >> config.mak
143                     else 
144                             echo "qimage: KDE environment not found - disabling extra image formats"
145                             echo "#define USE_QT3" >> config.h
146                             echo "USE_QT3=1" >> config.mak
147                             echo QTCXXFLAGS=-I$qimage_includedir -DQT_THREAD_SUPPORT>> config.mak
148                             echo QTLIBS=-L$qimage_libdir -lqt-mt >> config.mak
149                     fi
150                 fi
151         else
152                 echo "qimage: QT environment not found - disabling"
153                 touch ../disable-qimage
154         fi
155
156 fi