unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* _GNU_SOURCE redundant define
@ 2008-08-13 17:03 Greg Troxel
  2008-08-13 21:30 ` Ludovic Courtès
  2008-08-15 13:32 ` Greg Troxel
  0 siblings, 2 replies; 8+ messages in thread
From: Greg Troxel @ 2008-08-13 17:03 UTC (permalink / raw)
  To: guile-devel

On NetBSD-current/amd64, the branch_release-1-8 branch fails to build.
_GNU_SOURCE is defined in config.h, and also in two files.  With the
following change, it builds and 'gmake check' succeeds.

I'm not sure why _GNU_SOURCE is there; it seems guile should be mostly
relying on POSIX-specified things.  Clearly it at least mostly is, or it
wouldn't build on NetBSD, which doesn't use GNU libc.

diff --git a/libguile/posix.c b/libguile/posix.c
index e803f9f..c4570af 100644
--- a/libguile/posix.c
+++ b/libguile/posix.c
@@ -21,9 +21,6 @@
 #  include <config.h>
 #endif
 
-/* Make GNU/Linux libc declare everything it has. */
-#define _GNU_SOURCE
-
 #include <stdio.h>
 #include <errno.h>
 
diff --git a/libguile/srfi-14.c b/libguile/srfi-14.c
index f61db7d..69e7798 100644
--- a/libguile/srfi-14.c
+++ b/libguile/srfi-14.c
@@ -21,9 +21,6 @@
 #  include <config.h>
 #endif
 
-
-#define _GNU_SOURCE  /* Ask for `isblank ()'.  */
-
 #include <string.h>
 #include <ctype.h>


failing log at:

http://autobuild.josefsson.org/guile/log-200808131846090405000.txt

(thanks to ludo for help setting up for autobuilding)






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

* Re: _GNU_SOURCE redundant define
  2008-08-13 17:03 _GNU_SOURCE redundant define Greg Troxel
@ 2008-08-13 21:30 ` Ludovic Courtès
  2008-08-13 22:39   ` Greg Troxel
  2008-08-15 13:32 ` Greg Troxel
  1 sibling, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2008-08-13 21:30 UTC (permalink / raw)
  To: guile-devel

Hi,

Greg Troxel <gdt@ir.bbn.com> writes:

> On NetBSD-current/amd64, the branch_release-1-8 branch fails to build.
> _GNU_SOURCE is defined in config.h, and also in two files.  With the
> following change, it builds and 'gmake check' succeeds.

Correct me if I'm wrong, but I suspect that is because you had
autoreconf'd and configured `master', which created a `config.h{,.in}'
that defines `_GNU_SOURCE', and then switched to `branch_release-1-8',
which did not recreate `config.h.in'.

The fix is to make sure to run "make distclean" before running
"autoreconf && configure && make".

And thanks for the NetBSD autobuild!

Hope this helps,
Ludo'.





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

* Re: _GNU_SOURCE redundant define
  2008-08-13 21:30 ` Ludovic Courtès
@ 2008-08-13 22:39   ` Greg Troxel
  2008-08-14  7:54     ` Ludovic Courtès
  0 siblings, 1 reply; 8+ messages in thread
From: Greg Troxel @ 2008-08-13 22:39 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel

  > On NetBSD-current/amd64, the branch_release-1-8 branch fails to build.
  > _GNU_SOURCE is defined in config.h, and also in two files.  With the
  > following change, it builds and 'gmake check' succeeds.

  Correct me if I'm wrong, but I suspect that is because you had
  autoreconf'd and configured `master', which created a `config.h{,.in}'
  that defines `_GNU_SOURCE', and then switched to `branch_release-1-8',
  which did not recreate `config.h.in'.

  The fix is to make sure to run "make distclean" before running
  "autoreconf && configure && make".

I don't think so, but it's possible but I'll look at config.log.  I am
running a script to do the build, derived from yours.  But I see
distclean doesn't remove configure.

Are you saying that autoreconf won't recreate config.h.in from
configure.in after a branch switch?  Is that because git has old
timestamps on newly-changed files?

I have rm'd config.h and am starting a new build.

  And thanks for the NetBSD autobuild!

You're welcome - I'm glad to see people concerned about how guile works
on BSD, and my copious spare time levels are low, but this seemed high
leverage.




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

* Re: _GNU_SOURCE redundant define
  2008-08-13 22:39   ` Greg Troxel
