uuid-paren-cleanup-20010711
[openafs.git] / configure.in
1 AC_INIT(src/config/stds.h)
2 AM_INIT_AUTOMAKE(openafs,devel)
3 AC_CANONICAL_HOST
4 AC_CONFIG_HEADER(src/config/afsconfig.h)
5
6 #BOZO_SAVE_CORES BOS_RESTRICTED_MODE BOS_NEW_CONFIG pam sia
7 AC_ARG_WITH(afs-sysname,
8 [  --with-afs-sysname=sys    use sys for the afs sysname]
9 )
10 AC_ARG_ENABLE( obsolete,
11 [  --enable-obsolete                    enable obsolete portions of AFS (mpp, ntp and package)],, enable_obsolete="no")
12 AC_ARG_ENABLE( insecure,
13 [  --enable-insecure                    enable insecure portions of AFS (ftpd, inetd, rcp, rlogind and rsh)],, enable_insecure="no")
14 AC_ARG_ENABLE( afsdb,
15 [  --disable-afsdb                      disable AFSDB RR support],, enable_afsdb="yes")
16 AC_ARG_ENABLE( bos-restricted-mode,
17 [  --enable-bos-restricted-mode         enable bosserver restricted mode which disables certain bosserver functionality],, enable_bos_restricted_mode="no")
18 AC_ARG_ENABLE( namei-fileserver,
19 [  --enable-namei-fileserver            force compilation of namei fileserver in preference to inode fileserver],, enable_namei_fileserver="no")
20 AC_ARG_ENABLE( fast-restart,
21 [  --enable-fast-restart                enable fast startup of file server without salvaging],, enable_fast_restart="no")
22 AC_ARG_ENABLE( bitmap-later,
23 [  --enable-bitmap-later                enable fast startup of file server by not reading bitmap till needed],, enable_bitmap_later="no")
24 AC_ARG_WITH(dux-kernel-headers,
25 [  --with-dux-kernel-headers=path       use the kernel headers found at path(optional, defaults to first match in /usr/sys)]
26 )
27 AC_ARG_WITH(linux-kernel-headers,
28 [  --with-linux-kernel-headers=path     use the kernel headers found at path(optional, defaults to /usr/src/linux)]
29 )
30 AC_ARG_ENABLE(kernel-module,
31 [  --disable-kernel-module              disable compilation of the kernel module (defaults to enabled)],, enable_kernel_module="yes"
32 )
33
34 AC_PROG_CC
35
36 dnl weird ass systems
37 AC_AIX
38 AC_ISC_POSIX
39 AC_MINIX
40
41 dnl Various compiler setup.
42 AC_C_INLINE
43 AC_C_CONST
44 AC_TYPE_PID_T
45 AC_TYPE_SIZE_T
46 AC_TYPE_SIGNAL
47
48 dnl Checks for programs.
49 AC_PROG_INSTALL
50 AC_PROG_LN_S
51 AC_PROG_RANLIB
52 AC_PROG_YACC
53 AM_PROG_LEX
54
55 OPENAFS_CHECK_BIGENDIAN
56
57 AC_MSG_CHECKING(your OS)
58 system=$host
59 case $system in
60         *-linux*)
61                 MKAFS_OSTYPE=LINUX
62                 if test "x$enable_kernel_module" = "xyes"; then
63                  if test "x$with_linux_kernel_headers" != "x"; then
64                    LINUX_KERNEL_PATH="$with_linux_kernel_headers"
65                  else
66                    LINUX_KERNEL_PATH="/usr/src/linux"
67                  fi
68                  if test -f "$LINUX_KERNEL_PATH/include/linux/version.h"; then
69                   linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_PATH/include/linux/version.h |awk 'BEGIN { FS="\"" } { print $2 }'|tail -1`
70                   if test "x$linux_kvers" = "x"; then
71                     AC_MSG_ERROR(Linux headers lack version definition)
72                     exit 1
73                   else
74                     LINUX_VERSION="$linux_kvers"
75                   fi
76                  else
77                     enable_kernel_module="no"
78                  fi
79                  if test ! -f "$LINUX_KERNEL_PATH/include/linux/autoconf.h"; then
80                      enable_kernel_module="no"
81                  fi
82                  if test "x$enable_kernel_module" = "xno"; then
83                   if test "x$with_linux_kernel_headers" != "x"; then
84                    AC_MSG_ERROR(No usable linux headers found at $LINUX_KERNEL_PATH)
85                    exit 1
86                   else
87                    AC_MSG_WARN(No usable linux headers found at $LINUX_KERNEL_PATH so disabling kernel module)
88                   fi
89                  fi
90                 fi
91                 AC_MSG_RESULT(linux)
92                 if test "x$enable_kernel_module" = "xyes"; then
93                  LINUX_FS_STRUCT_INODE_HAS_I_BYTES
94                  LINUX_INODE_SETATTR_RETURN_TYPE
95                  LINUX_NEED_RHCONFIG
96                  LINUX_WHICH_MODULES
97                  if test "x$ac_cv_linux_func_inode_setattr_returns_int" = "xyes" ; then
98                   AC_DEFINE(INODE_SETATTR_NOT_VOID)
99                  fi
100                  if test "x$ac_cv_linux_fs_struct_inode_has_i_bytes" = "xyes"; then 
101                   AC_DEFINE(STRUCT_INODE_HAS_I_BYTES)
102                  fi
103                 :
104                 fi
105                 ;;
106         *-solaris*)
107                 MKAFS_OSTYPE=SOLARIS
108                 AC_MSG_RESULT(sun4)
109                 ;;
110         *-hpux*)
111                 MKAFS_OSTYPE=HPUX
112                 AC_MSG_RESULT(hp_ux)
113                 ;;
114         *-irix*)
115                 MKAFS_OSTYPE=IRIX
116                 AC_MSG_RESULT(sgi)
117                 ;;
118         *-aix*)
119                 MKAFS_OSTYPE=AIX
120                 AC_MSG_RESULT(rs_aix)
121                 ;;
122         *-osf*)
123                 MKAFS_OSTYPE=DUX
124                 AC_MSG_RESULT(alpha_dux)
125                 if test "x$enable_kernel_module" = "xyes"; then
126                  if test "x$with_dux_kernel_headers" != "x"; then
127                    HEADER_RT=`ls ${with_dux_kernel_headers}/rt_preempt.h | head -1 | sed 's,/rt_preempt.h,,;s,/usr/sys/,,'`
128                  else
129                    HEADER_RT=`ls /usr/sys/*/rt_preempt.h | head -1 | sed 's,/rt_preempt.h,,;s,/usr/sys/,,'`
130                  fi
131                 fi
132                 if test "$HEADER_RT" = "*" ; then
133                         AC_MSG_ERROR([Need a configured kernel directory])
134                 fi
135                 AC_SUBST([HEADER_RT])
136                 ;;
137         *-darwin*)
138                 MKAFS_OSTYPE=DARWIN
139                 AC_MSG_RESULT(ppc_darwin)
140                 ;;
141         *-freebsd*)
142                 MKAFS_OSTYPE=FBSD
143                 AC_MSG_RESULT(i386_fbsd)
144                 ;;
145         *)
146                 AC_MSG_RESULT($system)
147                 ;;
148 esac
149
150 if test "x${MKAFS_OSTYPE}" = "xIRIX"; then
151         echo Skipping library tests because they confuse Irix.
152 else
153   AC_CHECK_FUNCS(socket)
154
155   if test "$ac_cv_func_socket" = no; then
156     for lib in socket inet; do
157         if test "$HAVE_SOCKET" != 1; then
158                 AC_CHECK_LIB(${lib}, socket,LIBS="$LIBS -l$lib";HAVE_SOCKET=1;AC_DEFINE(HAVE_SOCKET))
159         fi
160     done
161   fi
162   
163   AC_CHECK_FUNCS(connect)       
164
165   if test "$ac_cv_func_connect" = no; then
166     for lib in nsl; do
167         if test "$HAVE_CONNECT" != 1; then
168                 AC_CHECK_LIB(${lib}, connect,LIBS="$LIBS -l$lib";HAVE_CONNECT=1;AC_DEFINE(HAVE_CONNECT))
169         fi
170     done
171   fi
172
173   AC_CHECK_FUNCS(gethostbyname)
174   if test "$ac_cv_func_gethostbyname" = no; then
175         for lib in dns nsl resolv; do
176           if test "$HAVE_GETHOSTBYNAME" != 1; then
177             AC_CHECK_LIB(${lib}, gethostbyname, LIBS="$LIBS -l$lib";HAVE_GETHOSTBYNAME=1;AC_DEFINE(HAVE_GETHOSTBYNAME))
178           fi
179         done    
180   fi    
181
182   AC_CHECK_FUNCS(res_search)
183   if test "$ac_cv_func_res_search" = no; then
184         for lib in dns nsl resolv; do
185           if test "$HAVE_RES_SEARCH" != 1; then
186             AC_CHECK_LIB(${lib}, res_search, LIBS="$LIBS -l$lib";HAVE_RES_SEARCH=1;AC_DEFINE(HAVE_RES_SEARCH))
187           fi
188         done    
189         if test "$HAVE_RES_SEARCH" = 1; then
190           LIB_res_search="-l$lib"       
191         fi
192   fi    
193 fi
194
195 PTHREAD_LIBS=error
196 AC_CHECK_LIB(pthread, pthread_attr_init,
197              PTHREAD_LIBS="-lpthread")
198 if test "x$PTHREAD_LIBS" = xerror; then
199         AC_CHECK_LIB(pthreads, pthread_attr_init,
200                 PTHREAD_LIBS="-lpthreads")
201 fi
202 if test "x$PTHREAD_LIBS" = xerror; then
203         AC_CHECK_LIB(c_r, pthread_attr_init,
204                 PTHREAD_LIBS="-lc_r")
205 fi
206 if test "x$PTHREAD_LIBS" = xerror; then
207         AC_CHECK_FUNC(pthread_attr_init, PTHREAD_LIBS="")
208 fi
209 if test "x$PTHREAD_LIBS" = xerror; then
210         AC_MSG_WARN(*** Unable to locate working posix thread library ***)
211 fi
212 AC_SUBST(PTHREAD_LIBS)
213
214 WITH_OBSOLETE=NO
215 if test "$enable_obsolete" = "yes"; then
216         WITH_OBSOLETE=YES
217 fi
218
219 WITH_INSECURE=NO
220 if test "$enable_insecure" = "yes"; then
221         WITH_INSECURE=YES
222 fi
223
224 # Fast restart
225 if test "$enable_fast_restart" = "yes"; then
226         AC_DEFINE(FAST_RESTART)
227 fi
228
229 if test "$enable_bitmap_later" = "yes"; then
230         AC_DEFINE(BITMAP_LATER)
231 fi
232
233 # Should autocompute a default
234 if test "x$with_afs_sysname" != "x"; then
235         AFS_SYSNAME="$with_afs_sysname"
236 else
237         AC_MSG_ERROR(An AFS sysname is required)
238         exit 1
239 fi
240
241 if test "$enable_bos_restricted_mode" = "yes"; then
242         AC_DEFINE(BOS_RESTRICTED_MODE)
243 fi
244
245 if test "$enable_namei_fileserver" = "yes"; then
246         AC_DEFINE(AFS_NAMEI_ENV)
247 fi
248
249 if test "$enable_afsdb" = "yes"; then
250         LIB_AFSDB="$LIB_res_search"
251         AC_DEFINE(AFS_AFSDB_ENV)
252 fi
253
254 SRCDIR_PARENT=`pwd`
255 TOP_SRCDIR="${SRCDIR_PARENT}/src"
256
257 dnl checks for header files.
258 AC_HEADER_STDC
259 AC_HEADER_SYS_WAIT
260 AC_HEADER_DIRENT
261 AC_CHECK_HEADERS(stdlib.h string.h unistd.h fcntl.h sys/time.h sys/file.h)
262 AC_CHECK_HEADERS(netinet/in.h netdb.h sys/fcntl.h sys/mnttab.h sys/mntent.h)
263 AC_CHECK_HEADERS(mntent.h sys/vfs.h sys/param.h sys/fs_types.h)
264 AC_CHECK_HEADERS(sys/mount.h strings.h termios.h signal.h)
265 AC_CHECK_HEADERS(windows.h malloc.h winsock2.h direct.h io.h)
266 AC_CHECK_HEADERS(security/pam_modules.h siad.h usersec.h)
267
268 AC_CHECK_FUNCS(utimes random srandom getdtablesize snprintf re_comp re_exec)
269
270 if test "x$enable_kernel_module" = "xyes"; then
271 ENABLE_KERNEL_MODULE=libafs
272 fi
273
274 AC_SUBST(AFS_SYSNAME)
275 AC_SUBST(ENABLE_KERNEL_MODULE)
276 AC_SUBST(LIB_AFSDB)
277 AC_SUBST(LINUX_KERNEL_PATH)
278 AC_SUBST(LINUX_VERSION)
279 AC_SUBST(MKAFS_OSTYPE)
280 AC_SUBST(TOP_SRCDIR)
281 AC_SUBST(WITH_OBSOLETE)
282 AC_SUBST(WITH_INSECURE)
283
284 AC_OUTPUT(             \
285 Makefile               \
286 src/config/Makefile.${AFS_SYSNAME} \
287 src/libafs/MakefileProto.${MKAFS_OSTYPE} \
288 )