Whamcloud - gitweb
merge b_devel into HEAD. Includes:
[fs/lustre-release.git] / lustre / configure.in
1 AC_INIT
2 AC_CANONICAL_SYSTEM
3
4 # Copyright (C) 2001-2003 Cluster File Systems, Inc.
5 #
6 # This code is issued under the GNU General Public License.
7 # See the file COPYING in this distribution
8
9 # Automake variables.  Steal the version number from lustre.spec.in.
10 AM_INIT_AUTOMAKE(lustre, builtin([esyscmd], [sed -ne '/^%define version /{ s/.*version //; p; q; }' scripts/lustre.spec.in]))
11 #AM_MAINTAINER_MODE
12
13 AC_PROG_CC
14 AC_MSG_CHECKING(for buggy compiler)
15 CC_VERSION=`$CC -v 2>&1 | grep "^gcc version"`
16 bad_cc() {
17         echo
18         echo "   '$CC_VERSION'"
19         echo "  has been known to generate bad code, "
20         echo "  please get an updated compiler."
21         AC_MSG_ERROR(sorry)
22 }
23 TMP_VERSION=`echo $CC_VERSION | cut -c 1-16`
24 if test "$TMP_VERSION" = "gcc version 2.95"; then
25         bad_cc
26 fi
27 case "$CC_VERSION" in 
28         # ost_pack_niobuf putting 64bit NTOH temporaries on the stack
29         # without "sub    $0xc,%esp" to protect the stack from being
30         # stomped on by interrupts (bug 606)
31         "gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98)")
32                 bad_cc
33                 ;;
34         *)
35                 AC_MSG_RESULT(no known problems)
36                 ;;
37 esac
38
39 AC_PROG_RANLIB
40
41
42 # Check for required packages
43
44 # this doesn't seem to work on older autoconf
45 # AC_CHECK_LIB(readline, readline,,)
46
47 AC_ARG_ENABLE(readline, [  --enable-readline  use readline library],,
48                         enable_readline="yes")
49  
50 if test "$enable_readline" = "yes" ; then
51    LIBREADLINE="-lreadline -lncurses"
52    HAVE_LIBREADLINE="-DHAVE_LIBREADLINE=1"
53 else 
54    LIBREADLINE=""
55    HAVE_LIBREADLINE=""
56 fi
57 AC_SUBST(LIBREADLINE)
58 AC_SUBST(HAVE_LIBREADLINE)
59
60 AC_ARG_ENABLE(efence,  [  --enable-efence  use efence library],,
61                         enable_efence="no")
62  
63 if test "$enable_efence" = "yes" ; then
64    LIBEFENCE="-lefence"
65    HAVE_LIBEFENCE="-DHAVE_LIBEFENCE=1"
66 else 
67    LIBEFENCE=""
68    HAVE_LIBEFENCE=""
69 fi
70 AC_SUBST(LIBEFENCE)
71 AC_SUBST(HAVE_LIBEFENCE)
72
73 # XXX this should be a runtime option
74 AC_MSG_CHECKING(if you are enabling OST recovery...)
75 AC_ARG_ENABLE(ost_recovery, [  --enable-ost-recovery: enable support for ost recovery],,
76               enable_ost_recovery="no")
77 if test "$enable_ost_recovery" = "yes" ; then
78    ENABLE_OST_RECOVERY="-DOST_RECOVERY=1"
79    AC_MSG_RESULT(yes)
80 else 
81    ENABLE_OST_RECOVERY=""
82    AC_MSG_RESULT(no)
83 fi
84 AC_SUBST(ENABLE_OST_RECOVERY)
85
86
87 # Kernel build environment.
88 ac_default_prefix=
89 bindir='${exec_prefix}/usr/bin'
90 sbindir='${exec_prefix}/usr/sbin'
91
92 linuxdir_def=/usr/src/linux
93 AC_ARG_WITH(linux, [  --with-linux=[path] set path to Linux source (default=/usr/src/linux)], enable_linuxdir=$withval)
94 AC_ARG_ENABLE(linuxdir, [  --enable-linuxdir=[path] (deprecated) set path to Linux source (default=/usr/src/linux)],, enable_linuxdir=$linuxdir_def)
95
96 LINUX=$enable_linuxdir
97 AC_SUBST(LINUX)
98
99 AC_MSG_CHECKING(if you are running linux 2.5...)
100 if test -e $LINUX/include/linux/namei.h ; then
101         linux25="yes"
102         AC_MSG_RESULT(yes)
103 else
104         linux25="no"
105         AC_MSG_RESULT(no)
106 fi
107 AM_CONDITIONAL(LINUX25, test x$linux25 = xyes)
108
109 sinclude(archdep.m4)
110
111
112 portalsdir_def='$(top_srcdir)/../portals'
113 AC_ARG_WITH(portals, [  --with-portals=[path] set path to Portals source (default=../portals)], enable_portalsdir=$withval)
114 AC_ARG_ENABLE(portalsdir, [  --enable-portalsdir=[path] (deprecated) set path to Portals source (default=$portalsdir_def],, enable_portalsdir=$portalsdir_def)
115 PORTALS=$enable_portalsdir
116
117 if test $PORTALS = $portalsdir_def; then
118         PORTALSLOC='../portals'
119 else
120         PORTALSLOC=$PORTALS
121 fi
122
123 AC_SUBST(PORTALS)
124 AC_SUBST(PORTALSLOC)
125
126 portalslib_def=$enable_portalsdir/linux/utils
127 AC_ARG_WITH(portalslib, [  --with-portalslib=[path] set path to Portals library (default=../portals/linux/utils)], enable_portalslib=$withval)
128 AC_ARG_ENABLE(portalslib, [  --enable-portalslib=[path] (deprecated) set path to Portals lib (default=../portals/linux/utils)],, enable_portalslib=$portalslib_def)
129
130
131 if ! test -z "$enable_portalslib"; then
132         PORTALSLIB=${enable_portalslib}
133 fi
134 AC_SUBST(PORTALSLIB)
135
136 AM_CONDITIONAL(LIBLUSTRE, test x$host_cpu = xlib)
137 AC_MSG_CHECKING(if you are building lib lustre)
138 if test "$host_cpu" = "lib"; then
139    AC_MSG_RESULT(yes)
140    libdir='${exec_prefix}/lib/lustre'
141 else
142    AC_MSG_RESULT(no)
143 fi
144
145 if test $host_cpu != "lib" ; then 
146 KINCFLAGS='-I$(top_srcdir)/include -I$(PORTALS)/include -I$(LINUX)/include'
147 else
148 KINCFLAGS='-I$(top_srcdir)/include -I$(PORTALS)/include'
149 fi
150 CPPFLAGS="$KINCFLAGS $ARCHCPPFLAGS $ENABLE_OST_RECOVERY"
151
152 if test $host_cpu != "lib" ; then 
153 AC_MSG_CHECKING(if make dep has been run in kernel source (host $host_cpu) )
154 if  test -f $LINUX/include/linux/config.h ; then
155         AC_MSG_RESULT(yes)
156 else
157         AC_MSG_ERROR(** cannot find $LINUX/include/linux/config.h. Run make dep in $LINUX.)
158 fi
159
160 AC_MSG_CHECKING(if autoconf.h is in kernel source)
161 if test -f $LINUX/include/linux/autoconf.h ; then
162         AC_MSG_RESULT(yes)
163 else
164         AC_MSG_ERROR(** cannot find $LINUX/include/linux/autoconf.h. Run make config in $LINUX.)
165 fi
166
167 AC_MSG_CHECKING(for Linux release)
168
169 dnl We need to rid ourselves of the nasty [ ] quotes.
170 changequote(, )
171 dnl Get release from version.h
172 RELEASE="`sed -ne 's/.*UTS_RELEASE[ \"]*\([0-9.a-zA-Z_-]*\).*/\1/p' $LINUX/include/linux/version.h`"
173 changequote([, ])
174
175 moduledir='$(libdir)/modules/'$RELEASE/kernel
176 AC_SUBST(moduledir)
177
178 modulefsdir='$(moduledir)/fs/$(PACKAGE)'
179 AC_SUBST(modulefsdir)
180
181 AC_MSG_RESULT($RELEASE)
182 AC_SUBST(RELEASE)
183
184 fi
185 # Directories for documentation and demos.
186 docdir='${prefix}/usr/share/doc/$(PACKAGE)'
187 AC_SUBST(docdir)
188
189 demodir='$(docdir)/demo'
190 AC_SUBST(demodir)
191
192 # not needed until the AC_CHECK_LIB(readline) above works
193 # AM_CONFIG_HEADER(include/config.h)
194
195 AC_OUTPUT(Makefile lib/Makefile ldlm/Makefile obdecho/Makefile ptlrpc/Makefile \
196         liblustre/Makefile \
197         lov/Makefile osc/Makefile mdc/Makefile mds/Makefile ost/Makefile \
198         cobd/Makefile ptlbd/Makefile conf/Makefile \
199         utils/Makefile utils/lconf tests/Makefile obdfilter/Makefile \
200         obdclass/Makefile llite/Makefile doc/Makefile scripts/Makefile \
201         scripts/lustre.spec extN/Makefile, chmod +x utils/lconf)