diff options
Diffstat (limited to 'm4')
-rw-r--r-- | m4/ax_add_fortify_source.m4 | 4 | ||||
-rw-r--r-- | m4/ax_boost_base.m4 | 4 | ||||
-rw-r--r-- | m4/ax_c99_inline.m4 | 10 | ||||
-rw-r--r-- | m4/ax_c_restrict.m4 | 62 | ||||
-rw-r--r-- | m4/ax_c_var_func.m4 | 4 | ||||
-rw-r--r-- | m4/ax_check_posix_regcomp.m4 | 4 | ||||
-rw-r--r-- | m4/ax_check_posix_sysinfo.m4 | 4 | ||||
-rw-r--r-- | m4/ax_check_strftime.m4 | 3 | ||||
-rw-r--r-- | m4/ax_check_uname_syscall.m4 | 4 | ||||
-rw-r--r-- | m4/ax_cpu_freq.m4 | 6 | ||||
-rw-r--r-- | m4/ax_cxx_compile_stdcxx.m4 | 15 | ||||
-rw-r--r-- | m4/ax_func_memmove.m4 | 4 | ||||
-rw-r--r-- | m4/ax_func_snprintf.m4 | 7 | ||||
-rw-r--r-- | m4/ax_ms_cpprest.m4 | 4 | ||||
-rw-r--r-- | m4/ax_pkg_swig.m4 | 5 |
15 files changed, 110 insertions, 30 deletions
diff --git a/m4/ax_add_fortify_source.m4 b/m4/ax_add_fortify_source.m4 index 1266048..8d15b8f 100644 --- a/m4/ax_add_fortify_source.m4 +++ b/m4/ax_add_fortify_source.m4 @@ -36,7 +36,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 4 +#serial 5 AC_DEFUN([AX_ADD_FORTIFY_SOURCE],[ ac_save_cflags=$CFLAGS @@ -97,7 +97,7 @@ AC_DEFUN([AX_ADD_FORTIFY_SOURCE],[ AC_LANG_SOURCE([[ #define _FORTIFY_SOURCE 2 #include <string.h> - int main() { + int main(void) { char *s = " "; strcpy(s, "x"); return strlen(s)-1; diff --git a/m4/ax_boost_base.m4 b/m4/ax_boost_base.m4 index 6c944b1..b1fed7a 100644 --- a/m4/ax_boost_base.m4 +++ b/m4/ax_boost_base.m4 @@ -33,7 +33,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 51 +#serial 52 # example boost program (need to pass version) m4_define([_AX_BOOST_BASE_PROGRAM], @@ -114,7 +114,7 @@ AC_DEFUN([_AX_BOOST_BASE_RUNDETECT],[ AS_CASE([${host_cpu}], [x86_64],[libsubdirs="lib64 libx32 lib lib64"], [mips*64*],[libsubdirs="lib64 lib32 lib lib64"], - [ppc64|powerpc64|s390x|sparc64|aarch64|ppc64le|powerpc64le|riscv64|e2k],[libsubdirs="lib64 lib lib64"], + [ppc64|powerpc64|s390x|sparc64|aarch64|ppc64le|powerpc64le|riscv64|e2k|loongarch64],[libsubdirs="lib64 lib lib64"], [libsubdirs="lib"] ) diff --git a/m4/ax_c99_inline.m4 b/m4/ax_c99_inline.m4 index 6675e02..2a03b8e 100644 --- a/m4/ax_c99_inline.m4 +++ b/m4/ax_c99_inline.m4 @@ -21,7 +21,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 8 +#serial 9 AC_DEFUN([AX_C99_INLINE], [ AC_MSG_CHECKING([whether the compiler supports C99 inline functions]) @@ -36,8 +36,8 @@ AC_DEFUN([AX_C99_INLINE], [ dnl translation units that could require the definition. AC_LINK_IFELSE( AC_LANG_SOURCE([ - inline void* foo() { foo(); return &foo; } - int main() { return foo() != 0;} + inline void* foo(void) { foo(); return &foo; } + int main(void) { return foo() != 0;} ]), dnl the invalid source compiled, so the inline keyword does not work @@ -47,8 +47,8 @@ AC_DEFUN([AX_C99_INLINE], [ dnl Secondary test of valid source. AC_LINK_IFELSE( AC_LANG_SOURCE([ - extern inline void* foo() { foo(); return &foo; } - int main() { return foo() != 0;} + extern inline void* foo(void) { foo(); return &foo; } + int main(void) { return foo() != 0;} ]), AC_MSG_RESULT([yes]) diff --git a/m4/ax_c_restrict.m4 b/m4/ax_c_restrict.m4 new file mode 100644 index 0000000..1ca9e71 --- /dev/null +++ b/m4/ax_c_restrict.m4 @@ -0,0 +1,62 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_c_restrict.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_C_RESTRICT +# +# DESCRIPTION +# +# This macro checks if the C99 restrict keyword is broken with the current +# compiler and optimizations settings. If broken, it undefines restrict to +# do no harm. As of 2019 gcc since 5.0 and clang since 6.0 (June 2017) are +# known to be broken and not yet fixed. See +# https://github.com/rust-lang/rust/issues/54878 with the links to the gcc +# and clang tickets. +# +# LICENSE +# +# Copyright (c) 2019 Reini Urban <rurban@cpan.org> +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 1 + +AC_DEFUN([AX_C_RESTRICT], +[AC_CACHE_CHECK([for restrict usability], + [ax_cv_c_restrict_usable], + [AC_RUN_IFELSE([AC_LANG_PROGRAM([], + [[ + void copy (int * restrict to, int * restrict from) { + *to = *from; + } + void test (int *a, int *b) { + for (int i = 0; i < 4; i++) { + copy (&b[i & 1], &a[i & 1]); + } + } + int main () { + int ary[] = {0, 1, 2}; + test (&ary[1], &ary[0]); + /* printf("%d %d %d\n", ary[0], ary[1], ary[2]); + 2 2 2 is correct + 1 2 2 wrong */ + return ary[0] == 2 ? 0 : 1; + } + ]])], + [ax_cv_c_restrict_usable=restrict], + [ax_cv_c_restrict_usable=], + [ax_cv_c_restrict_usable=])]) + +if test -z $ax_cv_c_restrict_usable; then + AC_MSG_RESULT([no]) + AC_DEFINE_UNQUOTED(restrict, $ax_cv_c_restrict_usable, + [If restrict is broken with this C compiler]) +else + AC_MSG_RESULT([yes]) +fi +]) dnl AX_C_RESTRICT diff --git a/m4/ax_c_var_func.m4 b/m4/ax_c_var_func.m4 index 4e0e083..8b1e67a 100644 --- a/m4/ax_c_var_func.m4 +++ b/m4/ax_c_var_func.m4 @@ -50,14 +50,14 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 12 +#serial 13 AU_ALIAS([AC_C_VAR_FUNC], [AX_C_VAR_FUNC]) AC_DEFUN([AX_C_VAR_FUNC], [AC_REQUIRE([AC_PROG_CC]) AC_CACHE_CHECK(whether $CC recognizes __func__, ac_cv_c_var_func, AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], -[[int main() { +[[int main(void) { char *s = __func__; }]])], [ac_cv_c_var_func=yes], diff --git a/m4/ax_check_posix_regcomp.m4 b/m4/ax_check_posix_regcomp.m4 index 121734c..72c0bdd 100644 --- a/m4/ax_check_posix_regcomp.m4 +++ b/m4/ax_check_posix_regcomp.m4 @@ -21,7 +21,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 7 +#serial 8 AU_ALIAS([AG_CHECK_POSIX_REGCOMP], [AX_CHECK_POSIX_REGCOMP]) AC_DEFUN([AX_CHECK_POSIX_REGCOMP],[ @@ -29,7 +29,7 @@ AC_DEFUN([AX_CHECK_POSIX_REGCOMP],[ AC_CACHE_VAL([ax_cv_posix_regcomp],[ AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <sys/types.h> #include <regex.h> -int main() { +int main(void) { int flags = REG_EXTENDED|REG_ICASE|REG_NEWLINE; regex_t re; if (regcomp( &re, "^.*$", flags ) != 0) diff --git a/m4/ax_check_posix_sysinfo.m4 b/m4/ax_check_posix_sysinfo.m4 index 0df3873..0b53d16 100644 --- a/m4/ax_check_posix_sysinfo.m4 +++ b/m4/ax_check_posix_sysinfo.m4 @@ -20,14 +20,14 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 7 +#serial 8 AU_ALIAS([AG_CHECK_POSIX_SYSINFO], [AX_CHECK_POSIX_SYSINFO]) AC_DEFUN([AX_CHECK_POSIX_SYSINFO],[ AC_MSG_CHECKING([whether sysinfo(2) is POSIX]) AC_CACHE_VAL([ax_cv_posix_sysinfo],[ AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <sys/systeminfo.h> -int main() { char z[ 256 ]; +int main(void) { char z[ 256 ]; long sz = sysinfo( SI_SYSNAME, z, sizeof( z )); return (sz > 0) ? 0 : 1; }]])],[ax_cv_posix_sysinfo=yes],[ax_cv_posix_sysinfo=no],[ax_cv_posix_sysinfo=no] ) # end of TRY_RUN]) # end of CACHE_VAL diff --git a/m4/ax_check_strftime.m4 b/m4/ax_check_strftime.m4 index fdf2186..5e7cf33 100644 --- a/m4/ax_check_strftime.m4 +++ b/m4/ax_check_strftime.m4 @@ -19,13 +19,14 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 7 +#serial 8 AU_ALIAS([AG_CHECK_STRFTIME], [AX_CHECK_STRFTIME]) AC_DEFUN([AX_CHECK_STRFTIME],[ AC_MSG_CHECKING([whether strftime() works]) AC_CACHE_VAL([ax_cv_strftime],[ AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <time.h> +#include <string.h> char t_buf[ 64 ]; int main() { static const char z[] = "Thursday Aug 28 240"; diff --git a/m4/ax_check_uname_syscall.m4 b/m4/ax_check_uname_syscall.m4 index 5a33bfb..d20b526 100644 --- a/m4/ax_check_uname_syscall.m4 +++ b/m4/ax_check_uname_syscall.m4 @@ -19,14 +19,14 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 7 +#serial 8 AU_ALIAS([AG_CHECK_UNAME_SYSCALL], [AX_CHECK_UNAME_SYSCALL]) AC_DEFUN([AX_CHECK_UNAME_SYSCALL],[ AC_MSG_CHECKING([whether uname(2) is POSIX]) AC_CACHE_VAL([ax_cv_uname_syscall],[ AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <sys/utsname.h> -int main() { struct utsname unm; +int main(void) { struct utsname unm; return uname( &unm ); }]])],[ax_cv_uname_syscall=yes],[ax_cv_uname_syscall=no],[ax_cv_uname_syscall=no] ) # end of TRY_RUN]) # end of CACHE_VAL diff --git a/m4/ax_cpu_freq.m4 b/m4/ax_cpu_freq.m4 index eeb4d5f..c731b2f 100644 --- a/m4/ax_cpu_freq.m4 +++ b/m4/ax_cpu_freq.m4 @@ -19,16 +19,18 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 8 +#serial 9 AC_DEFUN([AX_CPU_FREQ], [AC_REQUIRE([AC_PROG_CC]) AC_LANG_PUSH([C++]) AC_CACHE_CHECK(your cpu frequency, ax_cpu_freq, [AC_RUN_IFELSE([AC_LANG_PROGRAM([ +#include <cstring> #include <iostream> -#include <sys/time.h> #include <fstream> +#include <unistd.h> +#include <sys/time.h> using namespace std; static __inline__ unsigned long long int rdtsc() diff --git a/m4/ax_cxx_compile_stdcxx.m4 b/m4/ax_cxx_compile_stdcxx.m4 index a3d964c..a9c990e 100644 --- a/m4/ax_cxx_compile_stdcxx.m4 +++ b/m4/ax_cxx_compile_stdcxx.m4 @@ -43,7 +43,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 15 +#serial 16 dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro dnl (serial version number 13). @@ -104,9 +104,18 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl dnl HP's aCC needs +std=c++11 according to: dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf dnl Cray's crayCC needs "-h std=c++11" + dnl MSVC needs -std:c++NN for C++17 and later (default is C++14) for alternative in ${ax_cxx_compile_alternatives}; do - for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) + for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}" MSVC; do + if test x"$switch" = xMSVC; then + dnl AS_TR_SH maps both `:` and `=` to `_` so -std:c++17 would collide + dnl with -std=c++17. We suffix the cache variable name with _MSVC to + dnl avoid this. + switch=-std:c++${alternative} + cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_${switch}_MSVC]) + else + cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) + fi AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, $cachevar, [ac_save_CXX="$CXX" diff --git a/m4/ax_func_memmove.m4 b/m4/ax_func_memmove.m4 index 26ca7c6..b2be366 100644 --- a/m4/ax_func_memmove.m4 +++ b/m4/ax_func_memmove.m4 @@ -20,7 +20,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 7 +#serial 8 AU_ALIAS([AC_FUNC_MEMMOVE], [AX_FUNC_MEMMOVE]) AC_DEFUN([AX_FUNC_MEMMOVE], @@ -28,6 +28,8 @@ AC_DEFUN([AX_FUNC_MEMMOVE], AC_MSG_CHECKING(for working memmove) AC_CACHE_VAL(ac_cv_have_working_memmove, [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> +#include <stdlib.h> +#include <string.h> int main(void) { diff --git a/m4/ax_func_snprintf.m4 b/m4/ax_func_snprintf.m4 index 6fc87d8..b5b78d4 100644 --- a/m4/ax_func_snprintf.m4 +++ b/m4/ax_func_snprintf.m4 @@ -24,7 +24,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 7 +#serial 8 AU_ALIAS([AC_FUNC_SNPRINTF], [AX_FUNC_SNPRINTF]) AC_DEFUN([AX_FUNC_SNPRINTF], @@ -32,7 +32,8 @@ AC_DEFUN([AX_FUNC_SNPRINTF], AC_MSG_CHECKING(for working snprintf) AC_CACHE_VAL(ac_cv_have_working_snprintf, [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> - +#include <stdlib.h> +#include <string.h> int main(void) { char bufs[5] = { 'x', 'x', 'x', '\0', '\0' }; @@ -51,6 +52,8 @@ AC_MSG_CHECKING(for working vsnprintf) AC_CACHE_VAL(ac_cv_have_working_vsnprintf, [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> #include <stdarg.h> +#include <stdlib.h> +#include <string.h> int my_vsnprintf (char *buf, const char *tmpl, ...) { diff --git a/m4/ax_ms_cpprest.m4 b/m4/ax_ms_cpprest.m4 index ca66d93..57e21dd 100644 --- a/m4/ax_ms_cpprest.m4 +++ b/m4/ax_ms_cpprest.m4 @@ -35,7 +35,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 1 +#serial 2 dnl This supporting method tests for the correct Microsoft C++ Rest SDK dnl version by comparing the converted version string value as received @@ -141,7 +141,7 @@ AC_DEFUN([_AX_MS_CPPREST_RUNDETECT], [ AS_CASE([${host_cpu}], [x86_64],[libsubdirs="lib64 libx32 lib lib64"], [mips*64*],[libsubdirs="lib64 lib32 lib lib64"], - [ppc64|powerpc64|s390x|sparc64|aarch64|ppc64le|powerpc64le|riscv64|e2k],[libsubdirs="lib64 lib lib64"], + [ppc64|powerpc64|s390x|sparc64|aarch64|ppc64le|powerpc64le|riscv64|e2k|loongarch64],[libsubdirs="lib64 lib lib64"], [libsubdirs="lib"] ) diff --git a/m4/ax_pkg_swig.m4 b/m4/ax_pkg_swig.m4 index 4971738..7a4196f 100644 --- a/m4/ax_pkg_swig.m4 +++ b/m4/ax_pkg_swig.m4 @@ -36,6 +36,7 @@ # Copyright (c) 2008 Rafael Laboissiere <rafael@laboissiere.net> # Copyright (c) 2008 Andrew Collier # Copyright (c) 2011 Murray Cumming <murrayc@openismus.com> +# Copyright (c) 2018 Reini Urban <rurban@cpan.org> # Copyright (c) 2021 Vincent Danjean <Vincent.Danjean@ens-lyon.org> # # This program is free software; you can redistribute it and/or modify it @@ -64,7 +65,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 14 +#serial 15 AC_DEFUN([AX_PKG_SWIG],[ # Find path to the "swig" executable. @@ -124,7 +125,7 @@ AC_DEFUN([AX_PKG_SWIG],[ m4_ifval([$3],[$3],[]) else AC_MSG_CHECKING([for SWIG library]) - SWIG_LIB=`$SWIG -swiglib` + SWIG_LIB=`$SWIG -swiglib | tr '\r\n' ' '` AC_MSG_RESULT([$SWIG_LIB]) m4_ifval([$2],[$2],[]) fi |