Compiling from another directory



Hello!

Latest Gtk+ from the CVS repository doesn't compile from another
directory. For most programs using autoconf/automake it is possible to
create an empty directory, say "gtk1", and run
../gtk+/configure; make; make install
from it. This separates different builds, eventually made with different
options and even compilers.
It doesn't work for gtk+ in the moment. Reasons are:

1) += in Makefile.am works differently in new (not yet released) automake.
This has been corrected by Jeff Garzik for glib, but not for gtk+
2) Many source files include config.h in a non-standard way. It is
recommended to include config.h in brackets and do it before other
includes. In this case automake provides that this file will be found.

Attached patch fixes both problems and makes it possible (at least for me)
to compile gtk+ from another directory.
Actually, all sources should begin with
#include <config.h>
I don't want to do it now. I know a example when a program stopped working
after that because code between "#ifdef HAVE_MMAP" and "#endif" has never
been tested. It would be better to do it on file-by-file basis IMHO.

Pavel Roskin
Index: gtk/Makefile.am
===================================================================
RCS file: /debian/home/gnomecvs/gtk+/gtk/Makefile.am,v
retrieving revision 1.61
diff -u -r1.61 Makefile.am
--- Makefile.am	1998/11/17 09:59:25	1.61
+++ Makefile.am	1998/11/18 13:48:30
@@ -1,7 +1,6 @@
 ### Process this file with automake to produce Makefile.in
 
 gtkincludedir = $(includedir)/gtk
-DEFS += -DG_LOG_DOMAIN=\"Gtk\"
 
 lib_LTLIBRARIES = libgtk.la
 
@@ -336,7 +335,7 @@
 INCLUDES = \
 	-DGTK_EXE_PREFIX=\"$(exec_prefix)\"   \
 	-DGTK_DATA_PREFIX=\"$(prefix)\"   \
-	-I$(top_srcdir) @GLIB_CFLAGS@ @x_cflags@
+	-I$(top_srcdir) -DG_LOG_DOMAIN=\"Gtk\" @GLIB_CFLAGS@ @x_cflags@
 
 noinst_PROGRAMS = testgtk testinput testselection testthreads testrgb testdnd simple 
 
Index: gtk/fnmatch.c
===================================================================
RCS file: /debian/home/gnomecvs/gtk+/gtk/fnmatch.c,v
retrieving revision 1.5
diff -u -r1.5 fnmatch.c
--- fnmatch.c	1998/04/13 01:59:11	1.5
+++ fnmatch.c	1998/11/18 13:48:31
@@ -17,7 +17,7 @@
  */
 
 #ifdef HAVE_CONFIG_H
-#include "../config.h"
+#include <config.h>
 #endif
 
 #include <errno.h>
Index: gtk/gtkclist.c
===================================================================
RCS file: /debian/home/gnomecvs/gtk+/gtk/gtkclist.c,v
retrieving revision 1.109
diff -u -r1.109 gtkclist.c
--- gtkclist.c	1998/11/11 20:46:47	1.109
+++ gtkclist.c	1998/11/18 13:48:32
@@ -17,9 +17,9 @@
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
  */
+#include <config.h>
 #include <stdlib.h>
 #include <string.h>
-#include "../config.h"
 #include "gtkmain.h"
 #include "gtkclist.h"
 #include "gtkbindings.h"
Index: gtk/gtkmain.c
===================================================================
RCS file: /debian/home/gnomecvs/gtk+/gtk/gtkmain.c,v
retrieving revision 1.86
diff -u -r1.86 gtkmain.c
--- gtkmain.c	1998/11/13 21:28:34	1.86
+++ gtkmain.c	1998/11/18 13:48:33
@@ -16,6 +16,7 @@
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
  */
+#include <config.h>
 #include <X11/Xlocale.h>	/* so we get the right setlocale */
 #include <stdio.h>
 #include <stdlib.h>
@@ -39,7 +40,6 @@
 #include "gtkwindow.h"
 #include "gtkprivate.h"
 #include "gdk/gdki18n.h"
