From 68b791fab128b1c34d1a817c8cb886f61654d8d6 Mon Sep 17 00:00:00 2001
From: tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>
Date: Mon, 26 Jul 2010 02:04:25 +0000
Subject: First attempt at getting TQT integrated...

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kde-common@1154613 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
---
 admin/acinclude.m4.in | 34 +++++++++++++++++++++++++++++++++-
 admin/am_edit         | 15 ++++++++-------
 2 files changed, 41 insertions(+), 8 deletions(-)

diff --git a/admin/acinclude.m4.in b/admin/acinclude.m4.in
index 2c44123..f1c8062 100644
--- a/admin/acinclude.m4.in
+++ b/admin/acinclude.m4.in
@@ -251,6 +251,18 @@ configure.
 ])
 ])
 
+AC_DEFUN([KDE_TQTMOC_ERROR_MESSAGE],
+[
+    AC_MSG_ERROR([No Trinity Qt meta object compiler (moc-tqt) found!
+Please check whether you installed the Trinity Qt Interface correctly.
+You need to have a running moc-tqt 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 TQTMOC to the right one before running
+configure.
+])
+])
+
 AC_DEFUN([KDE_UIC_ERROR_MESSAGE],
 [
     AC_MSG_WARN([No Qt ui compiler (uic) found!
@@ -2773,12 +2785,32 @@ AC_LANG_RESTORE
 
 if eval "test ! \"`echo $kde_cv_tqt`\" = no"; then
   AC_MSG_RESULT(no)
-dnl  AC_MSG_ERROR([You are attempting to compile Trinity without the Trinity Qt Interface installed.  Please install libtqtinterface-dev and try again!])
+  AC_MSG_ERROR([You are attempting to compile Trinity without the Trinity Qt Interface installed.  Please install libtqtinterface-dev and try again!])
 else
   AC_MSG_RESULT(yes)
   LIBTQT_LDFLAGS="-ltqt"
   all_libraries="$all_libraries $LIBTQT_LDFLAGS"
   QT_LDFLAGS="$QT_LDFLAGS $LIBTQT_LDFLAGS"
+  LIBTQT_CXXFLAGS="-include tqt.h"
+  all_includes="$all_includes $LIBTQT_CXXFLAGS"
+  QT_INCLUDES="$QT_INCLUDES $LIBTQT_CXXFLAGS"
+
+  KDE_FIND_PATH(moc-tqt, TQTMOC, [$qt_bindirs], [KDE_TQTMOC_ERROR_MESSAGE])
+  AC_SUBST(TQTMOC)
+
+  KDE_FIND_PATH(dcopidl-tqt, TQTDCOPIDL, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl-tqt)])
+  KDE_FIND_PATH(dcopidl2cpp-tqt, TQTDCOPIDL2CPP, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl2cpp-tqt)])
+  if test "$build_arts" '!=' "no"; then
+    KDE_FIND_PATH(mcopidl-tqt, TQTMCOPIDL, [$kde_default_bindirs], [KDE_MISSING_ARTS_ERROR(mcopidl-tqt)])
+  fi
+  if test -n "$kde32ornewer"; then
+    KDE_FIND_PATH(dcopidlng-tqt, TQTDCOPIDLNG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidlng-tqt)])
+  fi
+
+  AC_SUBST(TQTDCOPIDL)
+  AC_SUBST(TQTMCOPIDL)
+  AC_SUBST(TQTDCOPIDLNG)
+  AC_SUBST(TQTDCOPIDL2CPP)
 fi
 
 ])
diff --git a/admin/am_edit b/admin/am_edit
index 2e475de..41dee23 100644
--- a/admin/am_edit
+++ b/admin/am_edit
@@ -820,6 +820,7 @@ sub tag_FINAL()
             $handling .= "\trm -f $program.all_$suffix.files $program.all_$suffix.final; \\\n";
             $handling .= "\techo \"#define KDE_USE_FINAL 1\" >> $program.all_$suffix.final; \\\n";
             $handling .= "\tfor file in " . $sourcelist{$suffix} . "; do \\\n";
+#            $handling .= "\t  tqt-replace \$\(srcdir\)/\$\$file; \\\n";
             $handling .= "\t  echo \"#include \\\"\$\$file\\\"\" >> $program.all_$suffix.files; \\\n";
             $handling .= "\t  test ! -f \$\(srcdir\)/\$\$file || egrep '^#pragma +implementation' \$\(srcdir\)/\$\$file >> $program.all_$suffix.final; \\\n";
             $handling .= "\tdone; \\\n";
