2 dnl Please leave this alone. I use this file in
6 dnl find a binary in the path
9 AC_MSG_CHECKING([for $1])
10 AC_CACHE_VAL(qt_cv_path_$1,
13 if test -n "$$2"; then
25 if test -x "$dir/$1"; then
27 evalstr="$dir/$1 $5 2>&1 "
28 if eval $evalstr; then
29 qt_cv_path_$1="$dir/$1"
33 qt_cv_path_$1="$dir/$1"
41 if test -z "$qt_cv_path_$1" || test "$qt_cv_path_$1" = "NONE"; then
42 AC_MSG_RESULT(not found)
45 AC_MSG_RESULT($qt_cv_path_$1)
50 dnl Find the uic compiler on the path or in qt_cv_dir
53 QT_FIND_PATH(uic, ac_uic, $qt_cv_dir/bin)
54 if test -z "$ac_uic" -a "$FATAL" = 1; then
55 AC_MSG_ERROR([uic binary not found in \$PATH or $qt_cv_dir/bin !])
59 dnl Find the right moc in path/qt_cv_dir
62 QT_FIND_PATH(moc2, ac_moc2, $qt_cv_dir/bin)
63 QT_FIND_PATH(moc, ac_moc1, $qt_cv_dir/bin)
65 if test -n "$ac_moc1" -a -n "$ac_moc2"; then
66 dnl found both. Prefer Qt3's if it exists else moc2
67 $ac_moc1 -v 2>&1 | grep "Qt 3" >/dev/null
68 if test "$?" = 0; then
74 if test -n "$ac_moc1"; then
81 if test -z "$ac_moc" -a "$FATAL" = 1; then
82 AC_MSG_ERROR([moc binary not found in \$PATH or $qt_cv_dir/bin !])
86 dnl check a particular libname
89 CXXFLAGS="$BASE_CXXFLAGS $1"
95 QString s("mangle_failure");
96 #if (QT_VERSION < 221)
102 CXXFLAGS="$BASE_CXXFLAGS"
105 dnl check we can do a compile
106 AC_DEFUN(QT_CHECK_COMPILE,
108 AC_MSG_CHECKING([for Qt library name])
110 AC_CACHE_VAL(qt_cv_libname,
113 SAVE_CXXFLAGS=$CXXFLAGS
114 BASE_CXXFLAGS="$CXXFLAGS $QT_INCLUDES $QT_LDFLAGS"
116 for libname in -lqt3 -lqt2 -lqt -lqt-mt;
118 QT_TRY_LINK($libname)
119 if test -n "$qt_cv_libname"; then
124 CXXFLAGS=$SAVE_CXXFLAGS
127 if test -z "$qt_cv_libname"; then
128 AC_MSG_RESULT([failed])
129 if test "$FATAL" = 1 ; then
130 AC_MSG_ERROR([Cannot compile a simple Qt executable. Check you have the right \$QTDIR !])
133 AC_MSG_RESULT([$qt_cv_libname])
138 AC_DEFUN(QT_DO_IT_ALL,
140 AC_ARG_WITH(qt-dir, [ --with-qt-dir where the root of Qt is installed ],
141 [ qt_cv_dir=`eval echo "$withval"/` ])
143 AC_ARG_WITH(qt-includes, [ --with-qt-includes where the Qt includes are. ],
144 [ qt_cv_includes=`eval echo "$withval"` ])
146 AC_ARG_WITH(qt-libraries, [ --with-qt-libraries where the Qt library is installed.],
147 [ qt_cv_libraries=`eval echo "$withval"` ])
149 dnl pay attention to $QTDIR unless overridden
150 if test -z "$qt_cv_dir"; then
154 dnl derive inc/lib if needed
155 if test -n "$qt_cv_dir"; then
156 if test -z "$qt_cv_includes"; then
157 qt_cv_includes=$qt_cv_dir/include
159 if test -z "$qt_cv_libraries"; then
160 qt_cv_libraries=$qt_cv_dir/lib
164 dnl flags for compilation
167 if test -n "$qt_cv_includes"; then
168 QT_INCLUDES="-I$qt_cv_includes"
170 if test -n "$qt_cv_libraries"; then
171 QT_LDFLAGS="-L$qt_cv_libraries"
173 AC_SUBST(QT_INCLUDES)
185 QT_LIB=$qt_cv_libname;