Released 0.6.3.
[pinentry.git] / acinclude.m4
index 89e1781..1212a08 100644 (file)
@@ -130,6 +130,80 @@ AC_DEFUN([IU_LIB_CURSES], [
   AC_SUBST(LIBCURSES)])dnl
 dnl additional configure macros
 
+#
+# From /usr/share/aclocal/iconv.m4.
+#
+#serial AM2
+
+dnl From Bruno Haible.
+
+AC_DEFUN([AM_ICONV],
+[
+  dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
+  dnl those with the standalone portable GNU libiconv installed).
+
+  AC_ARG_WITH([libiconv-prefix],
+[  --with-libiconv-prefix=DIR  search for libiconv in DIR/include and DIR/lib], [
+    for dir in `echo "$withval" | tr : ' '`; do
+      if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
+      if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
+    done
+   ])
+
+  AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
+    am_cv_func_iconv="no, consider installing GNU libiconv"
+    am_cv_lib_iconv=no
+    AC_TRY_LINK([#include <stdlib.h>
+#include <iconv.h>],
+      [iconv_t cd = iconv_open("","");
+       iconv(cd,NULL,NULL,NULL,NULL);
+       iconv_close(cd);],
+      am_cv_func_iconv=yes)
+    if test "$am_cv_func_iconv" != yes; then
+      am_save_LIBS="$LIBS"
+      LIBS="$LIBS -liconv"
+      AC_TRY_LINK([#include <stdlib.h>
+#include <iconv.h>],
+        [iconv_t cd = iconv_open("","");
+         iconv(cd,NULL,NULL,NULL,NULL);
+         iconv_close(cd);],
+        am_cv_lib_iconv=yes
+        am_cv_func_iconv=yes)
+      LIBS="$am_save_LIBS"
+    fi
+  ])
+  if test "$am_cv_func_iconv" = yes; then
+    AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
+    AC_MSG_CHECKING([for iconv declaration])
+    AC_CACHE_VAL(am_cv_proto_iconv, [
+      AC_TRY_COMPILE([
+#include <stdlib.h>
+#include <iconv.h>
+extern
+#ifdef __cplusplus
+"C"
+#endif
+#if defined(__STDC__) || defined(__cplusplus)
+size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
+#else
+size_t iconv();
+#endif
+], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
+      am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
+    am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
+    AC_MSG_RESULT([$]{ac_t:-
+         }[$]am_cv_proto_iconv)
+    AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
+      [Define as const if the declaration of iconv() needs const.])
+  fi
+  LIBICONV=
+  if test "$am_cv_lib_iconv" = yes; then
+    LIBICONV="-liconv"
+  fi
+  AC_SUBST(LIBICONV)
+])
+
+
 dnl
 dnl GNUPG_CHECK_TYPEDEF(TYPE, HAVE_NAME)
 dnl Check whether a typedef exists and create a #define $2 if it exists
@@ -661,150 +735,19 @@ dnl    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 dnl    Boston, MA 02111-1307, USA.
 
 dnl ------------------------------------------------------------------------
-dnl Forward compatibility macros (make autoconf 2.13 look like 2.50),
-dnl thanks to Raja R Harinath.
-dnl ------------------------------------------------------------------------
-dnl
-ifdef([_AC_PATH_X_XMKMF],[],
-   [AC_DEFUN([_AC_PATH_X_XMKMF],[AC_PATH_X_XMKMF])])
-
-# KDE_PATH_X_DIRECT
-dnl Internal subroutine of AC_PATH_X.
-dnl Set ac_x_includes and/or ac_x_libraries.
-AC_DEFUN(KDE_PATH_X_DIRECT,
-[if test "$ac_x_includes" = NO; then
-  # Guess where to find include files, by looking for this one X11 .h file.
-  test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
-
-  # First, try using that file with no special directory specified.
-AC_TRY_CPP([#include <$x_direct_test_include>],
-[# We can compile using X headers with no special include directory.
-ac_x_includes=],
-[# Look for the header file in a standard set of common directories.
-# Check X11 before X11Rn because it is often a symlink to the current release.
-  for ac_dir in               \
-    /usr/X11/include          \
-    /usr/X11R6/include        \
-    /usr/X11R5/include        \
-    /usr/X11R4/include        \
-                              \
-    /usr/include/X11          \
-    /usr/include/X11R6        \
-    /usr/include/X11R5        \
-    /usr/include/X11R4        \
-                              \
-    /usr/local/X11/include    \
-    /usr/local/X11R6/include  \
-    /usr/local/X11R5/include  \
-    /usr/local/X11R4/include  \
-                              \
-    /usr/local/include/X11    \
-    /usr/local/include/X11R6  \
-    /usr/local/include/X11R5  \
-    /usr/local/include/X11R4  \
-                              \
-    /usr/X386/include         \
-    /usr/x386/include         \
-    /usr/XFree86/include/X11  \
-                              \
-    /usr/include              \
-    /usr/local/include        \
-    /usr/unsupported/include  \
-    /usr/athena/include       \
-    /usr/local/x11r5/include  \
-    /usr/lpp/Xamples/include  \
-                              \
-    /usr/openwin/include      \
-    /usr/openwin/share/include \
-    ; \
-  do
-    if test -r "$ac_dir/$x_direct_test_include"; then
-      ac_x_includes=$ac_dir
-      break
-    fi
-  done])
-fi # $ac_x_includes = NO
-
-if test "$ac_x_libraries" = NO; then
-  # Check for the libraries.
-
-  test -z "$x_direct_test_library" && x_direct_test_library=Xt
-  test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc
-
-  # See if we find them without any special options.
-  # Don't add to $LIBS permanently.
-  ac_save_LIBS="$LIBS"
-  LIBS="-l$x_direct_test_library $LIBS"
-AC_TRY_LINK(, [${x_direct_test_function}()],
-[LIBS="$ac_save_LIBS"
-# We can link X programs with no special library path.
-ac_x_libraries=],
-[LIBS="$ac_save_LIBS"
-# First see if replacing the include by lib works.
-# Check X11 before X11Rn because it is often a symlink to the current release.
-for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \
-    /usr/X11/lib          \
-    /usr/X11R6/lib        \
-    /usr/X11R5/lib        \
-    /usr/X11R4/lib        \
-                          \
-    /usr/lib/X11          \
-    /usr/lib/X11R6        \
-    /usr/lib/X11R5        \
-    /usr/lib/X11R4        \
-                          \
-    /usr/local/X11/lib    \
-    /usr/local/X11R6/lib  \
-    /usr/local/X11R5/lib  \
-    /usr/local/X11R4/lib  \
-                          \
-    /usr/local/lib/X11    \
-    /usr/local/lib/X11R6  \
-    /usr/local/lib/X11R5  \
-    /usr/local/lib/X11R4  \
-                          \
-    /usr/X386/lib         \
-    /usr/x386/lib         \
-    /usr/XFree86/lib/X11  \
-                          \
-    /usr/lib              \
-    /usr/local/lib        \
-    /usr/unsupported/lib  \
-    /usr/athena/lib       \
-    /usr/local/x11r5/lib  \
-    /usr/lpp/Xamples/lib  \
-    /lib/usr/lib/X11     \
-                          \
-    /usr/openwin/lib      \
-    /usr/openwin/share/lib \
-    ; \
-do
-dnl Don't even attempt the hair of trying to link an X program!
-  for ac_extension in a so sl; do
-    if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then
-      ac_x_libraries=$ac_dir
-      break 2
-    fi
-  done
-done])
-fi # $ac_x_libraries = NO
-])
-
-
-dnl ------------------------------------------------------------------------
 dnl Find a file (or one of more files in a list of dirs)
 dnl ------------------------------------------------------------------------
 dnl
-AC_DEFUN(AC_FIND_FILE,
+AC_DEFUN(QT_FIND_FILE,
 [
 $3=NO
 for i in $2;
 do
   for j in $1;
   do
-    echo "configure: __oline__: $i/$j" >&AC_FD_CC
+    echo "configure: __oline__: $i/$j" >&AS_MESSAGE_LOG_FD
     if test -r "$i/$j"; then
-      echo "taking that" >&AC_FD_CC
+      echo "taking that" >&AS_MESSAGE_LOG_FD
       $3=$i
       break 2
     fi
@@ -812,608 +755,107 @@ do
 done
 ])
 
-dnl KDE_FIND_PATH(programm-name, variable-name, list of directories,
-dnl    if-not-found, test-parameter)
-AC_DEFUN(KDE_FIND_PATH,
-[
-   AC_MSG_CHECKING([for $1])
-   if test -n "$$2"; then
-        kde_cv_path="$$2";
-   else
-        kde_cache=`echo $1 | sed 'y%./+-%__p_%'`
-
-        AC_CACHE_VAL(kde_cv_path_$kde_cache,
-        [
-        kde_cv_path="NONE"
-       dirs="$3"
-       kde_save_IFS=$IFS
-       IFS=':'
-       for dir in $PATH; do
-         dirs="$dirs $dir"
-        done
-       IFS=$kde_save_IFS
-
-        for dir in $dirs; do
-         if test -x "$dir/$1"; then
-           if test -n "$5"
-           then
-              evalstr="$dir/$1 $5 2>&1 "
-             if eval $evalstr; then
-                kde_cv_path="$dir/$1"
-                break
-             fi
-            else
-               kde_cv_path="$dir/$1"
-                break
-           fi
-          fi
-        done
-
-        eval "kde_cv_path_$kde_cache=$kde_cv_path"
-
-        ])
-
-      eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\""
-
-   fi
-
-   if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then
-      AC_MSG_RESULT(not found)
-      $4
-   else
-      AC_MSG_RESULT($kde_cv_path)
-      $2=$kde_cv_path
-
-   fi
-])
-
-AC_DEFUN(KDE_MOC_ERROR_MESSAGE,
-[
-    AC_MSG_ERROR([No Qt meta object compiler (moc) found!
-Please check whether you installed Qt correctly.
-You need to have a running moc binary.
-configure tried to run $ac_cv_path_moc and the test didn't
-succeed. If configure shouldn't have tried this one, set
-the environment variable MOC to the right one before running
-configure.
-])
-])
-
 dnl ------------------------------------------------------------------------
-dnl Find the meta object compiler and the ui compiler in the PATH,
+dnl Find the meta object compiler in the PATH,
 dnl in $QTDIR/bin, and some more usual places
 dnl ------------------------------------------------------------------------
 dnl
-AC_DEFUN(AC_PATH_QT_MOC_UIC,
+AC_DEFUN(QT_PATH_MOC,
 [
    qt_bindirs=""
-   for dir in $kde_qt_dirs; do
-      qt_bindirs="$qt_bindirs $dir/bin $dir/src/moc"
+   for dir in $qt_dirs; do
+      qt_bindirs="$qt_bindirs:$dir/bin:$dir/src/moc"
    done
-   qt_bindirs="$qt_bindirs /usr/bin /usr/X11R6/bin /usr/local/qt/bin"
+   qt_bindirs="$qt_bindirs:/usr/bin:/usr/X11R6/bin:/usr/local/qt/bin"
    if test ! "$ac_qt_bindir" = "NO"; then
-      qt_bindirs="$ac_qt_bindir $qt_bindirs"
+      qt_bindirs="$ac_qt_bindir:$qt_bindirs"
    fi
 
-   KDE_FIND_PATH(moc, MOC, [$qt_bindirs], [KDE_MOC_ERROR_MESSAGE])
-   AC_SUBST(MOC)
-])
-
-AC_DEFUN(KDE_1_CHECK_PATHS,
-[
-  KDE_1_CHECK_PATH_HEADERS
-
-  KDE_TEST_RPATH=
-
-  if test -n "$USE_RPATH"; then
-
-     if test -n "$kde_libraries"; then
-       KDE_TEST_RPATH="-Wl,--rpath -Wl,$kde_libraries"
-     fi
-
-     if test -n "$qt_libraries"; then
-       KDE_TEST_RPATH="$KDE_TEST_RPATH -Wl,--rpath -Wl,$qt_libraries"
-     fi
-
-     if test -n "$x_libraries"; then
-       KDE_TEST_RPATH="$KDE_TEST_RPATH -Wl,--rpath -Wl,$x_libraries"
-     fi
-
-     KDE_TEST_RPATH="$KDE_TEST_RPATH"
-  fi
-
-if eval `KDEDIR= ./conftest 2>&5`; then
-  kde_result=done
-else
-  kde_result=problems
-fi
-
-KDEDIR= ./conftest 2> /dev/null >&5 # make an echo for config.log
-kde_have_all_paths=yes
-
-KDE_SET_PATHS($kde_result)
-
-])
-
-AC_DEFUN(KDE_SET_PATHS,
-[
-  kde_cv_all_paths="kde_have_all_paths=\"yes\" \
-       kde_htmldir=\"$kde_htmldir\" \
-       kde_appsdir=\"$kde_appsdir\" \
-       kde_icondir=\"$kde_icondir\" \
-       kde_sounddir=\"$kde_sounddir\" \
-       kde_datadir=\"$kde_datadir\" \
-       kde_locale=\"$kde_locale\" \
-       kde_cgidir=\"$kde_cgidir\" \
-       kde_confdir=\"$kde_confdir\" \
-       kde_mimedir=\"$kde_mimedir\" \
-       kde_toolbardir=\"$kde_toolbardir\" \
-       kde_wallpaperdir=\"$kde_wallpaperdir\" \
-       kde_templatesdir=\"$kde_templatesdir\" \
-       kde_bindir=\"$kde_bindir\" \
-       kde_servicesdir=\"$kde_servicesdir\" \
-       kde_servicetypesdir=\"$kde_servicetypesdir\" \
-       kde_moduledir=\"$kde_moduledir\" \
-   kde_styledir=\"$kde_styledir\" \
-       kde_widgetdir=\"$kde_widgetdir\" \
-       kde_result=$1"
-])
-
-AC_DEFUN(KDE_SET_DEFAULT_PATHS,
-[
-if test "$1" = "default"; then
-
-  if test -z "$kde_htmldir"; then
-    kde_htmldir='\${prefix}/share/doc/HTML'
-  fi
-  if test -z "$kde_appsdir"; then
-    kde_appsdir='\${prefix}/share/applnk'
-  fi
-  if test -z "$kde_icondir"; then
-    kde_icondir='\${prefix}/share/icons'
-  fi
-  if test -z "$kde_sounddir"; then
-    kde_sounddir='\${prefix}/share/sounds'
-  fi
-  if test -z "$kde_datadir"; then
-    kde_datadir='\${prefix}/share/apps'
-  fi
-  if test -z "$kde_locale"; then
-    kde_locale='\${prefix}/share/locale'
-  fi
-  if test -z "$kde_cgidir"; then
-    kde_cgidir='\${exec_prefix}/cgi-bin'
-  fi
-  if test -z "$kde_confdir"; then
-    kde_confdir='\${prefix}/share/config'
-  fi
-  if test -z "$kde_mimedir"; then
-    kde_mimedir='\${prefix}/share/mimelnk'
-  fi
-  if test -z "$kde_toolbardir"; then
-    kde_toolbardir='\${prefix}/share/toolbar'
-  fi
-  if test -z "$kde_wallpaperdir"; then
-    kde_wallpaperdir='\${prefix}/share/wallpapers'
-  fi
-  if test -z "$kde_templatesdir"; then
-    kde_templatesdir='\${prefix}/share/templates'
-  fi
-  if test -z "$kde_bindir"; then
-    kde_bindir='\${exec_prefix}/bin'
-  fi
-  if test -z "$kde_servicesdir"; then
-    kde_servicesdir='\${prefix}/share/services'
-  fi
-  if test -z "$kde_servicetypesdir"; then
-    kde_servicetypesdir='\${prefix}/share/servicetypes'
-  fi
-  if test -z "$kde_moduledir"; then
-    if test "$kde_qtver" = "2"; then
-      kde_moduledir='\${exec_prefix}/lib/kde2'
-    else
-      kde_moduledir='\${exec_prefix}/lib/kde3'
-    fi
-  fi
-  if test -z "$kde_styledir"; then
-    kde_styledir='\${exec_prefix}/lib/kde3/plugins/styles'
-  fi
-  if test -z "$kde_widgetdir"; then
-    kde_widgetdir='\${exec_prefix}/lib/kde3/plugins/designer'
-  fi
-
-  KDE_SET_PATHS(defaults)
-
-else
-
-  if test $kde_qtver = 1; then
-     AC_MSG_RESULT([compiling])
-     KDE_1_CHECK_PATHS
-  else
-     AC_MSG_ERROR([path checking not yet supported for KDE 2])
-  fi
-
-fi
-])
-
-AC_DEFUN(KDE_CHECK_PATHS_FOR_COMPLETENESS,
-[ if test -z "$kde_htmldir" || test -z "$kde_appsdir" ||
-   test -z "$kde_icondir" || test -z "$kde_sounddir" ||
-   test -z "$kde_datadir" || test -z "$kde_locale"  ||
-   test -z "$kde_cgidir"  || test -z "$kde_confdir" ||
-   test -z "$kde_mimedir" || test -z "$kde_toolbardir" ||
-   test -z "$kde_wallpaperdir" || test -z "$kde_templatesdir" ||
-   test -z "$kde_bindir" || test -z "$kde_servicesdir" ||
-   test -z "$kde_servicetypesdir" || test -z "$kde_moduledir" ||
-   test -z "$kde_styledir" || test -z "kde_widgetdir" 
-   test "x$kde_have_all_paths" != "xyes"; then
-     kde_have_all_paths=no
-  fi
-])
-
-AC_DEFUN(KDE_MISSING_PROG_ERROR,
-[
-    AC_MSG_ERROR([The important program $1 was not found!
-Please check whether you installed KDE correctly.
-])
-])
-
-AC_DEFUN(KDE_SUBST_PROGRAMS,
-[
-
-        kde_default_bindirs="/usr/bin /usr/local/bin /opt/local/bin /usr/X11R6/bin /opt/kde/bin /opt/kde3/bin /usr/kde/bin /usr/local/kde/bin"
-        if test -n "$KDEDIRS"; then
-           kde_save_IFS=$IFS
-           IFS=:
-           for dir in $KDEDIRS; do
-                kde_default_bindirs="$dir/bin $kde_default_bindirs "
-           done
-           IFS=$kde_save_IFS
-        fi
-        kde_default_bindirs="$exec_prefix/bin $prefix/bin $kde_default_bindirs"
-        KDE_FIND_PATH(kde-config, KDECONFIG, [$kde_default_bindirs])
-        AC_SUBST(KDECONFIG)
-
-        if test -x "$KDECONFIG"; then # it can be "compiled"
-          kde_libs_prefix=`$KDECONFIG --prefix`
-          if test -z "$kde_libs_prefix" || test ! -x "$kde_libs_prefix"; then
-               AC_MSG_ERROR([$KDECONFIG --prefix outputed the non existant prefix '$kde_libs_prefix' for kdelibs.
-                          This means it has been moved since you installed it.
-                          This won't work. Please recompile kdelibs for the new prefix.
-                          ])
-           fi
-           kde_libs_htmldir=`$KDECONFIG --install html --expandvars`
-        else
-           kde_libs_prefix='$(prefix)'
-           kde_libs_htmldir='$(kde_htmldir)'
-        fi
-        AC_SUBST(kde_libs_prefix)
-        AC_SUBST(kde_libs_htmldir)
-])dnl
-
-AC_DEFUN(AC_CREATE_KFSSTND,
-[
-AC_REQUIRE([AC_CHECK_RPATH])
-
-AC_MSG_CHECKING([for KDE paths])
-kde_result=""
-kde_cached_paths=yes
-AC_CACHE_VAL(kde_cv_all_paths,
-[
-  KDE_SET_DEFAULT_PATHS($1)
-  kde_cached_paths=no
-])
-eval "$kde_cv_all_paths"
-KDE_CHECK_PATHS_FOR_COMPLETENESS
-if test "$kde_have_all_paths" = "no" && test "$kde_cached_paths" = "yes"; then
-  # wrong values were cached, may be, we can set better ones
-  kde_result=
-  kde_htmldir= kde_appsdir= kde_icondir= kde_sounddir=
-  kde_datadir= kde_locale=  kde_cgidir=  kde_confdir=
-  kde_mimedir= kde_toolbardir= kde_wallpaperdir= kde_templatesdir=
-  kde_bindir= kde_servicesdir= kde_servicetypesdir= kde_moduledir=
-  kde_have_all_paths=
-  kde_styledir=
-  kde_widgetdir=
-  KDE_SET_DEFAULT_PATHS($1)
-  eval "$kde_cv_all_paths"
-  KDE_CHECK_PATHS_FOR_COMPLETENESS
-  kde_result="$kde_result (cache overridden)"
-fi
-if test "$kde_have_all_paths" = "no"; then
-  AC_MSG_ERROR([configure could not run a little KDE program to test the environment.
-Since it had compiled and linked before, it must be a strange problem on your system.
-Look at config.log for details. If you are not able to fix this, look at
-http://www.kde.org/faq/installation.html or any www.kde.org mirror.
-(If you're using an egcs version on Linux, you may update binutils!)
-])
-else
-  rm -f conftest*
-  AC_MSG_RESULT($kde_result)
-fi
-
-bindir=$kde_bindir
-
-KDE_SUBST_PROGRAMS
-
-])
-
-AC_DEFUN(AC_SUBST_KFSSTND,
-[
-AC_SUBST(kde_htmldir)
-AC_SUBST(kde_appsdir)
-AC_SUBST(kde_icondir)
-AC_SUBST(kde_sounddir)
-AC_SUBST(kde_datadir)
-AC_SUBST(kde_locale)
-AC_SUBST(kde_confdir)
-AC_SUBST(kde_mimedir)
-AC_SUBST(kde_wallpaperdir)
-AC_SUBST(kde_bindir)
-dnl for KDE 2
-AC_SUBST(kde_templatesdir)
-AC_SUBST(kde_servicesdir)
-AC_SUBST(kde_servicetypesdir)
-AC_SUBST(kde_moduledir)
-AC_SUBST(kde_styledir)
-AC_SUBST(kde_widgetdir)
-if test "$kde_qtver" = 1; then
-  kde_minidir="$kde_icondir/mini"
-else
-# for KDE 1 - this breaks KDE2 apps using minidir, but
-# that's the plan ;-/
-  kde_minidir="/dev/null"
-fi
-dnl AC_SUBST(kde_minidir)
-dnl AC_SUBST(kde_cgidir)
-dnl AC_SUBST(kde_toolbardir)
+   AC_PATH_PROG(MOC, moc, no, [$qt_bindirs])
+   if test "$MOC" = no; then
+    #AC_MSG_ERROR([No Qt meta object compiler (moc) found!
+    #Please check whether you installed Qt correctly.
+    #You need to have a running moc binary.
+    #configure tried to run $ac_cv_path_moc and the test didn't
+    #succeed. If configure shouldn't have tried this one, set
+    #the environment variable MOC to the right one before running
+    #configure.
+    #])
+    have_moc="no"
+   else
+    have_moc="yes"
+    AC_SUBST(MOC)
+   fi
 ])
 
-AC_DEFUN(KDE_MISC_TESTS,
-[
-   AC_LANG_C
-
-   # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
-   AC_CHECK_FUNC(shmat, ,
-     AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc"))
-   AC_SUBST(X_EXTRA_LIBS)
-])
 
 dnl ------------------------------------------------------------------------
-dnl Find the header files and libraries for X-Windows. Extended the
-dnl macro AC_PATH_X
+dnl Find the header files and libraries for the X Window System.
+dnl Extended the macro AC_PATH_XTRA.
 dnl ------------------------------------------------------------------------
 dnl
-AC_DEFUN(K_PATH_X,
+AC_DEFUN(QT_PATH_X,
 [
-AC_REQUIRE([KDE_MISC_TESTS])dnl
-
 AC_ARG_ENABLE(
   embedded,
   [  --enable-embedded       link to Qt-embedded, don't use X],
-  kde_use_qt_emb=$enableval,
-  kde_use_qt_emb=no
+  qt_use_emb=$enableval,
+  qt_use_emb=no
 )
 
 AC_ARG_ENABLE(
   palmtop,
-  [  --enable-palmtop       link to Qt-embedded, don't use X and link to the Qt Palmtop Environment],
-  kde_use_qt_emb_palm=$enableval,
-  kde_use_qt_emb_palm=no
+  [  --enable-palmtop       link to Qt-embedded, don't use X, link to the Qt Palmtop Environment],
+  qt_use_emb_palm=$enableval,
+  qt_use_emb_palm=no
 )
 
-if test "$kde_use_qt_emb" = "no"; then
-
-AC_MSG_CHECKING(for X)
-AC_LANG_SAVE
-AC_LANG_C
-AC_CACHE_VAL(kde_cv_have_x,
-[# One or both of the vars are not set, and there is no cached value.
-if test "{$x_includes+set}" = set || test "$x_includes" = NONE; then
-   kde_x_includes=NO
-else
-   kde_x_includes=$x_includes
-fi
-if test "{$x_libraries+set}" = set || test "$x_libraries" = NONE; then
-   kde_x_libraries=NO
-else
-   kde_x_libraries=$x_libraries
-fi
-
-# below we use the standard autoconf calls
-ac_x_libraries=$kde_x_libraries
-ac_x_includes=$kde_x_includes
-
-KDE_PATH_X_DIRECT
-dnl AC_PATH_X_XMKMF picks /usr/lib as the path for the X libraries.
-dnl Unfortunately, if compiling with the N32 ABI, this is not the correct
-dnl location. The correct location is /usr/lib32 or an undefined value
-dnl (the linker is smart enough to pick the correct default library).
-dnl Things work just fine if you use just AC_PATH_X_DIRECT.
-dnl Solaris has a similar problem. AC_PATH_X_XMKMF forces x_includes to
-dnl /usr/openwin/include, which doesn't work. /usr/include does work, so
-dnl x_includes should be left alone.
-case "$host" in
-mips-sgi-irix6*)
-  ;;
-*-*-solaris*)
-  ;;
-*)
-  _AC_PATH_X_XMKMF
-  if test -z "$ac_x_includes"; then
-    ac_x_includes="."
-  fi
-  if test -z "$ac_x_libraries"; then
-    ac_x_libraries="/usr/lib"
+if test "$qt_use_emb" = "no"; then
+  AC_PATH_X
+  AC_PATH_XTRA
+  if test "$no_x" = yes; then
+    AC_MSG_ERROR([Can't find X. Please check your installation and add the correct paths!])
   fi
-esac
-#from now on we use our own again
-
-# when the user already gave --x-includes, we ignore
-# what the standard autoconf macros told us.
-if test "$kde_x_includes" = NO; then
-  kde_x_includes=$ac_x_includes
-fi
-
-# for --x-libraries too
-if test "$kde_x_libraries" = NO; then
-  kde_x_libraries=$ac_x_libraries
-fi
-
-if test "$kde_x_includes" = NO; then
-  AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!])
-fi
-
-if test "$kde_x_libraries" = NO; then
-  AC_MSG_ERROR([Can't find X libraries. Please check your installation and add the correct paths!])
-fi
-
-# Record where we found X for the cache.
-kde_cv_have_x="have_x=yes \
-         kde_x_includes=$kde_x_includes kde_x_libraries=$kde_x_libraries"
-])dnl
-
-eval "$kde_cv_have_x"
-
-if test "$have_x" != yes; then
-  AC_MSG_RESULT($have_x)
-  no_x=yes
-else
-  AC_MSG_RESULT([libraries $kde_x_libraries, headers $kde_x_includes])
-fi
-
-if test -z "$kde_x_includes" || test "x$kde_x_includes" = xNONE; then
-  X_INCLUDES=""
-  x_includes="."; dnl better than nothing :-
- else
-  x_includes=$kde_x_includes
-  X_INCLUDES="-I$x_includes"
-fi
-
-if test -z "$kde_x_libraries" || test "x$kde_x_libraries" = xNONE; then
-  X_LDFLAGS=""
-  x_libraries="/usr/lib"; dnl better than nothing :-
- else
-  x_libraries=$kde_x_libraries
-  X_LDFLAGS="-L$x_libraries"
-fi
-all_includes="$X_INCLUDES"
-all_libraries="$X_LDFLAGS"
-
-AC_SUBST(X_INCLUDES)
-AC_SUBST(X_LDFLAGS)
-AC_SUBST(x_libraries)
-AC_SUBST(x_includes)
-
-# Check for libraries that X11R6 Xt/Xaw programs need.
-ac_save_LDFLAGS="$LDFLAGS"
-LDFLAGS="$LDFLAGS $X_LDFLAGS"
-# SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
-# check for ICE first), but we must link in the order -lSM -lICE or
-# we get undefined symbols.  So assume we have SM if we have ICE.
-# These have to be linked with before -lX11, unlike the other
-# libraries we check for below, so use a different variable.
-#  --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
-AC_CHECK_LIB(ICE, IceConnectionNumber,
-  [LIBSM="-lSM -lICE"], , $X_EXTRA_LIBS)
-AC_SUBST(LIBSM)
-LDFLAGS="$ac_save_LDFLAGS"
-
-AC_SUBST(X_PRE_LIBS)
-
-LIB_X11='-lX11 $(LIBSOCKET)'
-AC_SUBST(LIB_X11)
-
-AC_MSG_CHECKING(for libXext)
-AC_CACHE_VAL(kde_cv_have_libXext,
-[
-kde_ldflags_safe="$LDFLAGS"
-kde_libs_safe="$LIBS"
-
-LDFLAGS="$LDFLAGS $X_LDFLAGS"
-LIBS="-lXext -lX11 $LIBSOCKET"
-
-AC_TRY_LINK([
-#include <stdio.h>
-#ifdef STDC_HEADERS
-# include <stdlib.h>
-#endif
-],
-[
-printf("hello Xext\n");
-],
-kde_cv_have_libXext=yes,
-kde_cv_have_libXext=no
-   )
-
-LDFLAGS=$kde_ldflags_safe
-LIBS=$kde_libs_safe
- ])
-
-AC_MSG_RESULT($kde_cv_have_libXext)
-
-if test "$kde_cv_have_libXext" = "no"; then
-  AC_MSG_ERROR([We need a working libXext to proceed. Since configure
-can't find it itself, we stop here assuming that make wouldn't find
-them either.])
-fi
-
-LIB_XEXT="-lXext"
-QTE_NORTTI=""
-
+  QT_CXXFLAGS="$X_CFLAGS"
+  QT_LDFLAGS="$X_LIBS"
+  QT_LIBS="$X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS"
+  QTE_NORTTI=""
 else
   dnl We're using QT Embedded
-  CXXFLAGS="$CXXFLAGS -fno-rtti -DQWS"
-  CFLAGS="$CFLAGS -DQWS"
-  LDFLAGS="$LDFLAGS -DQWS"
+  QT_CXXFLAGS="-fno-rtti -DQWS"
+  QT_LDFLAGS="-DQWS"
+  QT_LIBS=""
   QTE_NORTTI="-fno-rtti -DQWS"
-  X_PRE_LIBS=""
-  LIB_X11=""
-  LIB_XEXT=""
-  LIBSM=""
-  X_INCLUDES=""
-  X_LDFLAGS=""
-  x_includes=""
-  x_libraries=""
-  AC_SUBST(X_PRE_LIBS)
-  AC_SUBST(LIB_X11)
-  AC_SUBST(LIBSM)
-  AC_SUBST(X_INCLUDES)
-  AC_SUBST(X_LDFLAGS)
-  AC_SUBST(x_includes)
-  AC_SUBST(x_libraries)
 fi
+AC_SUBST(QT_CXXFLAGS)
+AC_SUBST(QT_LDFLAGS)
+AC_SUBST(QT_LIBS)
 AC_SUBST(QTE_NORTTI)
-AC_SUBST(LIB_XEXT)
-
-
-AC_LANG_RESTORE
-
 ])
 
-AC_DEFUN(KDE_PRINT_QT_PROGRAM,
+AC_DEFUN(QT_PRINT_PROGRAM,
 [
-AC_REQUIRE([KDE_USE_QT])
+AC_REQUIRE([QT_CHECK_VERSION])
 cat > conftest.$ac_ext <<EOF
 #include "confdefs.h"
 #include <qglobal.h>
 #include <qapplication.h>
 EOF
-if test "$kde_qtver" = "2"; then
+if test "$qt_ver" = "2"; then
 cat >> conftest.$ac_ext <<EOF
 #include <qevent.h>
 #include <qstring.h>
 #include <qstyle.h>
 EOF
 
-if test $kde_qtsubver -gt 0; then
+if test $qt_subver -gt 0; then
 cat >> conftest.$ac_ext <<EOF
 #include <qiconview.h>
 EOF
 fi
 fi
 
-if test "$kde_qtver" = "3"; then
+if test "$qt_ver" = "3"; then
 cat >> conftest.$ac_ext <<EOF
 #include <qcursor.h>
 #include <qstylefactory.h>
@@ -1421,19 +863,19 @@ cat >> conftest.$ac_ext <<EOF
 EOF
 fi
 
-echo "#if ! ($kde_qt_verstring)" >> conftest.$ac_ext
+echo "#if ! ($qt_verstring)" >> conftest.$ac_ext
 cat >> conftest.$ac_ext <<EOF
 #error 1
 #endif
 
 int main() {
 EOF
-if test "$kde_qtver" = "2"; then
+if test "$qt_ver" = "2"; then
 cat >> conftest.$ac_ext <<EOF
     QStringList *t = new QStringList();
     Q_UNUSED(t);
 EOF
-if test $kde_qtsubver -gt 0; then
+if test $qt_subver -gt 0; then
 cat >> conftest.$ac_ext <<EOF
     QIconView iv(0);
     iv.setWordWrapIconText(false);
@@ -1442,7 +884,7 @@ cat >> conftest.$ac_ext <<EOF
 EOF
 fi
 fi
-if test "$kde_qtver" = "3"; then
+if test "$qt_ver" = "3"; then
 cat >> conftest.$ac_ext <<EOF
     (void)QStyleFactory::create(QString::null);
     QCursor c(Qt::WhatsThisCursor);
@@ -1454,79 +896,79 @@ cat >> conftest.$ac_ext <<EOF
 EOF
 ])
 
-AC_DEFUN(KDE_USE_QT,
-[
 
+AC_DEFUN(QT_CHECK_VERSION,
+[
 if test -z "$1"; then
-  kde_qtver=3
-  kde_qtsubver=1
+  qt_ver=3
+  qt_subver=1
 else
-  kde_qtsubver=`echo "$1" | sed -e 's#[0-9][0-9]*\.\([0-9][0-9]*\).*#\1#'`
+  qt_subver=`echo "$1" | sed -e 's#[0-9][0-9]*\.\([0-9][0-9]*\).*#\1#'`
   # following is the check if subversion isnĀ“t found in passed argument
-  if test "$kde_qtsubver" = "$1"; then
-    kde_qtsubver=1
+  if test "$qt_subver" = "$1"; then
+    qt_subver=1
   fi
-  kde_qtver=`echo "$1" | sed -e 's#^\([0-9][0-9]*\)\..*#\1#'`
-  if test "$kde_qtver" = "1"; then
-    kde_qtsubver=42
+  qt_ver=`echo "$1" | sed -e 's#^\([0-9][0-9]*\)\..*#\1#'`
+  if test "$qt_ver" = "1"; then
+    qt_subver=42
   fi
 fi
 
 if test -z "$2"; then
-  if test "$kde_qtver" = "2"; then
-    if test $kde_qtsubver -gt 0; then
-      kde_qt_minversion=">= Qt 2.2.2"
+  if test "$qt_ver" = "2"; then
+    if test $qt_subver -gt 0; then
+      qt_minversion=">= Qt 2.2.2"
     else
-      kde_qt_minversion=">= Qt 2.0.2"
+      qt_minversion=">= Qt 2.0.2"
     fi
   fi
-  if test "$kde_qtver" = "3"; then
-    kde_qt_minversion=">= Qt 3.0.1"
+  if test "$qt_ver" = "3"; then
+    qt_minversion=">= Qt 3.0.1"
   fi
-  if test "$kde_qtver" = "1"; then
-    kde_qt_minversion=">= 1.42 and < 2.0"
+  if test "$qt_ver" = "1"; then
+    qt_minversion=">= 1.42 and < 2.0"
   fi
 else
-   kde_qt_minversion=$2
+   qt_minversion=$2
 fi
 
 if test -z "$3"; then
-   if test $kde_qtver = 3; then
-     kde_qt_verstring="QT_VERSION >= 301"
+   if test $qt_ver = 3; then
+     qt_verstring="QT_VERSION >= 301"
    fi
-   if test $kde_qtver = 2; then
-     if test $kde_qtsubver -gt 0; then
-       kde_qt_verstring="QT_VERSION >= 222"
+   if test $qt_ver = 2; then
+     if test $qt_subver -gt 0; then
+       qt_verstring="QT_VERSION >= 222"
      else
-       kde_qt_verstring="QT_VERSION >= 200"
+       qt_verstring="QT_VERSION >= 200"
      fi
    fi
-   if test $kde_qtver = 1; then
-    kde_qt_verstring="QT_VERSION >= 142 && QT_VERSION < 200"
+   if test $qt_ver = 1; then
+    qt_verstring="QT_VERSION >= 142 && QT_VERSION < 200"
    fi
 else
-   kde_qt_verstring=$3
+   qt_verstring=$3
 fi
 
-if test $kde_qtver = 3; then
-  kde_qt_dirs="$QTDIR /usr/lib/qt3 /usr/lib/qt"
+if test $qt_ver = 3; then
+  qt_dirs="$QTDIR /usr/lib/qt3 /usr/lib/qt"
 fi
-if test $kde_qtver = 2; then
-   kde_qt_dirs="$QTDIR /usr/lib/qt2 /usr/lib/qt"
+if test $qt_ver = 2; then
+  qt_dirs="$QTDIR /usr/lib/qt2 /usr/lib/qt"
 fi
-if test $kde_qtver = 1; then
-   kde_qt_dirs="$QTDIR /usr/lib/qt"
+if test $qt_ver = 1; then
+  qt_dirs="$QTDIR /usr/lib/qt"
 fi
 ])
 
-AC_DEFUN(KDE_CHECK_QT_DIRECT,
+
+AC_DEFUN(QT_CHECK_DIRECT,
 [
-AC_REQUIRE([KDE_USE_QT])
+AC_REQUIRE([QT_CHECK_VERSION])
 AC_MSG_CHECKING([if Qt compiles without flags])
 AC_CACHE_VAL(kde_cv_qt_direct,
 [
-AC_LANG_SAVE
-AC_LANG_CPLUSPLUS
+AC_LANG_PUSH(C++)
 ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH
 ac_LIBRARY_PATH="$LIBRARY_PATH"
 ac_cxxflags_safe="$CXXFLAGS"
@@ -1534,25 +976,21 @@ ac_ldflags_safe="$LDFLAGS"
 ac_libs_safe="$LIBS"
 
 CXXFLAGS="$CXXFLAGS -I$qt_includes"
-LDFLAGS="$LDFLAGS $X_LDFLAGS"
-if test "x$kde_use_qt_emb" != "xyes"; then
-LIBS="$LIBQT -lXext -lX11 $LIBSOCKET"
-else
-LIBS="$LIBQT $LIBSOCKET"
-fi
+LDFLAGS="$LDFLAGS $QT_LDFLAGS"
+LIBS="$QT_LIBS"
 LD_LIBRARY_PATH=
 export LD_LIBRARY_PATH
 LIBRARY_PATH=
 export LIBRARY_PATH
 
-KDE_PRINT_QT_PROGRAM
+QT_PRINT_PROGRAM
 
 if AC_TRY_EVAL(ac_link) && test -s conftest; then
   kde_cv_qt_direct="yes"
 else
   kde_cv_qt_direct="no"
-  echo "configure: failed program was:" >&AC_FD_CC
-  cat conftest.$ac_ext >&AC_FD_CC
+  echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
+  cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD
 fi
 
 rm -f conftest*
@@ -1564,7 +1002,7 @@ LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe"
 export LD_LIBRARY_PATH
 LIBRARY_PATH="$ac_LIBRARY_PATH"
 export LIBRARY_PATH
-AC_LANG_RESTORE
+AC_LANG_POP(C++)
 ])
 
 if test "$kde_cv_qt_direct" = "yes"; then
@@ -1582,10 +1020,10 @@ dnl $(QT_LDFLAGS) will be -Lqtliblocation (if needed)
 dnl and $(QT_INCLUDES) will be -Iqthdrlocation (if needed)
 dnl ------------------------------------------------------------------------
 dnl
-AC_DEFUN(AC_PATH_QT_1_3,
+AC_DEFUN(QT_PATH_1_3,
 [
-AC_REQUIRE([K_PATH_X])
-AC_REQUIRE([KDE_USE_QT])
+AC_REQUIRE([QT_PATH_X])
+AC_REQUIRE([QT_CHECK_VERSION])
 
 dnl ------------------------------------------------------------------------
 dnl Add configure flag to enable linking to MT version of Qt library.
@@ -1594,12 +1032,12 @@ dnl ------------------------------------------------------------------------
 AC_ARG_ENABLE(
   mt,
   [  --disable-mt            link to non-threaded Qt (deprecated)],
-  kde_use_qt_mt=$enableval,
+  qt_use_mt=$enableval,
   [
-    if test $kde_qtver = 3; then
-      kde_use_qt_mt=yes
+    if test $qt_ver = 3; then
+      qt_use_mt=yes
     else
-      kde_use_qt_mt=no
+      qt_use_mt=no
     fi
   ]
 )
@@ -1610,28 +1048,26 @@ dnl ------------------------------------------------------------------------
 dnl If we not get --disable-qt-mt then adjust some vars for the host.
 dnl ------------------------------------------------------------------------
 
-KDE_MT_LDFLAGS=
-KDE_MT_LIBS=
-if test "x$kde_use_qt_mt" = "xyes"; then
-  KDE_CHECK_THREADING
-  if test "x$kde_use_threading" = "xyes"; then
-    CXXFLAGS="$USE_THREADS -DQT_THREAD_SUPPORT $CXXFLAGS"
-    KDE_MT_LDFLAGS="$USE_THREADS"
-    KDE_MT_LIBS="$LIBPTHREAD"
+QT_MT_LDFLAGS=
+QT_MT_LIBS=
+if test "x$qt_use_mt" = "xyes"; then
+  QT_CHECK_THREADING
+  if test "x$qt_use_threading" = "xyes"; then
+    QT_CXXFLAGS="$USE_THREADS -DQT_THREAD_SUPPORT $QT_CXXFLAGS"
+    QT_MT_LDFLAGS="$USE_THREADS"
+    QT_MT_LIBS="$LIBPTHREAD"
   else
-    kde_use_qt_mt=no
+    qt_use_mt=no
   fi
 fi
-AC_SUBST(KDE_MT_LDFLAGS)
-AC_SUBST(KDE_MT_LIBS)
-
-kde_qt_was_given=yes
+AC_SUBST(QT_MT_LDFLAGS)
+AC_SUBST(QT_MT_LIBS)
 
 dnl ------------------------------------------------------------------------
 dnl If we haven't been told how to link to Qt, we work it out for ourselves.
 dnl ------------------------------------------------------------------------
 if test -z "$LIBQT_GLOB"; then
-  if test "x$kde_use_qt_emb" = "xyes"; then
+  if test "x$qt_use_emb" = "xyes"; then
     LIBQT_GLOB="libqte.*"
   else
     LIBQT_GLOB="libqt.*"
@@ -1642,24 +1078,19 @@ if test -z "$LIBQT"; then
 dnl ------------------------------------------------------------
 dnl If we got --enable-embedded then adjust the Qt library name.
 dnl ------------------------------------------------------------
-  if test "x$kde_use_qt_emb" = "xyes"; then
+  if test "x$qt_use_emb" = "xyes"; then
     qtlib="qte"
   else
     qtlib="qt"
   fi
-
-  kde_int_qt="-l$qtlib"
-else
-  kde_int_qt="$LIBQT"
-  kde_lib_qt_set=yes
 fi
 
 if test -z "$LIBQPE"; then
 dnl ------------------------------------------------------------
 dnl If we got --enable-palmtop then add -lqpe to the link line
 dnl ------------------------------------------------------------
-  if test "x$kde_use_qt_emb" = "xyes"; then
-    if test "x$kde_use_qt_emb_palm" = "xyes"; then
+  if test "x$qt_use_emb" = "xyes"; then
+    if test "x$qt_use_emb_palm" = "xyes"; then
       LIB_QPE="-lqpe"
     else
       LIB_QPE=""
@@ -1673,13 +1104,11 @@ dnl ------------------------------------------------------------------------
 dnl If we got --enable-qt-mt then adjust the Qt library name for the host.
 dnl ------------------------------------------------------------------------
 
-if test "x$kde_use_qt_mt" = "xyes"; then
+if test "x$qt_use_mt" = "xyes"; then
   if test -z "$LIBQT"; then
     LIBQT="-l$qtlib-mt"
-    kde_int_qt="-l$qtlib-mt"
   else
     LIBQT="$qtlib-mt"
-    kde_int_qt="$qtlib-mt"
   fi
   LIBQT_GLOB="lib$qtlib-mt.*"
   USING_QT_MT="using -mt"
@@ -1689,9 +1118,9 @@ fi
 
 AC_MSG_CHECKING([for Qt])
 
-if test "x$kde_use_qt_emb" != "xyes"; then
-LIBQT="$LIBQT $X_PRE_LIBS -lXext -lX11 $LIBSM $LIBSOCKET"
-fi
+QT_LIBS="$LIBQT $QT_LIBS"
+test -z "$QT_MT_LIBS" || QT_LIBS="$QT_LIBS $QT_MT_LIBS"
+
 ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO
 qt_libraries=""
 qt_includes=""
@@ -1720,7 +1149,7 @@ AC_CACHE_VAL(ac_cv_have_qt,
 [#try to guess Qt locations
 
 qt_incdirs=""
-for dir in $kde_qt_dirs; do
+for dir in $qt_dirs; do
    qt_incdirs="$qt_incdirs $dir/include $dir"
 done
 qt_incdirs="$QTINC $qt_incdirs /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/X11R6/include/qt2 $x_includes"
@@ -1728,17 +1157,17 @@ if test ! "$ac_qt_includes" = "NO"; then
    qt_incdirs="$ac_qt_includes $qt_incdirs"
 fi
 
-if test "$kde_qtver" != "1"; then
+if test "$qt_ver" != "1"; then
   kde_qt_header=qstyle.h
 else
   kde_qt_header=qglobal.h
 fi
 
-AC_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir)
+QT_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir)
 ac_qt_includes="$qt_incdir"
 
 qt_libdirs=""
-for dir in $kde_qt_dirs; do
+for dir in $qt_dirs; do
    qt_libdirs="$qt_libdirs $dir/lib $dir"
 done
 qt_libdirs="$QTLIB $qt_libdirs /usr/X11R6/lib /usr/lib /usr/local/qt/lib $x_libraries"
@@ -1750,30 +1179,29 @@ else
   qt_libdir=NONE
   for dir in $qt_libdirs; do
     try="ls -1 $dir/${LIBQT_GLOB}"
-    if test -n "`$try 2> /dev/null`"; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
+    if test -n "`$try 2> /dev/null`"; then qt_libdir=$dir; break; else echo "tried $dir" >&AS_MESSAGE_LOG_FD; fi
   done
 fi
 
 ac_qt_libraries="$qt_libdir"
 
-AC_LANG_SAVE
-AC_LANG_CPLUSPLUS
+AC_LANG_PUSH(C++)
 
 ac_cxxflags_safe="$CXXFLAGS"
 ac_ldflags_safe="$LDFLAGS"
 ac_libs_safe="$LIBS"
 
-CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
-LDFLAGS="$LDFLAGS -L$qt_libdir $all_libraries $KDE_MT_LDFLAGS"
-LIBS="$LIBS $LIBQT $KDE_MT_LIBS"
+CXXFLAGS="$CXXFLAGS -I$qt_incdir $QT_CXXFLAGS"
+LDFLAGS="$LDFLAGS -L$qt_libdir $QT_LDFLAGS"
+LIBS="$LIBS $QT_LIBS"
 
-KDE_PRINT_QT_PROGRAM
+QT_PRINT_PROGRAM
 
 if AC_TRY_EVAL(ac_link) && test -s conftest; then
   rm -f conftest*
 else
-  echo "configure: failed program was:" >&AC_FD_CC
-  cat conftest.$ac_ext >&AC_FD_CC
+  echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
+  cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD
   ac_qt_libraries="NO"
 fi
 rm -f conftest*
@@ -1781,7 +1209,7 @@ CXXFLAGS="$ac_cxxflags_safe"
 LDFLAGS="$ac_ldflags_safe"
 LIBS="$ac_libs_safe"
 
-AC_LANG_RESTORE
+AC_LANG_POP(C++)
 if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then
   ac_cv_have_qt="have_qt=no"
   ac_qt_notfound=""
@@ -1793,7 +1221,7 @@ if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then
       ac_qt_notfound="(headers)";
     fi
   else
-    if test "x$kde_use_qt_mt" = "xyes"; then
+    if test "x$qt_use_mt" = "xyes"; then
        missing_qt_mt="
 Make sure that you have compiled Qt with thread support!"
        ac_qt_notfound="(library $qtlib-mt)";
@@ -1802,8 +1230,9 @@ Make sure that you have compiled Qt with thread support!"
     fi
   fi
 
-  AC_MSG_ERROR([Qt ($kde_qt_minversion) $ac_qt_notfound not found. Please check your installation!
-For more details about this problem, look at the end of config.log.$missing_qt_mt])
+  #AC_MSG_ERROR([Qt ($qt_minversion) $ac_qt_notfound not found. Please check your installation!
+  #For more details about this problem, look at the end of config.log.$missing_qt_mt])
+  have_qt="no"
 else
   have_qt="yes"
 fi
@@ -1823,7 +1252,7 @@ else
 fi
 
 if test ! "$kde_qt_libs_given" = "yes"; then
-KDE_CHECK_QT_DIRECT(qt_libraries= ,[])
+QT_CHECK_DIRECT(qt_libraries= ,[])
 fi
 
 AC_SUBST(qt_libraries)
@@ -1833,280 +1262,39 @@ if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then
  QT_INCLUDES=""
 else
  QT_INCLUDES="-I$qt_includes"
- all_includes="$QT_INCLUDES $all_includes"
 fi
 
-if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then
- QT_LDFLAGS=""
-else
- QT_LDFLAGS="-L$qt_libraries"
- all_libraries="$all_libraries $QT_LDFLAGS"
+if test "$qt_libraries" != "$x_libraries" && test -n "$qt_libraries"; then
+ QT_LDFLAGS="$QT_LDFLAGS -L$qt_libraries"
 fi
-test -z "$KDE_MT_LDFLAGS" || all_libraries="$all_libraries $KDE_MT_LDFLAGS"
+test -z "$QT_MT_LDFLAGS" || QT_LDFLAGS="$QT_LDFLAGS $QT_MT_LDFLAGS"
 
 AC_SUBST(QT_INCLUDES)
-AC_SUBST(QT_LDFLAGS)
-AC_PATH_QT_MOC_UIC
+QT_PATH_MOC
 
-if test "x$kde_use_qt_emb" != "xyes"; then
-LIB_QT="$kde_int_qt "'-lXext $(LIB_X11) $(LIBSM)'
-else
-LIB_QT=$kde_int_qt
-fi
-test -z "$KDE_MT_LIBS" || LIB_QT="$LIB_QT $KDE_MT_LIBS"
 
-AC_SUBST(LIB_QT)
 AC_SUBST(LIB_QPE)
-
-AC_SUBST(kde_qtver)
-])
-
-AC_DEFUN(AC_PATH_QT,
-[
-AC_PATH_QT_1_3
 ])
 
-dnl ------------------------------------------------------------------------
-dnl Now, the same with KDE
-dnl $(KDE_LDFLAGS) will be the kdeliblocation (if needed)
-dnl and $(kde_includes) will be the kdehdrlocation (if needed)
-dnl ------------------------------------------------------------------------
-dnl
-AC_DEFUN(AC_BASE_PATH_KDE,
+AC_DEFUN(QT_PATH,
 [
-AC_PREREQ([2.13])
-AC_REQUIRE([AC_PATH_QT])dnl
-AC_CHECK_RPATH
-AC_MSG_CHECKING([for KDE])
-
-if test "${prefix}" != NONE; then
-  kde_includes=${prefix}/include
-  ac_kde_includes=$prefix/include
-
-  if test "${exec_prefix}" != NONE; then
-    kde_libraries=${exec_prefix}/lib
-    ac_kde_libraries=$exec_prefix/lib
-  else
-    kde_libraries=${prefix}/lib
-    ac_kde_libraries=$prefix/lib
-  fi
-else
-  ac_kde_includes=
-  ac_kde_libraries=
-  kde_libraries=""
-  kde_includes=""
-fi
-
-AC_CACHE_VAL(ac_cv_have_kde,
-[#try to guess kde locations
-
-if test "$kde_qtver" = 1; then
-  kde_check_header="ksock.h"
-  kde_check_lib="libkdecore.la"
-else
-  kde_check_header="ksharedptr.h"
-  kde_check_lib="libkio.la"
-fi
-
-if test -z "$1"; then
-
-kde_incdirs="/usr/lib/kde/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /usr/include /opt/kde3/include /opt/kde/include $x_includes $qt_includes"
-test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR/include/kde $KDEDIR $kde_incdirs"
-kde_incdirs="$ac_kde_includes $kde_incdirs"
-AC_FIND_FILE($kde_check_header, $kde_incdirs, kde_incdir)
-ac_kde_includes="$kde_incdir"
-
-if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/$kde_check_header"; then
-  AC_MSG_ERROR([
-in the prefix, you've chosen, are no KDE headers installed. This will fail.
-So, check this please and use another prefix!])
-fi
-
-kde_libdirs="/usr/lib/kde/lib /usr/local/kde/lib /usr/kde/lib /usr/lib/kde /usr/lib/kde3 /usr/lib /usr/X11R6/lib /usr/local/lib /opt/kde3/lib /opt/kde/lib /usr/X11R6/kde/lib"
-test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib $KDEDIR $kde_libdirs"
-kde_libdirs="$ac_kde_libraries $kde_libdirs"
-AC_FIND_FILE($kde_check_lib, $kde_libdirs, kde_libdir)
-ac_kde_libraries="$kde_libdir"
-
-if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/$kde_check_lib"; then
-AC_MSG_ERROR([
-in the prefix, you've chosen, are no KDE libraries installed. This will fail.
-So, check this please and use another prefix!])
-fi
-ac_kde_libraries="$kde_libdir"
-
-if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO; then
-  ac_cv_have_kde="have_kde=no"
-else
-  ac_cv_have_kde="have_kde=yes \
-    ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
-fi
-
-else dnl test -z $1
-
-  ac_cv_have_kde="have_kde=no"
-
-fi
-])dnl
-
-eval "$ac_cv_have_kde"
-
-if test "$have_kde" != "yes"; then
- if test "${prefix}" = NONE; then
-  ac_kde_prefix="$ac_default_prefix"
- else
-  ac_kde_prefix="$prefix"
- fi
- if test "$exec_prefix" = NONE; then
-  ac_kde_exec_prefix="$ac_kde_prefix"
-  AC_MSG_RESULT([will be installed in $ac_kde_prefix])
- else
-  ac_kde_exec_prefix="$exec_prefix"
-  AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix])
- fi
-
- kde_libraries="${ac_kde_exec_prefix}/lib"
- kde_includes=${ac_kde_prefix}/include
-
-else
-  ac_cv_have_kde="have_kde=yes \
-    ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
-  AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes])
-
-  kde_libraries="$ac_kde_libraries"
-  kde_includes="$ac_kde_includes"
-fi
-AC_SUBST(kde_libraries)
-AC_SUBST(kde_includes)
-
-if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes"  || test "$kde_includes" = "/usr/include"; then
- KDE_INCLUDES=""
-else
- KDE_INCLUDES="-I$kde_includes"
- all_includes="$KDE_INCLUDES $all_includes"
-fi
-KDE_LDFLAGS="-L$kde_libraries"
-if test ! "$kde_libraries" = "$x_libraries" && test ! "$kde_libraries" = "$qt_libraries" ; then 
- all_libraries="$all_libraries $KDE_LDFLAGS"
-fi
-
-AC_SUBST(KDE_LDFLAGS)
-AC_SUBST(KDE_INCLUDES)
-
-AC_SUBST(all_includes)
-AC_SUBST(all_libraries)
-
-AC_SUBST(AUTODIRS)
+QT_PATH_1_3
+QT_CHECK_RPATH
 ])
 
 
-AC_DEFUN(KDE_1_CHECK_PATH_HEADERS,
-[
-    AC_MSG_CHECKING([for KDE headers installed])
-    AC_LANG_SAVE
-    AC_LANG_CPLUSPLUS
-cat > conftest.$ac_ext <<EOF
-#ifdef STDC_HEADERS
-# include <stdlib.h>
-#endif
-#include <stdio.h>
-#include "confdefs.h"
-#include <kapp.h>
-
-int main() {
-    printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data());
-    printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data());
-    printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data());
-    printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data());
-    printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data());
-    printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data());
-    printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data());
-    printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data());
-    printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data());
-    printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data());
-    printf("kde_wallpaperdir=\\"%s\\"\n",
-       KApplication::kde_wallpaperdir().data());
-    printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data());
-    printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data());
-    printf("kde_servicesdir=\\"/tmp/dummy\\"\n");
-    printf("kde_servicetypesdir=\\"/tmp/dummy\\"\n");
-    printf("kde_moduledir=\\"/tmp/dummy\\"\n");
-    printf("kde_styledir=\\"/tmp/dummy\\"\n");
-    printf("kde_widgetdir=\\"/tmp/dummy\\"\n");
-    return 0;
-    }
-EOF
-
- ac_compile='${CXX-g++} -c $CXXFLAGS $all_includes $CPPFLAGS conftest.$ac_ext'
- if AC_TRY_EVAL(ac_compile); then
-   AC_MSG_RESULT(yes)
- else
-   AC_MSG_ERROR([your system is not able to compile a small KDE application!
-Check, if you installed the KDE header files correctly.
-For more details about this problem, look at the end of config.log.])
-  fi
-
-  AC_LANG_RESTORE
-])
-
-
-AC_DEFUN(KDE_CREATE_LIBS_ALIASES,
-[
-   AC_REQUIRE([KDE_MISC_TESTS])
-   AC_REQUIRE([K_PATH_X])
-
-if test $kde_qtver != 1; then
-   LIB_KDECORE='-lkdecore'
-   AC_SUBST(LIB_KDECORE)
-   LIB_KDEUI='-lkdeui'
-   AC_SUBST(LIB_KDEUI)
-else
-   LIB_KDECORE='-lkdecore -lXext $(LIB_QT)'
-   AC_SUBST(LIB_KDECORE)
-   LIB_KDEUI='-lkdeui $(LIB_KDECORE)'
-   AC_SUBST(LIB_KDEUI)
-fi
-])
-
-AC_DEFUN(AC_PATH_KDE,
-[
-  AC_BASE_PATH_KDE
-  AC_ARG_ENABLE(path-check, [  --disable-path-check    don't try to find out, where to install],
-  [
-  if test "$enableval" = "no";
-    then ac_use_path_checking="default"
-    else ac_use_path_checking=""
-  fi
-  ],
-  [
-  if test "$kde_qtver" = 1;
-    then ac_use_path_checking=""
-    else ac_use_path_checking="default"
-  fi
-  ]
-  )
-
-  AC_CREATE_KFSSTND($ac_use_path_checking)
-
-  AC_SUBST_KFSSTND
-  KDE_CREATE_LIBS_ALIASES
-])
-
-
-AC_DEFUN(KDE_CHECK_COMPILER_FLAG,
+AC_DEFUN(QT_CHECK_COMPILER_FLAG,
 [
 AC_MSG_CHECKING(whether $CXX supports -$1)
 kde_cache=`echo $1 | sed 'y% .=/+-%____p_%'`
 AC_CACHE_VAL(kde_cv_prog_cxx_$kde_cache,
 [
-  AC_LANG_SAVE
-  AC_LANG_CPLUSPLUS
+  AC_LANG_PUSH(C++)
   save_CXXFLAGS="$CXXFLAGS"
   CXXFLAGS="$CXXFLAGS -$1"
   AC_TRY_LINK([],[ return 0; ], [eval "kde_cv_prog_cxx_$kde_cache=yes"], [])
   CXXFLAGS="$save_CXXFLAGS"
-  AC_LANG_RESTORE
+  AC_LANG_POP(C++)
 ])
 if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then
  AC_MSG_RESULT(yes)
@@ -2119,10 +1307,10 @@ else
 fi
 ])
 
-dnl AC_REMOVE_FORBIDDEN removes forbidden arguments from variables
-dnl use: AC_REMOVE_FORBIDDEN(CC, [-forbid -bad-option whatever])
+dnl QT_REMOVE_FORBIDDEN removes forbidden arguments from variables
+dnl use: QT_REMOVE_FORBIDDEN(CC, [-forbid -bad-option whatever])
 dnl it's all white-space separated
-AC_DEFUN(AC_REMOVE_FORBIDDEN,
+AC_DEFUN(QT_REMOVE_FORBIDDEN,
 [ __val=$$1
   __forbid=" $2 "
   if test -n "$__val"; then
@@ -2142,211 +1330,74 @@ AC_DEFUN(AC_REMOVE_FORBIDDEN,
   fi
 ])
 
-dnl AC_VALIDIFY_CXXFLAGS checks for forbidden flags the user may have given
-AC_DEFUN(AC_VALIDIFY_CXXFLAGS,
+dnl QT_VALIDIFY_CXXFLAGS checks for forbidden flags the user may have given
+AC_DEFUN(QT_VALIDIFY_CXXFLAGS,
 [dnl
-if test "x$kde_use_qt_emb" != "xyes"; then
AC_REMOVE_FORBIDDEN(CXX, [-fno-rtti -rpath])
AC_REMOVE_FORBIDDEN(CXXFLAGS, [-fno-rtti -rpath])
+if test "x$qt_use_emb" != "xyes"; then
QT_REMOVE_FORBIDDEN(CXX, [-fno-rtti -rpath])
QT_REMOVE_FORBIDDEN(CXXFLAGS, [-fno-rtti -rpath])
 else
AC_REMOVE_FORBIDDEN(CXX, [-rpath])
AC_REMOVE_FORBIDDEN(CXXFLAGS, [-rpath])
QT_REMOVE_FORBIDDEN(CXX, [-rpath])
QT_REMOVE_FORBIDDEN(CXXFLAGS, [-rpath])
 fi
 ])
 
-AC_DEFUN(AC_CHECK_COMPILERS,
+AC_DEFUN(QT_CHECK_COMPILERS,
 [
-  AC_ARG_ENABLE(debug,[  --enable-debug[=ARG]    enables debug symbols (yes|no|full) [default=no]],
-  [
-    case $enableval in
-      yes)
-        kde_use_debug_code="yes"
-        kde_use_debug_define=no
-        ;;
-      full)
-        kde_use_debug_code="full"
-        kde_use_debug_define=no
-        ;;
-      *)
-        kde_use_debug_code="no"
-        kde_use_debug_define=yes
-        ;;
-    esac
-  ], 
-    [kde_use_debug_code="no"
-      kde_use_debug_define=no
-  ])
-
-  dnl Just for configure --help
-  AC_ARG_ENABLE(dummyoption,[  --disable-debug         disables debug output and debug symbols [default=no]],[],[])
-
-  AC_ARG_ENABLE(strict,[  --enable-strict         compiles with strict compiler options (may not work!)],
-   [
-    if test $enableval = "no"; then
-         kde_use_strict_options="no"
-       else
-         kde_use_strict_options="yes"
-    fi
-   ], [kde_use_strict_options="no"])
-
-  AC_ARG_ENABLE(profile,[  --enable-profile        creates profiling infos [default=no]],
-    [kde_use_profiling=$enableval],
-    [kde_use_profiling="no"]
-  )
-
-  dnl this prevents stupid AC_PROG_CC to add "-g" to the default CFLAGS
-  CFLAGS=" $CFLAGS"
-
-  AC_PROG_CC 
-
-  AC_PROG_CPP
-
-  if test "$GCC" = "yes"; then
-    if test "$kde_use_debug_code" != "no"; then
-      if test $kde_use_debug_code = "full"; then
-        CFLAGS="-g3 $CFLAGS"
-      else
-        CFLAGS="-g -O2 $CFLAGS"
-      fi
-      case $host in
-        *-*-linux-gnu) 
-          CFLAGS="-ansi -W -Wall -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE=500 -D_BSD_SOURCE $CFLAGS"
-        ;;
-      esac
-    else
-      CFLAGS="-O2 $CFLAGS"
-    fi
-  fi
-
-  if test "$kde_use_debug_define" = "yes"; then
-    CFLAGS="-DNDEBUG $CFLAGS"
-  fi
-
-  case "$host" in
-  *-*-sysv4.2uw*) CFLAGS="-D_UNIXWARE $CFLAGS";;
-  *-*-sysv5uw7*) CFLAGS="-D_UNIXWARE7 $CFLAGS";;
-  esac
-
-  if test -z "$LDFLAGS" && test "$kde_use_debug_code" = "no" && test "$GCC" = "yes"; then
-     LDFLAGS=""
-  fi
-
-  CXXFLAGS=" $CXXFLAGS"
-
   AC_PROG_CXX
 
-  if test "$GXX" = "yes" || test "$CXX" = "KCC"; then
-    if test "$kde_use_debug_code" != "no"; then
-      if test "$CXX" = "KCC"; then
-        CXXFLAGS="+K0 -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings $CXXFLAGS"
-      else
-        if test $kde_use_debug_code = "full"; then
-          CXXFLAGS="-g3 -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings $CXXFLAGS"
-        else
-          CXXFLAGS="-g -O2 -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings $CXXFLAGS"
-        fi
-      fi
-      KDE_CHECK_COMPILER_FLAG(Wno-long-long,[CXXFLAGS="-Wno-long-long $CXXFLAGS"])
-      KDE_CHECK_COMPILER_FLAG(Wnon-virtual-dtor,[CXXFLAGS="-Wnon-virtual-dtor $CXXFLAGS"])
-      KDE_CHECK_COMPILER_FLAG(fno-builtin,[CXXFLAGS="-fno-builtin $CXXFLAGS"])
-
-      case $host in  dnl
-      *-*-linux-gnu)
-        CXXFLAGS="-ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wbad-function-cast -Wcast-align -Wundef -Wconversion $CXXFLAGS"
-        ;;
-      esac
-
-      if test "$kde_use_strict_options" = "yes"; then
-        CXXFLAGS="-Wcast-qual -Wbad-function-cast -Wshadow -Wcast-align $CXXFLAGS"
-      fi
-
-      if test "$kde_very_strict" = "yes"; then
-        CXXFLAGS="-Wold-style-cast -Wredundant-decls -Wconversion $CXXFLAGS"
-      fi
-    else
-      if test "$CXX" = "KCC"; then
-        CXXFLAGS="+K3 $CXXFLAGS"
-      else
-        CXXFLAGS="-O2 $CXXFLAGS"
-      fi  
-    fi
-  fi
-
-  if test "$kde_use_debug_define" = "yes"; then
-    CXXFLAGS="-DNDEBUG -DNO_DEBUG $CXXFLAGS"
-  fi  
-
-  if test "$kde_use_profiling" = "yes"; then
-    KDE_CHECK_COMPILER_FLAG(pg,
-    [
-      CFLAGS="-pg $CFLAGS"
-      CXXFLAGS="-pg $CXXFLAGS"
-    ])
-  fi
-    
-  KDE_CHECK_COMPILER_FLAG(fexceptions,[CXXFLAGS="$CXXFLAGS -fexceptions"])
+  QT_CHECK_COMPILER_FLAG(fexceptions,[QT_CXXFLAGS="$QT_CXXFLAGS -fexceptions"])
 
   case "$host" in
-      *-*-irix*)  test "$GXX" = yes && CXXFLAGS="-D_LANGUAGE_C_PLUS_PLUS -D__LANGUAGE_C_PLUS_PLUS $CXXFLAGS" ;;
-      *-*-sysv4.2uw*) CXXFLAGS="-D_UNIXWARE $CXXFLAGS";;
-      *-*-sysv5uw7*) CXXFLAGS="-D_UNIXWARE7 $CXXFLAGS";;
+      *-*-irix*)  test "$GXX" = yes && QT_CXXFLAGS="-D_LANGUAGE_C_PLUS_PLUS -D__LANGUAGE_C_PLUS_PLUS $QT_CXXFLAGS" ;;
+      *-*-sysv4.2uw*) QT_CXXFLAGS="-D_UNIXWARE $QT_CXXFLAGS";;
+      *-*-sysv5uw7*) QT_CXXFLAGS="-D_UNIXWARE7 $QT_CXXFLAGS";;
       *-*-solaris*) 
         if test "$GXX" = yes; then
           libstdcpp=`$CXX -print-file-name=libstdc++.so`
           if test ! -f $libstdcpp; then
