mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Build & getconf fixes for macOS (and UnixWare)
src/lib/libast/features/standards:
- Add heuristic (u_long availability) for systems that hide rather
than reveal functionality in the presence of _POSIX_SOURCE, etc.
- Define _DARWIN_C_SOURCE, like _GNU_SOURCE, to enable the full
range of definitions on macOS systems.
- Due to the above, remove MACH (macOS)-specific hack.
- These changes ported from https://github.com/att/ast/pull/1492 -
thanks to Lev Kujawski (@lkujaw). His PR indicates that this
fixes the standards macros on UnixWare, too. Therefore, no longer
exclude UnixWare from standards macros (re: ff70c27f
).
src/lib/libast/comp/conf.sh:
- Promote the 'op' member in Conf_t (struct Conf_s) from short to
int. This allows some Darwin/macOS values, now exposed, to fit
that would otherwise be truncated, namely:
_CS_DARWIN_USER_CACHE_DIR 65538
_CS_DARWIN_USER_DIR 65536
_CS_DARWIN_USER_TEMP_DIR 65537
Thus, the following AST getconf values are now correct on macOS:
$ /opt/ast/bin/getconf | grep ^DARWIN
DARWIN_USER_CACHE_DIR=/var/folders/nx/(REDACTED)/C/
DARWIN_USER_DIR=/var/folders/nx/(REDACTED)/0/
DARWIN_USER_TEMP_DIR=/var/folders/nx/(REDACTED)/T/
src/lib/libast/features/tty:
- Include <sys/ioctl.h> if available. This silences a compiler
warning in src/lib/libast/misc/procopen.c about an invalid
implicit declaration of ioctl(2).
This commit is contained in:
parent
0d2d6bb47b
commit
17f13345dc
3 changed files with 59 additions and 26 deletions
|
@ -1546,7 +1546,7 @@ struct Conf_s
|
||||||
short standard;
|
short standard;
|
||||||
short section;
|
short section;
|
||||||
short call;
|
short call;
|
||||||
short op;
|
int op;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct Prefix_s
|
typedef struct Prefix_s
|
||||||
|
|
|
@ -1,29 +1,39 @@
|
||||||
set stdio
|
set stdio
|
||||||
|
|
||||||
|
# Flag systems that omit necessary definitions such as u_long
|
||||||
|
# when _POSIX_SOURCE or _XOPEN_SOURCE are defined.
|
||||||
|
# Affected: Mac OS X, UnixWare.
|
||||||
|
typ u_long
|
||||||
|
|
||||||
# In FreeBSD, definitions like _POSIX_SOURCE and such are used to *limit*
|
# In FreeBSD, definitions like _POSIX_SOURCE and such are used to *limit*
|
||||||
# functionality to known API; they don't enable anything. The general intent in
|
# functionality to known API; they don't enable anything. The general intent in
|
||||||
# BSD is to enable everything by default (effectively, providing the
|
# BSD is to enable everything by default. So we look for that here, but stay
|
||||||
# _KITCHEN_SINK_SOURCE mentioned below). So we look for that here, but stay
|
|
||||||
# careful that we don't get fooled by presence of FreeBSD that underpins some
|
# careful that we don't get fooled by presence of FreeBSD that underpins some
|
||||||
# subsystems in Mac OS X; there are other Apple-specific portability hacks
|
# subsystems in Mac OS X; there are other Apple-specific portability hacks
|
||||||
# elsewhere we should not interfere with.
|
# elsewhere we should not interfere with.
|
||||||
if tst note{ FreeBSD, DragonFly BSD, or UnixWare }end compile{
|
if tst note{ FreeBSD or DragonFly BSD }end compile{
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#if (!defined(__FreeBSD__) && !defined(__DragonFly__) && !defined(__USLC__)) || defined(APPLE)
|
#if (!defined(__FreeBSD__) && !defined(__DragonFly__)) || defined(__APPLE__) || defined(__MACH__)
|
||||||
#error not a FreeBSD or DragonFly BSD system
|
#error not one of the listed systems
|
||||||
#endif
|
#endif
|
||||||
}end {
|
}end {
|
||||||
}
|
}
|
||||||
elif tst note{ _ALL_SOURCE & _POSIX_SOURCE & _POSIX_C_SOURCE & _XOPEN_SOURCE & __EXTENSIONS__ works }end compile{
|
elif tst note{ _ALL_SOURCE & _POSIX_SOURCE & _POSIX_C_SOURCE & _XOPEN_SOURCE & _GNU_SOURCE & _DARWIN_C_SOURCE & __EXTENSIONS__ works }end compile{
|
||||||
#define _ALL_SOURCE 1
|
#define _ALL_SOURCE 1
|
||||||
#define _POSIX_SOURCE 1
|
#define _POSIX_SOURCE 1
|
||||||
#define _POSIX_C_SOURCE 21000101L
|
#define _POSIX_C_SOURCE 21000101L
|
||||||
#define _XOPEN_SOURCE 9900
|
#define _XOPEN_SOURCE 9900
|
||||||
#define _GNU_SOURCE 1
|
#define _GNU_SOURCE 1
|
||||||
|
#define _DARWIN_C_SOURCE 1
|
||||||
#define __EXTENSIONS__ 1
|
#define __EXTENSIONS__ 1
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#if _typ_u_long
|
||||||
|
u_long _test_dummy_;
|
||||||
|
#endif
|
||||||
}end {
|
}end {
|
||||||
#ifndef _ALL_SOURCE
|
#ifndef _ALL_SOURCE
|
||||||
#define _ALL_SOURCE 1
|
#define _ALL_SOURCE 1
|
||||||
|
@ -40,20 +50,28 @@ elif tst note{ _ALL_SOURCE & _POSIX_SOURCE & _POSIX_C_SOURCE & _XOPEN_SOURCE & _
|
||||||
#ifndef _GNU_SOURCE
|
#ifndef _GNU_SOURCE
|
||||||
#define _GNU_SOURCE 1
|
#define _GNU_SOURCE 1
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef _DARWIN_C_SOURCE
|
||||||
|
#define _DARWIN_C_SOURCE 1
|
||||||
|
#endif
|
||||||
#ifndef __EXTENSIONS__
|
#ifndef __EXTENSIONS__
|
||||||
#define __EXTENSIONS__ 1
|
#define __EXTENSIONS__ 1
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
elif tst note{ _ALL_SOURCE & _POSIX_SOURCE & _XOPEN_SOURCE & __EXTENSIONS__ works }end compile{
|
elif tst note{ _ALL_SOURCE & _POSIX_SOURCE & _XOPEN_SOURCE & _GNU_SOURCE & _DARWIN_C_SOURCE & __EXTENSIONS__ works }end compile{
|
||||||
#define _ALL_SOURCE 1
|
#define _ALL_SOURCE 1
|
||||||
#define _POSIX_SOURCE 1
|
#define _POSIX_SOURCE 1
|
||||||
#define _XOPEN_SOURCE 9900
|
#define _XOPEN_SOURCE 9900
|
||||||
#define _GNU_SOURCE 1
|
#define _GNU_SOURCE 1
|
||||||
|
#define _DARWIN_C_SOURCE 1
|
||||||
#define __EXTENSIONS__ 1
|
#define __EXTENSIONS__ 1
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#if _typ_u_long
|
||||||
|
u_long _test_dummy;
|
||||||
|
#endif
|
||||||
}end {
|
}end {
|
||||||
#ifndef _ALL_SOURCE
|
#ifndef _ALL_SOURCE
|
||||||
#define _ALL_SOURCE 1
|
#define _ALL_SOURCE 1
|
||||||
|
@ -67,20 +85,28 @@ elif tst note{ _ALL_SOURCE & _POSIX_SOURCE & _XOPEN_SOURCE & __EXTENSIONS__ work
|
||||||
#ifndef _GNU_SOURCE
|
#ifndef _GNU_SOURCE
|
||||||
#define _GNU_SOURCE 1
|
#define _GNU_SOURCE 1
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef _DARWIN_C_SOURCE
|
||||||
|
#define _DARWIN_C_SOURCE 1
|
||||||
|
#endif
|
||||||
#ifndef __EXTENSIONS__
|
#ifndef __EXTENSIONS__
|
||||||
#define __EXTENSIONS__ 1
|
#define __EXTENSIONS__ 1
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
elif tst note{ _POSIX_SOURCE & _POSIX_C_SOURCE & _XOPEN_SOURCE & __EXTENSIONS__ works }end compile{
|
elif tst note{ _POSIX_SOURCE & _POSIX_C_SOURCE & _XOPEN_SOURCE & _GNU_SOURCE & _DARWIN_C_SOURCE & __EXTENSIONS__ works }end compile{
|
||||||
#define _POSIX_SOURCE 1
|
#define _POSIX_SOURCE 1
|
||||||
#define _POSIX_C_SOURCE 21000101L
|
#define _POSIX_C_SOURCE 21000101L
|
||||||
#define _XOPEN_SOURCE 9900
|
#define _XOPEN_SOURCE 9900
|
||||||
#define _GNU_SOURCE 1
|
#define _GNU_SOURCE 1
|
||||||
|
#define _DARWIN_C_SOURCE 1
|
||||||
#define __EXTENSIONS__ 1
|
#define __EXTENSIONS__ 1
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#if _typ_u_long
|
||||||
|
u_long _test_dummy;
|
||||||
|
#endif
|
||||||
}end {
|
}end {
|
||||||
#ifndef _POSIX_SOURCE
|
#ifndef _POSIX_SOURCE
|
||||||
#define _POSIX_SOURCE 1
|
#define _POSIX_SOURCE 1
|
||||||
|
@ -94,6 +120,9 @@ elif tst note{ _POSIX_SOURCE & _POSIX_C_SOURCE & _XOPEN_SOURCE & __EXTENSIONS__
|
||||||
#ifndef _GNU_SOURCE
|
#ifndef _GNU_SOURCE
|
||||||
#define _GNU_SOURCE 1
|
#define _GNU_SOURCE 1
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef _DARWIN_C_SOURCE
|
||||||
|
#define _DARWIN_C_SOURCE 1
|
||||||
|
#endif
|
||||||
#ifndef __EXTENSIONS__
|
#ifndef __EXTENSIONS__
|
||||||
#define __EXTENSIONS__ 1
|
#define __EXTENSIONS__ 1
|
||||||
#endif
|
#endif
|
||||||
|
@ -106,6 +135,10 @@ elif tst note{ _POSIX_SOURCE & _XOPEN_SOURCE & __EXTENSIONS__ works }end compile
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#if _typ_u_long
|
||||||
|
u_long _test_dummy;
|
||||||
|
#endif
|
||||||
}end {
|
}end {
|
||||||
#ifndef _POSIX_SOURCE
|
#ifndef _POSIX_SOURCE
|
||||||
#define _POSIX_SOURCE 1
|
#define _POSIX_SOURCE 1
|
||||||
|
@ -124,6 +157,10 @@ elif tst note{ _XOPEN_SOURCE & __EXTENSIONS__ works }end compile{
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#if _typ_u_long
|
||||||
|
u_long _test_dummy;
|
||||||
|
#endif
|
||||||
}end {
|
}end {
|
||||||
#ifndef _XOPEN_SOURCE
|
#ifndef _XOPEN_SOURCE
|
||||||
#define _XOPEN_SOURCE 1
|
#define _XOPEN_SOURCE 1
|
||||||
|
@ -138,6 +175,10 @@ elif tst note{ _XOPEN_SOURCE works }end compile{
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#if _typ_u_long
|
||||||
|
u_long _test_dummy;
|
||||||
|
#endif
|
||||||
}end {
|
}end {
|
||||||
#ifndef _XOPEN_SOURCE
|
#ifndef _XOPEN_SOURCE
|
||||||
#define _XOPEN_SOURCE 1
|
#define _XOPEN_SOURCE 1
|
||||||
|
@ -147,6 +188,10 @@ else tst note{ __EXTENSIONS__ works }end compile{
|
||||||
#define __EXTENSIONS__ 1
|
#define __EXTENSIONS__ 1
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#if _typ_u_long
|
||||||
|
u_long _test_dummy;
|
||||||
|
#endif
|
||||||
}end {
|
}end {
|
||||||
#ifndef __EXTENSIONS__
|
#ifndef __EXTENSIONS__
|
||||||
#define __EXTENSIONS__ 1
|
#define __EXTENSIONS__ 1
|
||||||
|
@ -167,19 +212,3 @@ if tst -D_ISOC99_SOURCE -lm note{ _ISOC99_SOURCE plays nice }end link{
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
endif
|
endif
|
||||||
|
|
||||||
cat{
|
|
||||||
|
|
||||||
/*
|
|
||||||
* this is a nasty game we all play to honor standards symbol visibility
|
|
||||||
* it would help if all implementations had
|
|
||||||
* _KITCHEN_SINK_SOURCE
|
|
||||||
* that enabled all symbols from the latest implemented standards
|
|
||||||
* that's probably the most useful but least portable request
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if __MACH__
|
|
||||||
#undef _POSIX_SOURCE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}end
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
hdr termios,termio,sgtty
|
hdr termios,termio,sgtty,sys/ioctl
|
||||||
sys termios,termio,ioctl,bsdtty,nttyio,ttyio
|
sys termios,termio,ioctl,bsdtty,nttyio,ttyio
|
||||||
lib tcgetattr,tcgetpgrp termios.h
|
lib tcgetattr,tcgetpgrp termios.h
|
||||||
mac _POSIX_VDISABLE termios.h
|
mac _POSIX_VDISABLE termios.h
|
||||||
|
@ -107,6 +107,10 @@ cat{
|
||||||
# endif /* TCSANOW */
|
# endif /* TCSANOW */
|
||||||
#endif /* _hdr_termios */
|
#endif /* _hdr_termios */
|
||||||
|
|
||||||
|
#if _hdr_sys_ioctl
|
||||||
|
# include <sys/ioctl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* set ECHOCTL if driver can echo control characters as ^c */
|
/* set ECHOCTL if driver can echo control characters as ^c */
|
||||||
#ifdef LCTLECH
|
#ifdef LCTLECH
|
||||||
# ifndef ECHOCTL
|
# ifndef ECHOCTL
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue