# ************************************************************************** # MOL_AC_HAVE_QWT_IFELSE( IF-FOUND, IF-NOT-FOUND ) # # Variables: # mol_ac_have_qwt # mol_ac_qwt_cxxflags # mol_ac_qwt_ldflags # mol_ac_qwt_libs # # Authors: # Anette Gjetnes , based on sps.m4 # Frederik Heber , bases on qwt.m4 # Todo: # - use AS_UNSET to unset internal variables to avoid polluting the environment # # ************************************************************************** AC_DEFUN([MOL_AC_HAVE_QWT_IFELSE], [: ${mol_ac_have_qwt=false} AC_MSG_CHECKING([for Qwt]) AC_ARG_WITH( [qwt-includedir], [AC_HELP_STRING([--with-qwt-includedir=PATH], [state directory with Qwt includes])], [mol_ac_qwt_include_path=$withval], [mol_ac_want_qwt=true]) AC_ARG_WITH( [qwt-libdir], [AC_HELP_STRING([--with-qwt-libdir=PATH], [state directory with Qwt libs])], [mol_ac_qwt_lib_path=$withval], [mol_ac_want_qwt=true]) # $mol_ac_have_qwt && break mol_ac_qwt_save_CXXFLAGS=$CXXFLAGS mol_ac_qwt_save_LDFLAGS=$LDFLAGS mol_ac_qwt_save_LIBS=$LIBS mol_ac_qwt_debug=false test -n "`echo -- $CXXFLAGS $CFLAGS $CXXFLAGS | grep -- '-g\\>'`" && mol_ac_qwt_debug=true # test -z "$mol_ac_qwt_path" -a x"$prefix" != xNONE && # mol_ac_qwt_path=$prefix mol_ac_qwt_name=qwt CXXFLAGS="$CXXFLAGS $QT_CFLAGS" if test -z "$mol_ac_qwt_include_path"; then mol_ac_qwt_include_path=`locate qwt.h | xargs dirname` fi if test -n "$mol_ac_qwt_include_path"; then mol_ac_qwt_cxxflags="-I$mol_ac_qwt_include_path" CXXFLAGS="$CXXFLAGS $mol_ac_qwt_cxxflags" fi LDFLAGS="$LDFLAGS $QT_LDFLAGS" if test -z "$mol_ac_qwt_lib_path"; then mol_ac_qwt_lib_path=`locate libqwt-qt4.so | head -n 1 | xargs dirname` fi if test -n "$mol_ac_qwt_lib_path"; then for mol_ac_qwt_candidate in \ `( ls $mol_ac_qwt_lib_path/qwt*.lib; ls $mol_ac_qwt_lib_path/qwt*d.lib; ls $mol_ac_qwt_lib_path/libqwt*.so; ls $mol_ac_qwt_lib_path/libqwt*d.so ) 2>/dev/null` do case $mol_ac_qwt_candidate in *d.lib) $mol_ac_qwt_debug && mol_ac_qwt_name=`basename $mol_ac_qwt_candidate .lib` ;; *.lib) mol_ac_qwt_name=`basename $mol_ac_qwt_candidate .lib` ;; *d.so) $mol_ac_qwt_debug && mol_ac_qwt_name=`basename $mol_ac_qwt_candidate .so | sed -e 's#^lib##'` ;; *.so) mol_ac_qwt_name=`basename $mol_ac_qwt_candidate .so | sed -e 's#^lib##'` ;; esac done mol_ac_qwt_ldflags="-Wl,-rpath -Wl,$mol_ac_qwt_lib_path -L$mol_ac_qwt_lib_path" LDFLAGS="$LDFLAGS $mol_ac_qwt_ldflags" # unset mol_ac_qwt_candidate # unset mol_ac_qwt_path fi mol_ac_qwt_libs="-l$mol_ac_qwt_name" LIBS="$LIBS $mol_ac_qwt_libs" AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_LINK( [#include ], [QwtPlot * plot = new QwtPlot();], [mol_ac_have_qwt=true]) AC_LANG_RESTORE CXXFLAGS=$mol_ac_qwt_save_CXXFLAGS LDFLAGS=$mol_ac_qwt_save_LDFLAGS LIBS=$mol_ac_qwt_save_LIBS # unset mol_ac_qwt_debug # unset mol_ac_qwt_name # unset mol_ac_qwt_save_CXXFLAGS # unset mol_ac_qwt_save_LDFLAGS # unset mol_ac_qwt_save_LIBS if $mol_ac_have_qwt; then AC_MSG_RESULT([success ($mol_ac_qwt_libs)]) AC_SUBST(mol_ac_qwt_cxxflags) AC_SUBST(mol_ac_qwt_ldflags) AC_SUBST(mol_ac_qwt_libs) $1 else AC_MSG_RESULT([failure]) $2 fi # unset mol_ac_want_qwt ]) # EOF **********************************************************************