~ubuntu-branches/ubuntu/trusty/qgis/trusty

« back to all changes in this revision

Viewing changes to tools/qgis.m4

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
dnl ------------------------------------------------------------------------
2
 
dnl Detect if this is a 64bit environment
3
 
dnl
4
 
dnl it sets:
5
 
dnl   _lib
6
 
dnl ------------------------------------------------------------------------
7
 
AC_DEFUN([AQ_CHECK_LIB64],
8
 
[
9
 
if test `echo ${libdir} | sed -e 's#.*lib64.*#64#'` = "64"; then
10
 
  _lib="lib64"
11
 
else
12
 
  _lib="lib"
13
 
fi
14
 
])
15
 
 
16
 
dnl ------------------------------------------------------------------------
17
 
dnl Detect GDAL/OGR
18
 
dnl
19
 
dnl use AQ_CHECK_GDAL to detect GDAL and OGR
20
 
dnl it sets:
21
 
dnl   GDAL_CFLAGS
22
 
dnl   GDAL_LDADD
23
 
dnl ------------------------------------------------------------------------
24
 
 
25
 
# Check for GDAL and OGR compiler and linker flags
26
 
 
27
 
AC_DEFUN([AQ_CHECK_GDAL],
28
 
[
29
 
AC_ARG_WITH([gdal],
30
 
  AC_HELP_STRING([--with-gdal=path],
31
 
    [Full path to 'gdal-config' script, e.g. '--with-gdal=/usr/local/bin/gdal-config']),
32
 
  [ac_gdal_config_path=$withval])
33
 
 
34
 
if test x"$ac_gdal_config_path" = x ; then
35
 
  ac_gdal_config_path=`which gdal-config`
36
 
fi
37
 
 
38
 
ac_gdal_config_path=`dirname $ac_gdal_config_path 2> /dev/null`
39
 
AC_PATH_PROG(GDAL_CONFIG, gdal-config, no, $ac_gdal_config_path)
40
 
 
41
 
if test x${GDAL_CONFIG} = xno ; then
42
 
  AC_MSG_ERROR([gdal-config not found! Supply it with --with-gdal=PATH])
43
 
else
44
 
  AC_MSG_CHECKING([for OGR in GDAL])
45
 
  if test x`$GDAL_CONFIG --ogr-enabled` = "xno" ; then
46
 
    AC_MSG_ERROR([GDAL must be compiled with OGR support and currently is not.])
47
 
  fi
48
 
  AC_MSG_RESULT(yes)
49
 
  AC_MSG_CHECKING([GDAL_CFLAGS])
50
 
  GDAL_CFLAGS=`$GDAL_CONFIG --cflags`
51
 
  AC_MSG_RESULT($GDAL_CFLAGS)
52
 
 
53
 
  AC_MSG_CHECKING([GDAL_LDADD])
54
 
  GDAL_LDADD=`$GDAL_CONFIG --libs`
55
 
  AC_MSG_RESULT($GDAL_LDADD)
56
 
 
57
 
  ac_gdalogr_version=`$GDAL_CONFIG --version`
58
 
  ac_gdalogr="yes"
59
 
fi
60
 
 
61
 
AC_SUBST(GDAL_CFLAGS)
62
 
AC_SUBST(GDAL_LDADD)
63
 
])
64
 
 
65
 
dnl ------------------------------------------------------------------------
66
 
dnl Detect GEOS
67
 
dnl
68
 
dnl use AQ_CHECK_GEOS to detect GEOS
69
 
dnl it sets:
70
 
dnl   GEOS_CFLAGS
71
 
dnl   GEOS_LDADD
72
 
dnl ------------------------------------------------------------------------
73
 
 
74
 
# Check for GEOS
75
 
 
76
 
