Autoconf: Use AC_CACHE_CHECK
[openafs.git] / src / cf / linux-test5.m4
1 dnl These options seem to only be used for the 2.4.x
2 dnl Linux kernel build
3 AC_DEFUN([OPENAFS_GCC_SUPPORTS_MARCH], [
4   AC_CACHE_CHECK([if $CC accepts -march=pentium],
5     [openafs_cv_gcc_supports_march],
6     [save_CFLAGS="$CFLAGS"
7      CFLAGS="-MARCH=pentium"
8      AC_TRY_COMPILE([],
9                     [int x;],
10                     [openafs_cv_gcc_supports_march=yes],
11                     [openafs_cv_gcc_supports_march=no])
12      CFLAGS="$save_CFLAGS"
13     ])
14   AS_IF([test x$openafs_cv_gcc_supports_march = xyes],
15         [P5PLUS_KOPTS="-march=pentium"],
16         [P5PLUS_KOPTS="-m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2"])
17 ])
18
19 AC_DEFUN([OPENAFS_GCC_NEEDS_NO_STRICT_ALIASING], [
20   AC_CACHE_CHECK([if $CC needs -fno-strict-aliasing],
21     [openafs_cv_gcc_needs_no_strict_aliasing],
22     [save_CFLAGS="$CFLAGS"
23      CFLAGS="-fno-strict-aliasing"
24      AC_TRY_COMPILE([],
25                     [int x;],
26                     [openafs_cv_gcc_needs_no_strict_aliasing=yes],
27                     [openafs_cv_gcc_needs_no_strict_aliasing=no])
28      CFLAGS="$save_CFLAGS"
29   ])
30   AS_IF([test x$openafs_cv_gcc_needs_no_strict_aliasing = xyes],
31         [LINUX_GCC_KOPTS="$LINUX_GCC_KOPTS -fno-strict-aliasing"])
32 ])
33
34 AC_DEFUN([OPENAFS_GCC_NEEDS_NO_STRENGTH_REDUCE], [
35   AC_CACHE_CHECK([if $CC needs -fno-strength-reduce],
36     [openafs_cv_gcc_needs_no_strength_reduce],
37     [save_CFLAGS="$CFLAGS"
38      CFLAGS="-fno-strength-reduce"
39      AC_TRY_COMPILE([],
40                     [int x;],
41                     [openafs_cv_gcc_needs_no_strength_reduce=yes],
42                     [openafs_cv_gcc_needs_no_strength_reduce=no])
43   ])
44   AS_IF([test x$openafs_cv_gcc_needs_no_strength_reduce = xyes],
45         [LINUX_GCC_KOPTS="$LINUX_GCC_KOPTS -fno-strength-reduce"])
46 ])
47
48 AC_DEFUN([OPENAFS_GCC_SUPPORTS_NO_COMMON], [
49   AC_CACHE_CHECK([if $CC supports -fno-common],
50     [openafs_cv_gcc_supports_no_common],
51     [save_CFLAGS="$CFLAGS"
52      CFLAGS="-fno-common"
53      AC_TRY_COMPILE([],
54                     [int x;],
55                     [openafs_cv_gcc_supports_no_common=yes],
56                     [openafs_cv_gcc_supports_no_common=no])
57
58      CFLAGS="$save_CFLAGS"
59   ])
60   AS_IF([test x$openafs_cv_gcc_supports_no_common = xyes],
61         [LINUX_GCC_KOPTS="$LINUX_GCC_KOPTS -fno-common"])
62 ])
63
64 AC_DEFUN([OPENAFS_GCC_SUPPORTS_PIPE], [
65   AC_CACHE_CHECK([if $CC supports -pipe],
66     [openafs_cv_gcc_supports_pipe],
67     [save_CFLAGS="$CFLAGS"
68      CFLAGS="-pipe"
69      AC_TRY_COMPILE([],
70                     [int x;],
71                     [openafs_cv_gcc_supports_pipe=yes],
72                     [openafs_cv_gcc_supports_pipe=no])
73   CFLAGS="$save_CFLAGS"
74   ])
75   AS_IF([test x$openafs_cv_gcc_supports_pipe = xyes],
76           [LINUX_GCC_KOPTS="$LINUX_GCC_KOPTS -pipe"])
77 ])