--- pre.l.orig	2011-07-09 11:42:36.000000000 +0200
+++ pre.l	2011-09-21 17:41:40.775729829 +0200
@@ -1250,6 +1250,17 @@
     int oldLineNr        = g_yyLineNr;
     //printf("Searching for `%s'\n",incFileName.data());
 
+    // absIncFileName avoids difficulties for incFileName starting with "../" (bug 641336)
+    QCString absIncFileName = incFileName;
+    {
+      QFileInfo fi(g_yyFileName);
+      if (fi.exists())
+      {
+	absIncFileName = QCString(fi.dirPath(TRUE).data())+"/"+incFileName;
+	//printf( "absIncFileName = %s\n", absIncFileName.data() );
+      }
+    }
+
     // findFile will overwrite g_yyFileDef if found
     FileState *fs;
     bool alreadyIncluded = FALSE;
@@ -1266,8 +1277,8 @@
       {
         // add include dependency to the file in which the #include was found
 	bool ambig;
-	// change to local name for bug 641336 
-        FileDef *incFd = findFileDef(Doxygen::inputNameDict,incFileName,ambig);
+	// change to absolute name for bug 641336 
+        FileDef *incFd = findFileDef(Doxygen::inputNameDict,absIncFileName,ambig);
         oldFileDef->addIncludeDependency(ambig ? 0 : incFd,incFileName,localInclude,g_isImported);
         // add included by dependency
         if (g_yyFileDef)
@@ -1308,9 +1319,9 @@
 	//  //printf("%s + %s -> resolved path %s\n",oldFileDef->getPath().data(),incFileName.data(),absPath.data());
 	//}
 
-	// change to local name for bug 641336 
-	FileDef *fd = findFileDef(Doxygen::inputNameDict,incFileName,ambig);
-	//printf("%s::findFileDef(%s)=%p\n",oldFileDef->name().data(),incFileName.data(),fd);
+	// change to absolute name for bug 641336 
+        FileDef *fd = findFileDef(Doxygen::inputNameDict,absIncFileName,ambig);
+	//printf("%s::findFileDef(%s)=%p\n",oldFileDef->name().data(),absIncFileName.data(),fd);
 	// add include dependency to the file in which the #include was found
 	oldFileDef->addIncludeDependency(ambig ? 0 : fd,incFileName,localInclude,g_isImported);
 	// add included by dependency
