Skip to content

Commit d7cd155

Browse files
authored
Autotools: Refactor cache variables in configure.ac and ext/ldap (#14784)
- Cache variables ac_cv_ renamed on few places to php_cv_ - Over-quoted arguments reduced - AS_VAR_IF and CS synced
1 parent a86163a commit d7cd155

File tree

2 files changed

+45
-38
lines changed

2 files changed

+45
-38
lines changed

configure.ac

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -519,19 +519,17 @@ dnl Check AVX512 VBMI
519519
PHP_CHECK_AVX512_VBMI_SUPPORTS
520520

521521
dnl Check for __alignof__ support in the compiler
522-
AC_CACHE_CHECK(whether the compiler supports __alignof__, ac_cv_alignof_exists,[
523-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
524-
]],[[
522+
AC_CACHE_CHECK([whether the compiler supports __alignof__],
523+
[php_cv_have_alignof],
524+
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
525525
int align = __alignof__(int);
526526
(void)align;
527-
]])],[
528-
ac_cv_alignof_exists=yes
529-
],[
530-
ac_cv_alignof_exists=no
531-
])])
532-
if test "$ac_cv_alignof_exists" = "yes"; then
533-
AC_DEFINE([HAVE_ALIGNOF], 1, [whether the compiler supports __alignof__])
534-
fi
527+
])],
528+
[php_cv_have_alignof=yes],
529+
[php_cv_have_alignof=no])])
530+
AS_VAR_IF([php_cv_have_alignof], [yes],
531+
[AC_DEFINE([HAVE_ALIGNOF], [1],
532+
[Define to 1 if the compiler supports '__alignof__'.])])
535533

536534
dnl Check for structure members.
537535
AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[#include <time.h>])
@@ -700,8 +698,8 @@ AS_VAR_IF([php_cv_func_getaddrinfo], [yes],
700698

701699
dnl on FreeBSD, copy_file_range() works only with the undocumented flag 0x01000000;
702700
dnl until the problem is fixed properly, copy_file_range() is used only on Linux
703-
AC_CACHE_CHECK([for copy_file_range], ac_cv_copy_file_range,
704-
[AC_RUN_IFELSE([AC_LANG_SOURCE([[
701+
AC_CACHE_CHECK([for copy_file_range], [php_cv_func_copy_file_range],
702+
[AC_RUN_IFELSE([AC_LANG_SOURCE([
705703
#ifdef __linux__
706704
#ifndef _GNU_SOURCE
707705
#define _GNU_SOURCE
@@ -720,37 +718,43 @@ return 0;
720718
#else
721719
#error "unsupported platform"
722720
#endif
723-
]])], [ac_cv_copy_file_range=yes], [ac_cv_copy_file_range=no], [ac_cv_copy_file_range=no])
721+
])],
722+
[php_cv_func_copy_file_range=yes],
723+
[php_cv_func_copy_file_range=no],
724+
[php_cv_func_copy_file_range=no])
724725
])
725-
726-
if test "$ac_cv_copy_file_range" = yes; then
727-
AC_DEFINE(HAVE_COPY_FILE_RANGE,1,[Define if copy_file_range support])
728-
fi
726+
AS_VAR_IF([php_cv_func_copy_file_range], [yes],
727+
[AC_DEFINE([HAVE_COPY_FILE_RANGE], [1],
728+
[Define to 1 if you have the 'copy_file_range' function.])])
729729

730730
AC_REPLACE_FUNCS(strlcat strlcpy explicit_bzero getopt)
731731
AC_FUNC_ALLOCA
732732
PHP_TIME_R_TYPE
733733

734-
AC_CACHE_CHECK([for aarch64 CRC32 API], ac_cv_func___crc32d,
735-
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <arm_acle.h>]],[[__crc32d(0, 0);]])],[ac_cv_func___crc32d=yes],[ac_cv_func___crc32d="no"])])
736-
if test "$ac_cv_func___crc32d" = "yes"; then
737-
AC_DEFINE([HAVE_AARCH64_CRC32], [1], [Define when aarch64 CRC32 API is available.])
738-
fi
734+
AC_CACHE_CHECK([for aarch64 CRC32 API], [php_cv_func___crc32d],
735+
[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <arm_acle.h>], [__crc32d(0, 0);])],
736+
[php_cv_func___crc32d=yes],
737+
[php_cv_func___crc32d=no])])
738+
AS_VAR_IF([php_cv_func___crc32d], [yes],
739+
[AC_DEFINE([HAVE_AARCH64_CRC32], [1],
740+
[Define to 1 when aarch64 CRC32 API is available.])])
739741

