[PATCH:twm] Fix: menus.c:2374: warning: implicit declaration of function `putenv`

Alan Coopersmith alan.coopersmith at oracle.com
Tue May 10 15:40:46 PDT 2011


Ensure _GNU_SOURCE is defined on Linux builds before including <stdlib.h>
so the prototype is exposed in the header properly.

https://bugs.freedesktop.org/show_bug.cgi?id=32696

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 configure.ac    |    1 +
 src/Makefile.am |    2 +-
 src/menus.c     |    4 ++++
 src/twm.h       |    4 ++++
 4 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6f1cef7..fc63127 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,6 +26,7 @@ AC_INIT([twm], [1.0.6],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [twm])
 AC_CONFIG_SRCDIR([Makefile.am])
 AC_CONFIG_HEADERS([config.h])
+AC_USE_SYSTEM_EXTENSIONS
 
 # Initialize Automake
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
diff --git a/src/Makefile.am b/src/Makefile.am
index cb6f615..cfd0b44 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -27,7 +27,7 @@ bin_PROGRAMS = twm
 rcdir = ${datadir}/X11/twm
 dist_rc_DATA = system.twmrc
 
-AM_CFLAGS = $(TWM_CFLAGS) -DXVENDORNAME=\"The\ X.Org\ Foundation\" -DXORG_RELEASE=\"Release\ $(VERSION)\" -D_BSD_SOURCE
+AM_CFLAGS = $(TWM_CFLAGS) -DXVENDORNAME=\"The\ X.Org\ Foundation\" -DXORG_RELEASE=\"Release\ $(VERSION)\"
 AM_CFLAGS += -DSYSTEM_INIT_FILE=\"${datadir}/X11/twm/system.twmrc\"
 
 twm_LDADD = $(TWM_LIBS)
diff --git a/src/menus.c b/src/menus.c
index 8d21644..bc688e6 100644
--- a/src/menus.c
+++ b/src/menus.c
@@ -58,6 +58,10 @@ in this Software without prior written authorization from The Open Group.
  *
  ***********************************************************************/
 
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include <stdio.h>
 #include <X11/Xos.h>
 #include "twm.h"
diff --git a/src/twm.h b/src/twm.h
index 420d6c8..6e2bb27 100644
--- a/src/twm.h
+++ b/src/twm.h
@@ -62,6 +62,10 @@ from The Open Group.
 #ifndef _TWM_
 #define _TWM_
 
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 #include <X11/cursorfont.h>
-- 
1.7.3.2



More information about the xorg-devel mailing list