AC_DEFUN([AQ_CHECK_GEOS],
77
 
[
78
 
AC_ARG_WITH([geos],
79
 
  AC_HELP_STRING([--with-geos=path],
80
 
    [Full path to 'geos-config' script, e.g. '--with-geos=/usr/local/bin/geos-config']),
81
 
  [ac_geos_config_path=$withval])
82
 
 
83
 
if test x"$ac_geos_config_path" = x ; then
84
 
  ac_geos_config_path=`which geos-config`
85
 
fi
86
 
 
87
 
ac_geos_config_path=`dirname $ac_geos_config_path 2> /dev/null`
88
 
AC_PATH_PROG(GEOS_CONFIG, geos-config, no, $ac_geos_config_path)
89
 
 
90
 
if test x${GEOS_CONFIG} = xno ; then
91
 
  AC_MSG_ERROR([geos-config not found! Supply it with --with-geos=PATH])
92
 
else
93
 
  ac_geos_version=`${GEOS_CONFIG} --version`
94
 
  if test `echo ${ac_geos_version} | sed -e 's#2\.[0-9].*#OK#'` != OK ; then
95
 
    AC_MSG_ERROR([Geos Version 2.x.x is needed, but you have $ac_geos_version!])
96
 
  else
97
 
    AC_MSG_CHECKING([GEOS_CFLAGS])
98
 
    GEOS_CFLAGS=`$GEOS_CONFIG --cflags`
99
 
    AC_MSG_RESULT($GEOS_CFLAGS)
100
 
 
101
 
    AC_MSG_CHECKING([GEOS_LDADD])
102
 
    GEOS_LDADD=`$GEOS_CONFIG --libs`
103
 
    AC_MSG_RESULT($GEOS_LDADD)
104
 
 
105
 
    ac_geos="yes"
106
 
  fi
107
 
fi
108
 
 
109
 
AC_SUBST(GEOS_CFLAGS)
110
 
AC_SUBST(GEOS_LDADD)
111
 
])
112
 
 
113
 
dnl ------------------------------------------------------------------------                                                                             
114
 
dnl Detect QT3
115
 
dnl
116
 
dnl use AQ_CHECK_QT to detect QT3
117
 
dnl it sets:
118
 
dnl   QT_CXXFLAGS
119
 
dnl   QT_LDADD
120
 
dnl   QT_GUILINK
121
 
dnl   QASSISTANTCLIENT_LDADD
122
 
dnl ------------------------------------------------------------------------                                                                             
123
 
 
124
 
# Check for Qt compiler flags, linker flags, and binary packages
125
 
 
126
 
AC_DEFUN([AQ_CHECK_QT],
127
 
[
128
 
AC_REQUIRE([AC_PROG_CXX])
129
 
AC_REQUIRE([AC_PATH_X])
130
 
 
131
 
AC_MSG_CHECKING([QTDIR])
132
 
AC_ARG_WITH([qtdir], [  --with-qtdir=DIR        Qt installation directory [default=/usr/local]], QTDIR=$withval)
133
 
# Check that QTDIR is defined or that --with-qtdir given
134
 
if test x$QTDIR = x ; then
135
 
  QT_SEARCH=" /usr/lib/qt31 /usr/lib64/qt31 /usr/local/qt31 /usr/lib/qt3 /usr/lib64/qt3 /usr/local/qt3 /usr/lib/qt2 /usr/lib64/qt2 /usr/local/qt2 /usr/lib/qt /usr/lib64/qt /usr/local/qt /usr /usr/local"
136
 
  for i in $QT_SEARCH; do
137
 
    if test x$QTDIR = x; then
138
 
      if test -f $i/include/qt/qglobal.h -o -f $i/include/qglobal.h -o -f $i/include/qt3/qglobal.h; then
139
 
        QTDIR=$i
140
 
      fi
141
 
    fi
142
 
  done
143
 
fi
144
 
if test x$QTDIR = x ; then
145
 
  AC_MSG_ERROR([*** QTDIR must be defined, or --with-qtdir option given])
146
 
fi
147
 
AC_MSG_RESULT([$QTDIR])
148
 
 
149
 
# Change backslashes in QTDIR to forward slashes to prevent escaping
150
 
# problems later on in the build process, mainly for Cygwin build
151
 
# environment using MSVC as the compiler
152
 
# TODO: Use sed instead of perl
153
 
QTDIR=`echo $QTDIR | perl -p -e 's/\\\\/\\//g'`
154
 
 
155
 
# Check for QT includedir 
156
 
if test -f $QTDIR/include/qt/qglobal.h; then
157
 
  QTINC=$QTDIR/include/qt
158
 
elif test -f $QTDIR/include/qt3/qglobal.h; then
159
 
  QTINC=$QTDIR/include/qt3
160
 
else
161
 
  QTINC=$QTDIR/include
162
 
fi
163
 
 
164
 
# Figure out which version of Qt we are using
165
 
AC_MSG_CHECKING([Qt version])
166
 
QT_VER=`grep 'define.*QT_VERSION_STR\W' $QTINC/qglobal.h | perl -p -e 's/\D//g'`
167
 
case "${QT_VER}" in
168
 
  33*)
169
 
    QT_MAJOR="3"
170
 
    ;;
171
 
  32*)
