Whamcloud - gitweb
2bdd785562360daae90404289ee778b63c59cc27
[fs/lustre-release.git] / lustre / archdep.m4
1 AC_ARG_WITH(lib, [  --with-lib compile lustre library], host_cpu="lib")
2
3 AC_MSG_CHECKING(if you are running user mode linux for $host_cpu ...)
4 if test $host_cpu = "lib" ; then 
5         host_cpu="lib"
6         AC_MSG_RESULT(no building Lustre library)
7 else
8 if test -e $LINUX/include/asm-um ; then
9 if test  X`ls -id $LINUX/include/asm/ | awk '{print $1}'` = X`ls -id $LINUX/include/asm-um | awk '{print $1}'` ; then
10         host_cpu="um";
11         AC_MSG_RESULT(yes)
12 else
13         AC_MSG_RESULT(no (asm doesn't point at asm-um))
14 fi
15
16 else 
17         AC_MSG_RESULT(no (asm-um missing))
18 fi
19 fi
20
21 AC_MSG_CHECKING(setting make flags system architecture: )
22 case ${host_cpu} in
23         lib )
24         AC_MSG_RESULT($host_cpu)
25         KCFLAGS='-g -Wall '
26         KCPPFLAGS='-D__arch_lib__ '
27         MOD_LINK=elf_i386
28 ;;
29         um )
30         AC_MSG_RESULT($host_cpu)
31         KCFLAGS='-g -Wall -pipe -Wno-trigraphs -Wstrict-prototypes -fno-strict-aliasing -fno-common '
32         case ${linux25} in
33                 yes )
34                 KCPPFLAGS='-D__KERNEL__ -U__i386__ -Ui386 -DUM_FASTCALL -D__arch_um__ -DSUBARCH="i386" -DNESTING=0 -D_LARGEFILE64_SOURCE  -Derrno=kernel_errno -DPATCHLEVEL=4 -DMODULE -I$(LINUX)/arch/um/include -I$(LINUX)/arch/um/kernel/tt/include -O2 -nostdinc -iwithprefix include -DKBUILD_BASENAME=$(MODULE) -DKBUILD_MODNAME=$(MODULE) '
35         ;;
36                 * )
37                 KCPPFLAGS='-D__KERNEL__ -U__i386__ -Ui386 -DUM_FASTCALL -D__arch_um__ -DSUBARCH="i386" -DNESTING=0 -D_LARGEFILE64_SOURCE  -Derrno=kernel_errno -DPATCHLEVEL=4 -DMODULE -I$(LINUX)/arch/um/include '
38         ;;
39         esac
40
41         MOD_LINK=elf_i386
42 ;;
43         i*86 )
44         AC_MSG_RESULT($host_cpu)
45         KCFLAGS='-g -O2 -Wall -Wstrict-prototypes -pipe'
46         case ${linux25} in
47                 yes )
48                 KCPPFLAGS='-D__KERNEL__ -DMODULE -march=i686 -I$(LINUX)/include/asm-i386/mach-default -nostdinc -iwithprefix include ' 
49         ;;
50                 * )
51                 KCPPFLAGS='-D__KERNEL__ -DMODULE '
52         ;;
53         esac
54         MOD_LINK=elf_i386
55 ;;
56
57         alphaev6 )
58         AC_MSG_RESULT($host_cpu)
59         KCFLAGS='-g -O2  -Wall -Wstrict-prototypes -Wno-trigraphs -fomit-frame-pointer -fno-strict-aliasing -fno-common -pipe -mno-fp-regs -ffixed-8 -mcpu=ev5 -Wa,-mev6'
60         KCPPFLAGS='-D__KERNEL__ -DMODULE '
61         MOD_LINK=elf64alpha
62 ;;
63
64         alphaev67 )
65         AC_MSG_RESULT($host_cpu)
66         KCFLAGS='-g -O2  -Wall -Wstrict-prototypes -Wno-trigraphs -fomit-frame-pointer -fno-strict-aliasing -fno-common -pipe -mno-fp-regs -ffixed-8 -mcpu=ev5 -Wa,-mev6'
67         KCPPFLAGS='-D__KERNEL__ -DMODULE '
68         MOD_LINK=elf64alpha
69 ;;
70
71         alpha* )
72         AC_MSG_RESULT($host_cpu)
73         KCFLAGS='-g -O2  -Wall -Wstrict-prototypes -Wno-trigraphs -fomit-frame-pointer -fno-strict-aliasing -fno-common -pipe -mno-fp-regs -ffixed-8 -mcpu=ev5 -Wa,-mev5'
74         KCPPFLAGS='-D__KERNEL__ -DMODULE '
75         MOD_LINK=elf64alpha
76 ;;
77
78         ia64 )
79         AC_MSG_RESULT($host_cpu)
80         KCFLAGS='-gstabs -O2 -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -pipe -ffixed-r13 -mfixed-range=f10-f15,f32-f127 -falign-functions=32 -mb-step'
81         KCPPFLAGS='-D__KERNEL__ -DMODULE'
82         MOD_LINK=elf64_ia64
83 ;;
84
85         sparc64 )
86         AC_MSG_RESULT($host_cpu)
87         KCFLAGS='-O2 -Wall -Wstrict-prototypes -Wno-trigraphs -fomit-frame-pointer -fno-strict-aliasing -fno-common -Wno-unused -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow -ffixed-g4 -fcall-used-g5 -fcall-used-g7 -Wno-sign-compare -Wa,--undeclared-regs'
88         KCPPFLAGS='-D__KERNEL__'
89         MOD_LINK=elf64_sparc
90
91 ;;
92
93         powerpc )
94         AC_MSG_RESULT($host_cpu)
95         KCFLAGS='-O2 -Wall -Wstrict-prototypes -Wno-trigraphs -fomit-frame-pointer -fno-strict-aliasing -fno-common -D__powerpc__ -fsigned-char -msoft-float -pipe -ffixed-r2 -Wno-uninitialized -mmultiple -mstring'
96         KCPPFLAGS='-D__KERNEL__'
97         MOD_LINK=elf32ppclinux
98 ;;
99
100         *)
101         AC_ERROR("Unknown Linux Platform: $host_cpu")
102 ;;
103 esac
104
105 if test $host_cpu != lib ; then 
106 AC_MSG_CHECKING(for MODVERSIONS)
107 if egrep -e 'MODVERSIONS.*1' $LINUX/include/linux/autoconf.h >/dev/null 2>&1;
108 then
109         MFLAGS="-DMODULE -DMODVERSIONS -include $LINUX/include/linux/modversions.h -DEXPORT_SYMTAB"
110         AC_MSG_RESULT(yes)
111 else
112         MFLAGS=
113         AC_MSG_RESULT(no)
114 fi
115
116 AC_MSG_CHECKING(for SMP)
117 if egrep -e SMP=y $LINUX/.config >/dev/null 2>&1; then
118         SMPFLAG=
119         AC_MSG_RESULT(yes)
120 else
121         SMPFLAG=
122         AC_MSG_RESULT(no)
123 fi
124 fi
125
126 CFLAGS="$KCFLAGS $MFLAGS"
127 ARCHCPPFLAGS="$KCPPFLAGS"