################################################################################ # Check for GNU Make (sulphur). ################################################################################ AC_DEFUN([AC_PROG_GNU_MAKE], [ AC_CACHE_CHECK(for GNU make,_cv_gnu_make_command, [ _cv_gnu_make_command='echo GNU make is missing.' for a in "$MAKE" make gmake gnumake ; do if ($a --version 2> /dev/null | grep -s GNU 2>/dev/null 1>/dev/null); then _cv_gnu_make_command=`which $a`; break; fi done ; ]) GNU_MAKE_CMD=$_cv_gnu_make_command AC_SUBST(GNU_MAKE_CMD) ]) ################################################################################ # Check for Qt (sulphur). # Outputs: QT_INC_FLAGS, QT_LIB_FLAGS, # QT_QMAKE, QT_MOC, QT_UIC, QT_LUPDATE, QT_LRELEASE # QT_VERSION, HAVE_QT # Prefers newer versions. ################################################################################ AC_DEFUN([AC_PATH_QT], [ ######################################## # Initialize local variables. ######################################## # General variables. qt_mission_impossible=false # Variables for includes. qt_inc_dir=false qt_inc_version=false qt_test_header=qglobal.h qt_inc_path="`ls -d /usr/lib/qt-3*/include 2>/dev/null` `ls -d /usr/lib/qt3*/include 2>/dev/null` `ls -d /usr/local/lib/qt-3*/include 2>/dev/null` `ls -d /usr/local/lib/qt3*/include 2>/dev/null` `ls -d /usr/local/qt-3*/include 2>/dev/null` `ls -d /usr/local/qt3*/include 2>/dev/null` `ls -d /opt/qt-3*/include 2>/dev/null` `ls -d /opt/qt3*/include 2>/dev/null` `ls -d /usr/lib/qt-2*/include 2>/dev/null` `ls -d /usr/lib/qt2*/include 2>/dev/null` `ls -d /usr/local/lib/qt-2*/include 2>/dev/null` `ls -d /usr/local/lib/qt2*/include 2>/dev/null` `ls -d /usr/local/qt-2*/include 2>/dev/null` `ls -d /usr/local/qt2*/include 2>/dev/null` `ls -d /opt/qt-2*/include 2>/dev/null` `ls -d /opt/qt2*/include 2>/dev/null` `ls -d /usr/lib/qt-1*/include 2>/dev/null` `ls -d /usr/lib/qt1*/include 2>/dev/null` `ls -d /usr/local/lib/qt-1*/include 2>/dev/null` `ls -d /usr/local/lib/qt1*/include 2>/dev/null` `ls -d /usr/local/qt-1*/include 2>/dev/null` `ls -d /usr/local/qt1*/include 2>/dev/null` `ls -d /opt/qt-1*/include 2>/dev/null` `ls -d /opt/qt1*/include 2>/dev/null` /usr/lib/qt/include /usr/local/lib/qt/include /usr/local/qt/include /opt/qt/include /usr/KDE/include" # TU Berlin, FB Informatik # Variables for libraries. qt_lib_dir=false qt_lib_version=false qt_test_lib=libqt.so qt_test_lib_mt=libqt-mt.so qt_version_three_lib=libqt.so.3 qt_version_three_lib_mt=libqt-mt.so.3 qt_version_two_lib=libqt.so.2 qt_version_two_lib_mt=libqt-mt.so.2 qt_link_name=-lqt qt_lib_path="`ls -d /usr/lib/qt-3*/lib 2>/dev/null` `ls -d /usr/lib/qt3*/lib 2>/dev/null` `ls -d /usr/local/lib/qt-3*/lib 2>/dev/null` `ls -d /usr/local/lib/qt3*/lib 2>/dev/null` `ls -d /usr/local/qt-3*/lib 2>/dev/null` `ls -d /usr/local/qt3*/lib 2>/dev/null` `ls -d /opt/qt-3*/lib 2>/dev/null` `ls -d /opt/qt3*/lib 2>/dev/null` `ls -d /usr/lib/qt-2*/lib 2>/dev/null` `ls -d /usr/lib/qt2*/lib 2>/dev/null` `ls -d /usr/local/lib/qt-2*/lib 2>/dev/null` `ls -d /usr/local/lib/qt2*/lib 2>/dev/null` `ls -d /usr/local/qt-2*/lib 2>/dev/null` `ls -d /usr/local/qt2*/lib 2>/dev/null` `ls -d /opt/qt-2*/lib 2>/dev/null` `ls -d /opt/qt2*/lib 2>/dev/null` `ls -d /usr/lib/qt-1*/lib 2>/dev/null` `ls -d /usr/lib/qt1*/lib 2>/dev/null` `ls -d /usr/local/lib/qt-1*/lib 2>/dev/null` `ls -d /usr/local/lib/qt1*/lib 2>/dev/null` `ls -d /usr/local/qt-1*/lib 2>/dev/null` `ls -d /usr/local/qt1*/lib 2>/dev/null` `ls -d /opt/qt-1*/lib 2>/dev/null` `ls -d /opt/qt1*/lib 2>/dev/null` /usr/lib/qt/lib /usr/local/lib/qt/lib /usr/local/qt/lib /opt/qt/lib /usr/KDE/lib" # TU Berlin, FB Informatik # Variables for programs. qt_bin_dir=false qt_bin_version=false qt_test_bin=moc qt_version_three_bin=linguist # XXX Fix me! Linguist is not needed for installation of Tipo. qt_version_two_bin=designer qt_bin_path="`ls -d /usr/lib/qt-3*/bin 2>/dev/null` `ls -d /usr/lib/qt3*/bin 2>/dev/null` `ls -d /usr/local/lib/qt-3*/bin 2>/dev/null` `ls -d /usr/local/lib/qt3*/bin 2>/dev/null` `ls -d /usr/local/qt-3*/bin 2>/dev/null` `ls -d /usr/local/qt3*/bin 2>/dev/null` `ls -d /opt/qt-3*/bin 2>/dev/null` `ls -d /opt/qt3*/bin 2>/dev/null` `ls -d /usr/lib/qt-2*/bin 2>/dev/null` `ls -d /usr/lib/qt2*/bin 2>/dev/null` `ls -d /usr/local/lib/qt-2*/bin 2>/dev/null` `ls -d /usr/local/lib/qt2*/bin 2>/dev/null` `ls -d /usr/local/qt-2*/bin 2>/dev/null` `ls -d /usr/local/qt2*/bin 2>/dev/null` `ls -d /opt/qt-2*/bin 2>/dev/null` `ls -d /opt/qt2*/bin 2>/dev/null` `ls -d /usr/lib/qt-1*/bin 2>/dev/null` `ls -d /usr/lib/qt1*/bin 2>/dev/null` `ls -d /usr/local/lib/qt-1*/bin 2>/dev/null` `ls -d /usr/local/lib/qt1*/bin 2>/dev/null` `ls -d /usr/local/qt-1*/bin 2>/dev/null` `ls -d /usr/local/qt1*/bin 2>/dev/null` `ls -d /opt/qt-1*/bin 2>/dev/null` `ls -d /opt/qt1*/bin 2>/dev/null` /usr/lib/qt/bin /usr/local/lib/qt/bin /usr/local/qt/bin /opt/qt/bin /usr/KDE/bin /usr/bin /usr/local/bin" # /usr/KDE/bin applies to TU Berlin, FB Informatik ######################################## # Initialize outputs. ######################################## QT_INC_FLAGS=false QT_LIB_FLAGS=false QT_QMAKE=false QT_MOC=false QT_UIC=false QT_LUPDATE=false QT_LRELEASE=false QT_VERSION=false HAVE_QT=no ######################################## # Setup. ######################################## # Require C preprocessor. AC_REQUIRE([AC_PROG_CXX]) # Require X libs and extra X libs. AC_REQUIRE([AC_PATH_XTRA]) # Output message. echo "------------------------------------------------------------" AC_MSG_CHECKING(for Qt) echo "" echo "" # Configure options. AC_ARG_WITH([qt-inc], [ --with-qt-inc=DIR Qt include files are in DIR]) AC_ARG_WITH([qt-lib], [ --with-qt-lib=DIR Qt library files are in DIR]) AC_ARG_WITH([qt-bin], [ --with-qt-bin=DIR Qt program files are in DIR]) AC_ARG_WITH([qt-dir], [ --with-qt-dir=DIR Qt home dir, incs in DIR/include, libs in DIR/lib, bins in DIR/bin, overrides other options]) ######################################## # Stage 1: Find Qt includes. ######################################## echo " Starting stage 1: finding includes." # Check user specified values. if test "$qt_mission_impossible" = false; then if test "$qt_inc_dir" = false; then if test "x$with_qt_inc" != x; then if test -r $with_qt_inc/$qt_test_header; then qt_inc_dir="$with_qt_inc" fi fi fi fi if test "$qt_mission_impossible" = false; then if test "$qt_inc_dir" = false; then if test "x$with_qt_dir" != x; then if test -r $with_qt_dir/include/$qt_test_header; then qt_inc_dir="$with_qt_dir/include" fi fi fi fi # Look for includes in some well known dirs. if test "$qt_mission_impossible" = false; then if test "$qt_inc_dir" = false; then for d in $qt_inc_path; do if test -r "$d/$qt_test_header"; then qt_inc_dir="$d" break; fi done fi fi # If we have not found Qt includes yet, our glorious quest for Qt is in vain... if test "$qt_mission_impossible" = false; then if test "$qt_inc_dir" = false; then qt_mission_impossible=true echo " Mission impossible: Qt includes not found." echo " Try one of the following commands to tell" echo " configure where to find the Qt files." echo " ./configure --with-qt-dir=DIR" echo " ./configure --with-qt-inc=DIR --with-qt-lib=DIR --with-qt-bin=DIR" fi fi ######################################## # Figure out version of header files. ######################################## if test "$qt_mission_impossible" = false; then headerline=`cat $qt_inc_dir/$qt_test_header | grep '^#define *QT_VERSION_STR'` ; # Look for version 3.xx. for headerword in $headerline; do versionnumber=`echo $headerword | grep '"3'` ; if test "x$versionnumber" != x; then qt_inc_version="3" fi done ; # Look for version 2.xx. for headerword in $headerline; do versionnumber=`echo $headerword | grep '"2'` ; if test "x$versionnumber" != x; then qt_inc_version="2" fi done ; # Look for version 1.xx. for headerword in $headerline; do versionnumber=`echo $headerword | grep '"1'` ; if test "x$versionnumber" != x; then qt_inc_version="1" fi done ; fi # Output results for includes. if test "$qt_mission_impossible" = false; then echo " Qt includes found in dir: $qt_inc_dir" echo " Qt includes version found: $qt_inc_version" fi ######################################## # Stage 2: Find Qt libraries ######################################## echo " Starting stage 2: finding libraries." # Check user specified values. if test "$qt_mission_impossible" = false; then if test "$qt_lib_dir" = false; then if test "x$with_qt_lib" != x; then if test -r $with_qt_lib/$qt_test_lib; then qt_lib_dir="$with_qt_lib" qt_link_name="-lqt" fi if test -r $with_qt_lib/$qt_test_lib_mt; then qt_lib_dir="$with_qt_lib" qt_link_name="-lqt-mt" fi fi fi fi if test "$qt_mission_impossible" = false; then if test "$qt_lib_dir" = false; then if test "x$with_qt_dir" != x; then if test -r $with_qt_dir/lib/$qt_test_lib; then qt_lib_dir="$with_qt_dir/lib" qt_link_name="-lqt" fi if test -r $with_qt_dir/lib/$qt_test_lib_mt; then qt_lib_dir="$with_qt_dir/lib" qt_link_name="-lqt-mt" fi fi fi fi # Look for libraries in some well known dirs. if test "$qt_mission_impossible" = false; then if test "$qt_lib_dir" = false; then for d in $qt_lib_path; do if test -r "$d/$qt_test_lib"; then qt_lib_dir="$d" qt_link_name="-lqt" break; fi if test -r "$d/$qt_test_lib_mt"; then qt_lib_dir="$d" qt_link_name="-lqt-mt" break; fi done fi fi # If we have not found Qt libraries yet, our glorious quest for Qt is in vain... if test "$qt_mission_impossible" = false; then if test "$qt_lib_dir" = false; then qt_mission_impossible=true echo " Mission impossible: Qt libraries not found." echo " Try one of the following commands to tell" echo " configure where to find the Qt files." echo " ./configure --with-qt-dir=DIR" echo " ./configure --with-qt-inc=DIR --with-qt-lib=DIR --with-qt-bin=DIR" fi fi ######################################## # Figure out version of library files. ######################################## # Look for version 3.xx. if test "$qt_mission_impossible" = false; then if test "$qt_lib_version" = false; then if test -r "$qt_lib_dir/$qt_version_three_lib"; then qt_lib_version="3" fi if test -r "$qt_lib_dir/$qt_version_three_lib_mt"; then qt_lib_version="3" fi fi fi # Look for version 2.xx. if test "$qt_mission_impossible" = false; then if test "$qt_lib_version" = false; then if test -r "$qt_lib_dir/$qt_version_two_lib"; then qt_lib_version="2" fi if test -r "$qt_lib_dir/$qt_version_two_lib_mt"; then qt_lib_version="2" fi fi fi # Otherwise this must be version 1. if test "$qt_mission_impossible" = false; then if test "$qt_lib_version" = false; then qt_lib_version="1" fi fi # Output results for libraries. if test "$qt_mission_impossible" = false; then echo " Qt libraries found in dir: $qt_lib_dir" echo " Qt libraries version found: $qt_lib_version" fi ######################################## # Compare versions of headers and libraries. # Further checks make no sense if they are not the same. ######################################## if test "$qt_mission_impossible" = false; then if test "$qt_lib_version" != "$qt_inc_version"; then qt_mission_impossible=true echo " Mission impossible: Qt libraries version does not match Qt includes version." echo " Try one of the following commands to tell" echo " configure where to find the Qt files." echo " ./configure --with-qt-dir=DIR" echo " ./configure --with-qt-inc=DIR --with-qt-lib=DIR --with-qt-bin=DIR" fi fi ######################################## # Stage 3: Find Qt programs. ######################################## echo " Starting stage 3: finding programs." # Check user specified values. if test "$qt_mission_impossible" = false; then if test "$qt_bin_dir" = false; then if test "x$with_qt_bin" != x; then if test -x $with_qt_bin/$qt_test_bin; then qt_bin_dir="$with_qt_bin" fi fi fi fi if test "$qt_mission_impossible" = false; then if test "$qt_bin_dir" = false; then if test "x$with_qt_dir" != x; then if test -x $with_qt_dir/bin/$qt_test_bin; then qt_bin_dir="$with_qt_dir/bin" fi fi fi fi # Look for libraries in some well known dirs. if test "$qt_mission_impossible" = false; then if test "$qt_bin_dir" = false; then for d in $qt_bin_path; do if test -x "$d/$qt_test_bin"; then qt_bin_dir="$d" break; fi done fi fi # If we have not found Qt programs yet, our glorious quest for Qt is in vain... if test "$qt_mission_impossible" = false; then if test "$qt_bin_dir" = false; then qt_mission_impossible=true fi fi ######################################## # Figure out version of program files. ######################################## # Look for version 3.xx. if test "$qt_mission_impossible" = false; then if test "$qt_bin_version" = false; then if test -r "$qt_bin_dir/$qt_version_three_bin"; then qt_bin_version="3" fi fi fi # Look for version 2.xx. if test "$qt_mission_impossible" = false; then if test "$qt_bin_version" = false; then if test -r "$qt_bin_dir/$qt_version_two_bin"; then qt_bin_version="2" fi fi fi # Otherwise this must be version 1. if test "$qt_mission_impossible" = false; then if test "$qt_bin_version" = false; then qt_bin_version="1" fi fi # Output results for programs. if test "$qt_mission_impossible" = false; then echo " Qt programs found in dir: $qt_bin_dir" echo " Qt programs version found: $qt_bin_version" fi ######################################## # Compare versions of libraries and programs. # Further checks make no sense if they are not the same. ######################################## if test "$qt_mission_impossible" = false; then if test "$qt_lib_version" != "$qt_bin_version"; then qt_mission_impossible=true echo " Mission impossible: Qt libraries version does not match Qt programs version." echo " Try one of the following commands to tell" echo " configure where to find the Qt files." echo " ./configure --with-qt-dir=DIR" echo " ./configure --with-qt-inc=DIR --with-qt-lib=DIR --with-qt-bin=DIR" fi fi ######################################## # Prepare for take off... ######################################## if test "$qt_mission_impossible" = false; then QT_INC_FLAGS="-I$qt_inc_dir" QT_LIB_FLAGS="-L$qt_lib_dir $X_LIBS $qt_link_name $X_PRE_LIBS -lX11 -lXext $X_EXTRA_LIBS" if test "$qt_bin_version" = "1"; then QT_MOC=$qt_bin_dir/moc QT_QMAKE=/bin/false QT_UIC=/bin/false QT_LUPDATE=/bin/false QT_LRELEASE=/bin/false fi if test "$qt_bin_version" = "2"; then QT_MOC=$qt_bin_dir/moc QT_QMAKE=/bin/false QT_UIC=$qt_bin_dir/uic QT_LUPDATE=/bin/false QT_LRELEASE=/bin/false fi if test "$qt_bin_version" = "3"; then QT_MOC=$qt_bin_dir/moc QT_QMAKE=$qt_bin_dir/qmake QT_UIC=$qt_bin_dir/uic QT_LUPDATE=$qt_bin_dir/lupdate QT_LRELEASE=$qt_bin_dir/lrelease fi QT_VERSION=$qt_bin_version HAVE_QT=yes fi # Output all variables. echo "" echo " QT_INC_FLAGS = $QT_INC_FLAGS" echo " QT_LIB_FLAGS = $QT_LIB_FLAGS" echo " QT_QMAKE = $QT_QMAKE" echo " QT_MOC = $QT_MOC" echo " QT_UIC = $QT_UIC" echo " QT_LUPDATE = $QT_LUPDATE" echo " QT_LRELEASE = $QT_LRELEASE" echo " QT_VERSION = $QT_VERSION" echo " HAVE_QT = $HAVE_QT" echo "" echo "------------------------------------------------------------" # Output variables. AC_SUBST(QT_INC_FLAGS) AC_SUBST(QT_LIB_FLAGS) AC_SUBST(QT_DIR) AC_SUBST(QT_QMAKE) AC_SUBST(QT_MOC) AC_SUBST(QT_UIC) AC_SUBST(QT_LUPDATE) AC_SUBST(QT_LRELEASE) AC_SUBST(QT_VERSION) AC_SUBST(HAVE_QT) ])