all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Double slashes in config.h
@ 2005-03-20  5:43 Lőrentey Károly
  2005-03-20 18:01 ` Richard Stallman
  0 siblings, 1 reply; 7+ messages in thread
From: Lőrentey Károly @ 2005-03-20  5:43 UTC (permalink / raw)



[-- Attachment #1.1.1: Type: text/plain, Size: 2003 bytes --]

Hi,

trying to investigate some problems with GTK + multi-tty, I wanted to
compile Emacs with a debuggable GTK version.  I was weary but not
entirely shocked to find out that Emacs failed to pick up the location
of my locally compiled GTK instance.  Here is my pkg-config output for GTK:

$ pkg-config gtk+-2.0 --cflags
-DXTHREADS -I/home/lorentey/work/emacs/install//include/gtk-2.0 \
-I/home/lorentey/work/emacs/install//lib/gtk-2.0/include \
-I/usr/X11R6/include \
-I/home/lorentey/work/emacs/install//include/atk-1.0 \
-I/home/lorentey/work/emacs/install//include/pango-1.0 \
-I/usr/include/freetype2 \
-I/home/lorentey/work/emacs/install//include/cairo \
-I/home/lorentey/work/emacs/install//include -I/usr/include/libpng12 \
-I/home/lorentey/work/emacs/install/include/glib-2.0 \
-I/home/lorentey/work/emacs/install/lib/glib-2.0/include  

Note the double slashes; these are caused by ending a --prefix with a
slash, and are normally harmless.  In this case, however, the paths
are run through cpp, which thinks that the double slashes start
one-line comments.  The result is that pkg-config's carefully
configured include options are harshly truncated in src/Makefile:

ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(TOOLKIT_DEFINES) $(MYCPPFLAGS) -I. -I${srcdir} -D_BSD_SOURCE -I/usr/X11R6/include -DXTHREADS -I/home/lorentey/work/emacs/install ${CFLAGS}

For reference, here are the corresponding lines in src/Makefile.in:

/* C_SWITCH_X_SITE must come before C_SWITCH_X_MACHINE and C_SWITCH_X_SYSTEM
   since it may have -I options that should override those two.  */
ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(TOOLKIT_DEFINES) $(MYCPPFLAGS) -I. -I${srcdir} C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_SITE C_SWITCH_X_SITE C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM C_SWITCH_SYSTEM_TEMACS ${CFLAGS}

Passing the -ansi option to (GNU) cpp disables `//' recognition.  To
prevent other people running into this same problem, I think it would
be useful to apply the following patch:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1.2: Type: text/x-patch, Size: 1411 bytes --]

--- orig/configure.in
+++ mod/configure.in
@@ -3126,6 +3126,14 @@
 	CPP_NEED_TRADITIONAL=no,
 	CPP_NEED_TRADITIONAL=yes)
 
+## New-fangled C preprocessors consider `//' to start a one-line comment.
+## The -ansi option forces GCC's cpp to ignore this syntax.
+
+AC_EGREP_CPP(yes//yes,
+	[yes//yes],
+	CPP_NEED_ANSI=no,
+	CPP_NEED_ANSI=yes)
+
 AC_OUTPUT(Makefile lib-src/Makefile.c:lib-src/Makefile.in oldXMenu/Makefile \
 	man/Makefile lwlib/Makefile src/Makefile.c:src/Makefile.in \
 	lisp/Makefile lispref/Makefile lispintro/Makefile leim/Makefile, [
@@ -3160,6 +3168,13 @@
   CPPFLAGS="$CPPFLAGS -traditional"
 fi
 
+# Recent GNU cpp versions understand C++-style one-line comments
+# unless invoked with -ansi.  (Works with GCC 3.3, 3.4, 4.0)
+
+if test "x$GCC" = xyes && test "x$CPP_NEED_ANSI" = xyes; then
+  CPPFLAGS="$CPPFLAGS -ansi"
+fi
+
 echo creating lib-src/Makefile
 ( cd lib-src
   rm -f junk.c junk1.c junk2.c
@@ -3200,7 +3215,7 @@
 # This is how we know whether to re-run configure in certain cases.
 touch src/config.stamp
 
-], [GCC="$GCC" NON_GNU_CPP="$NON_GNU_CPP" CPP="$CPP" CPP_NEED_TRADITIONAL="$CPP_NEED_TRADITIONAL" CPPFLAGS="$CPPFLAGS"])
+], [GCC="$GCC" NON_GNU_CPP="$NON_GNU_CPP" CPP="$CPP" CPP_NEED_TRADITIONAL="$CPP_NEED_TRADITIONAL" CPP_NEED_ANSI="$CPP_NEED_ANSI" CPPFLAGS="$CPPFLAGS"])
 
 m4_if(dnl	Do not change this comment
    arch-tag: 156a4dd5-bddc-4d18-96ac-f37742cf6a5e



[-- Attachment #1.1.3: Type: text/plain, Size: 73 bytes --]


Running Makefiles through the C preprocessor is evil.

-- 
Károly

[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]

[-- Attachment #2: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-03-22  3:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-20  5:43 Double slashes in config.h Lőrentey Károly
2005-03-20 18:01 ` Richard Stallman
2005-03-20 18:30   ` David Kastrup
2005-03-21 17:08     ` Lőrentey Károly
2005-03-21 17:30     ` Richard Stallman
2005-03-21 17:12   ` Lőrentey Károly
2005-03-22  3:34     ` Richard Stallman

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.