-#include "../config.h"
 #include "gtkdebug.h"
 
 
Index: gtk/gtkthemes.c
===================================================================
RCS file: /debian/home/gnomecvs/gtk+/gtk/gtkthemes.c,v
retrieving revision 1.2
diff -u -r1.2 gtkthemes.c
--- gtkthemes.c	1998/11/06 22:04:43	1.2
+++ gtkthemes.c	1998/11/18 13:48:33
@@ -17,6 +17,7 @@
  * License along with this library; if not, write to the Free
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
+#include <config.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <gmodule.h>
@@ -27,7 +28,6 @@
 #include "gtksignal.h"
 #include "gtkwidget.h"
 #include "gtkprivate.h"
-#include "config.h"
 
 typedef struct _GtkThemeEnginePrivate GtkThemeEnginePrivate;
 
Index: gtk/testthreads.c
===================================================================
RCS file: /debian/home/gnomecvs/gtk+/gtk/testthreads.c,v
retrieving revision 1.4
diff -u -r1.4 testthreads.c
--- testthreads.c	1998/09/09 09:51:44	1.4
+++ testthreads.c	1998/11/18 13:48:33
@@ -16,10 +16,10 @@
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
  */
+#include <config.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <gtk/gtk.h>
-#include "../config.h"
 
 #ifdef USE_PTHREADS
 #include <pthread.h>
Index: gdk/Makefile.am
===================================================================
RCS file: /debian/home/gnomecvs/gtk+/gdk/Makefile.am,v
retrieving revision 1.21
diff -u -r1.21 Makefile.am
--- Makefile.am	1998/11/06 22:03:20	1.21
+++ Makefile.am	1998/11/18 13:48:33
@@ -3,7 +3,6 @@
 gdkincludedir = $(includedir)/gdk
 
 lib_LTLIBRARIES = libgdk.la
-DEFS += -DG_LOG_DOMAIN=\"Gdk\"
 
 libgdk_la_SOURCES = \
 	gdk.c		\
@@ -54,7 +53,7 @@
 	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE) \
          @x_ldflags@ @x_libs@
 
-INCLUDES = -I$(top_srcdir) @GLIB_CFLAGS@ @x_cflags@ 
+INCLUDES = -I$(top_srcdir) -DG_LOG_DOMAIN=\"Gdk\" @GLIB_CFLAGS@ @x_cflags@ 
 
 EXTRA_PROGRAMS = gxid
 
Index: gdk/gdk.c
===================================================================
RCS file: /debian/home/gnomecvs/gtk+/gdk/gdk.c,v
retrieving revision 1.93
diff -u -r1.93 gdk.c
--- gdk.c	1998/11/06 22:03:21	1.93
+++ gdk.c	1998/11/18 13:48:34
@@ -16,7 +16,7 @@
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
  */
-#include "../config.h"
+#include <config.h>
 
 /* If you don't want to use gdk's signal handlers define this */
 /* #define I_NEED_TO_ACTUALLY_DEBUG_MY_PROGRAMS 1 */
Index: gdk/gdkglobals.c
===================================================================
RCS file: /debian/home/gnomecvs/gtk+/gdk/gdkglobals.c,v
retrieving revision 1.13
diff -u -r1.13 gdkglobals.c
--- gdkglobals.c	1998/09/25 23:04:30	1.13
+++ gdkglobals.c	1998/11/18 13:48:34
@@ -16,11 +16,11 @@
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
  */
+#include <config.h>
 #include <stdio.h>
 #include <X11/Xlib.h>
 #include "gdktypes.h"
 #include "gdkprivate.h"
-#include "../config.h"
 
 guint             gdk_debug_flags = 0;
 gint              gdk_use_xshm = TRUE;
Index: gdk/gdkimage.c
===================================================================
RCS file: /debian/home/gnomecvs/gtk+/gdk/gdkimage.c,v
retrieving revision 1.9
diff -u -r1.9 gdkimage.c
--- gdkimage.c	1998/11/06 22:03:27	1.9
+++ gdkimage.c	1998/11/18 13:48:34
@@ -16,7 +16,7 @@
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
  */
