Pass -shared when linking some shared libraries
[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_COMPILE_IFELSE(
9        [AC_LANG_PROGRAM(
10          [[]],
11          [[int x;]])],
12          [openafs_cv_gcc_supports_march=yes],
13          [openafs_cv_gcc_supports_march=no])
14      CFLAGS="$save_CFLAGS"
15     ])
16   AS_IF([test x$openafs_cv_gcc_supports_march = xyes],
17         [P5PLUS_KOPTS="-march=pentium"],
18         [P5PLUS_KOPTS="-m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2"])
19 ])
20
21 AC_DEFUN([OPENAFS_GCC_NEEDS_NO_STRICT_ALIASING], [
22   AC_CACHE_CHECK([if $CC needs -fno-strict-aliasing],
23     [openafs_cv_gcc_needs_no_strict_aliasing],
24     [save_CFLAGS="$CFLAGS"
25      CFLAGS="-fno-strict-aliasing"
26      AC_COMPILE_IFELSE(
27        [AC_LANG_PROGRAM(
28          [[]],
29          [[int x;]])],
30        [openafs_cv_gcc_needs_no_strict_aliasing=yes],
31        [openafs_cv_gcc_needs_no_strict_aliasing=no])
32      CFLAGS="$save_CFLAGS"
33   ])
34   AS_IF([test x$openafs_cv_gcc_needs_no_strict_aliasing = xyes],
35         [LINUX_GCC_KOPTS="$LINUX_GCC_KOPTS -fno-strict-aliasing"])
36 ])
37
38 AC_DEFUN([OPENAFS_GCC_NEEDS_NO_STRENGTH_REDUCE], [
39   AC_CACHE_CHECK([if $CC needs -fno-strength-reduce],
40     [openafs_cv_gcc_needs_no_strength_reduce],
41     [save_CFLAGS="$CFLAGS"
42      CFLAGS="-fno-strength-reduce"
43      AC_COMPILE_IFELSE(
44        [AC_LANG_PROGRAM(
45          [[]],
46          [[int x;]])],
47        [openafs_cv_gcc_needs_no_strength_reduce=yes],
48        [openafs_cv_gcc_needs_no_strength_reduce=no])
49      CFLAGS="$save_CFLAGS"
50   ])
51   AS_IF([test x$openafs_cv_gcc_needs_no_strength_reduce = xyes],
52         [LINUX_GCC_KOPTS="$LINUX_GCC_KOPTS -fno-strength-reduce"])
53 ])
54
55 AC_DEFUN([OPENAFS_GCC_SUPPORTS_NO_COMMON], [
56   AC_CACHE_CHECK([if $CC supports -fno-common],
57     [openafs_cv_gcc_supports_no_common],
58     [save_CFLAGS="$CFLAGS"
59      CFLAGS="-fno-common"
60      AC_COMPILE_IFELSE(
61        [AC_LANG_PROGRAM(
62          [[]],
63          [[int x;]])],
64        [openafs_cv_gcc_supports_no_common=yes],
65        [openafs_cv_gcc_supports_no_common=no])
66
67      CFLAGS="$save_CFLAGS"
68   ])
69   AS_IF([test x$openafs_cv_gcc_supports_no_common = xyes],
70         [LINUX_GCC_KOPTS="$LINUX_GCC_KOPTS -fno-common"])
71 ])
72
73 AC_DEFUN([OPENAFS_GCC_SUPPORTS_PIPE], [
74   AC_CACHE_CHECK([if $CC supports -pipe],
75     [openafs_cv_gcc_supports_pipe],
76     [save_CFLAGS="$CFLAGS"
77      CFLAGS="-pipe"
78      AC_COMPILE_IFELSE(
79        [AC_LANG_PROGRAM(
80          [[]],
81          [[int x;]])],
82        [openafs_cv_gcc_supports_pipe=yes],
83        [openafs_cv_gcc_supports_pipe=no])
84   CFLAGS="$save_CFLAGS"
85   ])
86   AS_IF([test x$openafs_cv_gcc_supports_pipe = xyes],
87           [LINUX_GCC_KOPTS="$LINUX_GCC_KOPTS -pipe"])
88 ])
89
90 AC_DEFUN([OPENAFS_GCC_SUPPORTS_WNO_ERROR_FRAME_LARGER_THAN], [
91   AC_CACHE_CHECK([if $CC supports -Wno-error=frame-larger-than=],
92     [openafs_cv_gcc_supports_wno_error_frame_larger_than],
93     [save_CFLAGS="$CFLAGS"
94      CFLAGS="-Wno-error=frame-larger-than="
95      AC_COMPILE_IFELSE(
96        [AC_LANG_PROGRAM(
97          [[]],
98          [[int x;]])],
99        [openafs_cv_gcc_supports_wno_error_frame_larger_than=yes],
100        [openafs_cv_gcc_supports_wno_error_frame_larger_than=no])
101   CFLAGS="$save_CFLAGS"
102   ])
103   AS_IF([test x$openafs_cv_gcc_supports_wno_error_frame_larger_than = xyes && test x"$CFLAGS_NOERROR" != x],
104         dnl Only use -Wno-error=frame-larger-than= if gcc supports it, and if
105         dnl CFLAGS_NOERROR is nonempty (so if --enable-checking=all is used, we
106         dnl don't pass -Wno-error=frame-larger-than=)
107         [CFLAGS_WNOERROR_FRAME_LARGER_THAN="-Wno-error=frame-larger-than="])
108   AC_SUBST([CFLAGS_WNOERROR_FRAME_LARGER_THAN])
109 ])