172
 
    QT_MAJOR="3"
173
 
    ;;
174
 
  31*)
175
 
    QT_MAJOR="3"
176
 
    ;;
177
 
  *)
178
 
    AC_MSG_ERROR([*** Qt version 3.1.x or higher is required])
179
 
    ;;
180
 
esac
181
 
AC_MSG_RESULT([$QT_VER ($QT_MAJOR)])
182
 
 
183
 
# Check that moc is in path
184
 
AC_CHECK_PROG(MOC, moc, moc)
185
 
if test x$MOC = x ; then
186
 
  AC_MSG_ERROR([*** moc must be in path])
187
 
fi
188
 
# uic is the Qt user interface compiler
189
 
AC_CHECK_PROG(UIC, uic, uic)
190
 
if test x$UIC = x ; then
191
 
  AC_MSG_ERROR([*** uic must be in path])
192
 
fi
193
 
# qembed is the Qt data embedding utility.
194
 
# It is located in $QTDIR/tools/qembed, and must be compiled and installed
195
 
# manually, we'll let it slide if it isn't present
196
 
AC_CHECK_PROG(QEMBED, qembed, qembed)
197
 
# Calculate Qt include path
198
 
QT_CXXFLAGS="-I$QTINC"
199
 
QT_IS_EMBEDDED="no"
200
 
# On unix, figure out if we're doing a static or dynamic link
201
 
case "${host}" in
202
 
  *-cygwin)
203
 
    AC_DEFINE_UNQUOTED(WIN32, "", Defined if on Win32 platform)
204
 
    echo "$QTDIR/lib/qt-mt$QT_VER.lib"
205
 
    if test -f "$QTDIR/lib/qt-mt$QT_VER.lib" ; then
206
 
      QT_LIB="qt-mt$QT_VER.lib"
207
 
      QT_IS_STATIC="no"
208
 
      QT_IS_MT="yes"
209
 
         
210
 
    elif test -f "$QTDIR/lib/qt$QT_VER.lib" ; then
211
 
      QT_LIB="qt$QT_VER.lib"
212
 
      QT_IS_STATIC="no"
213
 
      QT_IS_MT="no"
214
 
    elif test -f "$QTDIR/lib/qt.lib" ; then
215
 
      QT_LIB="qt.lib"
216
 
      QT_IS_STATIC="yes"
217
 
      QT_IS_MT="no"
218
 
    elif test -f "$QTDIR/lib/qt-mt.lib" ; then
219
 
      QT_LIB="qt-mt.lib" 
220
 
      QT_IS_STATIC="yes"
221
 
      QT_IS_MT="yes"
222
 
    fi
223
 
    ;;
224
 
  *-darwin*)
225
 
    # determin static or dynamic -- prefer dynamic
226
 
    QT_IS_DYNAMIC=`ls $QTDIR/lib/libqt*.dylib 2> /dev/null`
227
 
    if test "x$QT_IS_DYNAMIC" = x;  then
228
 
      QT_IS_STATIC=`ls $QTDIR/lib/libqt*.a 2> /dev/null`
229
 
      if test "x$QT_IS_STATIC" = x; then
230
 
        QT_IS_STATIC="no"
