xref: /freebsd/sys/contrib/openzfs/config/always-arch.m4 (revision 113e60742ef6ba5c069aa737ee57ba3c2f88b248)
1dnl #
2dnl # Set the target cpu architecture.  This allows the
3dnl # following syntax to be used in a Makefile.am.
4dnl #
5dnl # if TARGET_CPU_POWERPC
6dnl # ...
7dnl # else
8dnl # ...
9dnl # endif
10dnl #
11AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_ARCH], [
12	case $target_cpu in
13	i?86)
14		TARGET_CPU=i386
15		;;
16	amd64|x86_64)
17		TARGET_CPU=x86_64
18		;;
19	powerpc*)
20		TARGET_CPU=powerpc
21		;;
22	aarch64*)
23		TARGET_CPU=aarch64
24		;;
25	armv*)
26		TARGET_CPU=arm
27		;;
28	sparc64)
29		TARGET_CPU=sparc64
30		;;
31	*)
32		TARGET_CPU=$target_cpu
33		;;
34	esac
35
36	AM_CONDITIONAL([TARGET_CPU_AARCH64], test $TARGET_CPU = aarch64)
37	AM_CONDITIONAL([TARGET_CPU_I386],    test $TARGET_CPU = i386)
38	AM_CONDITIONAL([TARGET_CPU_X86_64],  test $TARGET_CPU = x86_64)
39	AM_CONDITIONAL([TARGET_CPU_POWERPC], test $TARGET_CPU = powerpc)
40	AM_CONDITIONAL([TARGET_CPU_SPARC64], test $TARGET_CPU = sparc64)
41	AM_CONDITIONAL([TARGET_CPU_ARM],     test $TARGET_CPU = arm)
42])
43dnl #
44dnl # Check for conflicting environment variables
45dnl #
46dnl # If ARCH env variable is set up, then kernel Makefile in the /usr/src/kernel
47dnl # can misbehave during the zfs ./configure test of the module compilation.
48AC_DEFUN([ZFS_AC_CONFIG_CHECK_ARCH_VAR], [
49	AC_MSG_CHECKING([for conflicting environment variables])
50	if test -n "$ARCH"; then
51		AC_MSG_RESULT([warning])
52		AC_MSG_WARN(m4_normalize([ARCH environment variable is set to "$ARCH".
53    This can cause build kernel modules support check failure.
54    Please unset it.]))
55	else
56		AC_MSG_RESULT([done])
57	fi
58])
59
60