-             AC_MSG_ERROR([You've compiled gcc without --enable-shared. This doesn't work with KDE. Please recompile gcc with --enable-shared to receive a libstdc++.so])
+             AC_MSG_ERROR([You've compiled gcc without --enable-shared. This doesn't work with the Qt pinentry. Please recompile gcc with --enable-shared to receive a libstdc++.so])
           fi
         fi
         ;;
   esac
 
-  AC_VALIDIFY_CXXFLAGS
+  QT_VALIDIFY_CXXFLAGS
 
   AC_PROG_CXXCPP
-
-  ifdef([AM_DEPENDENCIES], AC_REQUIRE([KDE_ADD_DEPENDENCIES]), [])
-
-  KDE_CXXFLAGS=
-  AC_SUBST(KDE_CXXFLAGS)
 ])
 
-AC_DEFUN(KDE_ADD_DEPENDENCIES,
-[
-   [A]M_DEPENDENCIES(CC)
-   [A]M_DEPENDENCIES(CXX)
-])
-
-AC_DEFUN(AC_CHECK_RPATH,
+AC_DEFUN(QT_CHECK_RPATH,
 [
 AC_MSG_CHECKING(for rpath)
 AC_ARG_ENABLE(rpath,
       [  --disable-rpath         do not use the rpath feature of ld],
       USE_RPATH=$enableval, USE_RPATH=yes)
 
-if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then
-
-  KDE_RPATH="-Wl,--rpath -Wl,\$(kde_libraries)"
+if test -z "$QT_RPATH" && test "$USE_RPATH" = "yes"; then
 
+  QT_RPATH=""
   if test -n "$qt_libraries"; then
-    KDE_RPATH="$KDE_RPATH -Wl,--rpath -Wl,\$(qt_libraries)"
+    QT_RPATH="$QT_RPATH -Wl,--rpath -Wl,\$(qt_libraries)"
   fi
   dnl $x_libraries is set to /usr/lib in case
-  if test -n "$X_LDFLAGS"; then
-    KDE_RPATH="$KDE_RPATH -Wl,--rpath -Wl,\$(x_libraries)"
+  if test -n "$X_LIBS"; then
+    QT_RPATH="$QT_RPATH -Wl,--rpath -Wl,\$(x_libraries)"
   fi
 fi
-AC_SUBST(KDE_RPATH)
+AC_SUBST(x_libraries)
+AC_SUBST(QT_RPATH)
 AC_MSG_RESULT($USE_RPATH)
 ])
 
 
-AC_DEFUN(KDE_CHECK_LIBPTHREAD,
+AC_DEFUN(QT_CHECK_LIBPTHREAD,
 [
 AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"] )
 AC_SUBST(LIBPTHREAD)
 ])
 
-AC_DEFUN(KDE_CHECK_PTHREAD_OPTION,
+AC_DEFUN(QT_CHECK_PTHREAD_OPTION,
 [
     AC_ARG_ENABLE(kernel-threads, [  --enable-kernel-threads Enable the use of the LinuxThreads port on FreeBSD/i386 only.],
        kde_use_kernthreads=$enableval, kde_use_kernthreads=no)
@@ -2373,25 +1424,25 @@ AC_DEFUN(KDE_CHECK_PTHREAD_OPTION,
     else 
       USE_THREADS=""
       if test -z "$LIBPTHREAD"; then
-        KDE_CHECK_COMPILER_FLAG(pthread, [USE_THREADS="-pthread"] )
+        QT_CHECK_COMPILER_FLAG(pthread, [USE_THREADS="-pthread"] )
       fi
     fi
 
     case $host_os in
        solaris*)
-               KDE_CHECK_COMPILER_FLAG(mt, [USE_THREADS="-mt"])
-                CXXFLAGS="$CXXFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4"
+               QT_CHECK_COMPILER_FLAG(mt, [USE_THREADS="-mt"])
+                QT_CXXFLAGS="$QT_CXXFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4"
                ;;
         freebsd*)
-                CXXFLAGS="$CXXFLAGS -D_THREAD_SAFE"
+                QT_CXXFLAGS="$QT_CXXFLAGS -D_THREAD_SAFE"
                 ;;
         aix*)
-                CXXFLAGS="$CXXFLAGS -D_THREAD_SAFE"
+                QT_CXXFLAGS="$QT_CXXFLAGS -D_THREAD_SAFE"
                 LIBPTHREAD="$LIBPTHREAD -lc_r"
                 ;;
-        linux*) CXXFLAGS="$CXXFLAGS -D_REENTRANT"
+        linux*) QT_CXXFLAGS="$QT_CXXFLAGS -D_REENTRANT"
                 if test "$CXX" = "KCC"; then
-                  CXXFLAGS="$CXXFLAGS --thread_safe"
+                  QT_CXXFLAGS="$QT_CXXFLAGS --thread_safe"
                 fi
                 ;;
        *)