231
 
        AC_MSG_ERROR([*** Couldn't find any Qt libraries in $QTDIR/${_lib}])
232
 
      else
233
 
        QT_IS_STATIC="yes"
234
 
      fi
235
 
    else
236
 
      QT_IS_STATIC="no"
237
 
    fi
238
 
    # set link parameters based on shared/mt libs or static lib
239
 
    if test "x`ls $QTDIR/lib/libqt.a* 2> /dev/null`" != x ; then
240
 
      QT_LIB="-lqt"
241
 
      QT_IS_MT="no"
242
 
    elif test "x`ls $QTDIR/lib/libqt-mt.*.dylib 2> /dev/null`" != x ; then
243
 
      QT_LIB="-lqt-mt"
244
 
      QT_IS_MT="yes"
245
 
    elif test "x`ls $QTDIR/lib/libqt.*.dylib 2> /dev/null`" != x ; then
246
 
      QT_LIB="-lqt"
247
 
      QT_IS_MT="no"
248
 
    elif test "x`ls $QTDIR/lib/libqte.* 2> /dev/null`" != x ; then
249
 
      QT_LIB="-lqte"
250
 
      QT_IS_MT="no"
251
 
      QT_IS_EMBEDDED="yes"
252
 
    elif test "x`ls $QTDIR/lib/libqte-mt.* 2> /dev/null`" != x ; then
253
 
      QT_LIB="-lqte-mt"
254
 
      QT_IS_MT="yes"
255
 
      QT_IS_EMBEDDED="yes"
256
 
    fi
257
 
    ;;
258
 
  *)
259
 
    # determin static or dynamic -- prefer dynamic
260
 
    QT_IS_DYNAMIC=`ls $QTDIR/${_lib}/libqt*.so 2> /dev/null`
261
 
    if test "x$QT_IS_DYNAMIC" = x;  then
262
 
      QT_IS_STATIC=`ls $QTDIR/${_lib}/libqt*.a 2> /dev/null`
263
 
      if test "x$QT_IS_STATIC" = x; then
264
 
        QT_IS_STATIC="no"
265
 
        AC_MSG_ERROR([*** Couldn't find any Qt libraries in $QTDIR/${_lib}])
266
 
      else
267
 
        QT_IS_STATIC="yes"
268
 
      fi
269
 
    else
270
 
      QT_IS_STATIC="no"
271
 
    fi
272
 
    # set link parameters based on shared/mt libs or static lib
273
 
    if test "x`ls $QTDIR/${_lib}/libqt.a* 2> /dev/null`" != x ; then
274
 
      QT_LIB="-lqt"
275
 
      QT_IS_MT="no"
276
 
    elif test "x`ls $QTDIR/${_lib}/libqt-mt.so* 2> /dev/null`" != x ; then
277
 
      QT_LIB="-lqt-mt"
278
 
      QT_IS_MT="yes"
279
 
    elif test "x`ls $QTDIR/${_lib}/libqt.so* 2> /dev/null`" != x ; then
280
 
      QT_LIB="-lqt"
281
 
      QT_IS_MT="no"
282
 
    elif test "x`ls $QTDIR/${_lib}/libqte.* 2> /dev/null`" != x ; then
283
 
      QT_LIB="-lqte"
284
 
      QT_IS_MT="no"
285
 
      QT_IS_EMBEDDED="yes"
286
 
    elif test "x`ls $QTDIR/${_lib}/libqte-mt.* 2> /dev/null`" != x ; then
287
 
      QT_LIB="-lqte-mt"
288
 
      QT_IS_MT="yes"
289
 
      QT_IS_EMBEDDED="yes"
290
 
    fi
291
 
    ;;
292
 
esac
293
 
 
294
 
AC_MSG_CHECKING([if Qt is static])
295
 
AC_MSG_RESULT([$QT_IS_STATIC])
296
 
AC_MSG_CHECKING([if Qt is multithreaded])
297
 
AC_MSG_RESULT([$QT_IS_MT])
298
 
AC_MSG_CHECKING([if Qt is embedded])
299
 
AC_MSG_RESULT([$QT_IS_EMBEDDED])
300
 
 
301
 
QT_GUILINK=""
302
 
QASSISTANTCLIENT_LDADD="-lqassistantclient"
303
 
case "${host}" in
304
 
  *irix*)
305
 
    QT_LIBS="$QT_LIB"
306
 
    if test $QT_IS_STATIC = yes ; then
307
 
    QT_LIBS="$QT_LIBS -L$x_libraries -lXext -lX11 -lm -lSM -lICE"
308
 
    fi
309
 
    ;;
310
 
 
311
 
  *linux*)
312
 
    QT_LIBS="$QT_LIB"
313
 
    if test $QT_IS_STATIC = yes && test $QT_IS_EMBEDDED = no; then
314
 
      QT_LIBS="$QT_LIBS -L$x_libraries -lXext -lX11 -lm -lSM -lICE -ldl -ljpeg"
315
 
    fi
316
 
    ;;
317
 
 
318
 
  *freebsd*)
319
 
    QT_LIBS="$QT_LIB"
320
 
    if test $QT_IS_STATIC = yes && test $QT_IS_EMBEDDED = no; then
321
 
      QT_LIBS="$QT_LIBS -L$x_libraries -lXext -lX11 -lm -lSM -lICE -ldl -ljpeg -lpthread"
322
 
   else
323
 
      QT_LIBS="$QT_LIBS -lpthread"
324
 
    fi
325
 
    ;;
326
 
 
327
 
  *darwin*)
328
 
    QT_LIBS="$QT_LIB"
329
 
    if test $QT_IS_STATIC = yes && test $QT_IS_EMBEDDED = no; then
