Browse Source

Use _Exit() when available

Sam Lantinga 6 years ago
parent
commit
f79190f407
6 changed files with 36 additions and 3 deletions
  1. 1 1
      CMakeLists.txt
  2. 28 1
      configure
  3. 1 1
      configure.ac
  4. 1 0
      include/SDL_config.h.cmake
  5. 1 0
      include/SDL_config.h.in
  6. 4 0
      src/SDL_assert.c

+ 1 - 1
CMakeLists.txt

@@ -699,7 +699,7 @@ if(LIBC)
             _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull
             atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp
             vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp
-            nanosleep sysconf sysctlbyname getauxval poll
+            nanosleep sysconf sysctlbyname getauxval poll _Exit
             )
       string(TOUPPER ${_FN} _UPPER)
       set(_HAVEVAR "HAVE_${_UPPER}")

+ 28 - 1
configure

@@ -651,6 +651,7 @@ SDL_RLD_FLAGS
 SDL_STATIC_LIBS
 SDL_LIBS
 SDL_CFLAGS
+INSTALL_SDL2_CONFIG
 LIBUSB_LIBS
 LIBUSB_CFLAGS
 FCITX_LIBS
@@ -896,6 +897,7 @@ enable_rpath
 enable_backgrounding_signal
 enable_foregrounding_signal
 enable_render_d3d
+enable_sdl2_config
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1684,6 +1686,7 @@ Optional Features:
                           number to use for magic foregrounding signal or 'no'
                           [[default=no]]
   --enable-render-d3d     enable the Direct3D render driver [[default=yes]]
+  --enable-sdl2-config    Install sdl2-config [default=yes]
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -16969,7 +16972,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 
-    for ac_func in malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcscmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval poll
+    for ac_func in malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcscmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval poll _Exit
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -25165,6 +25168,30 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h
         ;;
 esac
 
+# Check whether to install sdl2-config
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to install sdl2-config" >&5
+$as_echo_n "checking whether to install sdl2-config... " >&6; }
+# Check whether --enable-sdl2-config was given.
+if test "${enable_sdl2_config+set}" = set; then :
+  enableval=$enable_sdl2_config; case "${enableval}" in
+        yes) enable_sdl2_config="TRUE" ;;
+        no) enable_sdl2_config="FALSE" ;;
+        *) as_fn_error $? "bad value '${enableval}' for --enable-sdl2-config" "$LINENO" 5 ;;
+    esac
+else
+  enable_sdl2_config="TRUE"
+fi
+
+if test "$enable_sdl2_config" = "TRUE"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+INSTALL_SDL2_CONFIG=$enable_sdl2_config
+
+
 # Verify that we have all the platform specific files we need
 
 if test x$have_joystick != xyes; then

+ 1 - 1
configure.ac

@@ -335,7 +335,7 @@ if test x$enable_libc = xyes; then
         AC_DEFINE(HAVE_MPROTECT, 1, [ ])
         ]),
     )
-    AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcscmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval poll)
+    AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcscmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval poll _Exit)
 
     AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
     AC_CHECK_FUNCS(acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf exp expf fabs fabsf floor floorf fmod fmodf log logf log10 log10f pow powf scalbn scalbnf sin sinf sqrt sqrtf tan tanf)

+ 1 - 0
include/SDL_config.h.cmake

@@ -184,6 +184,7 @@
 #cmakedefine HAVE_SEM_TIMEDWAIT 1
 #cmakedefine HAVE_GETAUXVAL 1
 #cmakedefine HAVE_POLL 1
+#cmakedefine HAVE__EXIT 1
 
 #elif __WIN32__
 #cmakedefine HAVE_STDARG_H 1

+ 1 - 0
include/SDL_config.h.in

@@ -189,6 +189,7 @@
 #undef HAVE_SEM_TIMEDWAIT
 #undef HAVE_GETAUXVAL
 #undef HAVE_POLL
+#undef HAVE__EXIT
 
 #else
 #define HAVE_STDARG_H   1

+ 4 - 0
src/SDL_assert.c

@@ -135,9 +135,13 @@ static void SDL_ExitProcess(int exitcode)
     emscripten_cancel_main_loop();  /* this should "kill" the app. */
     emscripten_force_exit(exitcode);  /* this should "kill" the app. */
     exit(exitcode);
+#else
+#ifdef HAVE__EXIT /* Upper case _Exit() */
+    _Exit(exitcode);
 #else
     _exit(exitcode);
 #endif
+#endif
 }