mirror of https://github.com/encounter/SDL.git
Check for O_CLOEXEC definition in fcntl.h at configuration time,
If not available, define it internally as 0 (in SDL_internal.h). Define it as available for macOS >= 10.7 in SDL_config_macosx.h.
This commit is contained in:
parent
f903a39e13
commit
5a0ea7fb17
|
@ -993,6 +993,10 @@ if(UNIX OR APPLE)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(UNIX OR APPLE OR HAIKU OR RISCOS)
|
||||||
|
CheckO_CLOEXEC()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(SDL_JOYSTICK)
|
if(SDL_JOYSTICK)
|
||||||
if(SDL_VIRTUAL_JOYSTICK)
|
if(SDL_VIRTUAL_JOYSTICK)
|
||||||
set(HAVE_VIRTUAL_JOYSTICK TRUE)
|
set(HAVE_VIRTUAL_JOYSTICK TRUE)
|
||||||
|
|
|
@ -53,6 +53,14 @@ macro(CheckDLOPEN)
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
macro(CheckO_CLOEXEC)
|
||||||
|
check_c_source_compiles("
|
||||||
|
#include <fcntl.h>
|
||||||
|
int flag = O_CLOEXEC;
|
||||||
|
int main(void) {
|
||||||
|
}" HAVE_O_CLOEXEC)
|
||||||
|
endmacro()
|
||||||
|
|
||||||
# Requires:
|
# Requires:
|
||||||
# - n/a
|
# - n/a
|
||||||
macro(CheckOSS)
|
macro(CheckOSS)
|
||||||
|
|
|
@ -20234,7 +20234,6 @@ main ()
|
||||||
{
|
{
|
||||||
|
|
||||||
EGL_DISPMANX_WINDOW_T window;
|
EGL_DISPMANX_WINDOW_T window;
|
||||||
|
|
||||||
bcm_host_init();
|
bcm_host_init();
|
||||||
|
|
||||||
;
|
;
|
||||||
|
@ -24362,6 +24361,39 @@ $as_echo "#define SDL_LOADSO_DLOPEN 1" >>confdefs.h
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CheckO_CLOEXEC()
|
||||||
|
{
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for O_CLOEXEC" >&5
|
||||||
|
$as_echo_n "checking for O_CLOEXEC... " >&6; }
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
|
||||||
|
#include <fcntl.h>
|
||||||
|
int flag = O_CLOEXEC;
|
||||||
|
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_c_try_compile "$LINENO"; then :
|
||||||
|
have_o_cloexec=yes
|
||||||
|
else
|
||||||
|
have_o_cloexec=no
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_o_cloexec" >&5
|
||||||
|
$as_echo "$have_o_cloexec" >&6; }
|
||||||
|
if test $have_o_cloexec = yes; then
|
||||||
|
|
||||||
|
$as_echo "#define HAVE_O_CLOEXEC 1" >>confdefs.h
|
||||||
|
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
CheckUSBHID()
|
CheckUSBHID()
|
||||||
{
|
{
|
||||||
case "$host" in
|
case "$host" in
|
||||||
|
@ -25055,6 +25087,7 @@ $as_echo "#define SDL_VIDEO_DRIVER_ANDROID 1" >>confdefs.h
|
||||||
CheckDLOPEN
|
CheckDLOPEN
|
||||||
CheckARM
|
CheckARM
|
||||||
CheckNEON
|
CheckNEON
|
||||||
|
CheckO_CLOEXEC
|
||||||
CheckOSS
|
CheckOSS
|
||||||
CheckALSA
|
CheckALSA
|
||||||
CheckPipewire
|
CheckPipewire
|
||||||
|
@ -25321,10 +25354,8 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h
|
||||||
|
|
||||||
# Set up the core platform files
|
# Set up the core platform files
|
||||||
SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
|
SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
|
||||||
|
|
||||||
SOURCES="$SOURCES $srcdir/src/misc/windows/*.c"
|
SOURCES="$SOURCES $srcdir/src/misc/windows/*.c"
|
||||||
have_misc=yes
|
have_misc=yes
|
||||||
|
|
||||||
# Use the Windows locale APIs.
|
# Use the Windows locale APIs.
|
||||||
SOURCES="$SOURCES $srcdir/src/locale/windows/*.c"
|
SOURCES="$SOURCES $srcdir/src/locale/windows/*.c"
|
||||||
have_locale=yes
|
have_locale=yes
|
||||||
|
@ -25556,6 +25587,7 @@ fi
|
||||||
CheckDiskAudio
|
CheckDiskAudio
|
||||||
CheckDummyAudio
|
CheckDummyAudio
|
||||||
CheckDLOPEN
|
CheckDLOPEN
|
||||||
|
CheckO_CLOEXEC
|
||||||
CheckHaikuVideo
|
CheckHaikuVideo
|
||||||
CheckHaikuGL
|
CheckHaikuGL
|
||||||
CheckPTHREAD
|
CheckPTHREAD
|
||||||
|
@ -25623,6 +25655,7 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h
|
||||||
CheckDiskAudio
|
CheckDiskAudio
|
||||||
CheckDummyAudio
|
CheckDummyAudio
|
||||||
CheckDLOPEN
|
CheckDLOPEN
|
||||||
|
CheckO_CLOEXEC
|
||||||
CheckMETAL
|
CheckMETAL
|
||||||
CheckVulkan
|
CheckVulkan
|
||||||
CheckPTHREAD
|
CheckPTHREAD
|
||||||
|
@ -25749,6 +25782,7 @@ $as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h
|
||||||
CheckDiskAudio
|
CheckDiskAudio
|
||||||
CheckDummyAudio
|
CheckDummyAudio
|
||||||
CheckDLOPEN
|
CheckDLOPEN
|
||||||
|
CheckO_CLOEXEC
|
||||||
CheckCOCOA
|
CheckCOCOA
|
||||||
CheckMETAL
|
CheckMETAL
|
||||||
CheckX11
|
CheckX11
|
||||||
|
@ -25845,6 +25879,7 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h
|
||||||
CheckOffscreenVideo
|
CheckOffscreenVideo
|
||||||
CheckInputEvents
|
CheckInputEvents
|
||||||
CheckPTHREAD
|
CheckPTHREAD
|
||||||
|
CheckO_CLOEXEC
|
||||||
|
|
||||||
# Set up files for the timer library
|
# Set up files for the timer library
|
||||||
if test x$enable_timers = xyes; then
|
if test x$enable_timers = xyes; then
|
||||||
|
@ -25940,6 +25975,7 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h
|
||||||
CheckDiskAudio
|
CheckDiskAudio
|
||||||
CheckDummyAudio
|
CheckDummyAudio
|
||||||
CheckDLOPEN
|
CheckDLOPEN
|
||||||
|
CheckO_CLOEXEC
|
||||||
CheckOSS
|
CheckOSS
|
||||||
CheckPTHREAD
|
CheckPTHREAD
|
||||||
CheckClockGettime
|
CheckClockGettime
|
||||||
|
|
22
configure.ac
22
configure.ac
|
@ -1702,7 +1702,6 @@ CheckRPI()
|
||||||
#include <EGL/eglplatform.h>
|
#include <EGL/eglplatform.h>
|
||||||
]], [[
|
]], [[
|
||||||
EGL_DISPMANX_WINDOW_T window;
|
EGL_DISPMANX_WINDOW_T window;
|
||||||
|
|
||||||
bcm_host_init();
|
bcm_host_init();
|
||||||
]])], [have_video_rpi=yes],[])
|
]])], [have_video_rpi=yes],[])
|
||||||
AC_MSG_RESULT($have_video_rpi)
|
AC_MSG_RESULT($have_video_rpi)
|
||||||
|
@ -3296,6 +3295,19 @@ CheckDLOPEN()
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CheckO_CLOEXEC()
|
||||||
|
{
|
||||||
|
AC_MSG_CHECKING(for O_CLOEXEC)
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||||
|
#include <fcntl.h>
|
||||||
|
int flag = O_CLOEXEC;
|
||||||
|
]],[])], [have_o_cloexec=yes],[have_o_cloexec=no])
|
||||||
|
AC_MSG_RESULT($have_o_cloexec)
|
||||||
|
if test $have_o_cloexec = yes; then
|
||||||
|
AC_DEFINE(HAVE_O_CLOEXEC, 1, [ ])
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
dnl Check for the usbhid(3) library on *BSD
|
dnl Check for the usbhid(3) library on *BSD
|
||||||
CheckUSBHID()
|
CheckUSBHID()
|
||||||
{
|
{
|
||||||
|
@ -3630,6 +3642,7 @@ case "$host" in
|
||||||
CheckDLOPEN
|
CheckDLOPEN
|
||||||
CheckARM
|
CheckARM
|
||||||
CheckNEON
|
CheckNEON
|
||||||
|
CheckO_CLOEXEC
|
||||||
CheckOSS
|
CheckOSS
|
||||||
CheckALSA
|
CheckALSA
|
||||||
CheckPipewire
|
CheckPipewire
|
||||||
|
@ -3862,10 +3875,8 @@ case "$host" in
|
||||||
|
|
||||||
# Set up the core platform files
|
# Set up the core platform files
|
||||||
SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
|
SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
|
||||||
|
|
||||||
SOURCES="$SOURCES $srcdir/src/misc/windows/*.c"
|
SOURCES="$SOURCES $srcdir/src/misc/windows/*.c"
|
||||||
have_misc=yes
|
have_misc=yes
|
||||||
|
|
||||||
# Use the Windows locale APIs.
|
# Use the Windows locale APIs.
|
||||||
SOURCES="$SOURCES $srcdir/src/locale/windows/*.c"
|
SOURCES="$SOURCES $srcdir/src/locale/windows/*.c"
|
||||||
have_locale=yes
|
have_locale=yes
|
||||||
|
@ -4014,6 +4025,7 @@ case "$host" in
|
||||||
CheckDiskAudio
|
CheckDiskAudio
|
||||||
CheckDummyAudio
|
CheckDummyAudio
|
||||||
CheckDLOPEN
|
CheckDLOPEN
|
||||||
|
CheckO_CLOEXEC
|
||||||
CheckHaikuVideo
|
CheckHaikuVideo
|
||||||
CheckHaikuGL
|
CheckHaikuGL
|
||||||
CheckPTHREAD
|
CheckPTHREAD
|
||||||
|
@ -4071,6 +4083,7 @@ case "$host" in
|
||||||
CheckDiskAudio
|
CheckDiskAudio
|
||||||
CheckDummyAudio
|
CheckDummyAudio
|
||||||
CheckDLOPEN
|
CheckDLOPEN
|
||||||
|
CheckO_CLOEXEC
|
||||||
CheckMETAL
|
CheckMETAL
|
||||||
CheckVulkan
|
CheckVulkan
|
||||||
CheckPTHREAD
|
CheckPTHREAD
|
||||||
|
@ -4175,6 +4188,7 @@ case "$host" in
|
||||||
CheckDiskAudio
|
CheckDiskAudio
|
||||||
CheckDummyAudio
|
CheckDummyAudio
|
||||||
CheckDLOPEN
|
CheckDLOPEN
|
||||||
|
CheckO_CLOEXEC
|
||||||
CheckCOCOA
|
CheckCOCOA
|
||||||
CheckMETAL
|
CheckMETAL
|
||||||
CheckX11
|
CheckX11
|
||||||
|
@ -4259,6 +4273,7 @@ case "$host" in
|
||||||
CheckOffscreenVideo
|
CheckOffscreenVideo
|
||||||
CheckInputEvents
|
CheckInputEvents
|
||||||
CheckPTHREAD
|
CheckPTHREAD
|
||||||
|
CheckO_CLOEXEC
|
||||||
|
|
||||||
# Set up files for the timer library
|
# Set up files for the timer library
|
||||||
if test x$enable_timers = xyes; then
|
if test x$enable_timers = xyes; then
|
||||||
|
@ -4338,6 +4353,7 @@ case "$host" in
|
||||||
CheckDiskAudio
|
CheckDiskAudio
|
||||||
CheckDummyAudio
|
CheckDummyAudio
|
||||||
CheckDLOPEN
|
CheckDLOPEN
|
||||||
|
CheckO_CLOEXEC
|
||||||
CheckOSS
|
CheckOSS
|
||||||
CheckPTHREAD
|
CheckPTHREAD
|
||||||
CheckClockGettime
|
CheckClockGettime
|
||||||
|
|
|
@ -222,6 +222,7 @@
|
||||||
#cmakedefine HAVE_INOTIFY_INIT 1
|
#cmakedefine HAVE_INOTIFY_INIT 1
|
||||||
#cmakedefine HAVE_INOTIFY_INIT1 1
|
#cmakedefine HAVE_INOTIFY_INIT1 1
|
||||||
#cmakedefine HAVE_INOTIFY 1
|
#cmakedefine HAVE_INOTIFY 1
|
||||||
|
#cmakedefine HAVE_O_CLOEXEC 1
|
||||||
|
|
||||||
/* Apple platforms might be building universal binaries, where Intel builds
|
/* Apple platforms might be building universal binaries, where Intel builds
|
||||||
can use immintrin.h but other architectures can't. */
|
can use immintrin.h but other architectures can't. */
|
||||||
|
|
|
@ -215,6 +215,7 @@
|
||||||
#define HAVE_STDINT_H 1
|
#define HAVE_STDINT_H 1
|
||||||
#endif /* HAVE_LIBC */
|
#endif /* HAVE_LIBC */
|
||||||
|
|
||||||
|
#undef HAVE_O_CLOEXEC
|
||||||
#undef HAVE_ALTIVEC_H
|
#undef HAVE_ALTIVEC_H
|
||||||
#undef HAVE_DBUS_DBUS_H
|
#undef HAVE_DBUS_DBUS_H
|
||||||
#undef HAVE_FCITX
|
#undef HAVE_FCITX
|
||||||
|
@ -234,14 +235,13 @@
|
||||||
#undef HAVE_DXGI_H
|
#undef HAVE_DXGI_H
|
||||||
#undef HAVE_WINDOWS_GAMING_INPUT_H
|
#undef HAVE_WINDOWS_GAMING_INPUT_H
|
||||||
#undef HAVE_XINPUT_H
|
#undef HAVE_XINPUT_H
|
||||||
|
#undef HAVE_XINPUT_GAMEPAD_EX
|
||||||
|
#undef HAVE_XINPUT_STATE_EX
|
||||||
|
|
||||||
#undef HAVE_MMDEVICEAPI_H
|
#undef HAVE_MMDEVICEAPI_H
|
||||||
#undef HAVE_AUDIOCLIENT_H
|
#undef HAVE_AUDIOCLIENT_H
|
||||||
#undef HAVE_SENSORSAPI_H
|
#undef HAVE_SENSORSAPI_H
|
||||||
|
|
||||||
#undef HAVE_XINPUT_GAMEPAD_EX
|
|
||||||
#undef HAVE_XINPUT_STATE_EX
|
|
||||||
|
|
||||||
/* SDL internal assertion support */
|
/* SDL internal assertion support */
|
||||||
#undef SDL_DEFAULT_ASSERT_LEVEL
|
#undef SDL_DEFAULT_ASSERT_LEVEL
|
||||||
|
|
||||||
|
|
|
@ -144,6 +144,10 @@
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 1070)
|
||||||
|
#define HAVE_O_CLOEXEC 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#define HAVE_GCC_ATOMICS 1
|
#define HAVE_GCC_ATOMICS 1
|
||||||
|
|
||||||
/* Enable various audio drivers */
|
/* Enable various audio drivers */
|
||||||
|
|
|
@ -51,6 +51,10 @@
|
||||||
|
|
||||||
#include "SDL_config.h"
|
#include "SDL_config.h"
|
||||||
|
|
||||||
|
#ifndef HAVE_O_CLOEXEC
|
||||||
|
#define O_CLOEXEC 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/* A few #defines to reduce SDL2 footprint.
|
/* A few #defines to reduce SDL2 footprint.
|
||||||
Only effective when library is statically linked.
|
Only effective when library is statically linked.
|
||||||
You have to manually edit this file. */
|
You have to manually edit this file. */
|
||||||
|
|
Loading…
Reference in New Issue