@@ -1263,7 +1264,7 @@ sub tag_IDLFILES ()
             if ($allidls !~ /$source\_kidl/) {
                 
                 $use_ng = ($MakefileData =~ /\n$source\_DCOPIDLNG\s*=\s*(\S+)\n/);
-                $dcopidl =  $use_ng ? "KDECONFIG=\"\$(KDECONFIG)\" \$(DCOPIDLNG)" : "\$(DCOPIDL)";
+                $dcopidl =  $use_ng ? "KDECONFIG=\"\$(KDECONFIG)\" \$(TQTDCOPIDLNG) \$(DCOPIDLNG)" : " \$(TQTDCOPIDL) \$(DCOPIDL)";
 
                 $dep_lines .= "$source.kidl: $sourcedir$source.h \$(DCOP_DEPENDENCIES)\n";
                 $dep_lines .= "\t$dcopidl $sourcedir$source.h > $source.kidl || ( rm -f $source.kidl ; false )\n";
@@ -1277,11 +1278,11 @@ sub tag_IDLFILES ()
 
                 if ($skel) {
                     $dep_lines .= "$sourcename.$cxxsuffix: $source.kidl\n";
-                    $dep_lines .= "\t\$(DCOPIDL2CPP) --c++-suffix $cxxsuffix --no-signals --no-stub $source.kidl\n";
+                    $dep_lines .= "\t\$(TQTDCOPIDL2CPP) \$(DCOPIDL2CPP) --c++-suffix $cxxsuffix --no-signals --no-stub $source.kidl\n";
                 } elsif ($stub) {
-                    $dep_lines_tmp = "\t\$(DCOPIDL2CPP) --c++-suffix $cxxsuffix --no-signals --no-skel $source.kidl\n";
+                    $dep_lines_tmp = "\t\$(TQTDCOPIDL2CPP) \$(DCOPIDL2CPP) --c++-suffix $cxxsuffix --no-signals --no-skel $source.kidl\n";
                 } else { # signals - obsolete, remove in KDE 4
-                    $dep_lines_tmp = "\t\$(DCOPIDL2CPP) --c++-suffix $cxxsuffix --no-stub --no-skel $source.kidl\n";
+                    $dep_lines_tmp = "\t\$(TQTDCOPIDL2CPP) \$(DCOPIDL2CPP) --c++-suffix $cxxsuffix --no-stub --no-skel $source.kidl\n";
                 }
 
                 if ($stub || $signals) {
@@ -1380,7 +1381,7 @@ sub tag_UIFILES ()
                     $dep_lines .= "\t\$(UIC) -o $source.h $sourcedir$source.ui\n";
                 }
                 $dep_lines .= "$source.moc: $source.h\n";
-                $dep_lines .= "\t\$(MOC) $source.h -o $source.moc\n";
+                $dep_lines .= "\t\$(TQTMOC) \$(MOC) $source.h $source.moc\n";
 
                 $rule_adds{"$source.$cxxsuffix"} = $dep_lines;
 
@@ -2241,13 +2242,13 @@ sub addMocRules ()
 	  $cppFile =~ s,\.[^.]*$,,;
 	  $target_adds{"$cppFile.o"} .= "$mocFile.moc ";
 	  $target_adds{"$cppFile.lo"} .= "$mocFile.moc ";
-	  appendLines ("$mocFile.moc: $dir/$hFile\n\t\$(MOC) $dir/$hFile -o $mocFile.moc\n");
+	  appendLines ("$mocFile.moc: $dir/$hFile\n\t\$(TQTMOC) \$(MOC) $dir/$hFile $mocFile.moc\n");
 	  $cleanMoc .= " $mocFile.moc";
 	  appendLines ("mocs: $mocFile.moc\n");
         }
         else
         {
-            appendLines ("$mocFile$mocExt: $dir/$hFile\n\t\$(MOC) $dir/$hFile -o $mocFile$mocExt\n");
+            appendLines ("$mocFile$mocExt: $dir/$hFile\n\t\$(TQTMOC) \$(MOC) $dir/$hFile $mocFile$mocExt\n");
             $cleanMoc .= " $mocFile$mocExt";
 	    appendLines ("mocs: $mocFile$mocExt\n");
         }
-- 
cgit v1.2.3