330
 
      QT_LIBS="$QT_LIBS -L$x_libraries -lXext -lX11 -lm -lSM -lICE -ldl -ljpeg"
331
 
    fi
332
 
    ;;
333
 
 
334
 
  *osf*) 
335
 
    # Digital Unix (aka DGUX aka Tru64)
336
 
    QT_LIBS="$QT_LIB"
337
 
    if test $QT_IS_STATIC = yes ; then
338
 
      QT_LIBS="$QT_LIBS -L$x_libraries -lXext -lX11 -lm -lSM -lICE"
339
 
    fi
340
 
    ;;
341
 
 
342
 
  *solaris*)
343
 
    QT_LIBS="$QT_LIB"
344
 
    if test $QT_IS_STATIC = yes ; then
345
 
      QT_LIBS="$QT_LIBS -L$x_libraries -lXext -lX11 -lm -lSM -lICE -lresolv -lsocket -lnsl"
346
 
    fi
347
 
    ;;
348
 
 
349
 
  *win*)
350
 
    # linker flag to suppress console when linking a GUI app on Win32
351
 
    QT_GUILINK="/subsystem:windows"
352
 
    if test $QT_MAJOR = "3" ; then
353
 
      if test $QT_IS_MT = yes ; then
354
 
        QT_LIBS="/nodefaultlib:libcmt"
355
 
      else
356
 
        QT_LIBS="/nodefaultlib:libc"
357
 
      fi
358
 
    fi
359
 
 
360
 
    if test $QT_IS_STATIC = yes ; then
361
 
      QT_LIBS="$QT_LIBS $QT_LIB kernel32.lib user32.lib gdi32.lib comdlg32.lib ole32.lib shell32.lib imm32.lib advapi32.lib wsock32.lib winspool.lib winmm.lib netapi32.lib"
362
 
      if test $QT_MAJOR = "3" ; then
363
 
        QT_LIBS="$QT_LIBS qtmain.lib"
364
 
      fi
365
 
    else
366
 
      QT_LIBS="$QT_LIBS $QT_LIB"        
367
 
      if test $QT_MAJOR = "3" ; then
368
 
        QT_CXXFLAGS="$QT_CXXFLAGS -DQT_DLL"
369
 
        QT_LIBS="$QT_LIBS qtmain.lib qui.lib user32.lib netapi32.lib"
370
 
      fi
371
 
    fi
372
 
    QASSISTANTCLIENT_LDADD="qassistantclient.lib"
373
 
    ;;
374
 
esac
375
 
 
376
 
if test x"$QT_IS_EMBEDDED" = "xyes" ; then
377
 
  QT_CXXFLAGS="-DQWS $QT_CXXFLAGS"
378
 
fi
379
 
 
380
 
if test x"$QT_IS_MT" = "xyes" ; then
381
 
  QT_CXXFLAGS="$QT_CXXFLAGS -D_REENTRANT -DQT_THREAD_SUPPORT"
382
 
fi
383
 
 
384
 
QT_LDADD="-L$QTDIR/${_lib} $QT_LIBS"
385
 
 
386
 
if test x$QT_IS_STATIC = xyes ; then
387
 
  OLDLIBS="$LIBS"
388
 
  LIBS="$QT_LDADD"
389
 
  AC_CHECK_LIB(Xft, XftFontOpen, QT_LDADD="$QT_LDADD -lXft")
390
 
  LIBS="$LIBS"
391
 
fi
392
 
 
393
 
AC_MSG_CHECKING([QT_CXXFLAGS])
394
 
AC_MSG_RESULT([$QT_CXXFLAGS])
395
 
AC_MSG_CHECKING([QT_LDADD])
396
 
AC_MSG_RESULT([$QT_LDADD])
397
 
 
398
 
AC_SUBST(QT_CXXFLAGS)
399
 
AC_SUBST(QT_LDADD)
400
 
AC_SUBST(QT_GUILINK)
401
 
AC_SUBST(QASSISTANTCLIENT_LDADD)
402
 
AC_SUBST(QTDIR)
403
 
])
404
 
 
405
 
 
406
 
 
407
 
# Configure path for the GNU Scientific Library
408
 
# Christopher R. Gabriel <cgabriel@linux.it>, April 2000
409
 
 
410
 
 
411
 