@ 2008-08-14  7:54     ` Ludovic Courtès
  0 siblings, 0 replies; 8+ messages in thread
From: Ludovic Courtès @ 2008-08-14  7:54 UTC (permalink / raw)
  To: guile-devel

Hi,

Greg Troxel <gdt@ir.bbn.com> writes:

> Are you saying that autoreconf won't recreate config.h.in from
> configure.in after a branch switch?  Is that because git has old
> timestamps on newly-changed files?

Not sure actually.  Well, to make sure, it's best to delete
`config.h.in' and regenerate it, either with `autoreconf' or with
`autoheader'.

To summarize, on `master', `config.h.in' contains this:

  /* Enable GNU extensions on systems that have them.  */
  #ifndef _GNU_SOURCE
  # undef _GNU_SOURCE
  #endif

On `branch_release-1-8', it should not contain this snippet; if it does,
regenerate things until it vanishes.  ;-)

> You're welcome - I'm glad to see people concerned about how guile works
> on BSD, and my copious spare time levels are low, but this seemed high
> leverage.

I think it's really going to be helpful to see more platform build
results.  It's a good tool to help us improve portability, and to make
sure we don't break things.

Thanks,
Ludovic.





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

* Re: _GNU_SOURCE redundant define
  2008-08-13 17:03 _GNU_SOURCE redundant define Greg Troxel
  2008-08-13 21:30 ` Ludovic Courtès
@ 2008-08-15 13:32 ` Greg Troxel
  2008-08-17 21:47   ` Ludovic Courtès
  1 sibling, 1 reply; 8+ messages in thread
From: Greg Troxel @ 2008-08-15 13:32 UTC (permalink / raw)
  To: guile-devel

Greg Troxel <gdt@ir.bbn.com> writes:

> On NetBSD-current/amd64, the branch_release-1-8 branch fails to build.
> _GNU_SOURCE is defined in config.h, and also in two files.  With the
> following change, it builds and 'gmake check' succeeds.

I have figured this out.  With autoconf 2.62 on NetBSD, several macros
end up defining _GNU_SOURCE.  The following diff makes guile build for
me (plus enables autobuild).  I'm not sure what the right fix is; it
seems broken for AC_AIX to define _GNU_SOURCE at all, especially on
NetBSD.  I'd be somewhat inclined to drop the three macros, and have
adherents of AIX, ISC_POSIX, and MINIX find another way around if
needed.

Alternatively, the two _GNU_SOURCE defines could be wrapped in ifndef
_GNU_SOURCE.

Also, I noticed a forced define of _GNU_SOURCE inside the strptime test.
The NetBSD man page says:

  STANDARDS
       The strptime() function conforms to X/Open Portability Guide Issue 4
       (``XPG4'').

so it would seem that shouldn't be necessary.


diff --git a/configure.in b/configure.in
index ee3d527..101de10 100644
--- a/configure.in
+++ b/configure.in
@@ -49,6 +49,9 @@ AC_CONFIG_SRCDIR([GUILE-VERSION])
 
 AM_MAINTAINER_MODE
 AC_CONFIG_HEADERS([config.h])
+
+AB_INIT
+
 AH_TOP(/*GUILE_CONFIGURE_COPYRIGHT*/)
 
 #--------------------------------------------------------------------
@@ -73,10 +76,14 @@ AC_PROG_CC
 AC_PROG_CPP
 AC_PROG_AWK
 
-AC_AIX
-AC_ISC_POSIX
-AC_MINIX
+# AC_AIX
+dnl AC_AIX
+# AC_ISC_POSIX
+dnl AC_ISC_POSIX
+# AC_MINIX
+dnl AC_MINIX
 
+# c89
 AC_PROG_CC_C89
 
 # for per-target cflags in the libguile subdir




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

* Re: _GNU_SOURCE redundant define
  2008-08-15 13:32 ` Greg Troxel
@ 2008-08-17 21:47   ` Ludovic Courtès
  2008-08-18  8:50     ` Thien-Thi Nguyen
  2008-08-20 17:12     ` Ludovic Courtès
  0 siblings, 2 replies; 8+ messages in thread
From: Ludovic Courtès @ 2008-08-17 21:47 UTC (permalink / raw)
  To: guile-devel

Hi Greg,

Greg Troxel <gdt@ir.bbn.com> writes:

> Greg Troxel <gdt@ir.bbn.com> writes:
>
>> On NetBSD-current/amd64, the branch_release-1-8 branch fails to build.
>> _GNU_SOURCE is defined in config.h, and also in two files.  With the
>> following change, it builds and 'gmake check' succeeds.
>
> I have figured this out.  With autoconf 2.62 on NetBSD, several macros
> end up defining _GNU_SOURCE.  The following diff makes guile build for
> me (plus enables autobuild).  I'm not sure what the right fix is; it
> seems broken for AC_AIX to define _GNU_SOURCE at all, especially on
> NetBSD.  I'd be somewhat inclined to drop the three macros, and have
> adherents of AIX, ISC_POSIX, and MINIX find another way around if
> needed.

