[c76b8b] | 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"
|
---|
[b61bd5] | 45 | if test -z "$mol_ac_qwt_include_path"; then
|
---|
| 46 | mol_ac_qwt_include_path=`locate qwt.h | xargs dirname`
|
---|
| 47 | fi
|
---|
[c76b8b] | 48 | if test -n "$mol_ac_qwt_include_path"; then
|
---|
| 49 | mol_ac_qwt_cxxflags="-I$mol_ac_qwt_include_path"
|
---|
| 50 | CXXFLAGS="$CXXFLAGS $mol_ac_qwt_cxxflags"
|
---|
| 51 | fi
|
---|
| 52 | LDFLAGS="$LDFLAGS $QT_LDFLAGS"
|
---|
[b61bd5] | 53 | if test -z "$mol_ac_qwt_lib_path"; then
|
---|
| 54 | mol_ac_qwt_lib_path=`locate libqwt-qt4.so | head -n 1 | xargs dirname`
|
---|
| 55 | fi
|
---|
[c76b8b] | 56 | if test -n "$mol_ac_qwt_lib_path"; then
|
---|
| 57 | for mol_ac_qwt_candidate in \
|
---|
| 58 | `( ls $mol_ac_qwt_lib_path/qwt*.lib;
|
---|
| 59 | ls $mol_ac_qwt_lib_path/qwt*d.lib;
|
---|
| 60 | ls $mol_ac_qwt_lib_path/libqwt*.so;
|
---|
| 61 | ls $mol_ac_qwt_lib_path/libqwt*d.so ) 2>/dev/null`
|
---|
| 62 | do
|
---|
| 63 | case $mol_ac_qwt_candidate in
|
---|
| 64 | *d.lib)
|
---|
| 65 | $mol_ac_qwt_debug &&
|
---|
| 66 | mol_ac_qwt_name=`basename $mol_ac_qwt_candidate .lib` ;;
|
---|
| 67 | *.lib)
|
---|
| 68 | mol_ac_qwt_name=`basename $mol_ac_qwt_candidate .lib` ;;
|
---|
| 69 | *d.so)
|
---|
| 70 | $mol_ac_qwt_debug &&
|
---|
| 71 | mol_ac_qwt_name=`basename $mol_ac_qwt_candidate .so | sed -e 's#^lib##'` ;;
|
---|
| 72 | *.so)
|
---|
| 73 | mol_ac_qwt_name=`basename $mol_ac_qwt_candidate .so | sed -e 's#^lib##'` ;;
|
---|
| 74 | esac
|
---|
| 75 | done
|
---|
| 76 | mol_ac_qwt_ldflags="-Wl,-rpath -Wl,$mol_ac_qwt_lib_path -L$mol_ac_qwt_lib_path"
|
---|
| 77 | LDFLAGS="$LDFLAGS $mol_ac_qwt_ldflags"
|
---|
| 78 | # unset mol_ac_qwt_candidate
|
---|
| 79 | # unset mol_ac_qwt_path
|
---|
| 80 | fi
|
---|
| 81 |
|
---|
| 82 | mol_ac_qwt_libs="-l$mol_ac_qwt_name"
|
---|
[35302b] | 83 | LIBS="$LIBS $mol_ac_qwt_libs"
|
---|
[c76b8b] | 84 | AC_LANG_SAVE
|
---|
| 85 | AC_LANG_CPLUSPLUS
|
---|
| 86 | AC_TRY_LINK(
|
---|
| 87 | [#include <qwt_plot.h>],
|
---|
[3b35e7] | 88 | [QwtPlot * plot = new QwtPlot();],
|
---|
[c76b8b] | 89 | [mol_ac_have_qwt=true])
|
---|
| 90 | AC_LANG_RESTORE
|
---|
| 91 | CXXFLAGS=$mol_ac_qwt_save_CXXFLAGS
|
---|
| 92 | LDFLAGS=$mol_ac_qwt_save_LDFLAGS
|
---|
| 93 | LIBS=$mol_ac_qwt_save_LIBS
|
---|
| 94 | # unset mol_ac_qwt_debug
|
---|
| 95 | # unset mol_ac_qwt_name
|
---|
| 96 | # unset mol_ac_qwt_save_CXXFLAGS
|
---|
| 97 | # unset mol_ac_qwt_save_LDFLAGS
|
---|
| 98 | # unset mol_ac_qwt_save_LIBS
|
---|
| 99 | if $mol_ac_have_qwt; then
|
---|
| 100 | AC_MSG_RESULT([success ($mol_ac_qwt_libs)])
|
---|
| 101 | AC_SUBST(mol_ac_qwt_cxxflags)
|
---|
| 102 | AC_SUBST(mol_ac_qwt_ldflags)
|
---|
| 103 | AC_SUBST(mol_ac_qwt_libs)
|
---|
| 104 | $1
|
---|
| 105 | else
|
---|
| 106 | AC_MSG_RESULT([failure])
|
---|
| 107 | $2
|
---|
| 108 | fi
|
---|
| 109 | # unset mol_ac_want_qwt
|
---|
| 110 | ])
|
---|
| 111 |
|
---|
| 112 | # EOF **********************************************************************
|
---|