Whamcloud - gitweb
land 0.5.20.3 b_devel onto HEAD (b_devel will remain)
[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 # XXX this should be a runtime option
61 AC_ARG_ENABLE(ost_recovery, [  --enable-ost-recovery: enable support for ost recovery],,
62               enable_ost_recovery="yes")
63 if test "$enable_ost_recovery" = "yes" ; then
64    ENABLE_OST_RECOVERY="-DOST_RECOVERY=1"
65 else 
66    HAVE_LIBREADLINE=""
67 fi
68 AC_SUBST(ENABLE_OST_RECOVERY)
69
70
71 # Kernel build environment.
72 ac_default_prefix=
73 bindir='${exec_prefix}/usr/bin'
74 sbindir='${exec_prefix}/usr/sbin'
75
76 linuxdir_def=/usr/src/linux
77 AC_ARG_WITH(linux, [  --with-linux=[path] set path to Linux source (default=/usr/src/linux)], enable_linuxdir=$withval)
78 AC_ARG_ENABLE(linuxdir, [  --enable-linuxdir=[path] (deprecated) set path to Linux source (default=/usr/src/linux)],, enable_linuxdir=$linuxdir_def)
79
80 LINUX=$enable_linuxdir
81 AC_SUBST(LINUX)
82
83 AC_MSG_CHECKING(if you are running linux 2.5...)
84 if test -e $LINUX/include/linux/namei.h ; then
85         linux25="yes"
86         AC_MSG_RESULT(yes)
87 else
88         linux25="no"
89         AC_MSG_RESULT(no)
90 fi
91 AM_CONDITIONAL(LINUX25, test x$linux25 = xyes)
92
93 sinclude(archdep.m4)
94
95
96 portalsdir_def='$(top_srcdir)/../portals'
97 AC_ARG_WITH(portals, [  --with-portals=[path] set path to Portals source (default=../portals)], enable_portalsdir=$withval)
98 AC_ARG_ENABLE(portalsdir, [  --enable-portalsdir=[path] (deprecated) set path to Portals source (default=$portalsdir_def],, enable_portalsdir=$portalsdir_def)
99 PORTALS=$enable_portalsdir
100
101 if test $PORTALS = $portalsdir_def; then
102         PORTALSLOC='../portals'
103 else
104         PORTALSLOC=$PORTALS
105 fi
106
107 AC_SUBST(PORTALS)
108 AC_SUBST(PORTALSLOC)
109
110 portalslib_def=$enable_portalsdir/linux/utils
111 AC_ARG_WITH(portalslib, [  --with-portalslib=[path] set path to Portals library (default=../portals/linux/utils)], enable_portalslib=$withval)
112 AC_ARG_ENABLE(portalslib, [  --enable-portalslib=[path] (deprecated) set path to Portals lib (default=../portals/linux/utils)],, enable_portalslib=$portalslib_def)
113
114
115 if ! test -z "$enable_portalslib"; then
116         PORTALSLIB=${enable_portalslib}
117 fi
118 AC_SUBST(PORTALSLIB)
119
120 AM_CONDITIONAL(LIBLUSTRE, test x$host_cpu = xlib)
121 AC_MSG_CHECKING(if you are building lib lustre)
122 if test "$host_cpu" = "lib"; then
123    AC_MSG_RESULT(yes)
124    libdir='${exec_prefix}/lib/lustre'
125 else
126    AC_MSG_RESULT(no)
127 fi
128
129 if test $host_cpu != "lib" ; then 
130 KINCFLAGS='-I$(top_srcdir)/include -I$(PORTALS)/include -I$(LINUX)/include'
131 else
132 KINCFLAGS='-I$(top_srcdir)/include -I$(PORTALS)/include'
133 fi
134 CPPFLAGS="$KINCFLAGS $ARCHCPPFLAGS"
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
144 AC_MSG_CHECKING(if autoconf.h is in kernel source)
145 if test -f $LINUX/include/linux/autoconf.h ; then
146         AC_MSG_RESULT(yes)
147 else
148         AC_MSG_ERROR(** cannot find $LINUX/include/linux/autoconf.h. Run make config in $LINUX.)
149 fi
150
151 AC_MSG_CHECKING(for Linux release)
152
153 dnl We need to rid ourselves of the nasty [ ] quotes.
154 changequote(, )
155 dnl Get release from version.h
156 RELEASE="`sed -ne 's/.*UTS_RELEASE[ \"]*\([0-9.a-zA-Z-]*\).*/\1/p' $LINUX/include/linux/version.h`"
157 changequote([, ])
158
159 moduledir='$(libdir)/modules/'$RELEASE/kernel
160 AC_SUBST(moduledir)
161
162 modulefsdir='$(moduledir)/fs/$(PACKAGE)'
163 AC_SUBST(modulefsdir)
164
165 AC_MSG_RESULT($RELEASE)
166 AC_SUBST(RELEASE)
167
168 fi
169 # Directories for documentation and demos.
170 docdir='${prefix}/usr/share/doc/$(PACKAGE)'
171 AC_SUBST(docdir)
172
173 demodir='$(docdir)/demo'
174 AC_SUBST(demodir)
175
176 # not needed until the AC_CHECK_LIB(readline) above works
177 # AM_CONFIG_HEADER(include/config.h)
178
179 AC_OUTPUT(Makefile lib/Makefile ldlm/Makefile obdecho/Makefile ptlrpc/Makefile \
180         liblustre/Makefile \
181         lov/Makefile osc/Makefile mdc/Makefile mds/Makefile ost/Makefile \
182         cobd/Makefile ptlbd/Makefile conf/Makefile \
183         utils/Makefile utils/lconf tests/Makefile obdfilter/Makefile \
184         obdclass/Makefile llite/Makefile doc/Makefile scripts/Makefile \
185         scripts/lustre.spec extN/Makefile, chmod +x utils/lconf)