public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* How to patch fixincludes/Makefile for Interix?
@ 2011-06-03 17:01 Douglas B Rupp
  2011-06-03 17:17 ` Bruce Korb
  0 siblings, 1 reply; 8+ messages in thread
From: Douglas B Rupp @ 2011-06-03 17:01 UTC (permalink / raw)
  To: gcc-patches, bkorb


I've been working on a resurrection patch for Interix, one remaining 
problem is fixincludes/fixincl.c must be compiled on native Interix with 
-D_ALL_SOURCE in order to find the getpagesize prototype.

This works (taking some liberties with diff...):

fixincludes/Makefile.in
-FIXINC_CFLAGS = -DHAVE_CONFIG_H $(INCLUDES)
+FIXINC_CFLAGS = -DHAVE_CONFIG_H $(INCLUDES) -D_ALL_SOURCE

Obviously unacceptable in general.
Fixincludes ignores a config/mh-interix, so adding
FIXINC_CFLAGS += -D_ALL_SOURCE doesn't work.

What is the correct solution? Any advice would be greatly appreciated.

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

* Re: How to patch fixincludes/Makefile for Interix?
  2011-06-03 17:01 How to patch fixincludes/Makefile for Interix? Douglas B Rupp
@ 2011-06-03 17:17 ` Bruce Korb
  2011-06-04 20:43   ` [PATCH] fixincludes/Makefile for Interix Douglas B Rupp
  0 siblings, 1 reply; 8+ messages in thread
From: Bruce Korb @ 2011-06-03 17:17 UTC (permalink / raw)
  To: Douglas B Rupp; +Cc: gcc-patches

Hi Doug,

On Fri, Jun 3, 2011 at 10:00 AM, Douglas B Rupp <rupp@gnat.com> wrote:
>
> I've been working on a resurrection patch for Interix, one remaining problem
> is fixincludes/fixincl.c must be compiled on native Interix with
> -D_ALL_SOURCE in order to find the getpagesize prototype.
>
> This works (taking some liberties with diff...):
>
> fixincludes/Makefile.in
> -FIXINC_CFLAGS = -DHAVE_CONFIG_H $(INCLUDES)
> +FIXINC_CFLAGS = -DHAVE_CONFIG_H $(INCLUDES) -D_ALL_SOURCE
>
> Obviously unacceptable in general.

Obviously.

> Fixincludes ignores a config/mh-interix, so adding
> FIXINC_CFLAGS += -D_ALL_SOURCE doesn't work.
>
> What is the correct solution? Any advice would be greatly appreciated.

Without digging into makefile magic, it would seem to me that
you'd want to jigger Makefile.in to source $(top_srcdir)/config/mh-$(target)
and use FIXINC_CPPFLAGS (this being a pre-processor flag).

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

* [PATCH] fixincludes/Makefile for Interix
  2011-06-03 17:17 ` Bruce Korb
@ 2011-06-04 20:43   ` Douglas B Rupp
  2011-06-05 17:19     ` Bruce Korb
  0 siblings, 1 reply; 8+ messages in thread
From: Douglas B Rupp @ 2011-06-04 20:43 UTC (permalink / raw)
  To: Bruce Korb; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 163 bytes --]

Here's my proposed patch, along the lines you suggested. top_srcdir 
didn't seem to be set, so I used srcdir instead.

Bootstrapped on x86_64-unknown-linux-gnu




[-- Attachment #2: fixinc.txt --]
[-- Type: text/plain, Size: 1968 bytes --]

2011-06-04  Douglas B Rupp  <rupp@gnat.com>

	* fixincludes/configure.ac (host_makefile_frag): Use mh-interix.
	* fixincludes/configure: Regenerate
	* fixincludes/Makefile.in (FIXINC_CPPFLAGS): New flag macro.
	(@host_makefile_frag@): New substitution placeholder.
	(.c.o): Use FIXINC_CPPFLAGS.

diff -rupN gcc.orig/fixincludes/configure.ac gcc/fixincludes/configure.ac
--- gcc.orig/fixincludes/configure.ac	2011-04-06 17:01:09.000000000 -0700
+++ gcc/fixincludes/configure.ac	2011-06-04 13:18:23.000000000 -0700
@@ -23,6 +23,20 @@ ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual]
 # Determine the noncanonical target name, for directory use.
 ACX_NONCANONICAL_TARGET
 
