1 | # **************************************************************************
|
---|
2 | # MOL_AC_HAVE_QWT_IFELSE( IF-FOUND, IF-NOT-FOUND )
|
---|
3 | #
|
---|
4 | # Variables:
|
---|
5 | # mol_ac_have_qwt
|
---|
6 | # mol_ac_qwt_cxxflags
|
---|
7 | # mol_ac_qwt_ldflags
|
---|
8 | # mol_ac_qwt_libs
|
---|
9 | #
|
---|
10 | # Authors:
|
---|
11 | # Anette Gjetnes <anetteg@mol.no>, based on sps.m4
|
---|
12 | # Frederik Heber <frederik.heber@googlemail.com>, bases on qwt.m4
|
---|
13 |
|
---|
14 | # Todo:
|
---|
15 | # - use AS_UNSET to unset internal variables to avoid polluting the environment
|
---|
16 | #
|
---|
17 |
|
---|
18 | # **************************************************************************
|
---|
19 |
|
---|
20 | AC_DEFUN([MOL_AC_HAVE_QWT_IFELSE],
|
---|
21 | [: ${mol_ac_have_qwt=false}
|
---|
22 | AC_MSG_CHECKING([for Qwt])
|
---|
23 | AC_ARG_WITH(
|
---|
24 | [qwt-includedir],
|
---|
25 | [AC_HELP_STRING([--with-qwt-includedir=PATH], [state directory with Qwt includes])],
|
---|
26 | [mol_ac_qwt_include_path=$withval],
|
---|
27 | [mol_ac_want_qwt=true])
|
---|
28 | AC_ARG_WITH(
|
---|
29 | [qwt-libdir],
|
---|
30 | [AC_HELP_STRING([--with-qwt-libdir=PATH], [state directory with Qwt libs])],
|
---|
31 | [mol_ac_qwt_lib_path=$withval],
|
---|
32 | [mol_ac_want_qwt=true])
|
---|
33 |
|
---|
34 | # $mol_ac_have_qwt && break
|
---|
35 | mol_ac_qwt_save_CXXFLAGS=$CXXFLAGS
|
---|
36 | mol_ac_qwt_save_LDFLAGS=$LDFLAGS
|
---|
37 | mol_ac_qwt_save_LIBS=$LIBS
|
---|
38 | mol_ac_qwt_debug=false
|
---|
39 | test -n "`echo -- $CXXFLAGS $CFLAGS $CXXFLAGS | grep -- '-g\\>'`" &&
|
---|
40 | mol_ac_qwt_debug=true
|
---|
41 | # test -z "$mol_ac_qwt_path" -a x"$prefix" != xNONE &&
|
---|
42 | # mol_ac_qwt_path=$prefix
|
---|
43 | mol_ac_qwt_name=qwt
|
---|
44 | CXXFLAGS="$CXXFLAGS $QT_CFLAGS"
|
---|
45 | if test -n "$mol_ac_qwt_include_path"; then
|
---|
46 | mol_ac_qwt_cxxflags="-I$mol_ac_qwt_include_path"
|
---|
47 | CXXFLAGS="$CXXFLAGS $mol_ac_qwt_cxxflags"
|
---|
48 | fi
|
---|
49 | LDFLAGS="$LDFLAGS $QT_LDFLAGS"
|
---|
50 | if test -n "$mol_ac_qwt_lib_path"; then
|
---|
51 | for mol_ac_qwt_candidate in \
|
---|
52 | `( ls $mol_ac_qwt_lib_path/qwt*.lib;
|
---|
53 | ls $mol_ac_qwt_lib_path/qwt*d.lib;
|
---|
54 | ls $mol_ac_qwt_lib_path/libqwt*.so;
|
---|
55 | ls $mol_ac_qwt_lib_path/libqwt*d.so ) 2>/dev/null`
|
---|
56 | do
|
---|
57 | case $mol_ac_qwt_candidate in
|
---|
58 | *d.lib)
|
---|
59 | $mol_ac_qwt_debug &&
|
---|
60 | mol_ac_qwt_name=`basename $mol_ac_qwt_candidate .lib` ;;
|
---|
61 | *.lib)
|
---|
62 | mol_ac_qwt_name=`basename $mol_ac_qwt_candidate .lib` ;;
|
---|
63 | *d.so)
|
---|
64 | $mol_ac_qwt_debug &&
|
---|
65 | mol_ac_qwt_name=`basename $mol_ac_qwt_candidate .so | sed -e 's#^lib##'` ;;
|
---|
66 | *.so)
|
---|
67 | mol_ac_qwt_name=`basename $mol_ac_qwt_candidate .so | sed -e 's#^lib##'` ;;
|
---|
68 | esac
|
---|
69 | done
|
---|
70 | mol_ac_qwt_ldflags="-Wl,-rpath -Wl,$mol_ac_qwt_lib_path -L$mol_ac_qwt_lib_path"
|
---|
71 | LDFLAGS="$LDFLAGS $mol_ac_qwt_ldflags"
|
---|
72 | # unset mol_ac_qwt_candidate
|
---|
73 | # unset mol_ac_qwt_path
|
---|
74 | fi
|
---|
75 |
|
---|
76 | mol_ac_qwt_libs="-l$mol_ac_qwt_name"
|
---|
77 | LIBS="$LIBS $mol_ac_qwt_libs -lQtGui -lQtCore"
|
---|
78 | AC_LANG_SAVE
|
---|
79 | AC_LANG_CPLUSPLUS
|
---|
80 | AC_TRY_LINK(
|
---|
81 | [#include <qwt_plot.h>],
|
---|
82 | [QwtPlot * plot = new QwtPlot(QString("Two Curves"));],
|
---|
83 | [mol_ac_have_qwt=true])
|
---|
84 | AC_LANG_RESTORE
|
---|
85 | CXXFLAGS=$mol_ac_qwt_save_CXXFLAGS
|
---|
86 | LDFLAGS=$mol_ac_qwt_save_LDFLAGS
|
---|
87 | LIBS=$mol_ac_qwt_save_LIBS
|
---|
88 | # unset mol_ac_qwt_debug
|
---|
89 | # unset mol_ac_qwt_name
|
---|
90 | # unset mol_ac_qwt_save_CXXFLAGS
|
---|
91 | # unset mol_ac_qwt_save_LDFLAGS
|
---|
92 | # unset mol_ac_qwt_save_LIBS
|
---|
93 | if $mol_ac_have_qwt; then
|
---|
94 | AC_MSG_RESULT([success ($mol_ac_qwt_libs)])
|
---|
95 | AC_SUBST(mol_ac_qwt_cxxflags)
|
---|
96 | AC_SUBST(mol_ac_qwt_ldflags)
|
---|
97 | AC_SUBST(mol_ac_qwt_libs)
|
---|
98 | $1
|
---|
99 | else
|
---|
100 | AC_MSG_RESULT([failure])
|
---|
101 | $2
|
---|
102 | fi
|
---|
103 | # unset mol_ac_want_qwt
|
---|
104 | ])
|
---|
105 |
|
---|
106 | # EOF **********************************************************************
|
---|