Whamcloud - gitweb
7a4e05c1d0bfa780760940aa2b269f66303292ed
[fs/lustre-release.git] / lnet / archdep.m4
1
2 # -------- in kernel compilation? (2.5 only) -------------
3 AC_ARG_ENABLE(inkernel, [ --enable-inkernel set up 2.5 kernel makefiles])
4 AM_CONDITIONAL(INKERNEL, test x$enable_inkernel = xyes)
5 echo "Makefile for in kernel build: $INKERNEL"
6
7 # -------- liblustre compilation --------------
8 AC_ARG_WITH(lib, [  --with-lib compile lustre library], host_cpu="lib")
9
10 # -------- set linuxdir ------------
11
12 AC_ARG_WITH(linux, [  --with-linux=[path] set path to Linux source (default=/usr/src/linux)],LINUX=$with_linux,LINUX=/usr/src/linux)
13 AC_SUBST(LINUX)
14
15 # --------- UML?  --------------------
16 AC_MSG_CHECKING(if you are running user mode linux for $host_cpu ...)
17 if test $host_cpu = "lib" ; then 
18         host_cpu="lib"
19         AC_MSG_RESULT(no building Lustre library)
20 else
21   if test -e $LINUX/include/asm-um ; then
22     if test  X`ls -id $LINUX/include/asm/ | awk '{print $1}'` = X`ls -id $LINUX/include/asm-um | awk '{print $1}'` ; then
23         host_cpu="um";
24         AC_MSG_RESULT(yes)
25     else
26         AC_MSG_RESULT(no (asm doesn't point at asm-um))
27     fi
28
29   else 
30         AC_MSG_RESULT(no (asm-um missing))
31   fi
32 fi
33
34 # --------- Linux 25 ------------------
35
36 AC_MSG_CHECKING(if you are running linux 2.5)
37 if test -e $LINUX/include/linux/namei.h ; then
38         linux25="yes"
39         AC_MSG_RESULT(yes)
40 else
41         linux25="no"
42         AC_MSG_RESULT(no)
43 fi
44 AM_CONDITIONAL(LINUX25, test x$linux25 = xyes)
45 echo "Makefiles for in linux 2.5 build: $LINUX25"
46
47 # -------  Makeflags ------------------
48
49 AC_MSG_CHECKING(setting make flags system architecture: )
50 case ${host_cpu} in
51         lib )
52         AC_MSG_RESULT($host_cpu)
53         KCFLAGS='-g -Wall '
54         KCPPFLAGS='-D__arch_lib__ '
55         libdir='${exec_prefix}/lib/lustre'
56         MOD_LINK=elf_i386
57 ;;
58         um )
59         AC_MSG_RESULT($host_cpu)
60         KCFLAGS='-g -Wall -pipe -Wno-trigraphs -Wstrict-prototypes -fno-strict-aliasing -fno-common '
61         case ${linux25} in
62                 yes )
63                 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 -I$(LINUX)/arch/um/kernel/skas/include -O2 -nostdinc -iwithprefix include -DKBUILD_BASENAME=$(MODULE) -DKBUILD_MODNAME=$(MODULE) '
64         ;;
65                 * )
66                 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/kernel/tt/include -I$(LINUX)/arch/um/include '
67         ;;
68         esac
69
70         MOD_LINK=elf_i386
71 ;;
72         i*86 )
73         AC_MSG_RESULT($host_cpu)
74         KCFLAGS='-g -O2 -Wall -Wstrict-prototypes -pipe'
75         case ${linux25} in
76                 yes )
77                 KCPPFLAGS='-D__KERNEL__ -DMODULE -march=i686 -I$(LINUX)/include/asm-i386/mach-default -nostdinc -iwithprefix include '
78         ;;
79                 * )
80                 KCPPFLAGS='-D__KERNEL__ -DMODULE '
81         ;;
82         esac
83         MOD_LINK=elf_i386
84 ;;
85
86         alphaev6 )
87         AC_MSG_RESULT($host_cpu)
88         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'
89         KCPPFLAGS='-D__KERNEL__ -DMODULE '
90         MOD_LINK=elf64alpha
91 ;;
92
93         alphaev67 )
94         AC_MSG_RESULT($host_cpu)
95         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'
96         KCPPFLAGS='-D__KERNEL__ -DMODULE '
97         MOD_LINK=elf64alpha
98 ;;
99
100         alpha* )
101         AC_MSG_RESULT($host_cpu)
102         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'
103         KCPPFLAGS='-D__KERNEL__ -DMODULE '
104         MOD_LINK=elf64alpha
105 ;;
106
107         ia64 )
108         AC_MSG_RESULT($host_cpu)
109         KCFLAGS='-g -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'
110         KCPPFLAGS='-D__KERNEL__ -DMODULE'
111         MOD_LINK=elf64_ia64
112 ;;
113
114         sparc64 )
115         AC_MSG_RESULT($host_cpu)
116         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'
117         KCPPFLAGS='-D__KERNEL__'
118         MOD_LINK=elf64_sparc
119
120 ;;
121
122         powerpc )
123         AC_MSG_RESULT($host_cpu)
124         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'
125         KCPPFLAGS='-D__KERNEL__'
126         MOD_LINK=elf32ppclinux
127 ;;
128
129         *)
130         AC_ERROR("Unknown Linux Platform: $host_cpu")
131 ;;
132 esac
133
134 # ----------- make dep run? ------------------
135
136 if test $host_cpu != "lib" ; then 
137   AC_MSG_CHECKING(if make dep has been run in kernel source (host $host_cpu) )
138   if test -f $LINUX/include/linux/config.h ; then
139   AC_MSG_RESULT(yes)
140  else
141   AC_MSG_ERROR(** cannot find $LINUX/include/linux/config.h. Run make dep in $LINUX.)
142   fi
143 fi
144
145 # ------------ include paths ------------------
146
147 if test $host_cpu != "lib" ; then 
148     KINCFLAGS="-I\$(top_srcdir)/include -I\$(top_srcdir)/portals/include -I$LINUX/include"
149 else
150     KINCFLAGS='-I$(top_srcdir)/include -I$(top_srcdir)/portals/include'
151 fi
152 CPPFLAGS="$KINCFLAGS $ARCHCPPFLAGS"
153
154 if test $host_cpu != "lib" ; then 
155 # ------------ autoconf.h ------------------
156   AC_MSG_CHECKING(if autoconf.h is in kernel source)
157   if test -f $LINUX/include/linux/autoconf.h ; then
158       AC_MSG_RESULT(yes)
159   else
160       AC_MSG_ERROR(** cannot find $LINUX/include/linux/autoconf.h. Run make config in $LINUX.)
161   fi
162
163 # ------------ RELEASE and moduledir ------------------
164   AC_MSG_CHECKING(for Linux release)
165   
166   dnl We need to rid ourselves of the nasty [ ] quotes.
167   changequote(, )
168   dnl Get release from version.h
169   RELEASE="`sed -ne 's/.*UTS_RELEASE[ \"]*\([0-9.a-zA-Z_-]*\).*/\1/p' $LINUX/include/linux/version.h`"
170   changequote([, ])
171   
172   moduledir='$(libdir)/modules/'$RELEASE/kernel
173   AC_SUBST(moduledir)
174   
175   modulefsdir='$(moduledir)/fs/$(PACKAGE)'
176   AC_SUBST(modulefsdir)
177   
178   AC_MSG_RESULT($RELEASE)
179   AC_SUBST(RELEASE)
180
181 # ---------- modversions? --------------------
182   AC_MSG_CHECKING(for MODVERSIONS)
183   if egrep -e 'MODVERSIONS.*1' $LINUX/include/linux/autoconf.h >/dev/null 2>&1;
184   then
185         MFLAGS="-DMODULE -DMODVERSIONS -include $LINUX/include/linux/modversions.h -DEXPORT_SYMTAB"
186         AC_MSG_RESULT(yes)
187   else
188         MFLAGS=
189         AC_MSG_RESULT(no)
190   fi
191 fi
192
193 # ---------- Portals flags --------------------
194
195 #AC_PREFIX_DEFAULT([])
196 #if test "x$prefix" = xNONE || test "x$prefix" = x; then
197 #  usrprefix=/usr
198 #else
199 #  usrprefix='${prefix}'
200 #fi
201 #AC_SUBST(usrprefix)
202
203 AC_MSG_CHECKING(if kernel has CPU affinity support)
204 if test "$target_cpu" != ia64 ; then
205   enable_affinity_temp="-DCPU_AFFINITY=1"
206   AC_MSG_RESULT(yes)
207 else
208   enable_affinity_temp=""
209   AC_MSG_RESULT(no)
210 fi
211
212 AC_MSG_CHECKING(if kernel has zero-copy TCP support)
213 ZCCD="`grep -c zccd $LINUX/include/linux/skbuff.h`"
214 if test "$ZCCD" != 0 ; then
215   enable_zerocopy_temp="-DSOCKNAL_ZC=1"
216   AC_MSG_RESULT(yes)
217 else
218   enable_zerocopy_temp=""
219   AC_MSG_RESULT(no)
220 fi
221
222 AC_ARG_ENABLE(zerocopy, [  --enable-zerocopy enable socknal zerocopy],enable_zerocopy=$enable_zerocopy_temp, enable_zerocopy="")
223
224 AC_ARG_ENABLE(affinity, [  --enable-affinity enable process/irq affinity],enable_affinity="-DCPU_AFFINITY=1", enable_affinity=$enable_affinity_temp)
225 #####################################
226
227 AC_MSG_CHECKING(if quadrics kernel headers are present)
228 if test -d $LINUX/drivers/net/qsnet ; then
229   AC_MSG_RESULT(yes)
230   QSWNAL="qswnal"
231   with_quadrics="-I$LINUX/drivers/net/qsnet/include"
232   :
233 elif test -d $LINUX/drivers/qsnet1 ; then
234   AC_MSG_RESULT(yes)
235   QSWNAL="qswnal"
236   with_quadrics="-I$LINUX/drivers/qsnet1/include -DPROPRIETARY_ELAN"
237   :
238 elif test -d $LINUX/drivers/quadrics ; then
239   AC_MSG_RESULT(yes)
240   QSWNAL="qswnal"
241   with_quadrics="-I$LINUX/drivers/quadrics/include -DPROPRIETARY_ELAN"
242   :
243 #elif test -d /usr/include/elan3 ; then
244 #  AC_MSG_RESULT(yes)
245 #  QSWNAL="qswnal"
246 #  with_quadrics=""
247 #  :
248 else
249   AC_MSG_RESULT(no)
250   QSWNAL=""
251   with_quadrics=""
252   :
253 fi
254 AC_SUBST(with_quadrics)
255 AC_SUBST(QSWNAL)
256
257 # R. Read 5/02
258 GMNAL=""
259 echo "checking with-gm=" ${with_gm}
260 if test "${with_gm+set}" = set; then
261   if test "${with_gm}" = yes; then
262     with_gm="-I/usr/local/gm/include"
263   else
264     with_gm=-I"$with_gm/include"
265   fi
266   GMNAL="gmnal"
267 else
268 # default case - no GM
269   with_gm=""
270 fi
271 AC_SUBST(with_gm)
272 AC_SUBST(GMNAL)
273
274
275 def_scamac=/opt/scali/include
276 AC_ARG_WITH(scamac, [  --with-scamac=[yes/no/path] Path to ScaMAC includes (default=/opt/scali/include)], with_scamac=$withval, with_scamac=$def_scamac)
277 AC_MSG_CHECKING(if ScaMAC headers are present)
278 if test "$with_scamac" = yes; then
279   with_scamac=$def_scamac
280 fi
281 if test "$with_scamac" != no -a -f ${with_scamac}/scamac.h; then
282   AC_MSG_RESULT(yes)
283   SCIMACNAL="scimacnal"
284   with_scamac="-I${with_scamac} -I${with_scamac}/icm"
285 else
286   AC_MSG_RESULT(no)
287   SCIMACNAL=""
288   with_scamac=""
289 fi
290
291 AC_SUBST(with_scamac)
292 AC_SUBST(SCIMACNAL)
293
294 CFLAGS="$KCFLAGS"
295 CPPFLAGS="$KINCFLAGS $KCPPFLAGS $MFLAGS $enable_zerocopy $enable_affinity $with_quadrics $with_gm $with_scamac "
296
297 AC_SUBST(MOD_LINK)
298 AC_SUBST(LINUX25)
299 AM_CONDITIONAL(LIBLUSTRE, test x$host_cpu = xlib)
300
301 # ---------- Red Hat 2.4.20 backports some 2.5 bits --------
302 # This needs to run after we've defined the KCPPFLAGS
303
304 AC_MSG_CHECKING(for kernel version)
305 AC_TRY_LINK([#define __KERNEL__
306              #include <linux/sched.h>],
307             [struct task_struct p;
308              p.sighand = NULL;],
309             [RH_2_4_20=1],
310             [RH_2_4_20=0])
311
312 if test $RH_2_4_20 = 1; then
313         AC_MSG_RESULT(redhat-2.4.20)
314         CPPFLAGS="$CPPFLAGS -DCONFIG_RH_2_4_20"
315 else
316         AC_MSG_RESULT($RELEASE)
317 fi