+host_makefile_frag=/dev/null
+if test -d ${srcdir}/../config ; then
+case "${host}" in
+  *-interix[[3-9]]*)
+    host_makefile_frag="config/mh-interix"
+    ;;
+esac
+fi
+
+if test $host_makefile_frag != /dev/null; then
+  eval host_makefile_frag=${srcdir}/../$host_makefile_frag
+fi
+AC_SUBST_FILE(host_makefile_frag)
+
 # Specify the local prefix
 local_prefix=
 AC_ARG_WITH(local-prefix,
diff -rupN gcc.orig/fixincludes/Makefile.in gcc/fixincludes/Makefile.in
--- gcc.orig/fixincludes/Makefile.in	2011-04-06 17:01:09.000000000 -0700
+++ gcc/fixincludes/Makefile.in	2011-06-04 00:31:30.000000000 -0700
@@ -32,6 +32,11 @@ WARN_CFLAGS = @WARN_CFLAGS@ @WARN_PEDANT
 LDFLAGS = @LDFLAGS@
 INCLUDES = -I. -I$(srcdir) -I../include -I$(srcdir)/../include
 FIXINC_CFLAGS = -DHAVE_CONFIG_H $(INCLUDES)
+FIXINC_CPPFLAGS =
+
+#### host specific makefile fragments come in here.
+@host_makefile_frag@
+###
 
 # Directory where sources are, from where we are.
 srcdir = @srcdir@
@@ -73,7 +78,7 @@ default : all
 # Now figure out from those variables how to compile and link.
 
 .c.o:
-	$(CC) -c $(CFLAGS) $(WARN_CFLAGS) $(CPPFLAGS) $(FIXINC_CFLAGS) $<
+	$(CC) -c $(CFLAGS) $(WARN_CFLAGS) $(CPPFLAGS) $(FIXINC_CPPFLAGS) $(FIXINC_CFLAGS) $<
 
 # The only suffixes we want for implicit rules are .c and .o.
 .SUFFIXES:

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

* Re: [PATCH] fixincludes/Makefile for Interix
  2011-06-04 20:43   ` [PATCH] fixincludes/Makefile for Interix Douglas B Rupp
@ 2011-06-05 17:19     ` Bruce Korb
  2011-06-07  4:37       ` [PATCH] fixincludes/Makefile for Interix Rev 2 Douglas B Rupp
  0 siblings, 1 reply; 8+ messages in thread
From: Bruce Korb @ 2011-06-05 17:19 UTC (permalink / raw)
  To: Douglas B Rupp; +Cc: gcc-patches

On 06/04/11 13:43, Douglas B Rupp wrote:
> Here's my proposed patch, along the lines you suggested.

Hi Doug,

Excellent.  Just a couple nits:

It is more normal and easier to read when you quote the entire shell
script fragment, as below (removing unnecessary "eval", too):

> diff -rupN gcc.orig/fixincludes/configure.ac gcc/fixincludes/configure.ac
> --- gcc.orig/fixincludes/configure.ac	2011-04-06 17:01:09.000000000 -0700
> +++ gcc/fixincludes/configure.ac	2011-06-04 13:18:23.000000000 -0700
> @@ -23,6 +23,20 @@ ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual]
>  # Determine the noncanonical target name, for directory use.
>  ACX_NONCANONICAL_TARGET
>
> +[host_makefile_frag=/dev/null
> +if test -d ${srcdir}/../config ; then
> +case "${host}" in
> +  *-interix[3-9]*)
> +    host_makefile_frag="${srcdir}/../config/mh-interix"
> +    ;;
> +esac
> +fi]
> +AC_SUBST_FILE(host_makefile_frag)
> +
>  # Specify the local prefix
>  local_prefix=
>  AC_ARG_WITH(local-prefix,

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

* [PATCH] fixincludes/Makefile for Interix Rev 2
  2011-06-05 17:19     ` Bruce Korb
@ 2011-06-07  4:37       ` Douglas B Rupp
  2011-06-07  7:20         ` Paolo Bonzini
  0 siblings, 1 reply; 8+ messages in thread
From: Douglas B Rupp @ 2011-06-07  4:37 UTC (permalink / raw)
  To: bkorb; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 70 bytes --]

Revised and retested patch attached.

OK to commit?

--Douglas Rupp