The "current Autoconf way" is to use `AC_USE_SYSTEM_EXTENSIONS' (also
available in 2.61) in lieu of these macros (see
http://www.gnu.org/software/autoconf/manual/html_node/Obsolete-Macros.html)
and to never explicitly define the `_*_SOURCE' CPP macros.

I'll change that and test it ASAP.  In the meantime, the easiest way is
to use 2.61, or to remove the offending macro invocations.

Thanks,
Ludo'.





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

* Re: _GNU_SOURCE redundant define
  2008-08-17 21:47   ` Ludovic Courtès
@ 2008-08-18  8:50     ` Thien-Thi Nguyen
  2008-08-20 17:12     ` Ludovic Courtès
  1 sibling, 0 replies; 8+ messages in thread
From: Thien-Thi Nguyen @ 2008-08-18  8:50 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel

() ludo@gnu.org (Ludovic Courtès)
() Sun, 17 Aug 2008 23:47:26 +0200

   The "current Autoconf way" is to use `AC_USE_SYSTEM_EXTENSIONS'

Note that you should also reposition:

#include "libguile/_scm.h"

as the first #include (before <stdio.h> et al) in, for example,
libguile/stime.c, so that the system extension macros can DTRT.

thi




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

* Re: _GNU_SOURCE redundant define
  2008-08-17 21:47   ` Ludovic Courtès
  2008-08-18  8:50     ` Thien-Thi Nguyen