-#include "../config.h"
+#include <config.h>
 
 #include <stdlib.h>
 #include <sys/types.h>
Index: gdk/gdkinput.c
===================================================================
RCS file: /debian/home/gnomecvs/gtk+/gdk/gdkinput.c,v
retrieving revision 1.6
diff -u -r1.6 gdkinput.c
--- gdkinput.c	1998/07/04 15:29:57	1.6
+++ gdkinput.c	1998/11/18 13:48:34
@@ -16,10 +16,10 @@
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
  */
+#include <config.h>
 #include <stdlib.h>
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
-#include "../config.h"
 #include "gdk.h"
 #include "gdkx.h"
 #include "gdkprivate.h"
Index: gdk/gdkpixmap.c
===================================================================
RCS file: /debian/home/gnomecvs/gtk+/gdk/gdkpixmap.c,v
retrieving revision 1.21
diff -u -r1.21 gdkpixmap.c
--- gdkpixmap.c	1998/11/13 21:28:29	1.21
+++ gdkpixmap.c	1998/11/18 13:48:34
@@ -16,7 +16,7 @@
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
  */
-#include "../config.h"
+#include <config.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
Index: gdk/gdkrgb.c
===================================================================
RCS file: /debian/home/gnomecvs/gtk+/gdk/gdkrgb.c,v
retrieving revision 1.19
diff -u -r1.19 gdkrgb.c
--- gdkrgb.c	1998/11/06 22:03:31	1.19
+++ gdkrgb.c	1998/11/18 13:48:36
@@ -22,6 +22,7 @@
    Raph Levien <raph@acm.org>
    */
 
+#include <config.h>
 #include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -32,13 +33,11 @@
 
 /* Compiling as a standalone module (i.e. with Gtk 1.0) */
 /* gtk/gtk.h is already included in gdkrgbstub.c */
-#include "config.h"
 #include <gdk/gdkprivate.h>
 
 #else
 
 /* Compiling as a part of Gtk 1.1 or later */
-#include "../config.h"
 #include "gdk.h"
 #include "gdkprivate.h"
 
Index: gdk/gdkthreads.c
===================================================================
RCS file: /debian/home/gnomecvs/gtk+/gdk/gdkthreads.c,v
retrieving revision 1.2
diff -u -r1.2 gdkthreads.c
--- gdkthreads.c	1998/07/22 22:22:05	1.2
+++ gdkthreads.c	1998/11/18 13:48:36
@@ -16,7 +16,7 @@
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
  */
-#include "../config.h"
+#include <config.h>
 #include "gdk.h"
 #include "gdkprivate.h"
 
Index: gdk/gdkwindow.c
===================================================================
RCS file: /debian/home/gnomecvs/gtk+/gdk/gdkwindow.c,v
retrieving revision 1.60
diff -u -r1.60 gdkwindow.c
--- gdkwindow.c	1998/11/18 03:15:13	1.60
+++ gdkwindow.c	1998/11/18 13:48:37
@@ -17,12 +17,12 @@
  * Boston, MA 02111-1307, USA.
  */
 
+#include <config.h>
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 #include <X11/Xatom.h>
 #include <netinet/in.h>
 #include "gdk.h"
-#include "../config.h"
 #include "gdkinput.h"
 #include "gdkprivate.h"
 #include "MwmUtil.h"
Index: gdk/gxid_lib.c
===================================================================
RCS file: /debian/home/gnomecvs/gtk+/gdk/gxid_lib.c,v
retrieving revision 1.2
diff -u -r1.2 gxid_lib.c
--- gxid_lib.c	1997/12/18 02:16:59	1.2
+++ gxid_lib.c	1998/11/18 13:48:37
@@ -4,7 +4,7 @@
  * Copyright 1997 Owen Taylor <owt1@cornell.edu>
 */
 
-#include "../config.h"
+#include <config.h>
 #include "gxid_lib.h"
 
 #ifdef XINPUT_GXI


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]