Skip to content

Commit e4f961b

Browse files
authored
improve alignment autoconf test (python#1129)
Replace the deprecated AC_TRY_RUN with AC_RUN_IFELSE. Also, standardize the variable name and allow for caching of the result.
1 parent ce040f6 commit e4f961b

File tree

3 files changed

+36
-22
lines changed

3 files changed

+36
-22
lines changed

Diff for: aclocal.m4

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
1515
dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
16-
dnl serial 11 (pkg-config-0.29)
16+
dnl serial 11 (pkg-config-0.29.1)
1717
dnl
1818
dnl Copyright © 2004 Scott James Remnant <[email protected]>.
1919
dnl Copyright © 2012-2015 Dan Nicholson <[email protected]>
@@ -55,7 +55,7 @@ dnl
5555
dnl See the "Since" comment for each macro you use to see what version
5656
dnl of the macros you require.
5757
m4_defun([PKG_PREREQ],
58-
[m4_define([PKG_MACROS_VERSION], [0.29])
58+
[m4_define([PKG_MACROS_VERSION], [0.29.1])
5959
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
6060
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
6161
])dnl PKG_PREREQ

Diff for: configure

+25-10
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,7 @@ infodir
784784
docdir
785785
oldincludedir
786786
includedir
787+
runstatedir
787788
localstatedir
788789
sharedstatedir
789790
sysconfdir
@@ -894,6 +895,7 @@ datadir='${datarootdir}'
894895
sysconfdir='${prefix}/etc'
895896
sharedstatedir='${prefix}/com'
896897
localstatedir='${prefix}/var'
898+
runstatedir='${localstatedir}/run'
897899
includedir='${prefix}/include'
898900
oldincludedir='/usr/include'
899901
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1146,6 +1148,15 @@ do
11461148
| -silent | --silent | --silen | --sile | --sil)
11471149
silent=yes ;;
11481150

1151+
-runstatedir | --runstatedir | --runstatedi | --runstated \
1152+
| --runstate | --runstat | --runsta | --runst | --runs \
1153+
| --run | --ru | --r)
1154+
ac_prev=runstatedir ;;
1155+
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
1156+
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
1157+
| --run=* | --ru=* | --r=*)
1158+
runstatedir=$ac_optarg ;;
1159+
11491160
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
11501161
ac_prev=sbindir ;;
11511162
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1283,7 +1294,7 @@ fi
12831294
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
12841295
datadir sysconfdir sharedstatedir localstatedir includedir \
12851296
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
1286-
libdir localedir mandir
1297+
libdir localedir mandir runstatedir
12871298
do
12881299
eval ac_val=\$$ac_var
12891300
# Remove trailing slashes.
@@ -1436,6 +1447,7 @@ Fine tuning of the installation directories:
14361447
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
14371448
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
14381449
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
1450+
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
14391451
--libdir=DIR object code libraries [EPREFIX/lib]
14401452
--includedir=DIR C header files [PREFIX/include]
14411453
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -9738,8 +9750,11 @@ esac
97389750
# check for systems that require aligned memory access
97399751
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking aligned memory access is required" >&5
97409752
$as_echo_n "checking aligned memory access is required... " >&6; }
9741-
if test "$cross_compiling" = yes; then :
9742-
aligned_required=yes
9753+
if ${ac_cv_aligned_required+:} false; then :
9754+
$as_echo_n "(cached) " >&6
9755+
else
9756+
if test "$cross_compiling" = yes; then :
9757+
ac_cv_aligned_required=yes
97439758
else
97449759
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
97459760
/* end confdefs.h. */
@@ -9756,26 +9771,26 @@ int main()
97569771
return 1;
97579772
return 0;
97589773
}
9759-
97609774
_ACEOF
97619775
if ac_fn_c_try_run "$LINENO"; then :
9762-
aligned_required=no
9776+
ac_cv_aligned_required=no
97639777
else
9764-
aligned_required=yes
9778+
ac_cv_aligned_required=yes
97659779
fi
97669780
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
97679781
conftest.$ac_objext conftest.beam conftest.$ac_ext
97689782
fi
97699783

97709784

9771-
if test "$aligned_required" = yes ; then
9785+
fi
9786+
9787+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_aligned_required" >&5
9788+
$as_echo "$ac_cv_aligned_required" >&6; }
9789+
if test "$ac_cv_aligned_required" = yes ; then
97729790

97739791
$as_echo "#define HAVE_ALIGNED_REQUIRED 1" >>confdefs.h
97749792

97759793
fi
9776-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $aligned_required" >&5
9777-
$as_echo "$aligned_required" >&6; }
9778-
97799794

97809795
# str, bytes and memoryview hash algorithm
97819796

Diff for: configure.ac

+9-10
Original file line numberDiff line numberDiff line change
@@ -2716,7 +2716,8 @@ esac
27162716

27172717
# check for systems that require aligned memory access
27182718
AC_MSG_CHECKING(aligned memory access is required)
2719-
AC_TRY_RUN([
2719+
AC_CACHE_VAL(ac_cv_aligned_required,
2720+
[AC_RUN_IFELSE([AC_LANG_SOURCE([[
27202721
int main()
27212722
{
27222723
char s[16];
@@ -2728,18 +2729,16 @@ int main()
27282729
if (*p1 == *p2)
27292730
return 1;
27302731
return 0;
2731-
}
2732-
],
2733-
[aligned_required=no],
2734-
[aligned_required=yes],
2735-
[aligned_required=yes])
2736-
2737-
if test "$aligned_required" = yes ; then
2732+
}]])],
2733+
[ac_cv_aligned_required=no],
2734+
[ac_cv_aligned_required=yes],
2735+
[ac_cv_aligned_required=yes])
2736+
])
2737+
AC_MSG_RESULT($ac_cv_aligned_required)
2738+
if test "$ac_cv_aligned_required" = yes ; then
27382739
AC_DEFINE([HAVE_ALIGNED_REQUIRED], [1],
27392740
[Define if aligned memory access is required])
27402741
fi
2741-
AC_MSG_RESULT($aligned_required)
2742-
27432742

27442743
# str, bytes and memoryview hash algorithm
27452744
AH_TEMPLATE(Py_HASH_ALGORITHM,

0 commit comments

Comments
 (0)