1 dnl find a binary in the path
4 AC_MSG_CHECKING([for $1])
5 AC_CACHE_VAL(qt_cv_path_$1,
20 if test -x "$dir/$1"; then
22 evalstr="$dir/$1 $5 2>&1 "
23 if eval $evalstr; then
24 qt_cv_path_$1="$dir/$1"
28 qt_cv_path_$1="$dir/$1"
36 if test -z "$qt_cv_path_$1" || test "$qt_cv_path_$1" = "NONE"; then
37 AC_MSG_RESULT(not found)
40 AC_MSG_RESULT($qt_cv_path_$1)
45 dnl Find the uic compiler on the path or in qt_cv_dir
48 QT_FIND_PATH(uic, ac_uic, $qt_cv_dir/bin)
49 if test -z "$ac_uic" -a "$FATAL" = 1; then
50 AC_MSG_ERROR([uic binary not found in \$PATH or $qt_cv_dir/bin !])
54 dnl Find the right moc in path/qt_cv_dir
57 QT_FIND_PATH(moc2, ac_moc2, $qt_cv_dir/bin)
58 QT_FIND_PATH(moc, ac_moc1, $qt_cv_dir/bin)
60 if test -n "$ac_moc1" -a -n "$ac_moc2"; then
61 dnl found both. Prefer Qt3's if it exists else moc2
62 $ac_moc1 -v 2>&1 | grep "Qt 3" >/dev/null
63 if test "$?" = 0; then
69 if test -n "$ac_moc1"; then
76 if test -z "$ac_moc" -a "$FATAL" = 1; then
77 AC_MSG_ERROR([moc binary not found in \$PATH or $qt_cv_dir/bin !])
81 dnl check a particular libname
84 CXXFLAGS="$BASE_CXXFLAGS $1"
90 QString s("mangle_failure");
91 #if (QT_VERSION < 221)
97 CXXFLAGS="$BASE_CXXFLAGS"
100 dnl check we can do a compile
101 AC_DEFUN(QT_CHECK_COMPILE,
103 AC_MSG_CHECKING([for Qt library name])
105 AC_CACHE_VAL(qt_cv_libname,
108 SAVE_CXXFLAGS=$CXXFLAGS
109 BASE_CXXFLAGS="$CXXFLAGS $QT_INCLUDES $QT_LDFLAGS"
111 for libname in -lqt3 -lqt2 -lqt -lqt-mt;
113 QT_TRY_LINK($libname)
114 if test -n "$qt_cv_libname"; then
119 CXXFLAGS=$SAVE_CXXFLAGS
122 if test -z "$qt_cv_libname"; then
123 AC_MSG_RESULT([failed])
124 if test "$FATAL" = 1 ; then
125 AC_MSG_ERROR([Cannot compile a simple Qt executable. Check you have the right \$QTDIR !])
128 AC_MSG_RESULT([$qt_cv_libname])
133 AC_DEFUN(QT_DO_IT_ALL,
135 dnl Please leave this alone. I use this file in
139 AC_ARG_WITH(qt-dir, [ --with-qt-dir where the root of Qt is installed ],
140 [ qt_cv_dir=`eval echo "$withval"/` ])
142 AC_ARG_WITH(qt-includes, [ --with-qt-includes where the Qt includes are. ],
143 [ qt_cv_includes=`eval echo "$withval"` ])
145 AC_ARG_WITH(qt-libraries, [ --with-qt-libraries where the Qt library is installed.],
146 [ qt_cv_libraries=`eval echo "$withval"` ])
148 dnl pay attention to $QTDIR unless overridden
149 if test -z "$qt_cv_dir"; then
153 dnl derive inc/lib if needed
154 if test -n "$qt_cv_dir"; then
155 if test -z "$qt_cv_includes"; then
156 qt_cv_includes=$qt_cv_dir/include
158 if test -z "$qt_cv_libraries"; then
159 qt_cv_libraries=$qt_cv_dir/lib
163 dnl flags for compilation
166 if test -n "$qt_cv_includes"; then
167 QT_INCLUDES="-I$qt_cv_includes"
169 if test -n "$qt_cv_libraries"; then
170 QT_LDFLAGS="-L$qt_cv_libraries"
172 AC_SUBST(QT_INCLUDES)
184 QT_LIB=$qt_cv_libname;