@ 2008-08-20 17:12     ` Ludovic Courtès
  1 sibling, 0 replies; 8+ messages in thread
From: Ludovic Courtès @ 2008-08-20 17:12 UTC (permalink / raw)
  To: guile-devel

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

Hi,

ludo@gnu.org (Ludovic Courtès) writes:

> The "current Autoconf way" is to use `AC_USE_SYSTEM_EXTENSIONS' (also
> available in 2.61) in lieu of these macros (see
> http://www.gnu.org/software/autoconf/manual/html_node/Obsolete-Macros.html)
> and to never explicitly define the `_*_SOURCE' CPP macros.
>
> I'll change that and test it ASAP.  In the meantime, the easiest way is
> to use 2.61, or to remove the offending macro invocations.

Done (patch attached).  Greg: can you confirm that you can now happily
use 2.62?

Thanks,
Ludovic.


[-- Attachment #2: The patch --]
[-- Type: text/x-patch, Size: 6118 bytes --]

From e210266510fb7dc7362a7ca7fb46d3039436c758 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Ludovic=20Court=C3=A8s?= <ludo@gnu.org>
Date: Wed, 20 Aug 2008 19:02:41 +0200
Subject: [PATCH] Use `AC_USE_SYSTEM_EXTENSIONS' instead of the obsolete `AC_AIX', etc.

---
 ChangeLog          |    8 ++++++++
 configure.in       |    4 +---
 libguile/ChangeLog |    7 +++++++
 libguile/eval.c    |    2 --
 libguile/filesys.c |    1 -
 libguile/gc.c      |    2 --
 libguile/numbers.c |    3 ---
 libguile/posix.c   |    5 +----
 libguile/srfi-14.c |    5 +----
 libguile/stime.c   |    3 +--
 libguile/threads.c |    4 +---
 11 files changed, 20 insertions(+), 24 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e80be78..3d8b7e8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-08-20  Ludovic Courtès  <ludo@gnu.org>
+
+	* configure.in: Use `AC_USE_SYSTEM_EXTENSIONS' instead of the
+	obsolete `AC_AIX', `AC_ISC_POSIX' and `AC_MINIX'.  As a side
+	effect, this will define `_POSIX_PTHREAD_SEMANTICS' on Solaris,
+	which provides a standard-conforming version of `readdir_r ()'
+	for instance; it also allows the use of Autoconf 2.62.
+
 2008-08-14  Ludovic Courtès  <ludo@gnu.org>
 
 	* configure.in: Remove incorrect and pointless
diff --git a/configure.in b/configure.in
index ee3d527..e1656c8 100644
--- a/configure.in
+++ b/configure.in
@@ -73,9 +73,7 @@ AC_PROG_CC
 AC_PROG_CPP
 AC_PROG_AWK
 
-AC_AIX
-AC_ISC_POSIX
-AC_MINIX
+AC_USE_SYSTEM_EXTENSIONS
 
 AC_PROG_CC_C89
 
diff --git a/libguile/ChangeLog b/libguile/ChangeLog
index bfdb798..1b3f5d3 100644
--- a/libguile/ChangeLog
+++ b/libguile/ChangeLog
@@ -1,3 +1,10 @@
+2008-08-20  Ludovic Courtès  <ludo@gnu.org>
+
+	* eval.c, filesys.c, gc.c, numbers.c, posix.c, srfi-14.c,
+	stime.c, threads.c: Don't define `_GNU_SOURCE' explicitly as
+	it's now defined in <config.h> thanks to
+	`AC_USE_SYSTEM_EXTENSIONS'.
+
 2008-08-19  Han-Wen Nienhuys  <hanwen@lilypond.org>
 	    Ludovic Courtès  <ludo@gnu.org>
 
diff --git a/libguile/eval.c b/libguile/eval.c
index 021640d..8fa29c8 100644
--- a/libguile/eval.c
+++ b/libguile/eval.c
@@ -18,8 +18,6 @@
 
 \f
 
-#define _GNU_SOURCE
-
 /* This file is read twice in order to produce debugging versions of ceval and
  * scm_apply.  These functions, deval and scm_dapply, are produced when we
  * define the preprocessor macro DEVAL.  The file is divided into sections
diff --git a/libguile/filesys.c b/libguile/filesys.c
index c3cc70c..ca50e21 100644
--- a/libguile/filesys.c
+++ b/libguile/filesys.c
@@ -19,7 +19,6 @@
 \f
 
 /* See stime.c for comments on why _POSIX_C_SOURCE is not always defined. */
-#define _GNU_SOURCE              /* ask glibc for everything */
 #define _LARGEFILE64_SOURCE      /* ask for stat64 etc */
 #ifdef __hpux
 #define _POSIX_C_SOURCE 199506L  /* for readdir_r */
diff --git a/libguile/gc.c b/libguile/gc.c
index 0b6e8b4..dde740f 100644
--- a/libguile/gc.c
+++ b/libguile/gc.c
@@ -15,8 +15,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#define _GNU_SOURCE
-
 /* #define DEBUGINFO */
 
 #if HAVE_CONFIG_H
diff --git a/libguile/numbers.c b/libguile/numbers.c
index fc57bf5..20eb16a 100644
--- a/libguile/numbers.c
+++ b/libguile/numbers.c
@@ -40,9 +40,6 @@
 
  */
 
-/* tell glibc (2.3) to give prototype for C99 trunc(), csqrt(), etc */
-#define _GNU_SOURCE
-
 #if HAVE_CONFIG_H
 #  include <config.h>
 #endif
diff --git a/libguile/posix.c b/libguile/posix.c
index e803f9f..7d53448 100644
--- a/libguile/posix.c
+++ b/libguile/posix.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -21,9 +21,6 @@
 #  include <config.h>
 #endif
 
-/* Make GNU/Linux libc declare everything it has. */
-#define _GNU_SOURCE
-
 #include <stdio.h>
 #include <errno.h>
 
diff --git a/libguile/srfi-14.c b/libguile/srfi-14.c
index f61db7d..3596fbf 100644
--- a/libguile/srfi-14.c
+++ b/libguile/srfi-14.c
@@ -1,6 +1,6 @@
 /* srfi-14.c --- SRFI-14 procedures for Guile
  *
- * Copyright (C) 2001, 2004, 2006 Free Software Foundation, Inc.
+ * Copyright (C) 2001, 2004, 2006, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -21,9 +21,6 @@
 #  include <config.h>
 #endif
 
-
-#define _GNU_SOURCE  /* Ask for `isblank ()'.  */
-
 #include <string.h>
 #include <ctype.h>
 
diff --git a/libguile/stime.c b/libguile/stime.c
index 8487b91..fa8b585 100644
--- a/libguile/stime.c
+++ b/libguile/stime.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -31,7 +31,6 @@
    what it takes away, and decide from that whether to use it, instead of
    hard coding __hpux.  */
 
-#define _GNU_SOURCE  /* ask glibc for everything, in particular strptime */
 #ifndef _REENTRANT
 # define _REENTRANT   /* ask solaris for gmtime_r prototype */
 #endif
diff --git a/libguile/threads.c b/libguile/threads.c
index 609fc99..843dfca 100644
--- a/libguile/threads.c
+++ b/libguile/threads.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2002, 2003, 2004, 2005, 2006, 2008 Free Software Foundation, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -18,8 +18,6 @@
 
 \f
 
-#define _GNU_SOURCE
-
 #include "libguile/_scm.h"
 
 #if HAVE_UNISTD_H
-- 
1.5.6.2


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

end of thread, other threads:[~2008-08-20 17:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-13 17:03 _GNU_SOURCE redundant define Greg Troxel
2008-08-13 21:30 ` Ludovic Courtès
2008-08-13 22:39   ` Greg Troxel
2008-08-14  7:54     ` Ludovic Courtès
2008-08-15 13:32 ` Greg Troxel
2008-08-17 21:47   ` Ludovic Courtès
2008-08-18  8:50     ` Thien-Thi Nguyen
2008-08-20 17:12     ` Ludovic Courtès

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).