[-- Attachment #2: fixinc.txt --]
[-- Type: text/plain, Size: 2031 bytes --]

2011-06-06  Douglas B Rupp  <rupp@gnat.com>

	* fixincludes/configure.ac (host_makefile_frag): Use mh-interix.
	* fixincludes/configure: Regenerate
	* fixincludes/Makefile.in (FIXINC_CPPFLAGS): New flag macro.
	(@host_makefile_frag@): New substitution placeholder.
	(.c.o): Use FIXINC_CPPFLAGS.

diff -rupN gcc.orig/fixincludes/configure.ac gcc/fixincludes/configure.ac
--- gcc.orig/fixincludes/configure.ac	2011-04-06 17:01:09.000000000 -0700
+++ gcc/fixincludes/configure.ac	2011-06-06 21:31:54.000000000 -0700
@@ -23,6 +23,16 @@
 # Determine the noncanonical target name, for directory use.
 ACX_NONCANONICAL_TARGET
 
+[host_makefile_frag=/dev/null
+if test -d ${srcdir}/../config ; then
+case "${host}" in
+  *-interix[3-9]*)
+    host_makefile_frag="${srcdir}/../config/mh-interix"
+    ;;
+esac
+fi]
+AC_SUBST_FILE(host_makefile_frag)
+
 # Specify the local prefix
 local_prefix=
 AC_ARG_WITH(local-prefix,
diff -rupN gcc.orig/fixincludes/Makefile.in gcc/fixincludes/Makefile.in
--- gcc.orig/fixincludes/Makefile.in	2011-04-06 17:01:09.000000000 -0700
+++ gcc/fixincludes/Makefile.in	2011-06-06 21:31:54.000000000 -0700
@@ -1,6 +1,6 @@
 # Makefile for fixincludes.
 #
-#   Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2009, 2010
+#   Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2009, 2010, 2011
 #   Free Software Foundation, Inc.
 
 #This file is part of fixincludes.
@@ -32,6 +32,11 @@
 LDFLAGS = @LDFLAGS@
 INCLUDES = -I. -I$(srcdir) -I../include -I$(srcdir)/../include
 FIXINC_CFLAGS = -DHAVE_CONFIG_H $(INCLUDES)
+FIXINC_CPPFLAGS =
+
+#### host specific makefile fragments come in here.
+@host_makefile_frag@
+###
 
 # Directory where sources are, from where we are.
 srcdir = @srcdir@
@@ -73,7 +78,7 @@
 # Now figure out from those variables how to compile and link.
 
 .c.o:
-	$(CC) -c $(CFLAGS) $(WARN_CFLAGS) $(CPPFLAGS) $(FIXINC_CFLAGS) $<
+	$(CC) -c $(CFLAGS) $(WARN_CFLAGS) $(CPPFLAGS) $(FIXINC_CPPFLAGS) $(FIXINC_CFLAGS) $<
 
 # The only suffixes we want for implicit rules are .c and .o.
 .SUFFIXES:

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

* Re: [PATCH] fixincludes/Makefile for Interix Rev 2
  2011-06-07  4:37       ` [PATCH] fixincludes/Makefile for Interix Rev 2 Douglas B Rupp
@ 2011-06-07  7:20         ` Paolo Bonzini
  2011-06-08  6:29           ` [PATCH] fixincludes/Makefile for Interix Rev 3 Douglas B Rupp
  0 siblings, 1 reply; 8+ messages in thread
From: Paolo Bonzini @ 2011-06-07  7:20 UTC (permalink / raw)
  To: Douglas B Rupp; +Cc: bkorb, gcc-patches

On 06/07/2011 06:37 AM, Douglas B Rupp wrote:
> Revised and retested patch attached.
>
> OK to commit?

It should be enough to add AC_USE_SYSTEM_EXTENSIONS to configure.ac 
instead (right after AC_PROG_CC).

Paolo

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

* [PATCH] fixincludes/Makefile for Interix Rev 3
  2011-06-07  7:20         ` Paolo Bonzini
@ 2011-06-08  6:29           ` Douglas B Rupp
  2011-06-08  7:47             ` Paolo Bonzini
  0 siblings, 1 reply; 8+ messages in thread
From: Douglas B Rupp @ 2011-06-08  6:29 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Bruce Korb, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 84 bytes --]

Reformulated as per your suggestion, and retested.

OK to commit?

--Douglas Rupp



[-- Attachment #2: fixinc.txt --]
[-- Type: text/plain, Size: 498 bytes --]

2011-06-07  Douglas B Rupp  <rupp@gnat.com>

	* fixincludes/configure.ac (AC_USE_SYSTEM_EXTENSIONS): Add.
	* fixincludes/configure: Regenerate.
	* fixincludes/config.h.in: Regenerate.

--- gcc.orig/fixincludes/configure.ac	2011-04-06 17:01:09.000000000 -0700
+++ gcc/fixincludes/configure.ac	2011-06-07 22:40:23.000000000 -0700
@@ -6,6 +6,7 @@
 m4_sinclude(../libtool.m4)
 AC_CANONICAL_SYSTEM
 AC_PROG_CC
+AC_USE_SYSTEM_EXTENSIONS
 AC_PROG_SED
 
 # Figure out what compiler warnings we can enable.

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

* Re: [PATCH] fixincludes/Makefile for Interix Rev 3
  2011-06-08  6:29           ` [PATCH] fixincludes/Makefile for Interix Rev 3 Douglas B Rupp
@ 2011-06-08  7:47             ` Paolo Bonzini
  0 siblings, 0 replies; 8+ messages in thread
From: Paolo Bonzini @ 2011-06-08  7:47 UTC (permalink / raw)
  To: Douglas B Rupp; +Cc: Bruce Korb, gcc-patches

On 06/08/2011 08:02 AM, Douglas B Rupp wrote:
> Reformulated as per your suggestion, and retested.
>
> OK to commit?

Yes, thanks!

Paolo

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

end of thread, other threads:[~2011-06-08  6:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-03 17:01 How to patch fixincludes/Makefile for Interix? Douglas B Rupp
2011-06-03 17:17 ` Bruce Korb
2011-06-04 20:43   ` [PATCH] fixincludes/Makefile for Interix Douglas B Rupp
2011-06-05 17:19     ` Bruce Korb
2011-06-07  4:37       ` [PATCH] fixincludes/Makefile for Interix Rev 2 Douglas B Rupp
2011-06-07  7:20         ` Paolo Bonzini
2011-06-08  6:29           ` [PATCH] fixincludes/Makefile for Interix Rev 3 Douglas B Rupp
2011-06-08  7:47             ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).