--- qsampler/trunk/configure.ac 2013/02/19 16:42:38 2416 +++ qsampler/trunk/configure.ac 2014/06/01 18:49:30 2591 @@ -1,5 +1,5 @@ # Process this file with autoconf to produce a configure script. -AC_INIT(Qsampler, 0.2.2.37, rncbc@rncbc.org, qsampler) +AC_INIT(Qsampler, 0.2.3.6, rncbc@rncbc.org, qsampler) AC_CONFIG_SRCDIR(src/qsampler.cpp) AC_CONFIG_HEADERS(src/config.h) @@ -29,6 +29,26 @@ fi AC_SUBST(ac_debug) + +# Enable Qt4/5 availability. +AC_ARG_ENABLE(qt4, + AC_HELP_STRING([--enable-qt4], [enable Qt4 build (default=yes)]), + [ac_qt4="$enableval"], + [ac_qt4="yes"]) + +AC_ARG_ENABLE(qt5, + AC_HELP_STRING([--enable-qt5], [enable Qt5 build (default=no)]), + [ac_qt5="$enableval"], + [ac_qt5="no"]) + +if test "x$ac_qt4" = "xno"; then + ac_qt5="yes" +fi +if test "x$ac_qt5" = "xyes"; then + ac_qt4="no" +fi + + # Enable libgig availability. AC_ARG_ENABLE(libgig, AC_HELP_STRING([--enable-libgig], [enable libgig interface (default=yes)]), @@ -41,20 +61,9 @@ [ac_stacktrace="$enableval"]) -if test "$cross_compiling" != yes; then # Standard installation base dirs. ac_with_paths="/usr /usr/local" -# Some a-la-debian alternatives... -for X in /usr/lib /usr/lib64 /usr/share; do - for Y in qt qt4; do - if test -d $X/$Y/bin; then - ac_with_paths="$ac_with_paths $X/$Y" - fi - done -done -fi - # Set for alternate Qt installation dir. AC_ARG_WITH(qt, AC_HELP_STRING([--with-qt=PATH], [use alternate Qt install path]), @@ -70,6 +79,12 @@ AC_HELP_STRING([--with-libgig=PATH], [use alternate libgig install path]), [ac_with_paths="$ac_with_paths $withval"]) + +# Honor user specified flags. +ac_cflags=$CFLAGS +ac_ldflags=$LDFLAGS + + # Checks for programs. AC_PROG_CC AC_PROG_CPP @@ -81,17 +96,48 @@ AC_LANG_C AC_LANG_CPLUSPLUS +PKG_PROG_PKG_CONFIG + +# Check for proper flags. +ac_arch=`uname -m` + +# Check for some a-la-debian alternatives... +ac_qtdirs="qt" + +if test "x$ac_qt4" = "xyes"; then + ac_qtdirs="qt4 $ac_qtdirs" +fi +if test "x$ac_qt5" = "xyes"; then + ac_qtdirs="qt5 $ac_qtdirs" +fi + +ac_topdirs="/usr/share /usr/lib" + +if test "x$ac_arch" = "xx86_64"; then + CFLAGS="-fPIC $CFLAGS" + CPPFLAGS="-fPIC $CPPFLAGS" + ac_topdirs="$ac_topdirs /usr/lib64" +fi + +for X in $ac_topdirs; do + for Y in $ac_qtdirs; do + if test -d $X/$Y/bin; then + ac_with_paths="$X/$Y $ac_with_paths" + fi + done +done + # Prepend alternate dependencies paths. ac_path=$PATH for X in $ac_with_paths; do if test -d $X/bin; then ac_path="$X/bin:$ac_path" fi - if test -x $X/qmake; then - ac_path="$X:$ac_path" - fi +# if test -x $X/qmake; then +# ac_path="$X:$ac_path" +# fi if test -d $X/include; then - for Y in qt qt4; do + for Y in $ac_qtdirs; do if test -d $X/include/$Y; then CFLAGS="-I$X/include/$Y $CFLAGS" CPPFLAGS="-I$X/include/$Y $CPPFLAGS" @@ -102,7 +148,7 @@ CPPFLAGS="-I$X/include $CPPFLAGS" ac_incpath="$X/include $ac_incpath" fi - if test -d $X/lib64; then + if test "x$ac_arch" = "xx86_64" -a -d $X/lib64; then LIBS="-L$X/lib64 $LIBS" ac_libs="-L$X/lib64 $ac_libs" fi @@ -112,19 +158,21 @@ fi done + # Check for proper Qt version. -AC_CACHE_CHECK([for Qt library version >= 4.2], +AC_CACHE_CHECK([for Qt library version >= 4.4], ac_cv_qtversion, [ AC_TRY_LINK([#include "QtCore/qglobal.h"], [ -#if QT_VERSION < 0x040200 -#error Qt library 4.2 or greater required. +#if QT_VERSION < 0x040400 +#error Qt library 4.4 or greater required. #endif ], ac_cv_qtversion="yes", [ - echo "no; Qt 4.2 or greater is required" + echo "no; Qt 4.4 or greater is required" exit ]) ]) + # A common error message: ac_errmsg="not found in current PATH. Maybe QT development environment isn't available (qt-devel)." @@ -302,29 +350,15 @@ # Check for optional libraries. if test "x$ac_libgig" = "xyes"; then - AC_CHECK_LIB(gig, main, [ac_libgig="yes"], [ac_libgig="no"]) + PKG_CHECK_MODULES(LIBGIG, gig >= 3.3.0, [ac_libgig="yes"], [ac_libgig="no"]) + AC_SUBST(LIBGIG_CFLAGS) + AC_SUBST(LIBGIG_LIBS) + ac_cflags="$ac_libs $LIBGIG_CFLAGS" + ac_libs="$ac_libs $LIBGIG_LIBS" if test "x$ac_libgig" = "xyes"; then AC_DEFINE(CONFIG_LIBGIG, 1, [Define if libgig is available.]) - ac_libs="$ac_libs -lgig" - AC_MSG_CHECKING([for gig::File::SetAutoLoad() method in libgig]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - CXXFLAGS="$ac_libs" - AC_TRY_COMPILE([ -#include -#include - ],[ - gig::File file; - file.SetAutoLoad(false); - ], - have_libgig_setautoload="yes", - have_libgig_setautoload="no" - ) - AC_LANG_RESTORE - AC_MSG_RESULT([$have_libgig_setautoload]) - if test "x$have_libgig_setautoload" = "xyes"; then - AC_DEFINE(HAVE_LIBGIG_SETAUTOLOAD, 1, [Define if libgig provides gig::File::SetAutoLoad() method.]) - fi + AC_DEFINE(HAVE_LIBGIG_SETAUTOLOAD, 1, [Define if libgig provides gig::File::SetAutoLoad() method.]) + have_libgig_setautoload="yes" fi fi @@ -346,6 +380,8 @@ AC_SUBST(ac_libs) AC_SUBST(ac_incpath) +AC_SUBST(ac_cflags) +AC_SUBST(ac_ldflags) # Checks for header files. AC_HEADER_STDC