@@ -2401,10 +1452,10 @@ AC_DEFUN(KDE_CHECK_PTHREAD_OPTION,
     AC_SUBST(LIBPTHREAD)
 ])
 
-AC_DEFUN(KDE_CHECK_THREADING,
+AC_DEFUN(QT_CHECK_THREADING,
 [
-  AC_REQUIRE([KDE_CHECK_LIBPTHREAD])
-  AC_REQUIRE([KDE_CHECK_PTHREAD_OPTION])
+  AC_REQUIRE([QT_CHECK_LIBPTHREAD])
+  AC_REQUIRE([QT_CHECK_PTHREAD_OPTION])
   dnl default is yes if libpthread is found and no if no libpthread is available
   if test -z "$LIBPTHREAD"; then
     if test -z "$USE_THREADS"; then
@@ -2416,19 +1467,8 @@ AC_DEFUN(KDE_CHECK_THREADING,
     kde_check_threading_default=yes
   fi
   AC_ARG_ENABLE(threading, [  --disable-threading     disables threading even if libpthread found ],
-   kde_use_threading=$enableval, kde_use_threading=$kde_check_threading_default)
-  if test "x$kde_use_threading" = "xyes"; then
+   qt_use_threading=$enableval, qt_use_threading=$kde_check_threading_default)
+  if test "x$qt_use_threading" = "xyes"; then
     AC_DEFINE(HAVE_LIBPTHREAD, 1, [Define if you have a working libpthread (will enable threaded code)])
   fi
 ])
-
-AC_DEFUN(KDE_LANG_CPLUSPLUS,
-[AC_LANG_CPLUSPLUS
-ac_link='rm -rf SunWS_cache; ${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC'
-pushdef([AC_LANG_CPLUSPLUS], [popdef([AC_LANG_CPLUSPLUS]) KDE_LANG_CPLUSPLUS])
-])
-
-pushdef([AC_LANG_CPLUSPLUS],
-[popdef([AC_LANG_CPLUSPLUS])
-KDE_LANG_CPLUSPLUS
-])