--- qsampler/trunk/configure.ac 2015/07/23 17:32:31 2829 +++ qsampler/trunk/configure.ac 2015/07/23 20:54:53 2830 @@ -59,7 +59,7 @@ if test "$cross_compiling" = yes; then ac_with_paths="" else - ac_with_paths="/usr/local /usr" + ac_with_paths="/usr /usr/local" fi # Set for alternate Qt4/5 installation dir. @@ -120,39 +120,15 @@ # 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/local /usr" +# Check for install paths and alternatives... ac_libdirs="lib" if test "x$ac_arch" = "xx86_64"; then ac_libdirs="$ac_libdirs lib64" fi -if test "x$ac_arch" = "xx86_64" -o "x$ac_qt5" = "xyes"; then - CFLAGS="-fPIC $CFLAGS" - CPPFLAGS="-fPIC $CPPFLAGS" -fi - -for X in $ac_topdirs; do - for Y1 in share $ac_libdirs; do - for Y2 in $Y1 $Y1/${ac_arch}-linux-gnu; do - for Z in $ac_qtdirs; do - if test -d $X/$Y2/$Z/bin; then - ac_with_paths="$ac_with_paths $X/$Y2/$Z" - fi - done - done - done -done +CFLAGS="-fPIC $CFLAGS" +CPPFLAGS="-fPIC $CPPFLAGS" # Prepend alternate dependencies paths. ac_path=$PATH @@ -162,29 +138,71 @@ ac_path="$X/bin:$ac_path" fi if test -d $X/include; then - for Y in include include/${ac_arch}-linux-gnu; do - for Z in $ac_qtdirs; do - if test -d "$X/$Y/$Z"; then - CFLAGS="-I$X/$Y/$Z $CFLAGS" - CPPFLAGS="-I$X/$Y/$Z $CPPFLAGS" - ac_incpath="$X/$Y/$Z $ac_incpath" - fi - done - done - CFLAGS="$CFLAGS -I$X/include" - CPPFLAGS="$CPPFLAGS -I$X/include" - ac_incpath="$ac_incpath $X/include" + CFLAGS="-I$X/include $CFLAGS " + CPPFLAGS="-I$X/include $CPPFLAGS" + ac_incpath="$X/include $ac_incpath" fi - for Y1 in $ac_libdirs; do - for Y2 in $Y1 $Y1/${ac_arch}-linux-gnu; do - if test -d $X/$Y2; then - LIBS="-L$X/$Y2 $LIBS" - ac_libs="-L$X/$Y2 $ac_libs" - fi - done + for Y in $ac_libdirs; do + if test -d $X/$Y; then + LIBS="-L$X/$Y $LIBS" + ac_libs="-L$X/$Y $ac_libs" + fi done done +# A common error message: +ac_errmsg="not found in current PATH. Maybe QT development environment isn't available." + +if test "x$ac_qt4" = "xyes"; then + AC_PATH_PROG(ac_qmake, qmake-qt4, [no], $ac_path) +fi +if test "x$ac_qt5" = "xyes"; then + AC_PATH_PROG(ac_qmake, qmake-qt5, [no], $ac_path) +fi +if test "x$ac_qmake" = "xno"; then + AC_PATH_PROG(ac_cv_qmake, qmake, [no], $ac_path) + ac_qmake=$ac_cv_qmake +fi +if test "x$ac_qmake" = "xno"; then + AC_MSG_ERROR([qmake $ac_errmsg]) +fi + +# Check for proper Qt4/5 major version. +ac_qt_version_major=`$ac_qmake -query QT_VERSION | cut -d. -f1` +if test "x$ac_qt4" = "xyes" -a "x$ac_qt_version_major" != "x4"; then + AC_MSG_ERROR([qmake-qt4 $ac_errmsg (qt4-devel)]) +fi +if test "x$ac_qt5" = "xyes" -a "x$ac_qt_version_major" != "x5"; then + AC_MSG_ERROR([qmake-qt5 $ac_errmsg (qt5-devel)]) +fi + +ac_qt_install_bins=`$ac_qmake -query QT_INSTALL_BINS` +if test -d $ac_qt_install_bins; then + ac_path="$ac_qt_install_bins:$ac_path" +fi + +# Check it again, now with updated PATH, just in case... +AC_PATH_PROG(ac_cv_qmake, qmake, [no], $ac_path) +ac_qmake=$ac_cv_qmake +if test "x$ac_qmake" = "xno"; then + AC_MSG_ERROR([qmake $ac_errmsg]) +fi + +AC_SUBST(ac_qmake) + +ac_qt_install_headers=`$ac_qmake -query QT_INSTALL_HEADERS` +if test -d $ac_qt_install_headers; then + CFLAGS="-I$ac_qt_install_headers $CFLAGS " + CPPFLAGS="-I$ac_qt_install_headers $CPPFLAGS" + ac_incpath="$ac_qt_install_headers $ac_incpath" +fi + +ac_qt_install_libs=`$ac_qmake -query QT_INSTALL_LIBS` +if test -d $ac_qt_install_libs; then + LIBS="-L$ac_qt_install_libs $LIBS" + ac_libs="-L$ac_qt_install_libs $ac_libs" +fi + # Check for proper Qt4/5 version. if test "x$ac_qt4" = "xyes"; then AC_CACHE_CHECK([for Qt library version >= 4.4], @@ -214,16 +232,6 @@ ]) fi -# A common error message: -ac_errmsg="not found in current PATH. Maybe QT development environment isn't available (qt-devel)." - -# Check for Qt qmake utility. -AC_PATH_PROG(ac_qmake, qmake, [no], $ac_path) -if test "x$ac_qmake" = "xno"; then - AC_MSG_ERROR([qmake $ac_errmsg]) -fi -AC_SUBST(ac_qmake) - # Check for Qt moc utility. AC_PATH_PROG(ac_moc, moc, [no], $ac_path) if test "x$ac_moc" = "xno"; then @@ -252,6 +260,7 @@ fi AC_SUBST(ac_lrelease) + # Checks for libraries. AC_CHECK_LIB(m, main) AC_CHECK_LIB(X11, main)