From b4e47d3807da4f204dbee8682dac98318f913bd0 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 21 Aug 2022 11:21:52 -0700 Subject: get_os_name: Use autoconf to detect uname() support Stop maintaining a list of #ifdefs for ancient platforms Signed-off-by: Alan Coopersmith --- configure.ac | 1 + src/CvtStdSel.c | 36 ++++++++++-------------------------- 2 files changed, 11 insertions(+), 26 deletions(-) diff --git a/configure.ac b/configure.ac index 1ac8612..4afe3d5 100644 --- a/configure.ac +++ b/configure.ac @@ -33,6 +33,7 @@ PKG_CHECK_MODULES(XMU, xt xext x11 xextproto) PKG_CHECK_MODULES(XMUU, x11) # Checks for library functions. +AC_CHECK_FUNCS([uname]) AC_REPLACE_FUNCS([reallocarray]) # Allow checking code with lint, sparse, etc. diff --git a/src/CvtStdSel.c b/src/CvtStdSel.c index 177de1b..439ab7a 100644 --- a/src/CvtStdSel.c +++ b/src/CvtStdSel.c @@ -65,26 +65,14 @@ in this Software without prior written authorization from The Open Group. #include #ifndef OS_NAME -#ifndef X_OS_FILE -#ifdef SYSV /* keep separate until makedepend fixed */ -#define USE_UNAME -#endif -#ifdef SVR4 -#define USE_UNAME -#endif -#ifdef ultrix -#define USE_UNAME -#endif -#ifdef CSRG_BASED -#define USE_UNAME -#endif -#ifdef __linux__ -#define USE_UNAME -#endif -#endif /*X_OS_FILE*/ -#ifdef USE_UNAME -#include -#endif +# ifndef X_OS_FILE +# ifdef HAVE_UNAME +# define USE_UNAME +# endif +# endif /*X_OS_FILE*/ +# ifdef USE_UNAME +# include +# endif #endif /* @@ -148,14 +136,10 @@ get_os_name(void) } #endif -#ifdef sun - return XtNewString("SunOS"); -#else -# if !defined(SYSV) && (defined(CSRG_BASED) || defined(unix)) +#if !defined(SYSV) && (defined(CSRG_BASED) || defined(unix)) return XtNewString("BSD"); -# else +#else return NULL; -# endif #endif #endif /*OS_NAME*/ -- cgit v1.2.1