740742
dnl Check for asm goto support.
741-
AC_CACHE_CHECK([for asm goto], [ac_cv__asm_goto],
742-
[AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
743+
AC_CACHE_CHECK([for asm goto], [php_cv_have__asm_goto],
744+
[AC_LINK_IFELSE([AC_LANG_PROGRAM([], [
743745
#if defined(__x86_64__) || defined(__i386__)
744-
__asm__ goto("jmp %l0\n" :::: end);
746+
__asm__ goto("jmp %l0\n" :::: end);
745747
#elif defined(__aarch64__)
746-
__asm__ goto("b %l0\n" :::: end);
748+
__asm__ goto("b %l0\n" :::: end);
747749
#endif
748750
end:
749-
return 0;
750-
]])], [ac_cv__asm_goto=yes], [ac_cv__asm_goto=no])])
751-
if test "$ac_cv__asm_goto" = yes; then
752-
AC_DEFINE([HAVE_ASM_GOTO], [1], [Define if asm goto support is available.])
753-
fi
751+
return 0;
752+
])],
753+
[php_cv_have__asm_goto=yes],
754+
[php_cv_have__asm_goto=no])])
755+
AS_VAR_IF([php_cv_have__asm_goto], [yes],
756+
[AC_DEFINE([HAVE_ASM_GOTO], [1],
757+
[Define to 1 if asm goto support is available.])])
754758

755759
dnl Check Valgrind support.
756760
PHP_ARG_WITH([valgrind],

ext/ldap/config.m4

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,15 @@ if test "$PHP_LDAP" != "no"; then
102102
LIBS="$LIBS $LDAP_SHARED_LIBADD"
103103

104104
dnl Check for 3 arg ldap_set_rebind_proc
105-
AC_CACHE_CHECK([for 3 arg ldap_set_rebind_proc], ac_cv_3arg_setrebindproc,
106-
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <ldap.h>]], [[ldap_set_rebind_proc(0,0,0)]])],
107-
[ac_cv_3arg_setrebindproc=yes], [ac_cv_3arg_setrebindproc=no])])
108-
if test "$ac_cv_3arg_setrebindproc" = yes; then
109-
AC_DEFINE(HAVE_3ARG_SETREBINDPROC,1,[Whether 3 arg set_rebind_proc()])
110-
fi
105+
AC_CACHE_CHECK([for 3 arg ldap_set_rebind_proc],
106+
[php_cv_have_3arg_setrebindproc],
107+
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <ldap.h>],
108+
[ldap_set_rebind_proc(0,0,0)])],
109+
[php_cv_have_3arg_setrebindproc=yes],
110+
[php_cv_have_3arg_setrebindproc=no])])
111+
AS_VAR_IF([php_cv_have_3arg_setrebindproc], [yes],
112+
[AC_DEFINE([HAVE_3ARG_SETREBINDPROC], [1],
113+
[Define to 1 if 'ldap_set_rebind_proc' has 3 arguments.])])
111114

112115
dnl Solaris 2.8 claims to be 2004 API, but doesn't have ldap_parse_reference()
113116
dnl nor ldap_start_tls_s()

0 commit comments

Comments
 (0)