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 section;
|
||||
short call;
|
||||
short op;
|
||||
int op;
|
||||
};
|
||||
|
||||
typedef struct Prefix_s
|
||||
|
|
|
@ -1,29 +1,39 @@
|
|||
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*
|
||||
# functionality to known API; they don't enable anything. The general intent in
|
||||
# BSD is to enable everything by default (effectively, providing the
|
||||
# _KITCHEN_SINK_SOURCE mentioned below). So we look for that here, but stay
|
||||
# BSD is to enable everything by default. So we look for that here, but stay
|
||||
# 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
|
||||
# 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>
|
||||
#if (!defined(__FreeBSD__) && !defined(__DragonFly__) && !defined(__USLC__)) || defined(APPLE)
|
||||
#error not a FreeBSD or DragonFly BSD system
|
||||
#if (!defined(__FreeBSD__) && !defined(__DragonFly__)) || defined(__APPLE__) || defined(__MACH__)
|
||||
#error not one of the listed systems
|
||||
#endif
|
||||
}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 _POSIX_SOURCE 1
|
||||
#define _POSIX_C_SOURCE 21000101L
|
||||
#define _XOPEN_SOURCE 9900
|
||||
#define _GNU_SOURCE 1
|
||||
#define _DARWIN_C_SOURCE 1
|
||||
#define __EXTENSIONS__ 1
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#if _typ_u_long
|
||||
u_long _test_dummy_;
|
||||
#endif
|
||||
}end {
|
||||
#ifndef _ALL_SOURCE
|
||||
#define _ALL_SOURCE 1
|
||||
|
@ -40,20 +50,28 @@ elif tst note{ _ALL_SOURCE & _POSIX_SOURCE & _POSIX_C_SOURCE & _XOPEN_SOURCE & _
|
|||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE 1
|
||||
#endif
|
||||
#ifndef _DARWIN_C_SOURCE
|
||||
#define _DARWIN_C_SOURCE 1
|
||||
#endif
|
||||
#ifndef __EXTENSIONS__
|
||||
#define __EXTENSIONS__ 1
|
||||
#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 _POSIX_SOURCE 1
|
||||
#define _XOPEN_SOURCE 9900
|
||||
#define _GNU_SOURCE 1
|
||||
#define _DARWIN_C_SOURCE 1
|
||||
#define __EXTENSIONS__ 1
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#if _typ_u_long
|
||||
u_long _test_dummy;
|
||||
#endif
|
||||
}end {
|
||||
#ifndef _ALL_SOURCE
|
||||
#define _ALL_SOURCE 1
|
||||
|
@ -67,20 +85,28 @@ elif tst note{ _ALL_SOURCE & _POSIX_SOURCE & _XOPEN_SOURCE & __EXTENSIONS__ work
|
|||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE 1
|
||||
#endif
|
||||
#ifndef _DARWIN_C_SOURCE
|
||||
#define _DARWIN_C_SOURCE 1
|
||||
#endif
|
||||
#ifndef __EXTENSIONS__
|
||||
#define __EXTENSIONS__ 1
|
||||
#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_C_SOURCE 21000101L
|
||||
#define _XOPEN_SOURCE 9900
|
||||
#define _GNU_SOURCE 1
|
||||
#define _DARWIN_C_SOURCE 1
|
||||
#define __EXTENSIONS__ 1
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#if _typ_u_long
|
||||
u_long _test_dummy;
|
||||
#endif
|
||||
}end {
|
||||
#ifndef _POSIX_SOURCE
|
||||
#define _POSIX_SOURCE 1
|
||||
|
@ -94,6 +120,9 @@ elif tst note{ _POSIX_SOURCE & _POSIX_C_SOURCE & _XOPEN_SOURCE & __EXTENSIONS__
|
|||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE 1
|
||||
#endif
|
||||
#ifndef _DARWIN_C_SOURCE
|
||||
#define _DARWIN_C_SOURCE 1
|
||||
#endif
|
||||
#ifndef __EXTENSIONS__
|
||||
#define __EXTENSIONS__ 1
|
||||
#endif
|
||||
|
@ -106,6 +135,10 @@ elif tst note{ _POSIX_SOURCE & _XOPEN_SOURCE & __EXTENSIONS__ works }end compile
|
|||
#include <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#if _typ_u_long
|
||||
u_long _test_dummy;
|
||||
#endif
|
||||
}end {
|
||||
#ifndef _POSIX_SOURCE
|
||||
#define _POSIX_SOURCE 1
|
||||
|
@ -124,6 +157,10 @@ elif tst note{ _XOPEN_SOURCE & __EXTENSIONS__ works }end compile{
|
|||
#include <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#if _typ_u_long
|
||||
u_long _test_dummy;
|
||||
#endif
|
||||
}end {
|
||||
#ifndef _XOPEN_SOURCE
|
||||
#define _XOPEN_SOURCE 1
|
||||
|
@ -138,6 +175,10 @@ elif tst note{ _XOPEN_SOURCE works }end compile{
|
|||
#include <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#if _typ_u_long
|
||||
u_long _test_dummy;
|
||||
#endif
|
||||
}end {
|
||||
#ifndef _XOPEN_SOURCE
|
||||
#define _XOPEN_SOURCE 1
|
||||
|
@ -147,6 +188,10 @@ else tst note{ __EXTENSIONS__ works }end compile{
|
|||
#define __EXTENSIONS__ 1
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#if _typ_u_long
|
||||
u_long _test_dummy;
|
||||
#endif
|
||||
}end {
|
||||
#ifndef __EXTENSIONS__
|
||||
#define __EXTENSIONS__ 1
|
||||
|
@ -167,19 +212,3 @@ if tst -D_ISOC99_SOURCE -lm note{ _ISOC99_SOURCE plays nice }end link{
|
|||
#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
|
||||
lib tcgetattr,tcgetpgrp termios.h
|
||||
mac _POSIX_VDISABLE termios.h
|
||||
|
@ -107,6 +107,10 @@ cat{
|
|||
# endif /* TCSANOW */
|
||||
#endif /* _hdr_termios */
|
||||
|
||||
#if _hdr_sys_ioctl
|
||||
# include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
/* set ECHOCTL if driver can echo control characters as ^c */
|
||||
#ifdef LCTLECH
|
||||
# ifndef ECHOCTL
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue