- dnl Check for presence of header files
- AC_CHECK_HEADERS([qwt/qwt.h],
- [],
- [libqwt_ok=no;AC_MSG_RESULT([cannot find usable qwt headers])]
- )
-
- dnl Set QWT_LIBS based on user input
- AC_MSG_CHECKING(QWT_LIBS)
- QWT_LIBS="-lqwt"
- if test "$qwt_libdir" != "" ; then
- QWT_LIBS="$QWT_LIBS -L$qwt_libdir"
+ dnl Don't bother going on if we can't find the headers
+ if test "$libqwt_ok" = "yes" ; then
+
+ dnl Check for QWT library (qwt or qwt-qt4)
+
+ dnl User-defined QWT library path
+ if test "$qwt_libdir" != "" ; then
+ QWT_LIBS="-L$qwt_libdir $QWT_LIBS"
+ fi
+
+ dnl temporarily set these so the AC_CHECK_LIB works
+ CPPFLAGS="$CPPFLAGS $QWT_CFLAGS"
+ LIBS="$qwt_save_LIBS $QT_LIBS $QWT_LIBS -lqwt"
+
+ dnl If the user specified a qwt library name, use it here
+ if test "$qwt_lib" != "" ; then
+ AC_CHECK_LIB([$qwt_lib], [main], [libqwt_ok=yes], [libqwt_ok=no])
+
+ else
+ dnl Check for 'main' in libqwt (Fedora)
+ AC_CHECK_LIB([qwt], [main], [libqwt_ok=yes], [libqwt_ok=no])
+
+ dnl If library found properly, set the flag and move on
+ if test "$libqwt_ok" = "yes" ; then
+ QWT_LIBS="$QWT_LIBS -lqwt"
+ else
+ dnl Otherwise, check for 'main' in libqwt-qt4 (Ubuntu)
+ LIBS="$qwt_save_LIBS $QT_LIBS $QWT_LIBS -lqwt-qt4"
+ AC_CHECK_LIB([qwt-qt4], [main], [libqwt_ok=yes], [libqwt_ok=no])
+ if test "$libqwt_ok" = "yes" ; then
+ QWT_LIBS="$QWT_LIBS -lqwt-qt4"
+ else
+ AC_MSG_RESULT([Could not link to libqwt.so])
+ fi
+ fi
+ fi
+ else
+ AC_MSG_RESULT([Could not find qwt headers])