summaryrefslogtreecommitdiff
path: root/Configure
diff options
context:
space:
mode:
authorAndy Dougherty <doughera@lafayette.edu>2019-08-27 12:58:23 -0400
committerAndy Dougherty <doughera@lafayette.edu>2019-12-29 17:39:32 -0500
commit793824db103f6f9040802055098223c7ab840ea4 (patch)
treecfee9c7ca7066514d3b32e5ead9f31164032825b /Configure
parentf16c94bc75aefb81949b423b399fac4071859f6d (diff)
downloadperl-793824db103f6f9040802055098223c7ab840ea4.tar.gz
Use a compile and run test for lchown() to satisfy clang++.
For glibc, previous reports were that some functions (such as lchown()) are present in libc, but are unimplemented. That is, they always fail and set errno=ENOSYS. Unfortunately, the stub test doesn't work under clang++. Thus use a compile and run test. This should be more reliable.
Diffstat (limited to 'Configure')
-rwxr-xr-xConfigure33
1 files changed, 15 insertions, 18 deletions
diff --git a/Configure b/Configure
index 65e624b353..f01786eee2 100755
--- a/Configure
+++ b/Configure
@@ -15905,27 +15905,24 @@ esac
: see if lchown exists
echo " "
-$cat > try.c <<'EOCP'
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char lchown(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char lchown();
-int main() {
- /* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_lchown) || defined (__stub___lchown)
-choke me
-#else
-lchown();
+$cat > try.c <<EOCP
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#$i_unistd I_UNISTD
+#ifdef I_UNISTD
+# include <unistd.h>
#endif
-; return 0; }
+int main(int argc, char *argv[])
+{
+ if (lchown("./try.c", -1, getgid()) == -1) {
+ exit(EXIT_FAILURE);
+ }
+ exit(EXIT_SUCCESS);
+}
EOCP
set try
-if eval $compile; then
+if eval $compile && ./try; then
$echo "lchown() found." >&4
val="$define"
else