summaryrefslogtreecommitdiff
path: root/ext/standard/config.m4
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/config.m4')
-rw-r--r--ext/standard/config.m4192
1 files changed, 70 insertions, 122 deletions
diff --git a/ext/standard/config.m4 b/ext/standard/config.m4
index c435f96554..26eb056321 100644
--- a/ext/standard/config.m4
+++ b/ext/standard/config.m4
@@ -69,11 +69,12 @@ AC_CACHE_CHECK(for standard DES crypt, ac_cv_crypt_des,[
#include <crypt.h>
#endif
-main() {
+int main() {
#if HAVE_CRYPT
- exit (strcmp((char *)crypt("rasmuslerdorf","rl"),"rl.3StKT.4T8M"));
+ char *encrypted = crypt("rasmuslerdorf","rl");
+ exit(!encrypted || strcmp(encrypted,"rl.3StKT.4T8M"));
#else
- exit(0);
+ exit(1);
#endif
}],[
ac_cv_crypt_des=yes
@@ -93,11 +94,12 @@ AC_CACHE_CHECK(for extended DES crypt, ac_cv_crypt_ext_des,[
#include <crypt.h>
#endif
-main() {
+int main() {
#if HAVE_CRYPT
- exit (strcmp((char *)crypt("rasmuslerdorf","_J9..rasm"),"_J9..rasmBYk8r9AiWNc"));
+ char *encrypted = crypt("rasmuslerdorf","_J9..rasm");
+ exit(!encrypted || strcmp(encrypted,"_J9..rasmBYk8r9AiWNc"));
#else
- exit(0);
+ exit(1);
#endif
}],[
ac_cv_crypt_ext_des=yes
@@ -117,20 +119,22 @@ AC_TRY_RUN([
#include <crypt.h>
#endif
-main() {
+int main() {
#if HAVE_CRYPT
- char salt[15], answer[40];
-
- salt[0]='$'; salt[1]='1'; salt[2]='$';
- salt[3]='r'; salt[4]='a'; salt[5]='s';
- salt[6]='m'; salt[7]='u'; salt[8]='s';
- salt[9]='l'; salt[10]='e'; salt[11]='$';
- salt[12]='\0';
- strcpy(answer,salt);
- strcat(answer,"rISCgZzpwk3UhDidwXvin0");
- exit (strcmp((char *)crypt("rasmuslerdorf",salt),answer));
+ char salt[15], answer[40];
+ char *encrypted;
+
+ salt[0]='$'; salt[1]='1'; salt[2]='$';
+ salt[3]='r'; salt[4]='a'; salt[5]='s';
+ salt[6]='m'; salt[7]='u'; salt[8]='s';
+ salt[9]='l'; salt[10]='e'; salt[11]='$';
+ salt[12]='\0';
+ strcpy(answer,salt);
+ strcat(answer,"rISCgZzpwk3UhDidwXvin0");
+ encrypted = crypt("rasmuslerdorf",salt);
+ exit(!encrypted || strcmp(encrypted,answer));
#else
- exit(0);
+ exit(1);
#endif
}],[
ac_cv_crypt_md5=yes
@@ -150,17 +154,19 @@ AC_TRY_RUN([
#include <crypt.h>
#endif
-main() {
+int main() {
#if HAVE_CRYPT
- char salt[30], answer[70];
-
- salt[0]='$'; salt[1]='2'; salt[2]='a'; salt[3]='$'; salt[4]='0'; salt[5]='7'; salt[6]='$'; salt[7]='\0';
- strcat(salt,"rasmuslerd............");
- strcpy(answer,salt);
- strcpy(&answer[29],"nIdrcHdxcUxWomQX9j6kvERCFjTg7Ra");
- exit (strcmp((char *)crypt("rasmuslerdorf",salt),answer));
+ char salt[30], answer[70];
+ char *encrypted;
+
+ salt[0]='$'; salt[1]='2'; salt[2]='a'; salt[3]='$'; salt[4]='0'; salt[5]='7'; salt[6]='$'; salt[7]='\0';
+ strcat(salt,"rasmuslerd............");
+ strcpy(answer,salt);
+ strcpy(&answer[29],"nIdrcHdxcUxWomQX9j6kvERCFjTg7Ra");
+ encrypted = crypt("rasmuslerdorf",salt);
+ exit(!encrypted || strcmp(encrypted,answer));
#else
- exit(0);
+ exit(1);
#endif
}],[
ac_cv_crypt_blowfish=yes
@@ -180,16 +186,18 @@ AC_TRY_RUN([
#include <crypt.h>
#endif
-main() {
+int main() {
#if HAVE_CRYPT
- char salt[21], answer[21+86];
-
- strcpy(salt,"\$6\$rasmuslerdorf\$");
- strcpy(answer, salt);
- strcat(answer, "EeHCRjm0bljalWuALHSTs1NB9ipEiLEXLhYeXdOpx22gmlmVejnVXFhd84cEKbYxCo.XuUTrW.RLraeEnsvWs/");
- exit (strcmp((char *)crypt("rasmuslerdorf",salt),answer));
+ char salt[21], answer[21+86];
+ char *encrypted;
+
+ strcpy(salt,"\$6\$rasmuslerdorf\$");
+ strcpy(answer, salt);
+ strcat(answer, "EeHCRjm0bljalWuALHSTs1NB9ipEiLEXLhYeXdOpx22gmlmVejnVXFhd84cEKbYxCo.XuUTrW.RLraeEnsvWs/");
+ encrypted = crypt("rasmuslerdorf",salt);
+ exit(!encrypted || strcmp(encrypted,answer));
#else
- exit(0);
+ exit(1);
#endif
}],[
ac_cv_crypt_sha512=yes
@@ -209,17 +217,18 @@ AC_TRY_RUN([
#include <crypt.h>
#endif
-main() {
+int main() {
#if HAVE_CRYPT
- char salt[21], answer[21+43];
-
- strcpy(salt,"\$5\$rasmuslerdorf\$");
- strcpy(answer, salt);
- strcat(answer, "cFAm2puLCujQ9t.0CxiFIIvFi4JyQx5UncCt/xRIX23");
- exit (strcmp((char *)crypt("rasmuslerdorf",salt),answer));
-
+ char salt[21], answer[21+43];
+ char *encrypted;
+
+ strcpy(salt,"\$5\$rasmuslerdorf\$");
+ strcpy(answer, salt);
+ strcat(answer, "cFAm2puLCujQ9t.0CxiFIIvFi4JyQx5UncCt/xRIX23");
+ encrypted = crypt("rasmuslerdorf",salt);
+ exit(!encrypted || strcmp(encrypted,answer));
#else
- exit(0);
+ exit(1);
#endif
}],[
ac_cv_crypt_sha256=yes
@@ -233,7 +242,7 @@ main() {
dnl
dnl If one of them is missing, use our own implementation, portable code is then possible
dnl
-if test "$ac_cv_crypt_blowfish" = "no" || test "$ac_cv_crypt_des" = "no" || test "$ac_cv_crypt_ext_des" = "no" || test "x$php_crypt_r" = "x0"; then
+if test "$ac_cv_crypt_blowfish" = "no" || test "$ac_cv_crypt_des" = "no" || test "$ac_cv_crypt_ext_des" = "no" || test "$ac_cv_crypt_md5" = "no" || test "$ac_cv_crypt_sha512" = "no" || test "$ac_cv_crypt_sha256" = "no" || test "x$php_crypt_r" = "x0"; then
dnl
dnl Check for __alignof__ support in the compiler
@@ -251,90 +260,29 @@ if test "$ac_cv_crypt_blowfish" = "no" || test "$ac_cv_crypt_des" = "no" || test
AC_DEFINE([HAVE_ALIGNOF], 1, [whether the compiler supports __alignof__])
fi
- dnl
- dnl Check for __attribute__ ((__aligned__)) support in the compiler
- dnl
- AC_CACHE_CHECK(whether the compiler supports aligned attribute, ac_cv_attribute_aligned,[
- AC_TRY_COMPILE([
- ],[
- unsigned char test[32] __attribute__ ((__aligned__ (__alignof__ (int))));
- ],[
- ac_cv_attribute_aligned=yes
- ],[
- ac_cv_attribute_aligned=no
- ])])
- if test "$ac_cv_attribute_aligned" = "yes"; then
- AC_DEFINE([HAVE_ATTRIBUTE_ALIGNED], 1, [whether the compiler supports __attribute__ ((__aligned__))])
- fi
-
-
AC_DEFINE_UNQUOTED(PHP_USE_PHP_CRYPT_R, 1, [Whether PHP has to use its own crypt_r for blowfish, des, ext des and md5])
- AC_DEFINE_UNQUOTED(PHP_STD_DES_CRYPT, 1, [Whether the system supports standard DES salt])
- AC_DEFINE_UNQUOTED(PHP_BLOWFISH_CRYPT, 1, [Whether the system supports BlowFish salt])
- AC_DEFINE_UNQUOTED(PHP_EXT_DES_CRYPT, 1, [Whether the system supports extended DES salt])
- AC_DEFINE_UNQUOTED(PHP_MD5_CRYPT, 1, [Whether the system supports MD5 salt])
- AC_DEFINE_UNQUOTED(PHP_SHA512_CRYPT, 1, [Whether the system supports SHA512 salt])
- AC_DEFINE_UNQUOTED(PHP_SHA256_CRYPT, 1, [Whether the system supports SHA256 salt])
PHP_ADD_SOURCES(PHP_EXT_DIR(standard), crypt_freesec.c crypt_blowfish.c crypt_sha512.c crypt_sha256.c php_crypt_r.c)
else
- if test "$ac_cv_crypt_des" = "yes"; then
- ac_result=1
- ac_crypt_des=1
- else
- ac_result=0
- ac_crypt_des=0
- fi
- AC_DEFINE_UNQUOTED(PHP_STD_DES_CRYPT, $ac_result, [Whether the system supports standard DES salt])
-
- if test "$ac_cv_crypt_blowfish" = "yes"; then
- ac_result=1
- ac_crypt_blowfish=1
- else
- ac_result=0
- ac_crypt_blowfish=0
- fi
- AC_DEFINE_UNQUOTED(PHP_BLOWFISH_CRYPT, $ac_result, [Whether the system supports BlowFish salt])
-
- if test "$ac_cv_crypt_ext_des" = "yes"; then
- ac_result=1
- ac_crypt_edes=1
- else
- ac_result=0
- ac_crypt_edes=0
- fi
- AC_DEFINE_UNQUOTED(PHP_EXT_DES_CRYPT, $ac_result, [Whether the system supports extended DES salt])
-
- if test "$ac_cv_crypt_md5" = "yes"; then
- ac_result=1
- ac_crypt_md5=1
- else
- ac_result=0
- ac_crypt_md5=0
- fi
- AC_DEFINE_UNQUOTED(PHP_MD5_CRYPT, $ac_result, [Whether the system supports MD5 salt])
-
- if test "$ac_cv_crypt_sha512" = "yes"; then
- ac_result=1
- ac_crypt_sha512=1
- else
- ac_result=0
- ac_crypt_sha512=0
- fi
- AC_DEFINE_UNQUOTED(PHP_SHA512_CRYPT, $ac_result, [Whether the system supports SHA512 salt])
-
- if test "$ac_cv_crypt_sha256" = "yes"; then
- ac_result=1
- ac_crypt_sha256=1
- else
- ac_result=0
- ac_crypt_sha256=0
- fi
- AC_DEFINE_UNQUOTED(PHP_SHA256_CRYPT, $ac_result, [Whether the system supports SHA256 salt])
-
AC_DEFINE_UNQUOTED(PHP_USE_PHP_CRYPT_R, 0, [Whether PHP has to use its own crypt_r for blowfish, des and ext des])
fi
+dnl
+dnl Check for __attribute__ ((__aligned__)) support in the compiler
+dnl
+AC_CACHE_CHECK(whether the compiler supports aligned attribute, ac_cv_attribute_aligned,[
+AC_TRY_COMPILE([
+],[
+ unsigned char test[32] __attribute__ ((__aligned__ (__alignof__ (int))));
+],[
+ ac_cv_attribute_aligned=yes
+],[
+ ac_cv_attribute_aligned=no
+])])
+if test "$ac_cv_attribute_aligned" = "yes"; then
+ AC_DEFINE([HAVE_ATTRIBUTE_ALIGNED], 1, [whether the compiler supports __attribute__ ((__aligned__))])
+fi
+
dnl
dnl Check for available functions
dnl