--- qsampler/trunk/configure.ac 2010/05/18 09:36:00 2093 +++ qsampler/trunk/configure.ac 2013/12/12 17:39:52 2483 @@ -1,5 +1,5 @@ # Process this file with autoconf to produce a configure script. -AC_INIT(Qsampler, 0.2.2.23, rncbc@rncbc.org, qsampler) +AC_INIT(Qsampler, 0.2.2.43, rncbc@rncbc.org, qsampler) AC_CONFIG_SRCDIR(src/qsampler.cpp) AC_CONFIG_HEADERS(src/config.h) @@ -29,6 +29,25 @@ 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,17 +60,28 @@ [ac_stacktrace="$enableval"]) +if test "$cross_compiling" != yes; then # Standard installation base dirs. ac_with_paths="/usr /usr/local" +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 + # Some a-la-debian alternatives... for X in /usr/lib /usr/lib64 /usr/share; do - for Y in qt qt4; do + for Y in $ac_qtdirs; 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, @@ -85,11 +115,11 @@ 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" @@ -110,15 +140,22 @@ fi done +# Check for proper flags. +ac_arch=`uname -m` +if test "x$ac_arch" = "xx86_64"; then + CFLAGS="-fPIC $CFLAGS" + CPPFLAGS="-fPIC $CPPFLAGS" +fi + # Check for proper Qt version. -AC_CACHE_CHECK([for Qt library version >= 4.1], +AC_CACHE_CHECK([for Qt library version >= 4.4], ac_cv_qtversion, [ - AC_TRY_LINK([#include "Qt/qglobal.h"], [ -#if QT_VERSION < 0x040100 -#error Qt library 4.1 or greater required. + AC_TRY_LINK([#include "QtCore/qglobal.h"], [ +#if QT_VERSION < 0x040400 +#error Qt library 4.4 or greater required. #endif ], ac_cv_qtversion="yes", [ - echo "no; Qt 4.1 or greater is required" + echo "no; Qt 4.4 or greater is required" exit ]) ]) @@ -178,6 +215,12 @@ AC_MSG_ERROR([LSCP library not found.]) fi ac_libs="$ac_libs -llscp" +case "{$host}" in + *mingw*) + ac_libs="$ac_libs -lws2_32" + LIBS="$LIBS -lws2_32" + ;; +esac AC_CACHE_CHECK([for instrument_name in lscp_channel_info_t], ac_cv_instrument_name, [ @@ -302,17 +345,14 @@ AC_LANG_SAVE AC_LANG_CPLUSPLUS CXXFLAGS="$ac_libs" - AC_TRY_RUN([ + AC_TRY_COMPILE([ #include #include -int main() { + ],[ gig::File file; file.SetAutoLoad(false); - exit(0); -} ], have_libgig_setautoload="yes", - have_libgig_setautoload="no", have_libgig_setautoload="no" ) AC_LANG_RESTORE @@ -334,13 +374,18 @@ AC_DEFINE(CONFIG_STACKTRACE, 1, [Define if debugger stack-trace is enabled.]) fi +# Some recent distros (eg. fedora, debian) require this. +if test "x$ac_cv_lib_X11_main" = "xyes"; then + ac_libs="$ac_libs -lX11" +fi + AC_SUBST(ac_libs) AC_SUBST(ac_incpath) # Checks for header files. AC_HEADER_STDC AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS(fcntl.h sys/ioctl.h unistd.h signal.h) +AC_CHECK_HEADERS(fcntl.h sys/ioctl.h unistd.h signal.h sys/socket.h) AC_CHECK_HEADER(lscp/client.h, [ac_lscp_h="yes"], [ac_lscp_h="no"]) if test "x$ac_lscp_h" = "xno"; then