diff options
Diffstat (limited to 'erts')
-rw-r--r-- | erts/aclocal.m4 | 319 | ||||
-rw-r--r-- | erts/configure.ac (renamed from erts/configure.in) | 445 | ||||
-rw-r--r-- | erts/emulator/pcre/local_config.h | 3 | ||||
-rw-r--r-- | erts/emulator/sys/unix/erl_unix_sys.h | 14 | ||||
-rw-r--r-- | erts/epmd/src/epmd_int.h | 12 | ||||
-rw-r--r-- | erts/include/internal/ethr_internal.h | 30 | ||||
-rw-r--r-- | erts/lib_src/common/erl_misc_utils.c | 12 | ||||
-rw-r--r-- | erts/lib_src/pthread/ethread.c | 10 |
8 files changed, 324 insertions, 521 deletions
diff --git a/erts/aclocal.m4 b/erts/aclocal.m4 index 0af9ae8d3c..c5126a322a 100644 --- a/erts/aclocal.m4 +++ b/erts/aclocal.m4 @@ -235,7 +235,7 @@ AC_DEFUN(LM_FIND_EMU_CC, [AC_CACHE_CHECK(for a compiler that handles jumptables, ac_cv_prog_emu_cc, [ -AC_TRY_COMPILE([],[ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ #if defined(__clang_major__) && __clang_major__ >= 3 /* clang 3.x or later is fine */ #elif defined(__llvm__) @@ -254,7 +254,7 @@ lbl1: return 1; lbl2: return 2; -],ac_cv_prog_emu_cc="$CC",ac_cv_prog_emu_cc=no) +]])],[ac_cv_prog_emu_cc="$CC"],[ac_cv_prog_emu_cc=no]) if test "$ac_cv_prog_emu_cc" = no; then for ac_progname in emu_cc.sh gcc-4.2 gcc; do @@ -281,7 +281,7 @@ if test "$ac_cv_prog_emu_cc" != no; then CC="$ac_cv_prog_emu_cc" CFLAGS="" CPPFLAGS="" - AC_TRY_COMPILE([],[ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ #if defined(__clang_major__) && __clang_major__ >= 3 /* clang 3.x or later is fine */ #elif defined(__llvm__) @@ -300,7 +300,7 @@ if test "$ac_cv_prog_emu_cc" != no; then return 1; lbl2: return 2; - ],ac_cv_prog_emu_cc="$CC",ac_cv_prog_emu_cc=no) + ]])],[ac_cv_prog_emu_cc="$CC"],[ac_cv_prog_emu_cc=no]) CC=$save_CC CFLAGS=$save_CFLAGS CPPFLAGS=$save_CPPFLAGS @@ -383,9 +383,7 @@ dnl Check if the system has the SO_BSDCOMPAT flag on sockets (linux) dnl AC_DEFUN(LM_DECL_SO_BSDCOMPAT, [AC_CACHE_CHECK([for SO_BSDCOMPAT declaration], ac_cv_decl_so_bsdcompat, -AC_TRY_COMPILE([#include <sys/socket.h>], [int i = SO_BSDCOMPAT;], - ac_cv_decl_so_bsdcompat=yes, - ac_cv_decl_so_bsdcompat=no)) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]], [[int i = SO_BSDCOMPAT;]])],[ac_cv_decl_so_bsdcompat=yes],[ac_cv_decl_so_bsdcompat=no])) case "${ac_cv_decl_so_bsdcompat}" in "yes" ) AC_DEFINE(HAVE_SO_BSDCOMPAT,[], @@ -405,18 +403,14 @@ dnl AC_DEFUN(LM_DECL_INADDR_LOOPBACK, [AC_CACHE_CHECK([for INADDR_LOOPBACK in netinet/in.h], ac_cv_decl_inaddr_loopback, -[AC_TRY_COMPILE([#include <sys/types.h> -#include <netinet/in.h>], [int i = INADDR_LOOPBACK;], -ac_cv_decl_inaddr_loopback=yes, ac_cv_decl_inaddr_loopback=no) +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> +#include <netinet/in.h>]], [[int i = INADDR_LOOPBACK;]])],[ac_cv_decl_inaddr_loopback=yes],[ac_cv_decl_inaddr_loopback=no]) ]) if test ${ac_cv_decl_inaddr_loopback} = no; then AC_CACHE_CHECK([for INADDR_LOOPBACK in rpc/types.h], ac_cv_decl_inaddr_loopback_rpc, - AC_TRY_COMPILE([#include <rpc/types.h>], - [int i = INADDR_LOOPBACK;], - ac_cv_decl_inaddr_loopback_rpc=yes, - ac_cv_decl_inaddr_loopback_rpc=no)) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <rpc/types.h>]], [[int i = INADDR_LOOPBACK;]])],[ac_cv_decl_inaddr_loopback_rpc=yes],[ac_cv_decl_inaddr_loopback_rpc=no])) case "${ac_cv_decl_inaddr_loopback_rpc}" in "yes" ) @@ -425,11 +419,8 @@ if test ${ac_cv_decl_inaddr_loopback} = no; then * ) AC_CACHE_CHECK([for INADDR_LOOPBACK in winsock2.h], ac_cv_decl_inaddr_loopback_winsock2, - AC_TRY_COMPILE([#define WIN32_LEAN_AND_MEAN - #include <winsock2.h>], - [int i = INADDR_LOOPBACK;], - ac_cv_decl_inaddr_loopback_winsock2=yes, - ac_cv_decl_inaddr_loopback_winsock2=no)) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define WIN32_LEAN_AND_MEAN + #include <winsock2.h>]], [[int i = INADDR_LOOPBACK;]])],[ac_cv_decl_inaddr_loopback_winsock2=yes],[ac_cv_decl_inaddr_loopback_winsock2=no])) case "${ac_cv_decl_inaddr_loopback_winsock2}" in "yes" ) AC_DEFINE(DEF_INADDR_LOOPBACK_IN_WINSOCK2_H,[], @@ -454,9 +445,8 @@ dnl AC_DEFUN(LM_STRUCT_SOCKADDR_SA_LEN, [AC_CACHE_CHECK([whether struct sockaddr has sa_len field], ac_cv_struct_sockaddr_sa_len, -AC_TRY_COMPILE([#include <sys/types.h> -#include <sys/socket.h>], [struct sockaddr s; s.sa_len = 10;], - ac_cv_struct_sockaddr_sa_len=yes, ac_cv_struct_sockaddr_sa_len=no)) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> +#include <sys/socket.h>]], [[struct sockaddr s; s.sa_len = 10;]])],[ac_cv_struct_sockaddr_sa_len=yes],[ac_cv_struct_sockaddr_sa_len=no])) dnl FIXME convbreak case ${ac_cv_struct_sockaddr_sa_len} in @@ -477,27 +467,24 @@ AC_DEFUN(LM_SYS_IPV6, [AC_MSG_CHECKING(for IP version 6 support) AC_CACHE_VAL(ac_cv_sys_ipv6_support, [ok_so_far=yes - AC_TRY_COMPILE([#include <sys/types.h> + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> #ifdef __WIN32__ #include <winsock2.h> #include <ws2tcpip.h> #else #include <netinet/in.h> -#endif], - [struct in6_addr a6; struct sockaddr_in6 s6;], ok_so_far=yes, ok_so_far=no) +#endif]], [[struct in6_addr a6; struct sockaddr_in6 s6;]])],[ok_so_far=yes],[ok_so_far=no]) if test $ok_so_far = yes; then ac_cv_sys_ipv6_support=yes else - AC_TRY_COMPILE([#include <sys/types.h> + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> #ifdef __WIN32__ #include <winsock2.h> #include <ws2tcpip.h> #else #include <netinet/in.h> -#endif], - [struct in_addr6 a6; struct sockaddr_in6 s6;], - ac_cv_sys_ipv6_support=in_addr6, ac_cv_sys_ipv6_support=no) +#endif]], [[struct in_addr6 a6; struct sockaddr_in6 s6;]])],[ac_cv_sys_ipv6_support=in_addr6],[ac_cv_sys_ipv6_support=no]) fi ])dnl @@ -533,7 +520,9 @@ dnl AC_DEFUN(LM_SYS_MULTICAST, [AC_CACHE_CHECK([for multicast support], ac_cv_sys_multicast_support, -[AC_EGREP_CPP(^yes$, +[AC_REQUIRE([AC_PROG_CPP]) +AC_REQUIRE([AC_PROG_EGREP]) +AC_EGREP_CPP(^yes$, [#include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> @@ -559,9 +548,8 @@ dnl AC_DEFUN(LM_DECL_SYS_ERRLIST, [AC_CACHE_CHECK([for sys_errlist declaration in stdio.h or errno.h], ac_cv_decl_sys_errlist, -[AC_TRY_COMPILE([#include <stdio.h> -#include <errno.h>], [char *msg = *(sys_errlist + 1);], - ac_cv_decl_sys_errlist=yes, ac_cv_decl_sys_errlist=no)]) +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h> +#include <errno.h>]], [[char *msg = *(sys_errlist + 1);]])],[ac_cv_decl_sys_errlist=yes],[ac_cv_decl_sys_errlist=no])]) if test $ac_cv_decl_sys_errlist = yes; then AC_DEFINE(SYS_ERRLIST_DECLARED,[], [define if the variable sys_errlist is declared in a system header file]) @@ -586,10 +574,10 @@ dnl AC_DEFUN(LM_CHECK_FUNC_DECL, [AC_MSG_CHECKING([for conflicting declaration of $1]) AC_CACHE_VAL(ac_cv_func_decl_$1, -[AC_TRY_COMPILE([#include <stdio.h> -$3],[$2 +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h> +$3]], [[$2 char *c = (char *)$1; -], eval "ac_cv_func_decl_$1=no", eval "ac_cv_func_decl_$1=yes")]) +]])],[eval "ac_cv_func_decl_$1=no"],[eval "ac_cv_func_decl_$1=yes"])]) if eval "test \"`echo '$ac_cv_func_decl_'$1`\" = yes"; then AC_MSG_RESULT(yes) ifelse([$4], , :, [$4]) @@ -743,37 +731,31 @@ AC_DEFUN(ERL_MONOTONIC_CLOCK, AC_CACHE_CHECK([for clock_gettime(CLOCK_MONOTONIC_RAW, _)], erl_cv_clock_gettime_monotonic_raw, [ - AC_TRY_LINK([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <time.h> $trust_test - ], - [ + ]], [[ struct timespec ts; long long result; clock_gettime(CLOCK_MONOTONIC_RAW, &ts); result = ((long long) ts.tv_sec) * 1000000000LL + ((long long) ts.tv_nsec); - ], - erl_cv_clock_gettime_monotonic_raw=yes, - erl_cv_clock_gettime_monotonic_raw=no) + ]])],[erl_cv_clock_gettime_monotonic_raw=yes],[erl_cv_clock_gettime_monotonic_raw=no]) ]) AC_CACHE_CHECK([for clock_gettime() with ${check_msg}monotonic clock type], erl_cv_clock_gettime_monotonic_$1, [ for clock_type in $prefer_resolution_clock_gettime_monotonic $default_resolution_clock_gettime_monotonic $high_resolution_clock_gettime_monotonic $low_resolution_clock_gettime_monotonic; do - AC_TRY_LINK([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <time.h> $trust_test - ], - [ + ]], [[ struct timespec ts; long long result; clock_gettime($clock_type,&ts); result = ((long long) ts.tv_sec) * 1000000000LL + ((long long) ts.tv_nsec); - ], - erl_cv_clock_gettime_monotonic_$1=$clock_type, - erl_cv_clock_gettime_monotonic_$1=no) + ]])],[erl_cv_clock_gettime_monotonic_$1=$clock_type],[erl_cv_clock_gettime_monotonic_$1=no]) test $erl_cv_clock_gettime_monotonic_$1 = no || break done ]) @@ -789,11 +771,10 @@ $trust_test AC_CACHE_CHECK([for mach clock_get_time() with monotonic clock type], erl_cv_mach_clock_get_time_monotonic, [ - AC_TRY_COMPILE([ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <mach/clock.h> #include <mach/mach.h> - ], - [ + ]], [[ kern_return_t res; clock_serv_t clk_srv; mach_timespec_t time_spec; @@ -801,9 +782,7 @@ $trust_test host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &clk_srv); res = clock_get_time(clk_srv, &time_spec); mach_port_deallocate(mach_task_self(), clk_srv); - ], - erl_cv_mach_clock_get_time_monotonic=yes, - erl_cv_mach_clock_get_time_monotonic=no) + ]])],[erl_cv_mach_clock_get_time_monotonic=yes],[erl_cv_mach_clock_get_time_monotonic=no]) ]) erl_corrected_monotonic_clock=no @@ -908,40 +887,34 @@ AC_DEFUN(ERL_WALL_CLOCK, AC_CACHE_CHECK([for clock_gettime() with ${check_msg}wall clock type], erl_cv_clock_gettime_wall_$1, [ for clock_type in $prefer_resolution_clock_gettime_wall $default_resolution_clock_gettime_wall $high_resolution_clock_gettime_wall $low_resolution_clock_gettime_wall; do - AC_TRY_LINK([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <time.h> $trust_test - ], - [ + ]], [[ struct timespec ts; long long result; clock_gettime($clock_type,&ts); result = ((long long) ts.tv_sec) * 1000000000LL + ((long long) ts.tv_nsec); - ], - erl_cv_clock_gettime_wall_$1=$clock_type, - erl_cv_clock_gettime_wall_$1=no) + ]])],[erl_cv_clock_gettime_wall_$1=$clock_type],[erl_cv_clock_gettime_wall_$1=no]) test $erl_cv_clock_gettime_wall_$1 = no || break done ]) LIBS="$save_LIBS" - if test "$LD_MAY_BE_WEAK" != "no"; then - check_for_clock_getres= - else - check_for_clock_getres=clock_getres + if test "$LD_MAY_BE_WEAK" = "no"; then + AC_CHECK_FUNCS([clock_getres]) fi - AC_CHECK_FUNCS([$check_for_clock_getres clock_get_attributes gettimeofday]) + AC_CHECK_FUNCS([clock_get_attributes gettimeofday]) AC_CACHE_CHECK([for mach clock_get_time() with wall clock type], erl_cv_mach_clock_get_time_wall, [ - AC_TRY_COMPILE([ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <mach/clock.h> #include <mach/mach.h> - ], - [ + ]], [[ kern_return_t res; clock_serv_t clk_srv; mach_timespec_t time_spec; @@ -949,9 +922,7 @@ $trust_test host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &clk_srv); res = clock_get_time(clk_srv, &time_spec); mach_port_deallocate(mach_task_self(), clk_srv); - ], - erl_cv_mach_clock_get_time_wall=yes, - erl_cv_mach_clock_get_time_wall=no) + ]])],[erl_cv_mach_clock_get_time_wall=yes],[erl_cv_mach_clock_get_time_wall=no]) ]) erl_wall_clock_lib= @@ -1036,10 +1007,8 @@ dnl On ofs1 the '-pthread' switch should be used AC_MSG_CHECKING([if the '-pthread' switch can be used]) saved_cflags=$CFLAGS CFLAGS="$CFLAGS -pthread" - AC_TRY_LINK([#include <pthread.h>], - pthread_create((void*)0,(void*)0,(void*)0,(void*)0);, - [THR_DEFS="-pthread" - THR_LIBS="-pthread"]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]], [[pthread_create((void*)0,(void*)0,(void*)0,(void*)0);]])],[THR_DEFS="-pthread" + THR_LIBS="-pthread"],[]) CFLAGS=$saved_cflags if test "x$THR_LIBS" != "x"; then AC_MSG_RESULT(yes) @@ -1204,17 +1173,17 @@ AC_DEFUN(ETHR_CHK_GCC_ATOMIC_OP__, AC_CACHE_CHECK([for 32-bit $1()], ethr_cv_32bit_$1, [ ethr_cv_32bit_$1=no - AC_TRY_LINK([], [$atomic32_call], [ethr_cv_32bit_$1=yes]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[$atomic32_call]])],[ethr_cv_32bit_$1=yes],[]) ]) AC_CACHE_CHECK([for 64-bit $1()], ethr_cv_64bit_$1, [ ethr_cv_64bit_$1=no - AC_TRY_LINK([], [$atomic64_call], [ethr_cv_64bit_$1=yes]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[$atomic64_call]])],[ethr_cv_64bit_$1=yes],[]) ]) AC_CACHE_CHECK([for 128-bit $1()], ethr_cv_128bit_$1, [ ethr_cv_128bit_$1=no - AC_TRY_LINK([], [$atomic128_call], [ethr_cv_128bit_$1=yes]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[$atomic128_call]])],[ethr_cv_128bit_$1=yes],[]) ]) case $ethr_cv_128bit_$1-$ethr_cv_64bit_$1-$ethr_cv_32bit_$1 in @@ -1303,9 +1272,7 @@ AC_DEFUN(ETHR_CHK_GCC_ATOMIC_OPS, AC_CACHE_CHECK([for a working __sync_synchronize()], ethr_cv___sync_synchronize, [ ethr_cv___sync_synchronize=no - AC_TRY_LINK([], - [ __sync_synchronize(); ], - [ethr_cv___sync_synchronize=yes]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ __sync_synchronize(); ]])],[ethr_cv___sync_synchronize=yes],[]) if test $ethr_cv___sync_synchronize = yes; then # # Old gcc versions on at least x86 have a buggy @@ -1351,11 +1318,9 @@ AC_DEFUN(ETHR_CHK_GCC_ATOMIC_OPS, AC_CACHE_CHECK([for ARM 'dmb sy' instruction], ethr_cv_arm_dbm_sy_instr, [ ethr_cv_arm_dbm_sy_instr=no - AC_TRY_LINK([], - [ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ __asm__ __volatile__("dmb sy" : : : "memory"); - ], - [ethr_cv_arm_dbm_sy_instr=yes]) + ]])],[ethr_cv_arm_dbm_sy_instr=yes],[]) ]) if test $ethr_cv_arm_dbm_sy_instr = yes; then ethr_arm_dbm_sy_instr_val=1 @@ -1365,11 +1330,9 @@ AC_DEFUN(ETHR_CHK_GCC_ATOMIC_OPS, AC_CACHE_CHECK([for ARM 'dmb st' instruction], ethr_cv_arm_dbm_st_instr, [ ethr_cv_arm_dbm_st_instr=no - AC_TRY_LINK([], - [ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ __asm__ __volatile__("dmb st" : : : "memory"); - ], - [ethr_cv_arm_dbm_st_instr=yes]) + ]])],[ethr_cv_arm_dbm_st_instr=yes],[]) ]) if test $ethr_cv_arm_dbm_st_instr = yes; then ethr_arm_dbm_st_instr_val=1 @@ -1377,11 +1340,9 @@ AC_DEFUN(ETHR_CHK_GCC_ATOMIC_OPS, AC_CACHE_CHECK([for ARM 'dmb ld' instruction], ethr_cv_arm_dbm_ld_instr, [ ethr_cv_arm_dbm_ld_instr=no - AC_TRY_LINK([], - [ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ __asm__ __volatile__("dmb ld" : : : "memory"); - ], - [ethr_cv_arm_dbm_ld_instr=yes]) + ]])],[ethr_cv_arm_dbm_ld_instr=yes],[]) ]) if test $ethr_cv_arm_dbm_ld_instr = yes; then ethr_arm_dbm_ld_instr_val=1 @@ -1424,20 +1385,17 @@ AC_DEFUN(ETHR_CHK_INTERLOCKED, "4") ilckd_call="${ilckd}(var, ($3) 0, ($3) 0, arr);";; esac have_interlocked_op=no - AC_TRY_LINK( - [ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <intrin.h> - ], - [ + ]], [[ volatile $3 *var; volatile $3 arr[2]; $ilckd_call return 0; - ], - [have_interlocked_op=yes]) + ]])],[have_interlocked_op=yes],[]) test $have_interlocked_op = yes && $4 AC_MSG_RESULT([$have_interlocked_op]) ]) @@ -1751,15 +1709,9 @@ case "$THR_LIB_NAME" in AC_DEFINE(ETHR_HAVE_SYS_TIME_H, 1, \ [Define if you have the <sys/time.h> header file.])) - AC_TRY_COMPILE([#include <time.h> - #include <sys/time.h>], - [struct timeval *tv; return 0;], - AC_DEFINE(ETHR_TIME_WITH_SYS_TIME, 1, \ -[Define if you can safely include both <sys/time.h> and <time.h>.])) - AC_MSG_CHECKING([for usable PTHREAD_STACK_MIN]) pthread_stack_min=no - AC_TRY_COMPILE([ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <limits.h> #if defined(ETHR_NEED_NPTL_PTHREAD_H) #include <nptl/pthread.h> @@ -1768,9 +1720,7 @@ case "$THR_LIB_NAME" in #elif defined(ETHR_HAVE_PTHREAD_H) #include <pthread.h> #endif - ], - [return PTHREAD_STACK_MIN;], - [pthread_stack_min=yes]) + ]], [[return PTHREAD_STACK_MIN;]])],[pthread_stack_min=yes],[]) AC_MSG_RESULT([$pthread_stack_min]) test $pthread_stack_min != yes || { @@ -1797,13 +1747,11 @@ case "$THR_LIB_NAME" in AC_DEFINE(ETHR_HAVE_SCHED_YIELD, 1, [Define if you have the sched_yield() function.]) AC_MSG_CHECKING([whether sched_yield() returns an int]) sched_yield_ret_int=no - AC_TRY_LINK([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #ifdef ETHR_HAVE_SCHED_H #include <sched.h> #endif - ], - [int sched_yield();], - [sched_yield_ret_int=yes]) + ]], [[int sched_yield();]])],[sched_yield_ret_int=yes],[]) AC_MSG_RESULT([$sched_yield_ret_int]) if test $sched_yield_ret_int = yes; then AC_DEFINE(ETHR_SCHED_YIELD_RET_INT, 1, [Define if sched_yield() returns an int.]) @@ -1816,7 +1764,7 @@ case "$THR_LIB_NAME" in AC_DEFINE(ETHR_HAVE_PTHREAD_YIELD, 1, [Define if you have the pthread_yield() function.]) AC_MSG_CHECKING([whether pthread_yield() returns an int]) pthread_yield_ret_int=no - AC_TRY_LINK([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #if defined(ETHR_NEED_NPTL_PTHREAD_H) #include <nptl/pthread.h> #elif defined(ETHR_HAVE_MIT_PTHREAD_H) @@ -1824,9 +1772,7 @@ case "$THR_LIB_NAME" in #elif defined(ETHR_HAVE_PTHREAD_H) #include <pthread.h> #endif - ], - [int pthread_yield();], - [pthread_yield_ret_int=yes]) + ]], [[int pthread_yield();]])],[pthread_yield_ret_int=yes],[]) AC_MSG_RESULT([$pthread_yield_ret_int]) if test $pthread_yield_ret_int = yes; then AC_DEFINE(ETHR_PTHREAD_YIELD_RET_INT, 1, [Define if pthread_yield() returns an int.]) @@ -1847,7 +1793,7 @@ case "$THR_LIB_NAME" in AC_MSG_CHECKING([for PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP]) ethr_pthread_rwlock_writer_nonrecursive_initializer_np=no - AC_TRY_LINK([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #if defined(ETHR_NEED_NPTL_PTHREAD_H) #include <nptl/pthread.h> #elif defined(ETHR_HAVE_MIT_PTHREAD_H) @@ -1855,13 +1801,11 @@ case "$THR_LIB_NAME" in #elif defined(ETHR_HAVE_PTHREAD_H) #include <pthread.h> #endif - ], - [ + ]], [[ pthread_rwlockattr_t *attr; return pthread_rwlockattr_setkind_np(attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP); - ], - [ethr_pthread_rwlock_writer_nonrecursive_initializer_np=yes]) + ]])],[ethr_pthread_rwlock_writer_nonrecursive_initializer_np=yes],[]) AC_MSG_RESULT([$ethr_pthread_rwlock_writer_nonrecursive_initializer_np]) if test $ethr_pthread_rwlock_writer_nonrecursive_initializer_np = yes; then AC_DEFINE(ETHR_HAVE_PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP, 1, \ @@ -1889,7 +1833,7 @@ case "$THR_LIB_NAME" in if test "x$erl_monotonic_clock_id" != "x"; then AC_MSG_CHECKING(whether pthread_cond_timedwait() can use the monotonic clock $erl_monotonic_clock_id for timeout) pthread_cond_timedwait_monotonic=no - AC_TRY_LINK([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #if defined(ETHR_NEED_NPTL_PTHREAD_H) # include <nptl/pthread.h> #elif defined(ETHR_HAVE_MIT_PTHREAD_H) @@ -1897,22 +1841,15 @@ case "$THR_LIB_NAME" in #elif defined(ETHR_HAVE_PTHREAD_H) # include <pthread.h> #endif - #ifdef ETHR_TIME_WITH_SYS_TIME - # include <time.h> + #include <time.h> + #ifdef ETHR_HAVE_SYS_TIME_H # include <sys/time.h> - #else - # ifdef ETHR_HAVE_SYS_TIME_H - # include <sys/time.h> - # else - # include <time.h> - # endif #endif #if defined(ETHR_HAVE_MACH_CLOCK_GET_TIME) # include <mach/clock.h> # include <mach/mach.h> #endif - ], - [ + ]], [[ int res; pthread_condattr_t attr; pthread_cond_t cond; @@ -1922,8 +1859,7 @@ case "$THR_LIB_NAME" in res = pthread_condattr_setclock(&attr, ETHR_MONOTONIC_CLOCK_ID); res = pthread_cond_init(&cond, &attr); res = pthread_cond_timedwait(&cond, &mutex, &cond_timeout); - ], - [pthread_cond_timedwait_monotonic=yes]) + ]])],[pthread_cond_timedwait_monotonic=yes],[]) AC_MSG_RESULT([$pthread_cond_timedwait_monotonic]) if test $pthread_cond_timedwait_monotonic = yes; then AC_DEFINE(ETHR_HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC, [1], [Define if pthread_cond_timedwait() can be used with a monotonic clock]) @@ -1932,21 +1868,19 @@ case "$THR_LIB_NAME" in linux_futex=no AC_MSG_CHECKING([for Linux futexes]) - AC_TRY_LINK([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <sys/syscall.h> #include <unistd.h> #include <linux/futex.h> #include <sys/time.h> - ], - [ + ]], [[ int i = 1; syscall(__NR_futex, (void *) &i, FUTEX_WAKE, 1, (void*)0,(void*)0, 0); syscall(__NR_futex, (void *) &i, FUTEX_WAIT, 0, (void*)0,(void*)0, 0); return 0; - ], - linux_futex=yes) + ]])],[linux_futex=yes],[]) AC_MSG_RESULT([$linux_futex]) test $linux_futex = yes && AC_DEFINE(ETHR_HAVE_LINUX_FUTEX, 1, [Define if you have a linux futex implementation.]) @@ -1954,18 +1888,12 @@ case "$THR_LIB_NAME" in AC_MSG_CHECKING([for pthread_setname_np]) old_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -Werror" - AC_TRY_LINK([#define __USE_GNU - #include <pthread.h>], - [pthread_setname_np(pthread_self(), "name");], - pthread_setname=linux) - AC_TRY_LINK([#define __USE_GNU - #include <pthread.h>], - [pthread_set_name_np(pthread_self(), "name");], - pthread_setname=bsd) - AC_TRY_LINK([#define _DARWIN_C_SOURCE - #include <pthread.h>], - [pthread_setname_np("name");], - pthread_setname=darwin) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define __USE_GNU + #include <pthread.h>]], [[pthread_setname_np(pthread_self(), "name");]])],[pthread_setname=linux],[]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define __USE_GNU + #include <pthread.h>]], [[pthread_set_name_np(pthread_self(), "name");]])],[pthread_setname=bsd],[]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define _DARWIN_C_SOURCE + #include <pthread.h>]], [[pthread_setname_np("name");]])],[pthread_setname=darwin],[]) AC_MSG_RESULT([$pthread_setname]) case $with_threadnames-$pthread_setname in yes-linux) AC_DEFINE(ETHR_HAVE_PTHREAD_SETNAME_NP_2, 1, @@ -1979,16 +1907,12 @@ case "$THR_LIB_NAME" in pthread_getname=no AC_MSG_CHECKING([for pthread_getname_np]) - AC_TRY_LINK([#define __USE_GNU + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define __USE_GNU #define _DARWIN_C_SOURCE - #include <pthread.h>], - [char buff[256]; pthread_getname_np(pthread_self(), buff, 256);], - pthread_getname=linux) - AC_TRY_LINK([#define __USE_GNU + #include <pthread.h>]], [[char buff[256]; pthread_getname_np(pthread_self(), buff, 256);]])],[pthread_getname=linux],[]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define __USE_GNU #define _DARWIN_C_SOURCE - #include <pthread.h>], - [char buff[256]; pthread_getname_np(pthread_self(), buff);], - pthread_getname=ibm) + #include <pthread.h>]], [[char buff[256]; pthread_getname_np(pthread_self(), buff);]])],[pthread_getname=ibm],[]) AC_MSG_RESULT([$pthread_getname]) case $pthread_getname in linux) AC_DEFINE(ETHR_HAVE_PTHREAD_GETNAME_NP_3, 1, @@ -2019,8 +1943,7 @@ case "$THR_LIB_NAME" in fi;; esac ethr_have_libatomic_ops=no - AC_TRY_LINK([#include "atomic_ops.h"], - [ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "atomic_ops.h"]], [[ volatile AO_t x; AO_t y; int z; @@ -2051,10 +1974,9 @@ case "$THR_LIB_NAME" in #else #error No compare_and_swap #endif - ], - [ethr_have_native_atomics=yes + ]])],[ethr_have_native_atomics=yes ethr_native_atomic_implementation=libatomic_ops - ethr_have_libatomic_ops=yes]) + ethr_have_libatomic_ops=yes],[]) AC_MSG_RESULT([$ethr_have_libatomic_ops]) if test $ethr_have_libatomic_ops = yes; then AC_CHECK_SIZEOF(AO_t, , @@ -2173,12 +2095,10 @@ case "$GCC-$ac_cv_sizeof_void_p-$host_cpu" in save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -msse2" gcc_sse2_asm=no - AC_TRY_COMPILE([], - [ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ long long x, *y; __asm__ __volatile__("movq %1, %0\n\t" : "=x"(x) : "m"(*y) : "memory"); - ], - [gcc_sse2_asm=yes]) + ]])],[gcc_sse2_asm=yes],[]) CFLAGS="$save_CFLAGS" AC_MSG_RESULT([$gcc_sse2_asm]) if test "$gcc_sse2_asm" = "yes"; then @@ -2221,8 +2141,7 @@ case "$GCC-$host_cpu" in AC_MSG_CHECKING([for gcc $pic_text$dw_cmpxchg plain asm support]) plain_cmpxchg=no - AC_TRY_COMPILE([], - [ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ char xchgd; long new[2], xchg[2], *p; __asm__ __volatile__( @@ -2235,8 +2154,7 @@ case "$GCC-$host_cpu" in : "=m"(*p), "=d"(xchg[1]), "=a"(xchg[0]), "=q"(xchgd) : "m"(*p), "1"(xchg[1]), "2"(xchg[0]), "c"(new[1]), "b"(new[0]) : "cc", "memory"); - ], - [plain_cmpxchg=yes]) + ]])],[plain_cmpxchg=yes],[]) AC_MSG_RESULT([$plain_cmpxchg]) @@ -2255,15 +2173,12 @@ case "$GCC-$host_cpu" in # as input to the asm on 32-bit x86 and old gcc # compilers (gcc vsn < 5). - AC_TRY_COMPILE([], - [ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ #if !defined(__PIC__) || !__PIC__ # error no pic #endif - ], - [pic_cmpxchg=yes - gcc_cflags_pic=yes], - [pic_cmpxchg=no]) + ]])],[pic_cmpxchg=yes + gcc_cflags_pic=yes],[pic_cmpxchg=no]) if test $pic_cmpxchg = yes; then gcc_pic_dw_cmpxchg_asm=$gcc_dw_cmpxchg_asm @@ -2282,8 +2197,7 @@ case "$GCC-$host_cpu" in # Check if we can work around it by managing the ebx # register explicitly in the asm... - AC_TRY_COMPILE([], - [ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ char xchgd; long new[2], xchg[2], *p; __asm__ __volatile__( @@ -2295,9 +2209,8 @@ case "$GCC-$host_cpu" in : "=m"(*p), "=d"(xchg[1]), "=a"(xchg[0]), "=q"(xchgd) : "m"(*p), "1"(xchg[1]), "2"(xchg[0]), "c"(new[1]), "r"(new[0]) : "cc", "memory"); - ], - [gcc_pic_dw_cmpxchg_asm=yes - gcc_cmpxchg8b_pic_no_clobber_ebx=yes]) + ]])],[gcc_pic_dw_cmpxchg_asm=yes + gcc_cmpxchg8b_pic_no_clobber_ebx=yes],[]) AC_MSG_RESULT([$gcc_pic_dw_cmpxchg_asm]) @@ -2308,8 +2221,7 @@ case "$GCC-$host_cpu" in # register shortage. Check if we can work around # this... - AC_TRY_COMPILE([], - [ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ char xchgd; long new[2], xchg[2], *p; __asm__ __volatile__( @@ -2323,10 +2235,9 @@ case "$GCC-$host_cpu" in : "m"(*p), "1"(xchg[1]), "2"(xchg[0]), "r"(new) : "cc", "memory"); - ], - [gcc_pic_dw_cmpxchg_asm=yes + ]])],[gcc_pic_dw_cmpxchg_asm=yes gcc_cmpxchg8b_pic_no_clobber_ebx=yes - gcc_cmpxchg8b_pic_no_clobber_ebx_register_shortage=yes]) + gcc_cmpxchg8b_pic_no_clobber_ebx_register_shortage=yes],[]) AC_MSG_RESULT([$gcc_pic_dw_cmpxchg_asm]) fi @@ -2605,7 +2516,7 @@ dnl or (yet to be written) write to the procfs ctl file. dnl AC_MSG_CHECKING([if gethrvtime works and how to use it]) -AC_TRY_RUN([ +AC_RUN_IFELSE([AC_LANG_SOURCE([[ /* gethrvtime procfs ioctl test */ /* These need to be undef:ed to not break activation of * micro level process accounting on /proc/self @@ -2653,10 +2564,7 @@ int main() { exit(5); exit(0); return 0; } -], -erl_gethrvtime=procfs_ioctl, -erl_gethrvtime=false, -[ +]])],[erl_gethrvtime=procfs_ioctl],[erl_gethrvtime=false],[ case X$erl_xcomp_gethrvtime_procfs_ioctl in X) erl_gethrvtime=cross;; @@ -2694,7 +2602,7 @@ case $erl_gethrvtime in AC_MSG_CHECKING([if clock_gettime can be used to get thread CPU time]) save_libs=$LIBS LIBS="-lrt" - AC_TRY_RUN([ + AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <stdlib.h> #include <unistd.h> #include <string.h> @@ -2717,10 +2625,7 @@ case $erl_gethrvtime in exit(5); exit(0); return 0; } - ], - erl_clock_gettime_cpu_time=yes, - erl_clock_gettime_cpu_time=no, - [ + ]])],[erl_clock_gettime_cpu_time=yes],[erl_clock_gettime_cpu_time=no],[ case X$erl_xcomp_clock_gettime_cpu_time in X) erl_clock_gettime_cpu_time=cross;; Xyes|Xno) erl_clock_gettime_cpu_time=$erl_xcomp_clock_gettime_cpu_time;; @@ -2762,7 +2667,7 @@ AC_DEFUN([LM_TRY_ENABLE_CFLAG], [ AC_MSG_CHECKING([if we can add $1 to $2 (via CFLAGS)]) saved_CFLAGS=$CFLAGS; CFLAGS="$1 $$2"; - AC_TRY_COMPILE([],[return 0;],can_enable_flag=true,can_enable_flag=false) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;]])],[can_enable_flag=true],[can_enable_flag=false]) CFLAGS=$saved_CFLAGS; if test "X$can_enable_flag" = "Xtrue"; then AC_MSG_RESULT([yes]) @@ -2776,7 +2681,7 @@ AC_DEFUN([LM_CHECK_ENABLE_CFLAG], [ AC_MSG_CHECKING([whether $CC accepts $1...]) saved_CFLAGS=$CFLAGS; CFLAGS="$1 $CFLAGS"; - AC_TRY_COMPILE([],[return 0;],can_enable_flag=true,can_enable_flag=false) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;]])],[can_enable_flag=true],[can_enable_flag=false]) CFLAGS=$saved_CFLAGS; if test "X$can_enable_flag" = "Xtrue"; then AS_VAR_SET($2, true) @@ -2798,7 +2703,7 @@ AC_DEFUN([LM_CHECK_RUN_CFLAG], [ AC_MSG_CHECKING([whether $CC accepts $1...]) saved_CFLAGS=$CFLAGS; CFLAGS="$1 $CFLAGS"; - AC_TRY_RUN([],[return 0;],can_enable_flag=true,can_enable_flag=false) + AC_RUN_IFELSE([AC_LANG_SOURCE([[]])],[return 0;],[can_enable_flag=true],[can_enable_flag=false]) CFLAGS=$saved_CFLAGS; if test "X$can_enable_flag" = "Xtrue"; then AS_VAR_SET($2, true) @@ -2811,10 +2716,10 @@ AC_DEFUN([LM_CHECK_RUN_CFLAG], [ dnl ERL_TRY_LINK_JAVA(CLASSES, FUNCTION-BODY dnl [ACTION_IF_FOUND [, ACTION-IF-NOT-FOUND]]) -dnl Freely inspired by AC_TRY_LINK. (Maybe better to create a +dnl Freely inspired by AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[],[]). (Maybe better to create a dnl AC_LANG_JAVA instead...) AC_DEFUN(ERL_TRY_LINK_JAVA, -[java_link='$JAVAC conftest.java 1>&AC_FD_CC' +[java_link='$JAVAC conftest.java 1>&AS_MESSAGE_LOG_FD' changequote(, )dnl cat > conftest.java <<EOF $1 @@ -2827,9 +2732,9 @@ if AC_TRY_EVAL(java_link) && test -s conftest.class; then ifelse([$3], , :, [rm -rf conftest* $3]) else - echo "configure: failed program was:" 1>&AC_FD_CC - cat conftest.java 1>&AC_FD_CC - echo "configure: PATH was $PATH" 1>&AC_FD_CC + echo "configure: failed program was:" 1>&AS_MESSAGE_LOG_FD + cat conftest.java 1>&AS_MESSAGE_LOG_FD + echo "configure: PATH was $PATH" 1>&AS_MESSAGE_LOG_FD ifelse([$4], , , [ rm -rf conftest* $4 ])dnl diff --git a/erts/configure.in b/erts/configure.ac index fd3190f0f1..00866a002a 100644 --- a/erts/configure.in +++ b/erts/configure.ac @@ -21,8 +21,9 @@ dnl %CopyrightEnd% dnl The string "FIXME convbreak" means that there is a break of dnl autoconf convention that should be cleaned up. -AC_INIT(vsn.mk) -AC_PREREQ(2.59) +AC_INIT +AC_CONFIG_SRCDIR([emulator/beam/erl_process.c]) +AC_PREREQ([2.71]) LM_PRECIOUS_VARS @@ -79,19 +80,20 @@ dnl ---------------------------------------------------------------------- dnl Figure out what system we are running on. dnl ---------------------------------------------------------------------- -# -# To configure for free source run ./configure --host=free_source -# dnl dnl AC_CANONICAL_HOST does not like free_source as a host specification, dnl so we make a little special case. dnl -if test "X$host" != "Xfree_source" -a "X$host" != "Xwin32"; then - AC_CANONICAL_HOST -else - host_os=$host +if test "$host" = "free_source" -o "$host" = "win32"; then + host_os="$host" +else + AC_CANONICAL_HOST fi +# +# To configure for free source run ./configure --host=free_source +# + if test "$cross_compiling" = "yes"; then CROSS_COMPILING=yes else @@ -101,9 +103,9 @@ AC_SUBST(CROSS_COMPILING) ERL_XCOMP_SYSROOT_INIT -AC_ISC_POSIX +AC_SEARCH_LIBS([strerror],[cposix]) -AC_CONFIG_HEADER($host/config.h:config.h.in include/internal/$host/ethread_header_config.h:include/internal/ethread_header_config.h.in include/$host/erl_int_sizes_config.h:include/erl_int_sizes_config.h.in) +AC_CONFIG_HEADERS([$host/config.h:config.h.in include/internal/$host/ethread_header_config.h:include/internal/ethread_header_config.h.in include/$host/erl_int_sizes_config.h:include/erl_int_sizes_config.h.in]) dnl ---------------------------------------------------------------------- dnl Optional features. dnl ---------------------------------------------------------------------- @@ -439,6 +441,87 @@ dnl ---------------------------------------------------------------------- AC_PROG_CC AC_SUBST(GCC) +AC_PROG_EGREP +AC_PROG_CPP +AC_PROG_RANLIB +AC_PROG_YACC +LM_PROG_PERL5 +if test "$ac_cv_path_PERL" = false; then + AC_MSG_ERROR([Perl version 5 is required to build the emulator!]) +fi +AC_PROG_LN_S +AC_CHECK_TOOL([AR], [ar], [false]) +if test "$ac_cv_prog_AR" = false; then + AC_MSG_ERROR([No 'ar' command found in PATH]) +fi + + +# +# Get programs needed for building the documentation +# + +## Delete previous failed configure results +if test -f doc/CONF_INFO; then + rm -f doc/CONF_INFO +fi + +AC_CHECK_PROGS(XSLTPROC, xsltproc) +if test -z "$XSLTPROC"; then + echo "xsltproc" >> doc/CONF_INFO + AC_MSG_WARN([No 'xsltproc' command found: the documentation cannot be built]) +fi + +AC_CHECK_PROGS(FOP, fop) +if test -z "$FOP"; then + FOP="$ERL_TOP/make/fakefop" + echo "fop" >> doc/CONF_INFO + AC_MSG_WARN([No 'fop' command found: going to generate placeholder PDF files]) +fi + +AC_CHECK_PROGS(XMLLINT, xmllint) +if test -z "$XMLLINT"; then + echo "xmllint" >> doc/CONF_INFO + AC_MSG_WARN([No 'xmllint' command found: can't run the xmllint target for the documentation]) +fi + +dnl +dnl We can live with Solaris /usr/ucb/install +dnl +case $host in + *-*-solaris*|free_source) + if test -x /usr/ucb/install; then + INSTALL="/usr/ucb/install -c" + fi + ;; + *) + ;; +esac +AC_PROG_INSTALL +LM_PROG_INSTALL_DIR + +case $host_os in + darwin*) + dnl Need to preserve modification time on archives; + dnl otherwise, ranlib has to be run on archives + dnl again after installation. + INSTALL_DATA="$INSTALL_DATA -p";; + *) + ;; +esac + +dnl +dnl Fix for Tilera install permissions +dnl + +case $build in + *tile*) + INSTALL_PROGRAM="$INSTALL_PROGRAM -m755" + INSTALL_SCRIPT="$INSTALL_SCRIPT -m755" + ;; + *) + ;; +esac + dnl --------------------------------------------------------------------- dnl Special stuff regarding CFLAGS and details in the environment... dnl --------------------------------------------------------------------- @@ -566,7 +649,7 @@ if test "x$GCC" = xyes; then saved_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -Wdeclaration-after-statement" - AC_TRY_COMPILE([],[;], warn_decl_after_st=true, warn_decl_after_st=false) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])],[warn_decl_after_st=true],[warn_decl_after_st=false]) if test "X$warn_decl_after_st" = "Xtrue"; then WFLAGS="$WFLAGS -Wdeclaration-after-statement" fi @@ -839,92 +922,6 @@ else AC_MSG_RESULT([no]) fi - -dnl some tests below will call this if we haven't already - and autoconf -dnl can't handle those tests being done conditionally at runtime -AC_PROG_CPP - -AC_PROG_RANLIB - -AC_PROG_YACC -LM_PROG_PERL5 -if test "$ac_cv_path_PERL" = false; then - AC_MSG_ERROR([Perl version 5 is required to build the emulator!]) -fi -AC_PROG_LN_S - - -AC_CHECK_TOOL([AR], [ar], [false]) -if test "$ac_cv_prog_AR" = false; then - AC_MSG_ERROR([No 'ar' command found in PATH]) -fi - -# -# Get programs needed for building the documentation -# - -## Delete previous failed configure results -if test -f doc/CONF_INFO; then - rm -f doc/CONF_INFO -fi - -AC_CHECK_PROGS(XSLTPROC, xsltproc) -if test -z "$XSLTPROC"; then - echo "xsltproc" >> doc/CONF_INFO - AC_MSG_WARN([No 'xsltproc' command found: the documentation cannot be built]) -fi - -AC_CHECK_PROGS(FOP, fop) -if test -z "$FOP"; then - FOP="$ERL_TOP/make/fakefop" - echo "fop" >> doc/CONF_INFO - AC_MSG_WARN([No 'fop' command found: going to generate placeholder PDF files]) -fi - -AC_CHECK_PROGS(XMLLINT, xmllint) -if test -z "$XMLLINT"; then - echo "xmllint" >> doc/CONF_INFO - AC_MSG_WARN([No 'xmllint' command found: can't run the xmllint target for the documentation]) -fi - -dnl -dnl We can live with Solaris /usr/ucb/install -dnl -case $host in - *-*-solaris*|free_source) - if test -x /usr/ucb/install; then - INSTALL="/usr/ucb/install -c" - fi - ;; - *) - ;; -esac -AC_PROG_INSTALL -LM_PROG_INSTALL_DIR - -case $host_os in - darwin*) - dnl Need to preserve modification time on archives; - dnl otherwise, ranlib has to be run on archives - dnl again after installation. - INSTALL_DATA="$INSTALL_DATA -p";; - *) - ;; -esac - -dnl -dnl Fix for Tilera install permissions -dnl - -case $build in - *tile*) - INSTALL_PROGRAM="$INSTALL_PROGRAM -m755" - INSTALL_SCRIPT="$INSTALL_SCRIPT -m755" - ;; - *) - ;; -esac - dnl ---------------------------------------------------------------------- dnl Misc. things (some of them should go away) dnl ---------------------------------------------------------------------- @@ -946,7 +943,6 @@ LD_MAY_BE_WEAK=no AC_SUBST(LD) dnl Check for cygwin and object/exe files extension -dnl AC_CYGWIN is deprecated AC_EXEEXT AC_OBJEXT @@ -983,11 +979,14 @@ case $host_os in DEXPORT="" ;; *) + DEXPORT= save_ldflags="$LDFLAGS" LDFLAGS=-Wl,-export-dynamic - AC_TRY_LINK(,,[DEXPORT=-Wl,-export-dynamic], [ - LDFLAGS=-Wl,-Bexport - AC_TRY_LINK(,,[DEXPORT=-Wl,-Bexport],)]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[DEXPORT="$LDFLAGS"]) + if test "$DEXPORT" = ""; then + LDFLAGS=-Wl,-Bexport + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[DEXPORT="$LDFLAGS"]) + fi LDFLAGS="$save_ldflags" ;; esac @@ -1127,18 +1126,17 @@ AC_CHECK_FUNCS([posix_fadvise closefrom]) AC_CHECK_HEADERS([linux/falloc.h]) dnl * Old glibcs have broken fallocate64(). Make sure not to use it. AC_CACHE_CHECK([whether fallocate() works],i_cv_fallocate_works,[ - AC_TRY_LINK([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <unistd.h> #include <fcntl.h> #include <linux/falloc.h> - ], - [ + ]], [[ int fd = creat("conftest.temp", 0600); fallocate(fd, FALLOC_FL_KEEP_SIZE,(off_t) 1024,(off_t) 1024); - ], i_cv_fallocate_works=yes, i_cv_fallocate_works=no) + ]])],[i_cv_fallocate_works=yes],[i_cv_fallocate_works=no]) ]) if test $i_cv_fallocate_works = yes; then AC_DEFINE(HAVE_FALLOCATE, 1, Define if you have a working fallocate()) @@ -1147,7 +1145,7 @@ fi dnl * Old glibcs have broken posix_fallocate(). Make sure not to use it. dnl * It may also be broken in AIX. AC_CACHE_CHECK([whether posix_fallocate() works],i_cv_posix_fallocate_works,[ - AC_TRY_RUN([ + AC_RUN_IFELSE([AC_LANG_SOURCE([[ #if !defined(__sun) && !defined(__sun__) #define _XOPEN_SOURCE 600 #endif @@ -1169,11 +1167,11 @@ AC_CACHE_CHECK([whether posix_fallocate() works],i_cv_posix_fallocate_works,[ unlink("conftest.temp"); return ret; } - ], [ + ]])],[ i_cv_posix_fallocate_works=yes - ], [ + ],[ i_cv_posix_fallocate_works=no - ], [ + ],[ i_cv_posix_fallocate_works=no ]) ]) @@ -1297,8 +1295,7 @@ fi if test "X$host" != "Xwin32"; then AC_MSG_CHECKING(for wcwidth) - AC_TRY_LINK([#include <wchar.h>], [wcwidth(0);], - have_wcwidth=yes, have_wcwidth=no) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <wchar.h>]], [[wcwidth(0);]])],[have_wcwidth=yes],[have_wcwidth=no]) if test $have_wcwidth = yes; then AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_WCWIDTH, [1], @@ -1536,10 +1533,8 @@ if test "$have_gethostbyname_r" = yes; then ;; aix*|os400*) # AIX version also needs "struct hostent_data" defn - AC_TRY_COMPILE([#include <netdb.h>], - [struct hostent_data hd;], - AC_DEFINE(HAVE_GETHOSTBYNAME_R, GHBN_R_AIX, - [Define to flavour of gethostbyname_r])) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], [[struct hostent_data hd;]])],[AC_DEFINE(HAVE_GETHOSTBYNAME_R, GHBN_R_AIX, + Define to flavour of gethostbyname_r)],[]) ;; *) AC_EGREP_CPP(^yes$,[ @@ -1554,18 +1549,17 @@ yes fi AC_MSG_CHECKING(for working posix_openpt implementation) -AC_TRY_LINK([ +AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #define _XOPEN_SOURCE 600 #include <stdlib.h> #include <fcntl.h> -], -[ +]], [[ int mfd = posix_openpt(O_RDWR); ptsname(mfd); grantpt(mfd); unlockpt(mfd); return mfd; -], working_posix_openpt=yes, working_posix_openpt=no) +]])],[working_posix_openpt=yes],[working_posix_openpt=no]) if test "X$working_posix_openpt" = "Xyes"; then AC_DEFINE(HAVE_WORKING_POSIX_OPENPT, [1], @@ -1583,11 +1577,8 @@ dnl netdb.h version 1.18. AC_MSG_CHECKING([if netdb.h requires netinet/in.h to be previously included]) AC_EGREP_CPP(sockaddr_in, [#include <netdb.h>], - AC_TRY_COMPILE([#include <netinet/in.h> - #include <netdb.h>], - [return 0;], - need_in_h=yes, - need_in_h=no), + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h> + #include <netdb.h>]], [[return 0;]])],[need_in_h=yes],[need_in_h=no]), need_in_h=no) if test $need_in_h = yes; then @@ -1601,10 +1592,7 @@ fi dnl Check for type socklen_t dnl AC_MSG_CHECKING([for socklen_t]) -AC_TRY_COMPILE( [#include <sys/socket.h>], - [socklen_t test;], - have_socklen_t=yes, - have_socklen_t=no), +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]], [[socklen_t test;]])],[have_socklen_t=yes],[have_socklen_t=no]), if test $have_socklen_t = yes; then AC_DEFINE(HAVE_SOCKLEN_T,[1],[Define if we have socklen_t]) @@ -1619,8 +1607,7 @@ dnl (e.g. function call for thread-safe) a simple 'extern int' may conflict dnl (we do assume that h_errno exists at all...) AC_CACHE_CHECK([for h_errno declaration in netdb.h], ac_cv_decl_h_errno, -[AC_TRY_COMPILE([#include <netdb.h>], [int err = h_errno;], - ac_cv_decl_h_errno=yes, ac_cv_decl_h_errno=no)]) +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], [[int err = h_errno;]])],[ac_cv_decl_h_errno=yes],[ac_cv_decl_h_errno=no])]) if test $ac_cv_decl_h_errno = yes; then AC_DEFINE(H_ERRNO_DECLARED,[1], [define if h_errno is declared (in some way) in a system header file]) @@ -1636,9 +1623,10 @@ saved_cppflags=$CPPFLAGS CPPFLAGS="$CPPFLAGS $EMU_THR_DEFS" AC_HEADER_DIRENT -AC_HEADER_STDC +AC_CHECK_INCLUDES_DEFAULT + AC_HEADER_SYS_WAIT -AC_HEADER_TIME +AC_CHECK_HEADERS_ONCE([sys/time.h]) dnl Interactive UX needs <net/errno.h> for socket related error codes. dnl Some Linuxes needs <sys/socketio.h> instead of <sys/sockio.h> @@ -1850,15 +1838,12 @@ LM_DECL_SYS_ERRLIST AC_CACHE_CHECK([if windows.h includes winsock2.h], erts_cv_windows_h_includes_winsock2_h, - AC_TRY_COMPILE([#include <windows.h> - ], - [#ifndef _WINSOCK2API_ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <windows.h> + ]], [[#ifndef _WINSOCK2API_ #error winsock2.h not included #endif int i = 1; - ], - erts_cv_windows_h_includes_winsock2_h=yes, - erts_cv_windows_h_includes_winsock2_h=no)) + ]])],[erts_cv_windows_h_includes_winsock2_h=yes],[erts_cv_windows_h_includes_winsock2_h=no])) if test $erts_cv_windows_h_includes_winsock2_h = yes; then AC_DEFINE(WINDOWS_H_INCLUDES_WINSOCK2_H, 1, \ [Define if windows.h includes winsock2.h]) @@ -1872,7 +1857,7 @@ dnl Checks for typedefs, structures, and compiler characteristics. dnl ---------------------------------------------------------------------- AC_C_CONST -AC_TYPE_SIGNAL + AC_TYPE_OFF_T AC_TYPE_PID_T AC_TYPE_SIZE_T @@ -1902,11 +1887,10 @@ AC_SUBST(BITS64) AC_MSG_CHECKING([for C compiler 'restrict' support]) restrict_keyword="" for x in restrict __restrict; do - AC_TRY_COMPILE([int * $x foo(int * $x arg); + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int * $x foo(int * $x arg); int * $x foo(int * $x arg) { int * $x var=arg; return var;} - ],[], - [restrict_keyword=$x],[]) + ]], [[]])],[restrict_keyword=$x],[]) if test "x$restrict_keyword" != "x"; then break fi @@ -1921,15 +1905,13 @@ fi if test "x$ac_compiler_gnu" = "xyes"; then AC_MSG_CHECKING([if we should add -fno-tree-copyrename to CFLAGS for computed gotos to work properly]) ## tree-copyrename was broken in gcc 4.3 and then removed in gcc 6 -AC_TRY_COMPILE([],[ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ #if (__GNUC__ > 4 && __GNUC__ < 6) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) ; #else #error old and ok #endif - ], - no_tree_copyrename=yes, - no_tree_copyrename=no) + ]])],[no_tree_copyrename=yes],[no_tree_copyrename=no]) if test "x$no_tree_copyrename" = "xyes"; then CFLAGS="$CFLAGS -fno-tree-copyrename" @@ -1939,7 +1921,7 @@ else fi AC_MSG_CHECKING([for broken gcc-4.3.0 compiler]) -AC_TRY_RUN([ +AC_RUN_IFELSE([AC_LANG_SOURCE([[ /* pr36339.c */ extern void abort (void); @@ -1972,7 +1954,7 @@ int main(void) abort (); return 0; } -], gcc_4_3_0_bug=no, gcc_4_3_0_bug=yes, gcc_4_3_0_bug=cross) +]])],[gcc_4_3_0_bug=no],[gcc_4_3_0_bug=yes],[gcc_4_3_0_bug=cross]) case $gcc_4_3_0_bug in yes|no) @@ -2071,7 +2053,7 @@ AC_CHECK_HEADERS(ws2tcpip.h,[],[],[ ]) dnl AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes, have_getaddrinfo=no) AC_MSG_CHECKING(for getaddrinfo) -AC_TRY_LINK([ +AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdlib.h> #include <string.h> #ifdef HAVE_WINSOCK2_H @@ -2087,14 +2069,13 @@ AC_TRY_LINK([ #include <sys/socket.h> #include <netdb.h> #endif -], -[ +]], [[ getaddrinfo("","",NULL,NULL); -],have_getaddrinfo=yes, have_getaddrinfo=no) +]])],[have_getaddrinfo=yes],[have_getaddrinfo=no]) if test $have_getaddrinfo = yes; then AC_MSG_RESULT([yes]) AC_MSG_CHECKING([whether getaddrinfo accepts enough flags]) - AC_TRY_LINK([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdlib.h> #include <string.h> #ifdef HAVE_WINSOCK2_H @@ -2110,8 +2091,7 @@ if test $have_getaddrinfo = yes; then #include <sys/socket.h> #include <netdb.h> #endif -], -[ +]], [[ struct addrinfo hints, *ai; memset(&hints, 0, sizeof(hints)); hints.ai_flags = AI_CANONNAME; @@ -2123,7 +2103,7 @@ if test $have_getaddrinfo = yes; then } else { exit(1); } -],, have_getaddrinfo=no) +]])],[],[have_getaddrinfo=no]) AC_MSG_RESULT($have_getaddrinfo) case $have_getaddrinfo in yes) @@ -2135,7 +2115,7 @@ else AC_MSG_RESULT([no]) fi AC_MSG_CHECKING(for getnameinfo) -AC_TRY_LINK([ +AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdlib.h> #include <string.h> #ifdef HAVE_WINSOCK2_H @@ -2151,10 +2131,9 @@ AC_TRY_LINK([ #include <sys/socket.h> #include <netdb.h> #endif -], -[ +]], [[ getnameinfo(NULL,0,NULL,0,NULL,0,0); -],have_getnameinfo=yes, have_getnameinfo=no) +]])],[have_getnameinfo=yes],[have_getnameinfo=no]) if test $have_getnameinfo = yes; then AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_GETNAMEINFO, [1], @@ -2176,13 +2155,13 @@ AC_CHECK_FUNCS([ieee_handler fpsetmask finite isnan isinf res_gethostbyname dlop ## We have a special check for inet_pton as AC_CHECK_FUCNS does not work ## on windows 32-bit as there a macro is used to rename the symbol... AC_MSG_CHECKING([for inet_pton]) -AC_TRY_LINK([ +AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #ifdef WIN32 #include <ws2tcpip.h> #else #include <arpa/inet.h> #endif -],[inet_pton(2,"",(void*)0)], have_inet_pton=yes, have_inet_pton=no) +]], [[inet_pton(2,"",(void*)0)]])],[have_inet_pton=yes],[have_inet_pton=no]) if test $have_inet_pton = yes; then AC_DEFINE(HAVE_INET_PTON,[1], @@ -2193,8 +2172,7 @@ else fi AC_MSG_CHECKING([for isfinite]) -AC_TRY_LINK([#include <math.h>], - [isfinite(0);], have_isfinite=yes, have_isfinite=no) +AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], [[isfinite(0);]])],[have_isfinite=yes],[have_isfinite=no]) if test $have_isfinite = yes; then AC_DEFINE(HAVE_ISFINITE,[1], @@ -2211,7 +2189,7 @@ case X$erl_xcomp_posix_memalign in AC_CHECK_FUNC( [posix_memalign], [if test "$cross_compiling" != yes; then -AC_TRY_RUN([ +AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <stdlib.h> int main(void) { void *ptr = NULL; @@ -2221,8 +2199,8 @@ int main(void) { return error; return 0; } -],have_posix_memalign=yes -) +]])],[have_posix_memalign=yes +],[],[]) else have_posix_memalign=yes fi]);; @@ -2255,10 +2233,7 @@ LM_CHECK_FUNC_DECL(fread, [extern int fread();],, dnl Checking with TRY_LINK since putc_unlocked might be (probably is) a macro AC_CACHE_CHECK([for putc_unlocked], erts_cv_putc_unlocked, - AC_TRY_LINK([#include <stdio.h>], - [int res = putc_unlocked('x',stdout);], - erts_cv_putc_unlocked=yes, - erts_cv_putc_unlocked=no)) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[int res = putc_unlocked('x',stdout);]])],[erts_cv_putc_unlocked=yes],[erts_cv_putc_unlocked=no])) if test $erts_cv_putc_unlocked = yes; then AC_DEFINE(HAVE_PUTC_UNLOCKED, 1, [Define if you have putc_unlocked]) fi @@ -2266,10 +2241,7 @@ fi dnl Checking with TRY_LINK since fwrite_unlocked might be a macro AC_CACHE_CHECK([for fwrite_unlocked], erts_cv_fwrite_unlocked, - AC_TRY_LINK([#include <stdio.h>], - [size_t res = fwrite_unlocked(NULL,sizeof(char),0,stdout);], - erts_cv_fwrite_unlocked=yes, - erts_cv_fwrite_unlocked=no)) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[size_t res = fwrite_unlocked(NULL,sizeof(char),0,stdout);]])],[erts_cv_fwrite_unlocked=yes],[erts_cv_fwrite_unlocked=no])) if test $erts_cv_fwrite_unlocked = yes; then AC_DEFINE(HAVE_FWRITE_UNLOCKED, 1, [Define if you have fwrite_unlocked]) fi @@ -2351,8 +2323,7 @@ dnl Checks for features/quirks in the system that affects Erlang. dnl ---------------------------------------------------------------------- AC_MSG_CHECKING([for sched_getaffinity/sched_setaffinity]) -AC_TRY_LINK([#include <sched.h>], -[ +AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sched.h>]], [[ #ifndef CPU_SETSIZE #error no CPU_SETSIZE #endif @@ -2364,9 +2335,7 @@ AC_TRY_LINK([#include <sched.h>], res = sched_getaffinity(0, sizeof(cpu_set_t), &cpuset); res = CPU_ISSET(1, &cpuset); CPU_CLR(1, &cpuset); -], - sched_xetaffinity=yes, - sched_xetaffinity=no) +]])],[sched_xetaffinity=yes],[sched_xetaffinity=no]) AC_MSG_RESULT([$sched_xetaffinity]) if test $sched_xetaffinity = yes; then AC_DEFINE(HAVE_SCHED_xETAFFINITY, 1, [Define if you have sched_getaffinity/sched_setaffinity]) @@ -2374,8 +2343,7 @@ fi AC_MSG_CHECKING([for pset functionality]) -AC_TRY_LINK([#include <sys/pset.h>], -[ +AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/pset.h>]], [[ int res; psetid_t id = PS_MYID; int type = PS_PRIVATE; @@ -2383,36 +2351,30 @@ AC_TRY_LINK([#include <sys/pset.h>], processorid_t cpulist[1024]; res = pset_info(id, &type, &numcpus, &cpulist[0]); -], - pset_functionality=yes, - pset_functionality=no) +]])],[pset_functionality=yes],[pset_functionality=no]) AC_MSG_RESULT([$pset_functionality]) if test $pset_functionality = yes; then AC_DEFINE(HAVE_PSET, 1, [Define if you have pset functionality]) fi AC_MSG_CHECKING([for processor_bind functionality]) -AC_TRY_LINK([ +AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> #include <sys/processor.h> #include <sys/procset.h> -], -[ +]], [[ int res = processor_bind(P_LWPID, P_MYID, PBIND_NONE, NULL); -], - processor_bind_functionality=yes, - processor_bind_functionality=no) +]])],[processor_bind_functionality=yes],[processor_bind_functionality=no]) AC_MSG_RESULT([$processor_bind_functionality]) if test $processor_bind_functionality = yes; then AC_DEFINE(HAVE_PROCESSOR_BIND, 1, [Define if you have processor_bind functionality]) fi AC_MSG_CHECKING([for cpuset_getaffinity/cpuset_setaffinity]) -AC_TRY_LINK([ +AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <sys/param.h> #include <sys/cpuset.h> -], -[ +]], [[ int res; cpuset_t cpuset; CPU_ZERO(&cpuset); @@ -2421,9 +2383,7 @@ AC_TRY_LINK([ res = cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, sizeof(cpuset_t), &cpuset); res = CPU_ISSET(1, &cpuset); CPU_CLR(1, &cpuset); -], - cpuset_xetaffinity=yes, - cpuset_xetaffinity=no) +]])],[cpuset_xetaffinity=yes],[cpuset_xetaffinity=no]) AC_MSG_RESULT([$cpuset_xetaffinity]) if test $cpuset_xetaffinity = yes; then AC_DEFINE(HAVE_CPUSET_xETAFFINITY, 1, [Define if you have cpuset_getaffinity/cpuset_setaffinity]) @@ -2431,27 +2391,21 @@ fi AC_CACHE_CHECK([for 'end' symbol], erts_cv_have_end_symbol, - [AC_TRY_LINK([], - [extern char end; {char *x = &end; *x= 0;}], - erts_cv_have_end_symbol=yes, - erts_cv_have_end_symbol=no)]) + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[extern char end; {char *x = &end; *x= 0;}]])],[erts_cv_have_end_symbol=yes],[erts_cv_have_end_symbol=no])]) if test $erts_cv_have_end_symbol = yes; then AC_DEFINE(HAVE_END_SYMBOL, 1, [Define if you have the 'end' symbol]) fi AC_CACHE_CHECK([for '_end' symbol], erts_cv_have__end_symbol, - [AC_TRY_LINK([], - [extern char _end; {char *x = &_end; *x= 0;}], - erts_cv_have__end_symbol=yes, - erts_cv_have__end_symbol=no)]) + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[extern char _end; {char *x = &_end; *x= 0;}]])],[erts_cv_have__end_symbol=yes],[erts_cv_have__end_symbol=no])]) if test $erts_cv_have__end_symbol = yes; then AC_DEFINE(HAVE__END_SYMBOL, 1, [Define if you have the '_end' symbol]) fi AC_CACHE_CHECK([if __after_morecore_hook can track malloc()s core memory use], erts_cv___after_morecore_hook_can_track_malloc, - [AC_TRY_RUN([ + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <stdlib.h> #ifdef HAVE_MALLOC_H # include <malloc.h> @@ -2573,17 +2527,14 @@ int main(void) return 1; return 0; } - ], - erts_cv___after_morecore_hook_can_track_malloc=yes, - erts_cv___after_morecore_hook_can_track_malloc=no, - [ + ]])],[erts_cv___after_morecore_hook_can_track_malloc=yes],[erts_cv___after_morecore_hook_can_track_malloc=no],[ case X$erl_xcomp_after_morecore_hook in X) erts_cv___after_morecore_hook_can_track_malloc=cross;; Xyes|Xno) erts_cv___after_morecore_hook_can_track_malloc=$erl_xcomp_after_morecore_hook;; *) AC_MSG_ERROR([Bad erl_xcomp_after_morecore_hook value: $erl_xcomp_after_morecore_hook]);; esac - ] - )]) + + ])]) case $erts_cv___after_morecore_hook_can_track_malloc in yes) AC_DEFINE(ERTS___AFTER_MORECORE_HOOK_CAN_TRACK_MALLOC, 1, \ @@ -2604,10 +2555,8 @@ if test "x$ac_cv_func_sbrk" = "xyes"; then for rtype in $ret_types; do for atype in $arg_types; do IFS=$save_ifs - AC_TRY_LINK([#include <sys/types.h> - #include <unistd.h>], - [$rtype sbrk($atype incr);], - [erts_cv_sbrk_ret_arg_types="$rtype,$atype"]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> + #include <unistd.h>]], [[$rtype sbrk($atype incr);]])],[erts_cv_sbrk_ret_arg_types="$rtype,$atype"],[]) IFS="," if test "$erts_cv_sbrk_ret_arg_types" != "unknown"; then break 2 @@ -2641,10 +2590,8 @@ if test $ac_cv_func_brk = yes; then for rtype in $ret_types; do for atype in $arg_types; do IFS=$save_ifs - AC_TRY_LINK([#include <sys/types.h> - #include <unistd.h>], - [$rtype brk($atype endds);], - [erts_cv_brk_ret_arg_types="$rtype,$atype"]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> + #include <unistd.h>]], [[$rtype brk($atype endds);]])],[erts_cv_brk_ret_arg_types="$rtype,$atype"],[]) IFS="," if test "$erts_cv_brk_ret_arg_types" != "unknown"; then break 2 @@ -2671,7 +2618,7 @@ if test $ac_cv_func_sbrk = yes; then AC_CACHE_CHECK([if sbrk()/brk() wrappers can track malloc()s core memory use], erts_cv_brk_wrappers_can_track_malloc, - [AC_TRY_RUN([ + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <stdlib.h> #include <sys/types.h> #include <unistd.h> @@ -2836,10 +2783,7 @@ int main(void) return 1; return 0; } - ], - erts_cv_brk_wrappers_can_track_malloc=yes, - erts_cv_brk_wrappers_can_track_malloc=no, - [ + ]])],[erts_cv_brk_wrappers_can_track_malloc=yes],[erts_cv_brk_wrappers_can_track_malloc=no],[ case X$erl_xcomp_dlsym_brk_wrappers in X) erts_cv_brk_wrappers_can_track_malloc=cross;; Xyes|Xno) erts_cv_brk_wrappers_can_track_malloc=$erl_xcomp_dlsym_brk_wrappers;; @@ -2945,19 +2889,15 @@ if test ${enable_jit} != no; then # Use the native stack if we can safely redirect OS signals to a # different stack. AC_MSG_CHECKING([for safe signal delivery]) - AC_TRY_COMPILE( - [#include <signal.h>], - [#if defined(__APPLE__) && defined(__MACH__) && !defined(__DARWIN__) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]], [[#if defined(__APPLE__) && defined(__MACH__) && !defined(__DARWIN__) #define __DARWIN__ 1 #endif #if !(defined(__GLIBC__) || defined(__DARWIN__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__sun__)) #error "Unknown libc. Assume musl, which does not allow safe signals" - #endif], - [AC_MSG_RESULT([yes]) - enable_native_stack=yes], - [AC_MSG_RESULT([no, disabling native stack in JIT]) - enable_native_stack=no] - );; + #endif]])],[AC_MSG_RESULT([yes]) + enable_native_stack=yes],[AC_MSG_RESULT([no, disabling native stack in JIT]) + enable_native_stack=no + ]);; esac if test X${enable_native_stack} = Xyes; then @@ -3034,7 +2974,7 @@ poll_works=no else -AC_TRY_RUN([ +AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <poll.h> main() { @@ -3053,10 +2993,7 @@ main() exit(0); #endif } -], -poll_works=yes, -poll_works=no, -[ +]])],[poll_works=yes],[poll_works=no],[ case X$erl_xcomp_poll in X) poll_works=cross;; Xyes|Xno) poll_works=$erl_xcomp_poll;; @@ -3115,7 +3052,7 @@ fi # if test $have_kernel_poll = epoll; then AC_MSG_CHECKING([whether epoll is level triggered]) - AC_TRY_LINK([#include <sys/epoll.h>],[ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/epoll.h>]], [[ #ifdef EPOLLET /* Edge triggered option exist, assume level triggered is default */ @@ -3125,9 +3062,7 @@ if test $have_kernel_poll = epoll; then triggered only */ #error No EPOLLET #endif - ], - level_triggered_epoll=yes, - [level_triggered_epoll=no + ]])],[level_triggered_epoll=yes],[level_triggered_epoll=no have_kernel_poll=no]) AC_MSG_RESULT([$level_triggered_epoll]) fi @@ -3167,7 +3102,7 @@ esac AC_SUBST(ERTS_BUILD_FALLBACK_POLL) AC_MSG_CHECKING([whether putenv() stores a copy of the key-value pair]) -AC_TRY_RUN([ +AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <stdlib.h> int main(void) { int i; @@ -3197,10 +3132,7 @@ int main(void) { return 5; return 0; } -], -copying_putenv=yes, -copying_putenv=no, -[ +]])],[copying_putenv=yes],[copying_putenv=no],[ case X$erl_xcomp_putenv_copy in X) copying_putenv=cross;; Xyes|Xno) copying_putenv=$erl_xcomp_putenv_copy;; @@ -3279,15 +3211,12 @@ if test "$enable_dtrace_test" = "yes" ; then AC_MSG_RESULT([yes]) AC_MSG_CHECKING([for 2-stage DTrace precompilation]) - AC_TRY_COMPILE([ #include "foo-dtrace.h" ], - [ERLANG_DIST_PORT_BUSY_ENABLED();], - [rm -f $DTRACE_2STEP_TEST + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include "foo-dtrace.h" ]], [[ERLANG_DIST_PORT_BUSY_ENABLED();]])],[rm -f $DTRACE_2STEP_TEST dtrace -G $DTRACE_CPP $DTRACE_BITS_FLAG -Iemulator/beam -o $DTRACE_2STEP_TEST -s emulator/beam/erlang_dtrace.d conftest.$OBJEXT 2>&AS_MESSAGE_LOG_FD if test -f $DTRACE_2STEP_TEST; then rm -f $DTRACE_2STEP_TEST DTRACE_ENABLED_2STEP=yes - fi], - []) + fi],[]) rm -f foo-dtrace.h AS_IF([test "x$DTRACE_ENABLED_2STEP" = "xyes"], [AC_MSG_RESULT([yes])], @@ -3563,13 +3492,11 @@ dnl Check for GCC diagnostic ignored "-Waddress-of-packed-member" dnl ---------------------------------------------------------------------- saved_CFLAGS="$CFLAGS" CFLAGS="-Werror $CFLAGS" -AC_TRY_COMPILE([], - [_Pragma("GCC diagnostic push") +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[_Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Waddress-of-packed-member\"") _Pragma("GCC diagnostic pop") - ], - AC_DEFINE(HAVE_GCC_DIAG_IGNORE_WADDRESS_OF_PACKED_MEMBER,[1], - [define if compiler support _Pragma('GCC diagnostic ignored '-Waddress-of-packed-member'')])) + ]])],[AC_DEFINE(HAVE_GCC_DIAG_IGNORE_WADDRESS_OF_PACKED_MEMBER,1, + define if compiler support _Pragma('GCC diagnostic ignored '-Waddress-of-packed-member''))],[]) CFLAGS="$saved_CFLAGS" diff --git a/erts/emulator/pcre/local_config.h b/erts/emulator/pcre/local_config.h index 178c4d4281..6f4f3a1868 100644 --- a/erts/emulator/pcre/local_config.h +++ b/erts/emulator/pcre/local_config.h @@ -73,9 +73,6 @@ "configure" can be used to override this default. */ #define POSIX_MALLOC_THRESHOLD 10 -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - /* Define to enable support for Unicode properties */ #define SUPPORT_UCP diff --git a/erts/emulator/sys/unix/erl_unix_sys.h b/erts/emulator/sys/unix/erl_unix_sys.h index 832b7a09c2..0aa782f6bf 100644 --- a/erts/emulator/sys/unix/erl_unix_sys.h +++ b/erts/emulator/sys/unix/erl_unix_sys.h @@ -73,15 +73,9 @@ # include <sys/mman.h> #endif -#if TIME_WITH_SYS_TIME +#include <time.h> +#if HAVE_SYS_TIME_H # include <sys/time.h> -# include <time.h> -#else -# if HAVE_SYS_TIME_H -# include <sys/time.h> -# else -# include <time.h> -# endif #endif #include <sys/times.h> @@ -113,6 +107,10 @@ # define ERTS_HAVE_ERTS_SYS_ALIGNED_ALLOC 1 #endif +#ifndef RETSIGTYPE +#define RETSIGTYPE void +#endif + /* * Make sure that MAXPATHLEN is defined. */ diff --git a/erts/epmd/src/epmd_int.h b/erts/epmd/src/epmd_int.h index e09dd0ac95..bc20e121ad 100644 --- a/erts/epmd/src/epmd_int.h +++ b/erts/epmd/src/epmd_int.h @@ -50,15 +50,9 @@ #include <fcntl.h> #ifndef __WIN32__ -# ifdef TIME_WITH_SYS_TIME -# include <sys/time.h> -# include <time.h> -# else -# ifdef HAVE_SYS_TIME_H -# include <sys/time.h> -# else -# include <time.h> -# endif +# include <time.h> +# ifdef HAVE_SYS_TIME_H +# include <sys/time.h> # endif #endif diff --git a/erts/include/internal/ethr_internal.h b/erts/include/internal/ethr_internal.h index 986e2b84de..f9c351ff63 100644 --- a/erts/include/internal/ethr_internal.h +++ b/erts/include/internal/ethr_internal.h @@ -56,28 +56,22 @@ ethr_ts_event *ethr_get_tse__(void); ETHR_PROTO_NORETURN__ ethr_abort__(void); #ifdef ETHR_INCLUDE_MONOTONIC_CLOCK__ -#undef ETHR_HAVE_ETHR_GET_MONOTONIC_TIME -#if defined(ETHR_HAVE_CLOCK_GETTIME_MONOTONIC) \ - || defined(ETHR_HAVE_MACH_CLOCK_GET_TIME) \ - || defined(ETHR_HAVE_GETHRTIME) -#ifdef ETHR_TIME_WITH_SYS_TIME -# include <time.h> -# include <sys/time.h> -#else -# ifdef ETHR_HAVE_SYS_TIME_H -# include <sys/time.h> -# else +# undef ETHR_HAVE_ETHR_GET_MONOTONIC_TIME +# if defined(ETHR_HAVE_CLOCK_GETTIME_MONOTONIC) \ + || defined(ETHR_HAVE_MACH_CLOCK_GET_TIME) \ + || defined(ETHR_HAVE_GETHRTIME) # include <time.h> +# ifdef ETHR_HAVE_SYS_TIME_H +# include <sys/time.h> +# endif # endif -#endif -#ifdef ETHR_HAVE_MACH_CLOCK_GET_TIME -#include <mach/clock.h> -#include <mach/mach.h> -#endif -#define ETHR_HAVE_ETHR_GET_MONOTONIC_TIME +# ifdef ETHR_HAVE_MACH_CLOCK_GET_TIME +# include <mach/clock.h> +# include <mach/mach.h> +# endif +# define ETHR_HAVE_ETHR_GET_MONOTONIC_TIME ethr_sint64_t ethr_get_monotonic_time(void); int ethr_get_monotonic_time_is_broken(void); -#endif #endif /* ETHR_INCLUDE_MONOTONIC_CLOCK__ */ void ethr_init_event__(void); diff --git a/erts/lib_src/common/erl_misc_utils.c b/erts/lib_src/common/erl_misc_utils.c index b35d53be7d..9b6c8341dc 100644 --- a/erts/lib_src/common/erl_misc_utils.c +++ b/erts/lib_src/common/erl_misc_utils.c @@ -41,15 +41,9 @@ # ifdef SYS_SELECT_H # include <sys/select.h> # endif -# if TIME_WITH_SYS_TIME -# include <sys/time.h> -# include <time.h> -# else -# if HAVE_SYS_TIME_H -# include <sys/time.h> -# else -# include <time.h> -# endif +# include <time.h> +# if HAVE_SYS_TIME_H +# include <sys/time.h> # endif # include <string.h> # include <stdio.h> diff --git a/erts/lib_src/pthread/ethread.c b/erts/lib_src/pthread/ethread.c index f7262c02b1..2a7f6aa18a 100644 --- a/erts/lib_src/pthread/ethread.c +++ b/erts/lib_src/pthread/ethread.c @@ -30,15 +30,9 @@ #define ETHR_CHILD_WAIT_SPIN_COUNT 4000 #include <stdio.h> -#ifdef ETHR_TIME_WITH_SYS_TIME -# include <time.h> +#include <time.h> +#ifdef ETHR_HAVE_SYS_TIME_H # include <sys/time.h> -#else -# ifdef ETHR_HAVE_SYS_TIME_H -# include <sys/time.h> -# else -# include <time.h> -# endif #endif #include <sys/types.h> #include <unistd.h> |