You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.9 KiB

  1. From dec5f888a457e36d81065ebc69f7d8d966be527d Mon Sep 17 00:00:00 2001
  2. From: Daiki Ueno <dueno@redhat.com>
  3. Date: Thu, 31 May 2018 11:02:51 +0200
  4. Subject: [PATCH] build: Ease issetugid() check when cross-compiling
  5. When cross-compiling, the configure check for issetugid() aborts,
  6. because of the pessimistic default of AC_RUN_IFELSE. This patch
  7. provides the non-pessimistic default to AC_RUN_IFELSE and wrap the
  8. macro invocation with AC_CACHE_CHECK so that the user can override the
  9. check by setting ac_cv_issetugid_openbsd=yes, as suggested in:
  10. https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Runtime.html#Runtime
  11. ---
  12. configure.ac | 16 +++++++++-------
  13. 1 file changed, 9 insertions(+), 7 deletions(-)
  14. diff --git a/configure.ac b/configure.ac
  15. index e99a3c7..bd6ece0 100644
  16. --- a/configure.ac
  17. +++ b/configure.ac
  18. @@ -115,15 +115,17 @@ if test "$os_unix" = "yes"; then
  19. # Check if issetugid() is available and has compatible behavior with OpenBSD
  20. AC_CHECK_FUNCS([issetugid], [
  21. - AC_MSG_CHECKING([whether issetugid() can detect setuid/setgid])
  22. - issetugid_openbsd=no
  23. - AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]],
  24. - [[return issetugid ();]])],
  25. - [chmod 02777 ./conftest$EXEEXT; ./conftest$EXEEXT || issetugid_openbsd=yes])
  26. - if test "$issetugid_openbsd" = yes; then
  27. + AC_CACHE_CHECK([whether issetugid() can detect setuid/setgid],
  28. + [ac_cv_issetugid_openbsd],
  29. + [ac_cv_issetugid_openbsd=no
  30. + AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]],
  31. + [[return issetugid ();]])],
  32. + [chmod 02777 ./conftest$EXEEXT; ./conftest$EXEEXT || ac_cv_issetugid_openbsd=yes],
  33. + [ac_cv_issetugid_openbsd=no],
  34. + [ac_cv_issetugid_openbsd="guessing no"])])
  35. + if test "$ac_cv_issetugid_openbsd" = yes; then
  36. AC_DEFINE([HAVE_ISSETUGID_OPENBSD], [1], [Whether issetugid() has compatible behavior with OpenBSD])
  37. fi
  38. - AC_MSG_RESULT([$issetugid_openbsd])
  39. ])
  40. # Required functions
  41. --
  42. 2.17.1