~ubuntu-branches/ubuntu/raring/muse/raring

« back to all changes in this revision

Viewing changes to m4/qt.m4

  • Committer: Package Import Robot
  • Author(s): Alessio Treglia
  • Date: 2011-08-12 11:16:41 UTC
  • mfrom: (1.1.9) (10.1.6 sid)
  • Revision ID: package-import@ubuntu.com-20110812111641-sjz0e93fr0ozfv0b
Tags: 2.0~beta2-1
* New maintainer (see bug 637185#12), thanks Daniel!
* New upstream release (Closes: #627371):
  - New interface Qt4-based (Closes: #604584)
* Refresh packaging:
  - Move to DH7 and source format 3.0 (quilt).
  - Refresh patchset.
  - Fix a bunch lintian warnings.
  - debian/postinst:
    + Use set -e in the body rather than pass -e on the #! line to make it
      have actually effect if it is run by hand with "sh /path/to/script".
  - Update instructions on how-to increase RTC clock frequency.
    Thanks to Torquil Macdonald Sørensen for the report (Closes: #570833).
  - Bump Standards.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
dnl
2
 
dnl CONFIGURE_QT([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
3
 
dnl \author J.E. Hoffmann <je-h@gmx.net>
4
 
dnl
5
 
AC_DEFUN([CONFIGURE_QT],
6
 
[
7
 
  qt_error="no"
8
 
 
9
 
  QT_CFLAGS=""
10
 
  QT_LIBS=""
11
 
  MOC="moc"
12
 
  UIC="uic"
13
 
  qt_includes="/usr/include/qt"
14
 
  qt_libraries=""
15
 
  qt_binaries=""
16
 
 
17
 
  if test "$qt_error" = "no"; then
18
 
    AC_MSG_CHECKING([for QT environment variable QTDIR])
19
 
    if test -z "$QTDIR"; then
20
 
      AC_MSG_RESULT(no)
21
 
      AC_MSG_WARN([
22
 
 
23
 
    ***************** WARNING *****************
24
 
 
25
 
YOU HAVE NOT SET YOUR 'QTDIR' ENVIRONMENT VARIABLE!!!
26
 
 
27
 
This is the source of most people's problems when
28
 
configuring muse.  If the configuration fails to find
29
 
qt, try setting your QTDIR environment variable to
30
 
the directory where qt is installed.
31
 
 
32
 
    *******************************************
33
 
 
34
 
])
35
 
      echo -ne "\a"
36
 
      echo -ne "\a"
37
 
      echo -ne "\a"
38
 
      sleep 7
39
 
    else
40
 
      AC_MSG_RESULT(yes)
41
 
      qt_includes="$QTDIR/include"
42
 
      qt_libraries="$QTDIR/lib"
43
 
      qt_binaries="$QTDIR/bin"
44
 
      MOC="$qt_binaries/moc";
45
 
      UIC="$qt_binaries/uic";
46
 
    fi
47
 
  fi
48
 
 
49
 
  muse_qttest="yes"
50
 
  AC_ARG_ENABLE(qttest,
51
 
  [  --disable-qttest        do not try to compile and run a test libqt program],[
52
 
    case "$enableval" in
53
 
      "yes")
54
 
        muse_qttest="yes"
55
 
        ;;
56
 
      "no")
57
 
        muse_qttest="no"
58
 
        ;;
59
 
      *)
60
 
        AC_MSG_ERROR([must use --enable-qttest(=yes/no) or --disable-qttest])
61
 
      ;;
62
 
    esac
63
 
  ])
64
 
 
65
 
 
66
 
  AC_ARG_WITH(qt-prefix,
67
 
    [  --with-qt-prefix=PFX    where the root of Qt is installed ],
68
 
    [
69
 
      qt_includes="$withval/include"
70
 
      qt_libraries="$withval/lib"
71
 
      qt_binaries="$withval/bin"
72
 
      MOC="$qt_binaries/moc";
73
 
      UIC="$qt_binaries/uic";
74
 
    ])
75
 
 
76
 
  AC_ARG_WITH(qt-includes,
77
 
    [  --with-qt-includes=DIR  where the Qt includes are installed ],
78
 
    [
79
 
      qt_includes="$withval"
80
 
    ])
81
 
 
82
 
  AC_ARG_WITH(qt-libraries,
83
 
    [  --with-qt-libraries=DIR where the Qt libraries are installed.],
84
 
    [
85
 
      qt_libraries="$withval"
86
 
    ])
87
 
 
88
 
  AC_ARG_WITH(qt-binaries,
89
 
    [  --with-qt-binaries=DIR  where the Qt binaries are installed.],
90
 
    [
91
 
      qt_binaries="$withval"
92
 
      MOC="$qt_binaries/moc";
93
 
      UIC="$qt_binaries/uic";
94
 
    ])
95
 
 
96
 
  AC_ARG_WITH(qt-moc,
97
 
    [  --with-qt-moc=PROG      where the Qt meta object compiler is installed.],
98
 
    [
99
 
      MOC="$withval"
100
 
    ])
101
 
 
102
 
  AC_ARG_WITH(qt-uic,
103
 
    [  --with-qt-uic=PROG      where the Qt user interface compiler is installed.],
104
 
    [
105
 
      UIC="$withval"
106
 
    ])
107
 
 
108
 
  if test "$qt_error" = "no"; then
109
 
    saved_CPPFLAGS="$CPPFLAGS"
110
 
    saved_LIBS="$LIBS"
111
 
    CPPFLAGS="$saved_CPPFLAGS -I$qt_includes"
112
 
    if test -n "$qt_libraries"; then
113
 
      LIBS="$saved_LIBS -L$qt_libraries -lqt-mt -lqui"
114
 
      QT_LIBS="-L$qt_libraries -lqt-mt -lqui"
115
 
    else
116
 
      LIBS="$saved_LIBS -lqt-mt -lqui -lm $X11_LIBS"
117
 
      QT_LIBS="-lqt-mt -lqui"
118
 
    fi
119
 
    AC_MSG_CHECKING([for QT includes ($qt_includes)])
120
 
    AC_CACHE_VAL(qt_includes_found,
121
 
    [
122
 
      AC_LANG_PUSH(C++)
123
 
      AC_TRY_CPP([#include <qapplication.h>],
124
 
                 qt_includes_found=yes, qt_includes_found=no)
125
 
      AC_LANG_POP(C++)
126
 
      if test "$qt_includes_found" = "yes"; then
127
 
        QT_CFLAGS="-I$qt_includes"
128
 
        AC_MSG_RESULT(yes)
129
 
      else
130
 
        qt_error=yes
131
 
        AC_MSG_RESULT(no)
132
 
      fi
133
 
    ])
134
 
 
135
 
    AC_MSG_CHECKING([for QT libraries ($qt_libraries)])
136
 
    AC_CACHE_VAL(qt_libraries_found,
137
 
    [
138
 
      AC_LANG_SAVE
139
 
      AC_LANG_CPLUSPLUS
140
 
      saved_CXXFLAGS="$CXXFLAGS"
141
 
      saved_LIBS="$LIBS"
142
 
      CXXFLAGS="$QT_CFLAGS $LIBS"
143
 
      LIBS="$QT_LIBS $LIBS"
144
 
 
145
 
 
146
 
      if test "$muse_qttest" = "yes"; then
147
 
          AC_TRY_RUN([
148
 
              #include <qapplication.h>
149
 
              int main(int argc, char **argv)
150
 
              {
151
 
                QApplication app(argc, argv, false);
152
 
        
153
 
              }
154
 
            ],[
155
 
              AC_MSG_RESULT(yes)
156
 
            ],[
157
 
              AC_MSG_RESULT(no)
158
 
              qt_error="yes"
159
 
            ],
160
 
            AC_MSG_ERROR([cross compiling unsupported])
161
 
          )
162
 
      else
163
 
        AC_MSG_RESULT([yes (assumed due to --disable-qttest)])
164
 
      fi
165
 
 
166
 
      LIBS="$saved_LIBS"
167
 
      CXXFLAGS="$saved_CXXFLAGS"
168
 
      AC_LANG_RESTORE
169
 
    ])
170
 
 
171
 
    AC_MSG_CHECKING([for QT moc ($MOC)])
172
 
    output=`eval "$MOC --help 2>&1 | grep Qt"`
173
 
    if test -z "$output"; then
174
 
      AC_MSG_RESULT(no)
175
 
      qt_error="yes"
176
 
    else
177
 
      AC_MSG_RESULT(yes)
178
 
    fi
179
 
 
180
 
    AC_MSG_CHECKING([for QT uic ($UIC)])
181
 
    output=`eval "$UIC --help 2>&1 | grep Qt"`
182
 
    if test -z "$output"; then
183
 
      AC_MSG_RESULT(no)
184
 
      qt_error="yes"
185
 
    else
186
 
      AC_MSG_RESULT(yes)
187
 
    fi
188
 
    CPPFLAGS="$saved_CPPFLAGS"
189
 
    LIBS="$saved_LIBS"
190
 
  fi
191
 
 
192
 
  if test "$qt_error" = "no"; then
193
 
    AC_MSG_CHECKING([for QT version >= $1])
194
 
    qt_major_version=`echo $1 | \
195
 
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
196
 
    qt_minor_version=`echo $1 | \
197
 
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
198
 
    qt_micro_version=`echo $1 | \
199
 
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
200
 
    qt_version="$qt_major_version$qt_minor_version$qt_micro_version"
201
 
 
202
 
    AC_LANG_SAVE
203
 
    AC_LANG_CPLUSPLUS
204
 
    saved_CXXFLAGS="$CXXFLAGS"
205
 
    saved_LIBS="$LIBS"
206
 
    CXXFLAGS="$QT_CFLAGS $LIBS"
207
 
    LIBS="$QT_LIBS $LIBS"
208
 
 
209
 
    if test "$muse_qttest" = "yes"; then
210
 
        AC_TRY_RUN([
211
 
            #include <qglobal.h>
212
 
            int main()
213
 
            {
214
 
            int version = ($qt_major_version << 16)
215
 
               + ($qt_minor_version << 8)
216
 
               + $qt_micro_version;
217
 
              if (QT_VERSION < version) return(1);
218
 
              return(0);
219
 
            }
220
 
          ],[
221
 
            AC_MSG_RESULT(yes)
222
 
          ],[
223
 
            AC_MSG_RESULT(no)
224
 
            qt_error="yes"
225
 
          ],
226
 
          AC_MSG_ERROR([cross compiling unsupported])
227
 
        )
228
 
    else
229
 
      AC_MSG_RESULT([yes (assumed due to --disable-qttest)])
230
 
    fi
231
 
 
232
 
    LIBS="$saved_LIBS"
233
 
    CXXFLAGS="$saved_CXXFLAGS"
234
 
    AC_LANG_RESTORE
235
 
  fi
236
 
 
237
 
  AC_SUBST(QT_CFLAGS)
238
 
  AC_SUBST(QT_LIBS)
239
 
  AC_SUBST(MOC)
240
 
  AC_SUBST(UIC)
241
 
  if test "$qt_error" = "no"; then
242
 
     ifelse([$2], , :, [$2])
243
 
  else
244
 
     ifelse([$3], , :, [$3])
245
 
  fi
246
 
])