summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-08-26 06:46:09 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-08-26 06:46:09 -0700
commite1d9261a6c0cacf922c7d189603bbd4bf0ba3017 (patch)
treeb6d7b8e0fecc2ba7273654eccc21f463e0994d0e /configure
parentc45fbf26af40b73202d42b6f0d5ef419e3412883 (diff)
downloadtxr-e1d9261a6c0cacf922c7d189603bbd4bf0ba3017.tar.gz
txr-e1d9261a6c0cacf922c7d189603bbd4bf0ba3017.tar.bz2
txr-e1d9261a6c0cacf922c7d189603bbd4bf0ba3017.zip
crypt: detect and use glibc's crypt_r.
* configure: New test for crypt_r, depositing HAVE_CRYPT_R preprocessor symbol in config.h. * sysif.c: Conditionally include <crypt.h> header. (crypt_wrap): Use crypt_r if HAVE_CRYPT_R is nonzero. (sysif_init): Register crypt intrinsic if we HAVE_CRYPT or if we HAVE_CRYPT_R.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure29
1 files changed, 29 insertions, 0 deletions
diff --git a/configure b/configure
index 4e33c2fa..e54eb2b5 100755
--- a/configure
+++ b/configure
@@ -2619,6 +2619,35 @@ for try_lcrypt in "" "-lcrypt" "no" ; do
fi
done
+printf "Checking for crypt_r ... "
+
+cat > conftest.c <<!
+#include <crypt.h>
+
+int main(void)
+{
+ static struct crypt_data cd;
+ char *c = crypt_r("foo", "bar", &cd);
+ return 0;
+}
+!
+
+for try_lcrypt in "" "-lcrypt" "no" ; do
+ if [ "$try_lcrypt" = "no" ] ; then
+ printf "no\n"
+ break
+ fi
+ if conftest EXTRA_LDFLAGS=$try_lcrypt; then
+ printf "yes\n"
+ printf "#define HAVE_CRYPT_R 1\n" >> config.h
+ if [ -n "$try_lcrypt" ] ; then
+ conf_ldflags="${conf_ldflags:+"$conf_ldflags "}-lcrypt"
+ fi
+ break;
+ fi
+done
+
+
printf "Checking for alloca ... "
for try_header in stdlib alloca malloc ; do