[PATCH:luit 2/3] Replace hardcoded _XOPEN_SOURCE=500 with AC_USE_SYSTEM_EXTENSIONS

Alan Coopersmith alan.coopersmith at oracle.com
Sat Jul 13 09:43:46 PDT 2013


-D_XOPEN_SOURCE was originally added for Linux in commit e751086392e837
and then updated to -D_XOPEN_SOURCE=500 in commit e1a002217cabdb to
expose strdup() in glibc headers.

As noted in bug 47792 though, the posix_openpt() function is not
visible unless that's raised to 600.

Instead of continually chasing the standards ourselves, switch to letting
autoconf handle that for us.

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 Makefile.am  |    1 -
 configure.ac |   13 ++-----------
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 8069670..ef042e3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -25,7 +25,6 @@ bin_PROGRAMS = luit
 AM_CFLAGS =		\
 	$(CWARNFLAGS)	\
 	$(LUIT_CFLAGS)	\
-	$(OS_CFLAGS)	\
 	-DLOCALE_ALIAS_FILE=\"$(LOCALEALIASFILE)\"
 
 luit_LDADD = $(LUIT_LIBS)
diff --git a/configure.ac b/configure.ac
index 946db23..0ec4664 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,6 +26,7 @@ AC_INIT([luit], [1.1.1],
 	[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [luit])
 AC_CONFIG_SRCDIR([Makefile.am])
 AC_CONFIG_HEADERS([config.h])
+AC_USE_SYSTEM_EXTENSIONS
 
 # Initialize Automake
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
@@ -37,9 +38,6 @@ m4_ifndef([XORG_MACROS_VERSION],
 XORG_MACROS_VERSION(1.8)
 XORG_DEFAULT_OPTIONS
 
-AC_CANONICAL_HOST
-
-
 AC_CHECK_HEADERS([pty.h stropts.h sys/param.h sys/select.h])
 AC_CHECK_FUNCS([select grantpt posix_openpt])
 
@@ -57,23 +55,16 @@ PKG_CHECK_MODULES(LUIT, fontenc)
 PKG_CHECK_EXISTS(x11, [],
 	[AC_MSG_WARN([libX11 not found.  luit may not be able to find locale aliases without it.])])
 
+AC_CANONICAL_HOST
 case $host_os in
     # darwin has poll() but can't be used to poll character devices (atleast through SnowLeopard)
     darwin*)
-        OS_CFLAGS=
-        ;;
-    linux*)
-        AC_CHECK_HEADERS([poll.h])
-        AC_CHECK_FUNCS([poll])
-        OS_CFLAGS="-D_XOPEN_SOURCE=500"
         ;;
     *)
         AC_CHECK_HEADERS([poll.h])
         AC_CHECK_FUNCS([poll])
-        OS_CFLAGS=
         ;;
 esac
-AC_SUBST(OS_CFLAGS)
 
 AC_CHECK_HEADERS([pty.h stropts.h sys/ioctl.h sys/param.h sys/poll.h sys/select.h sys/time.h termios.h]) 
 AC_CHECK_FUNCS([grantpt putenv select strdup])
-- 
1.7.9.2



More information about the xorg-devel mailing list