#
# If everything above is supported, runtime detection will be used to keep the
# binaries working on systems that don't support the required extensions.
+#
+# NOTE: Use a check that links and not merely compiles to ensure that
+# missing intrinsics don't get accepted with compilers that allow
+# implicit function declarations.
AC_MSG_CHECKING([if _mm_clmulepi64_si128 is usable])
AS_IF([test "x$enable_clmul_crc" = xno], [
AC_MSG_RESULT([no, --disable-clmul-crc was used])
], [
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+ AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <immintrin.h>
// CLMUL works on older E2K instruction set but it is slow due to emulation.
# A compile check is done here because some systems have
# linux/landlock.h, but do not have the syscalls defined
# in order to actually use Linux Landlock.
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+ AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <linux/landlock.h>
#include <sys/syscall.h>
#include <sys/prctl.h>
# -lfreebsd-glue when linking and thus in the current form this would
# fail on GNU/kFreeBSD. The above test for sched_getaffinity() matches
# on GNU/kFreeBSD so the test below should never run on that OS.
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <sys/param.h>
#include <sys/cpuset.h>
#
# We test sysctl() first and intentionally break the sysctl() test on QNX
# so that sysctl() is never used on QNX.
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+AC_LINK_IFELSE([AC_LANG_SOURCE([[
#ifdef __QNX__
compile error
#endif
}
]])], [tuklib_cv_cpucores_method=sysctl], [
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <unistd.h>
int
main(void)
}
]])], [tuklib_cv_cpucores_method=sysconf], [
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <sys/param.h>
#include <sys/pstat.h>
# Look for AIX-specific solution before sysconf(), because the test
# for sysconf() will pass on AIX but won't actually work
# (sysconf(_SC_PHYS_PAGES) compiles but always returns -1 on AIX).
+#
+# NOTE: There is no need to link the check program because it's not calling
+# any functions and thus implicit function declarations aren't a problem.
+# The unused reference to _system_configuration.physmem might get optimized
+# away, and thus the linker might not see that symbol anyway.
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <sys/systemcfg.h>
}
]])], [tuklib_cv_physmem_method=aix], [
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <unistd.h>
int
main(void)
}
]])], [tuklib_cv_physmem_method=sysconf], [
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+AC_LINK_IFELSE([AC_LANG_SOURCE([[
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
}
]])], [tuklib_cv_physmem_method=sysctl], [
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <sys/sysinfo.h>
#include <machine/hal_sysinfo.h>
}
]])], [tuklib_cv_physmem_method=getsysinfo],[
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <sys/param.h>
#include <sys/pstat.h>
}
]])], [tuklib_cv_physmem_method=pstat_getstatic],[
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <invent.h>
int
main(void)
# different sysinfo() so we must check $host_os.
case $host_os in
linux*)
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+ AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <sys/sysinfo.h>
int
main(void)