gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gpsd-dev] featuretest macros


From: Greg Troxel
Subject: [gpsd-dev] featuretest macros
Date: Fri, 21 Jun 2019 09:58:25 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (berkeley-unix)

As an experiment, I removed all the lines in SConstruct that add
featuretest macros.  gpsd built without any problems on NetBSD-8 amd64.
I get the same warnings I posted earlier.

This doesn't surprise me; gpsd's usage is POSIX and common extensions.
I know of only one function that's hidden by default in NetBSD, which is
the OpenBSD variant of a function (that originated in OpenBSD) and is
different in NetBSD: for that one needs to define _OPENBSD_SOURCE.

I think it's reasonably likely that the same results will be obtained on
other platforms.  But perhaps glibc or other things needs to be told to
include things in POSIX 2008 explicitly.

I am not proposing that we change this now, as I gather we are close to
releasing 3.19.  Merely a data point for future thought.

diff --git a/SConstruct b/SConstruct
index 91ff42d8..f8e0c05b 100644
--- a/SConstruct
+++ b/SConstruct
@@ -721,80 +721,6 @@ else:
 
     confdefs.append('#define GPSD_URL "%s"\n' % website)
 
-    # TODO: Move these into an if block only on systems with glibc.
-    # needed for isfinite(), pselect(), etc.
-    # for strnlen() before glibc 2.10
-    # glibc 2.10+ needs 200908L (or XOPEN 700+) for strnlen()
-    # on newer glibc _DEFAULT_SOURCE resets _POSIX_C_SOURCE
-    # we set it just in case
-    confdefs.append('#if !defined(_POSIX_C_SOURCE)')
-    confdefs.append('#define _POSIX_C_SOURCE 200809L')
-    confdefs.append('#endif\n')
-    # for daemon(), cfmakeraw(), strsep() and setgroups()
-    # on glibc 2.19+
-    # may also be added by pkg_config
-    confdefs.append('#if !defined(_DEFAULT_SOURCE)')
-    confdefs.append('#define _DEFAULT_SOURCE')
-    confdefs.append('#endif\n')
-
-    # sys/un.h, and more, needs __USE_MISC with glibc and osX
-    # __USE_MISC is set by _DEFAULT_SOURCE or _BSD_SOURCE
-
-    # TODO: Many of these are now specified by POSIX.  Check if
-    # defining _XOPEN_SOURCE is necessary, and limit to systems where
-    # it is.
-    # 500 means X/Open 1995
-    # getsid(), isascii(), nice(), putenv(), strdup(), sys/ipc.h need 500
-    # 600 means X/Open 2004
-    # Ubuntu and OpenBSD isfinite() needs 600
-    # 700 means X/Open 2008
-    # glibc 2.10+ needs 700+ for strnlen()
-    # Python.h wants 600 or 700
-    confdefs.append('#if !defined(_XOPEN_SOURCE)')
-    confdefs.append('#define _XOPEN_SOURCE 700')
-    confdefs.append('#endif\n')
-
-    if sys.platform.startswith('linux'):
-        # for cfmakeraw(), strsep(), etc. on CentOS 7
-        # glibc 2.19 and before
-        # sets __USE_MISC
-        confdefs.append('#if !defined(_BSD_SOURCE)')
-        confdefs.append('#define _BSD_SOURCE')
-        confdefs.append('#endif\n')
-        # for strnlen() and struct ifreq
-        # glibc before 2.10, deprecated in 2.10+
-        confdefs.append('#if !defined(_GNU_SOURCE)')
-        confdefs.append('#define _GNU_SOURCE 1')
-        confdefs.append('#endif\n')
-    elif sys.platform.startswith('darwin'):
-        # strlcpy() and SIGWINCH need _DARWIN_C_SOURCE
-        confdefs.append('#if !defined(_DARWIN_C_SOURCE)')
-        confdefs.append('#define _DARWIN_C_SOURCE 1\n')
-        confdefs.append('#endif\n')
-        # vsnprintf() needs __DARWIN_C_LEVEL >= 200112L
-        # snprintf() needs __DARWIN_C_LEVEL >= 200112L
-        # _DARWIN_C_SOURCE forces __DARWIN_C_LEVEL to 900000L
-        # see <sys/cdefs.h>
-
-        # set internal lib versions at link time.
-        gpslib_flags = ["-Wl,-current_version,%s" % libgps_version,
-                        "-Wl,-compatibility_version,%s" % libgps_version]
-    elif (sys.platform.startswith('freebsd') or
-          sys.platform.startswith('openbsd')):
-        # required to define u_int in sys/time.h
-        confdefs.append('#if !defined(_BSD_SOURCE)')
-        confdefs.append("#define _BSD_SOURCE 1\n")
-        confdefs.append('#endif\n')
-        # required to get strlcpy(), and more, from string.h
-        confdefs.append('#if !defined(__BSD_VISIBLE)')
-        confdefs.append("#define __BSD_VISIBLE 1\n")
-        confdefs.append('#endif\n')
-    elif sys.platform.startswith('netbsd'):
-        # required to get strlcpy(), and more, from string.h
-        confdefs.append('#if !defined(_NETBSD_SOURCE)')
-        confdefs.append("#define _NETBSD_SOURCE 1\n")
-        confdefs.append('#endif\n')
-
     cxx = config.CheckCXX()
     if not cxx and config.env["libgpsmm"]:
         announce("C++ doesn't work, suppressing libgpsmm build.")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]