AC_DEFUN([AM_PATH_GSL],
412
 
[
413
 
AC_ARG_WITH(gsl-prefix,[  --with-gsl-prefix=PFX   Prefix where GSL is installed (optional)],
414
 
            gsl_prefix="$withval", gsl_prefix="")
415
 
AC_ARG_WITH(gsl-exec-prefix,[  --with-gsl-exec-prefix=PFX Exec prefix where GSL is installed (optional)],
416
 
            gsl_exec_prefix="$withval", gsl_exec_prefix="")
417
 
AC_ARG_ENABLE(gsltest, [  --disable-gsltest       Do not try to compile and run a test GSL program],
418
 
                    , enable_gsltest=yes)
419
 
 
420
 
  if test "x${GSL_CONFIG+set}" != xset ; then
421
 
     if test "x$gsl_prefix" != x ; then
422
 
         GSL_CONFIG="$gsl_prefix/bin/gsl-config"
423
 
     fi
424
 
     if test "x$gsl_exec_prefix" != x ; then
425
 
        GSL_CONFIG="$gsl_exec_prefix/bin/gsl-config"
426
 
     fi
427
 
  fi
428
 
 
429
 
  AC_PATH_PROG(GSL_CONFIG, gsl-config, no)
430
 
  min_gsl_version=ifelse([$1], ,0.2.5,$1)
431
 
  AC_MSG_CHECKING(for GSL - version >= $min_gsl_version)
432
 
  no_gsl=""
433
 
  if test "$GSL_CONFIG" = "no" ; then
434
 
    no_gsl=yes
435
 
  else
436
 
    GSL_CFLAGS=`$GSL_CONFIG --cflags`
437
 
    GSL_LIBS=`$GSL_CONFIG --libs`
438
 
 
439
 
    gsl_major_version=`$GSL_CONFIG --version | \
440
 
           sed 's/^\([[0-9]]*\).*/\1/'`
441
 
    if test "x${gsl_major_version}" = "x" ; then
442
 
       gsl_major_version=0
443
 
    fi
444
 
 
445
 
    gsl_minor_version=`$GSL_CONFIG --version | \
446
 
           sed 's/^\([[0-9]]*\)\.\{0,1\}\([[0-9]]*\).*/\2/'`
447
 
    if test "x${gsl_minor_version}" = "x" ; then
448
 
       gsl_minor_version=0
449
 
    fi
450
 
 
451
 
    gsl_micro_version=`$GSL_CONFIG --version | \
452
 
           sed 's/^\([[0-9]]*\)\.\{0,1\}\([[0-9]]*\)\.\{0,1\}\([[0-9]]*\).*/\3/'`
453
 
    if test "x${gsl_micro_version}" = "x" ; then
454
 
       gsl_micro_version=0
455
 
    fi
456
 
 
457
 
    if test "x$enable_gsltest" = "xyes" ; then
458
 
      ac_save_CFLAGS="$CFLAGS"
459
 
      ac_save_LIBS="$LIBS"
460
 
      CFLAGS="$CFLAGS $GSL_CFLAGS"
461
 
      LIBS="$LIBS $GSL_LIBS"
462
 
 
463
 
      rm -f conf.gsltest
464
 
      AC_TRY_RUN([
465
 
#include <stdio.h>
466
 
#include <stdlib.h>
467
 
#include <string.h>
468
 
 
469
 
char* my_strdup (const char *str);
470
 
 
471
 
char*
472
 
my_strdup (const char *str)
473
 
{
474
 
  char *new_str;
475
 
  
476
 
  if (str)
477
 
    {
478
 
      new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
479
 
      strcpy (new_str, str);
480
 
    }
481
 
  else
482
 
    new_str = NULL;
483
 
  
484
 
  return new_str;
485
 
}
486
 
 
487
 
int main (void)
488
 
{
489
 
  int major = 0, minor = 0, micro = 0;
490
 
  int n;
491
 
  char *tmp_version;
492
 
 
493
 
  system ("touch conf.gsltest");
494
 
 
495
 
  /* HP/UX 9 (%@#!) writes to sscanf strings */
496
 
  tmp_version = my_strdup("$min_gsl_version");
497
 
 
498
 
  n = sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) ;
499
 
 
500
 
  if (n != 2 && n != 3) {
501
 
     printf("%s, bad version string\n", "$min_gsl_version");
502
 
     exit(1);
503
 
   }
504
 
 
505
 
   if (($gsl_major_version > major) ||
506
 
      (($gsl_major_version == major) && ($gsl_minor_version > minor)) ||
507
 
      (($gsl_major_version == major) && ($gsl_minor_version == minor) && ($gsl_micro_version >= micro)))
508
 
    {
509
 
      exit(0);
510
 
    }
511
 
  else
512
 
    {
513
 
      printf("\n*** 'gsl-config --version' returned %d.%d.%d, but the minimum version\n", $gsl_major_version, $gsl_minor_version, $gsl_micro_version);
514
 
      printf("*** of GSL required is %d.%d.%d. If gsl-config is correct, then it is\n", major, minor, micro);
515
 
      printf("*** best to upgrade to the required version.\n");
516
 
      printf("*** If gsl-config was wrong, set the environment variable GSL_CONFIG\n");
517
 
      printf("*** to point to the correct copy of gsl-config, and remove the file\n");
518
 
      printf("*** config.cache before re-running configure\n");
519
 
      exit(1);
520
 
    }
521
 
}
522
 
 
523
 
],, no_gsl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
524
 
       CFLAGS="$ac_save_CFLAGS"
525
 
       LIBS="$ac_save_LIBS"
526
 
     fi
527
 
  fi
528
 
  if test "x$no_gsl" = x ; then
529
 
     AC_MSG_RESULT(yes)
530
 
     ifelse([$2], , :, [$2])     
531
 
  else
532
 
     AC_MSG_RESULT(no)
533
 
     if test "$GSL_CONFIG" = "no" ; then
534
 
       echo "*** The gsl-config script installed by GSL could not be found"
535
 
       echo "*** If GSL was installed in PREFIX, make sure PREFIX/bin is in"
536
 
       echo "*** your path, or set the GSL_CONFIG environment variable to the"
537
 
       echo "*** full path to gsl-config."
538
 
     else
539
 
       if test -f conf.gsltest ; then
540
 
        :
541
 
       else
542
 
          echo "*** Could not run GSL test program, checking why..."
543
 
          CFLAGS="$CFLAGS $GSL_CFLAGS"
544
 
          LIBS="$LIBS $GSL_LIBS"
545
 
          AC_TRY_LINK([
546
 
#include <stdio.h>
547
 
],      [ return 0; ],
548
 
        [ echo "*** The test program compiled, but did not run. This usually means"
549
 
          echo "*** that the run-time linker is not finding GSL or finding the wrong"
550
 
          echo "*** version of GSL. If it is not finding GSL, you'll need to set your"
551
 
          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
552
 
          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
553
 
          echo "*** is required on your system"
554
 
          echo "***"
555
 
          echo "*** If you have an old version installed, it is best to remove it, although"
556
 
          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
557
 
        [ echo "*** The test program failed to compile or link. See the file config.log for the"
558
 
          echo "*** exact error that occured. This usually means GSL was incorrectly installed"
559
 
          echo "*** or that you have moved GSL since it was installed. In the latter case, you"
560
 
          echo "*** may want to edit the gsl-config script: $GSL_CONFIG" ])
561
 
          CFLAGS="$ac_save_CFLAGS"
562
 
          LIBS="$ac_save_LIBS"
563
 
       fi
564
 
     fi
565
 
#     GSL_CFLAGS=""
566
 
#     GSL_LIBS=""
567
 
     ifelse([$3], , :, [$3])
568
 
  fi
569
 
  AC_SUBST(GSL_CFLAGS)
570
 
  AC_SUBST(GSL_LIBS)
571
 
  rm -f conf.gsltest
572
 
])
573
 
 
574
 
dnl ------------------------------------------------------------------------
575
 
dnl Detect QGIS
576
 
dnl
577
 
dnl use AQ_CHECK_QGIS to detect QGIS
578
 
dnl it sets:
579
 
dnl   QGIS_CXXFLAGS
580
 
dnl   QGIS_LDADD
581
 
dnl ------------------------------------------------------------------------
582
 
 
583
 
# Check for QGIS compiler and linker flags
584
 
# Jens Oberender <j.obi@troja.net> 2004
585
 
 
586
 
AC_DEFUN([AQ_CHECK_QGIS],
587
 
[
588
 
dnl 
589
 
dnl Get the cflags and libraries from qgis-config
590
 
dnl
591
 
AC_ARG_WITH([qgis],
592
 
AC_HELP_STRING([--with-qgis=path],
593
 
  [Full path to 'qgis-config', e.g. --with-qgis=/usr/local/bin/qgis-config]),
594
 
  [ac_qgis_config_path=$withval])
595
 
 
596
 
if test x"$ac_qgis_config_path" = x ; then
597
 
  ac_qgis_config_path=`which qgis-config`
598
 
fi
599
 
 
600
 
ac_qgis_config_path=`dirname $ac_qgis_config_path 2> /dev/null`
601
 
AC_PATH_PROG(QGIS_CONFIG, qgis-config, no, $ac_qgis_config_path)
602
 
 
603
 
if test x"$QGIS_CONFIG" = xno ; then
604
 
  if test x"$ac_qgis_config_path" = x ; then
605
 
    AC_MSG_ERROR([qgis-config not found in $ac_qgis_config_path! Supply a path with --with-qgis=PATH])
606
 
  else
607
 
    AC_MSG_ERROR([qgis-config not found! Supply a path with --with-qgis=PATH])
608
 
  fi
609
 
else
610
 
  AC_MSG_CHECKING([QGIS_CXXFLAGS])
611
 
  QGIS_CXXFLAGS=`$QGIS_CONFIG --cflags`
612
 
  AC_MSG_RESULT($QGIS_CXXFLAGS)
613
 
 
614
 
  AC_MSG_CHECKING([QGIS_LDADD])
615
 
  QGIS_LDADD=`$QGIS_CONFIG --libs`
616
 
  AC_MSG_RESULT($QGIS_LDADD)
617
 
 
618
 
  AC_MSG_CHECKING([QGIS_PREFIX])
619
 
  QGIS_PREFIX=`$QGIS_CONFIG --prefix`
620
 
  AC_MSG_RESULT($QGIS_PREFIX)
621
 
 
622
 
  AC_MSG_CHECKING([QGIS_PLUGINPATH])
623
 
  QGIS_PLUGINPATH=`$QGIS_CONFIG --plugindir`
624
 
  AC_MSG_RESULT($QGIS_PLUGINPATH)
625
 
 
626
 
  AC_MSG_CHECKING([QGIS_MAJOR_VERSION])
627
 
  QGIS_MAJOR_VERSION=`$QGIS_CONFIG --major_version`
628
 
  AC_MSG_RESULT($QGIS_MAJOR_VERSION)
629
 
 
630
 
  AC_MSG_CHECKING([QGIS_MINOR_VERSION])
631
 
  QGIS_MINOR_VERSION=`$QGIS_CONFIG --minor_version`
632
 
  AC_MSG_RESULT($QGIS_MINOR_VERSION)
633
 
 
634
 
  AC_MSG_CHECKING([QGIS_MICRO_VERSION])
635
 
  QGIS_MICRO_VERSION=`$QGIS_CONFIG --micro_version`
636
 
  AC_MSG_RESULT($QGIS_MICRO_VERSION)
637
 
 
638
 
  ac_save_CXXFLAGS="$CXXFLAGS"
639
 
  ac_save_LDFLAGS="$LDFLAGS"
640
 
  CXXFLAGS="$CXXFLAGS $QGIS_CXXFLAGS $QT_CXXFLAGS"
641
 
  LDFLAGS="$LDFLAGS $QGIS_LDADD $QT_LDADD $GDAL_LDADD"
642
 
 
643
 
  case "${host}" in
644
 
    *darwin*)
645
 
      LDFLAGS="$LDFALGS -flat_namespace -undefined suppress"
646
 
      ;;
647
 
  esac
648
 
 
649
 
  AC_LINK_IFELSE([
650
 
  #include <qgsfeature.h>
651
 
  int main(int argc, char *argv[]) {
652
 
    QgsFeature * myQgsFeature = new QgsFeature(1);
653
 
    return 0;
654
 
  }
655
 
  ], [ac_qgis_linked='yes'], [ac_qgis_linked='no'])
656
 
  CXXFLAGS="$ac_save_CXXFLAGS"
657
 
  LDFLAGS="$ac_save_LDFLAGS"
658
 
 
659
 
  AC_MSG_CHECKING([if linking with QGIS works])
660
 
  if test x$ac_qgis_linked = xyes ; then
661
 
    AC_MSG_RESULT([yes])
662
 
  else
663
 
    AC_MSG_RESULT([no])
664
 
  fi
665
 
fi
666
 
 
667
 
AC_SUBST(QGIS_CXXFLAGS)
668
 
AC_SUBST(QGIS_LDADD)
669
 
AC_SUBST(QGIS_PREFIX)
670
 
AC_SUBST(QGIS_PLUGINPATH)
671
 
AC_SUBST(QGIS_MAJOR_VERSION)
672
 
AC_SUBST(QGIS_MINOR_VERSION)
673
 
AC_SUBST(QGIS_MICRO_VERSION)
674
 
])