linux-ext3-adds-items-to-struct-inode-and-so-do-we-20010807
[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_ENABLE( full-vos-listvol-switch,
25 [  --enable-full-vos-listvol-switch     enable vos full listvol switch for formatted output],, enable_full_vos_listvol_switch="no")
26 AC_ARG_WITH(dux-kernel-headers,
27 [  --with-dux-kernel-headers=path       use the kernel headers found at path(optional, defaults to first match in /usr/sys)]
28 )
29 AC_ARG_WITH(linux-kernel-headers,
30 [  --with-linux-kernel-headers=path     use the kernel headers found at path(optional, defaults to /usr/src/linux)]
31 )
32 AC_ARG_ENABLE(kernel-module,
33 [  --disable-kernel-module              disable compilation of the kernel module (defaults to enabled)],, enable_kernel_module="yes"
34 )
35 AC_ARG_ENABLE(redhat-buildsys,
36 [  --enable-redhat-buildsys             enable compilation of the redhat build system kernel (defaults to disabled)],, enable_redhat_buildsys="no"
37 )
38
39 AC_PROG_CC
40
41 dnl weird ass systems
42 AC_AIX
43 AC_ISC_POSIX
44 AC_MINIX
45
46 dnl Various compiler setup.
47 AC_C_INLINE
48 AC_C_CONST
49 AC_TYPE_PID_T
50 AC_TYPE_SIZE_T
51 AC_TYPE_SIGNAL
52
53 dnl Checks for programs.
54 AC_PROG_INSTALL
55 AC_PROG_LN_S
56 AC_PROG_RANLIB
57 AC_PROG_YACC
58 AM_PROG_LEX
59
60 OPENAFS_CHECK_BIGENDIAN
61
62 AC_MSG_CHECKING(your OS)
63 system=$host
64 case $system in
65         *-linux*)
66                 MKAFS_OSTYPE=LINUX
67                 if test "x$enable_redhat_buildsys" = "xyes"; then
68                  AC_DEFINE(ENABLE_REDHAT_BUILDSYS)
69                 fi
70                 if test "x$enable_kernel_module" = "xyes"; then
71                  if test "x$with_linux_kernel_headers" != "x"; then
72                    LINUX_KERNEL_PATH="$with_linux_kernel_headers"
73                  else
74                    LINUX_KERNEL_PATH="/usr/src/linux"
75                  fi
76                  if test -f "$LINUX_KERNEL_PATH/include/linux/version.h"; then
77                   linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_PATH/include/linux/version.h |awk 'BEGIN { FS="\"" } { print $2 }'|tail -1`
78                   if test "x$linux_kvers" = "x"; then
79                     if test -f "$LINUX_KERNEL_PATH/include/linux/version-up.h"; then
80                       linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_PATH/include/linux/version-up.h |awk 'BEGIN { FS="\"" } { print $2 }'|tail -1`
81                       if test "x$linux_kvers" = "x"; then
82
83                         AC_MSG_ERROR(Linux headers lack version definition [2])
84                         exit 1
85                       else
86                         LINUX_VERSION="$linux_kvers"
87                       fi
88                     else
89                       AC_MSG_ERROR(Linux headers lack version definition)
90                       exit 1
91                     fi
92                   else
93                     LINUX_VERSION="$linux_kvers"
94                   fi
95                  else
96                     enable_kernel_module="no"
97                  fi
98                  if test ! -f "$LINUX_KERNEL_PATH/include/linux/autoconf.h"; then
99                      enable_kernel_module="no"
100                  fi
101                  if test "x$enable_kernel_module" = "xno"; then
102                   if test "x$with_linux_kernel_headers" != "x"; then
103                    AC_MSG_ERROR(No usable linux headers found at $LINUX_KERNEL_PATH)
104                    exit 1
105                   else
106                    AC_MSG_WARN(No usable linux headers found at $LINUX_KERNEL_PATH so disabling kernel module)
107                   fi
108                  fi
109                 fi
110                 AC_MSG_RESULT(linux)
111                 if test "x$enable_kernel_module" = "xyes"; then
112                  LINUX_FS_STRUCT_INODE_HAS_I_BYTES
113                  LINUX_FS_STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK
114                  LINUX_FS_STRUCT_INODE_HAS_I_CDEV
115                  LINUX_FS_STRUCT_INODE_HAS_I_TRUNCATE_SEM
116                  LINUX_INODE_SETATTR_RETURN_TYPE
117                  LINUX_NEED_RHCONFIG
118                  LINUX_WHICH_MODULES
119                  if test "x$ac_cv_linux_func_inode_setattr_returns_int" = "xyes" ; then
120                   AC_DEFINE(INODE_SETATTR_NOT_VOID)
121                  fi
122                  if test "x$ac_cv_linux_fs_struct_inode_has_i_cdev" = "xyes"; then 
123                   AC_DEFINE(STRUCT_INODE_HAS_I_CDEV)
124                  fi
125                  if test "x$ac_cv_linux_fs_struct_inode_has_i_truncate_sem" = "xyes"; then 
126                   AC_DEFINE(STRUCT_INODE_HAS_I_TRUNCATE_SEM)
127                  fi
128                  if test "x$ac_cv_linux_fs_struct_inode_has_i_bytes" = "xyes"; then 
129                   AC_DEFINE(STRUCT_INODE_HAS_I_BYTES)
130                  fi
131                  if test "x$ac_cv_linux_fs_struct_address_space_has_page_lock" = "xyes"; then 
132                   AC_DEFINE(STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK)
133                  fi
134                 :
135                 fi
136                 ;;
137         *-solaris*)
138                 MKAFS_OSTYPE=SOLARIS
139                 AC_MSG_RESULT(sun4)
140                 SOLARIS_UFSVFS_HAS_DQRWLOCK
141                 ;;
142         *-hpux*)
143                 MKAFS_OSTYPE=HPUX
144                 AC_MSG_RESULT(hp_ux)
145                 ;;
146         *-irix*)
147                 MKAFS_OSTYPE=IRIX
148                 AC_MSG_RESULT(sgi)
149                 ;;
150         *-aix*)
151                 MKAFS_OSTYPE=AIX
152                 AC_MSG_RESULT(rs_aix)
153                 ;;
154         *-osf*)
155                 MKAFS_OSTYPE=DUX
156                 AC_MSG_RESULT(alpha_dux)
157                 if test "x$enable_kernel_module" = "xyes"; then
158                  if test "x$with_dux_kernel_headers" != "x"; then
159                    HEADER_RT=`ls ${with_dux_kernel_headers}/rt_preempt.h | head -1 | sed 's,/rt_preempt.h,,;s,/usr/sys/,,'`
160                  else
161                    HEADER_RT=`ls /usr/sys/*/rt_preempt.h | head -1 | sed 's,/rt_preempt.h,,;s,/usr/sys/,,'`
162                  fi
163                 fi
164                 if test "$HEADER_RT" = "*" ; then
165                         AC_MSG_ERROR([Need a configured kernel directory])
166                 fi
167                 AC_SUBST([HEADER_RT])
168                 ;;
169         *-darwin*)
170                 MKAFS_OSTYPE=DARWIN
171                 AC_MSG_RESULT(ppc_darwin)
172                 ;;
173         *-freebsd*)
174                 MKAFS_OSTYPE=FBSD
175                 AC_MSG_RESULT(i386_fbsd)
176                 ;;
177         *)
178                 AC_MSG_RESULT($system)
179                 ;;
180 esac
181
182 if test "x$with_afs_sysname" != "x"; then
183         AFS_SYSNAME="$with_afs_sysname"
184 else
185         AC_MSG_CHECKING(your AFS sysname)
186         case $host in
187                 i?86-*-freebsd4.2*)
188                         AFS_SYSNAME="i386_fbsd_42"
189                         ;;
190                 hppa2.0w-hp-hpux11*)
191                         AFS_SYSNAME="hp_ux110"
192                         ;;
193                 hppa-hp-hpux11*)
194                         AFS_SYSNAME="hp_ux110"
195                         ;;
196                 hppa-hp-hpux10*)
197                         AFS_SYSNAME="hp_ux102"
198                         ;;
199                 powerpc-apple-darwin1.2*)
200                         AFS_SYSNAME="ppc_darwin_12"
201                         ;;
202                 powerpc-apple-darwin1.3*)
203                         AFS_SYSNAME="ppc_darwin_13"
204                         ;;
205                 sparc-sun-solaris2.5*)
206                         AFS_SYSNAME="sun4x_55"
207                         ;;
208                 sparc-sun-solaris2.6)
209                         AFS_SYSNAME="sun4x_56"
210                         ;;
211                 sparc-sun-solaris2.7)
212                         AFS_SYSNAME="sun4x_57"
213                         ;;
214                 sparc-sun-solaris2.8)
215                         AFS_SYSNAME="sun4x_58"
216                         ;;
217                 alpha*-dec-osf4.0*)
218                         AFS_SYSNAME="alpha_dux40"
219                         ;;
220                 alpha*-dec-osf5.0*)
221                         AFS_SYSNAME="alpha_dux50"
222                         ;;
223                 mips-sgi-irix6.5)
224                         AFS_SYSNAME="sgi_65"
225                         ;;
226                 ia64-*-linux*)
227                         AFS_SYSNAME="ia64_linuxXX"
228                         ;;
229                 powerpc-*-linux*)
230                         AFS_SYSNAME="ppc_linuxXX"
231                         ;;
232                 alpha*-linux*)
233                         AFS_SYSNAME="alpha_linux_XX"
234                         ;;
235                 s390-*-linux*)
236                         AFS_SYSNAME="s390_linuxXX"
237                         ;;
238                 sparc-*-linux*)
239                         AFS_SYSNAME="sparc_linuxXX"
240                         ;;
241                 sparc64-*-linux*)
242                         AFS_SYSNAME="sparc64_linuxXX"
243                         ;;
244                 i?86-*-linux*)
245                         AFS_SYSNAME="i386_linuxXX"
246                         ;;
247                 power*-ibm-aix4.2*)
248                         AFS_SYSNAME="rs_aix42"
249                         ;;
250                 power*-ibm-aix4.3*)
251                         AFS_SYSNAME="rs_aix42"
252                         ;;
253                 *)
254                         AC_MSG_ERROR(An AFS sysname is required)
255                         exit 1
256                         ;;
257         esac
258         case $AFS_SYSNAME in
259                 *_linux*)
260                         AFS_SYSKVERS=`echo $LINUX_VERSION | awk -F\. '{print $1 $2}'`
261                         if test "x${AFS_SYSKVERS}" = "x"; then
262                          AC_MSG_ERROR(Couldn't guess your Linux version. Please use the --with-afs-sysname option to configure an AFS sysname.)
263                         fi
264                         _AFS_SYSNAME=`echo $AFS_SYSNAME|sed s/XX\$/$AFS_SYSKVERS/`
265                         AFS_SYSNAME="$_AFS_SYSNAME"
266                         ;;
267         esac
268         AC_MSG_RESULT($AFS_SYSNAME)
269 fi
270
271
272 if test "x${MKAFS_OSTYPE}" = "xIRIX"; then
273         echo Skipping library tests because they confuse Irix.
274 else
275   AC_CHECK_FUNCS(socket)
276
277   if test "$ac_cv_func_socket" = no; then
278     for lib in socket inet; do
279         if test "$HAVE_SOCKET" != 1; then
280                 AC_CHECK_LIB(${lib}, socket,LIBS="$LIBS -l$lib";HAVE_SOCKET=1;AC_DEFINE(HAVE_SOCKET))
281         fi
282     done
283   fi
284   
285   AC_CHECK_FUNCS(connect)       
286
287   if test "$ac_cv_func_connect" = no; then
288     for lib in nsl; do
289         if test "$HAVE_CONNECT" != 1; then
290                 AC_CHECK_LIB(${lib}, connect,LIBS="$LIBS -l$lib";HAVE_CONNECT=1;AC_DEFINE(HAVE_CONNECT))
291         fi
292     done
293   fi
294
295   AC_CHECK_FUNCS(gethostbyname)
296   if test "$ac_cv_func_gethostbyname" = no; then
297         for lib in dns nsl resolv; do
298           if test "$HAVE_GETHOSTBYNAME" != 1; then
299             AC_CHECK_LIB(${lib}, gethostbyname, LIBS="$LIBS -l$lib";HAVE_GETHOSTBYNAME=1;AC_DEFINE(HAVE_GETHOSTBYNAME))
300           fi
301         done    
302   fi    
303
304   AC_CHECK_FUNCS(res_search)
305   if test "$ac_cv_func_res_search" = no; then
306         for lib in dns nsl resolv; do
307           if test "$HAVE_RES_SEARCH" != 1; then
308             AC_CHECK_LIB(${lib}, res_search, LIBS="$LIBS -l$lib";HAVE_RES_SEARCH=1;AC_DEFINE(HAVE_RES_SEARCH))
309           fi
310         done    
311         if test "$HAVE_RES_SEARCH" = 1; then
312           LIB_res_search="-l$lib"       
313         fi
314   fi    
315 fi
316
317 PTHREAD_LIBS=error
318 AC_CHECK_LIB(pthread, pthread_attr_init,
319              PTHREAD_LIBS="-lpthread")
320 if test "x$PTHREAD_LIBS" = xerror; then
321         AC_CHECK_LIB(pthreads, pthread_attr_init,
322                 PTHREAD_LIBS="-lpthreads")
323 fi
324 if test "x$PTHREAD_LIBS" = xerror; then
325         AC_CHECK_LIB(c_r, pthread_attr_init,
326                 PTHREAD_LIBS="-lc_r")
327 fi
328 if test "x$PTHREAD_LIBS" = xerror; then
329         AC_CHECK_FUNC(pthread_attr_init, PTHREAD_LIBS="")
330 fi
331 if test "x$PTHREAD_LIBS" = xerror; then
332         AC_MSG_WARN(*** Unable to locate working posix thread library ***)
333 fi
334 AC_SUBST(PTHREAD_LIBS)
335
336 WITH_OBSOLETE=NO
337 if test "$enable_obsolete" = "yes"; then
338         WITH_OBSOLETE=YES
339 fi
340
341 WITH_INSECURE=NO
342 if test "$enable_insecure" = "yes"; then
343         WITH_INSECURE=YES
344 fi
345
346 # Fast restart
347 if test "$enable_fast_restart" = "yes"; then
348         AC_DEFINE(FAST_RESTART)
349 fi
350
351 if test "$enable_bitmap_later" = "yes"; then
352         AC_DEFINE(BITMAP_LATER)
353 fi
354
355 if test "$enable_full_vos_listvol_switch" = "yes"; then
356         AC_DEFINE(FULL_LISTVOL_SWITCH)
357 fi
358
359 if test "$enable_bos_restricted_mode" = "yes"; then
360         AC_DEFINE(BOS_RESTRICTED_MODE)
361 fi
362
363 if test "$enable_namei_fileserver" = "yes"; then
364         AC_DEFINE(AFS_NAMEI_ENV)
365 fi
366
367 if test "$enable_afsdb" = "yes"; then
368         LIB_AFSDB="$LIB_res_search"
369         AC_DEFINE(AFS_AFSDB_ENV)
370 fi
371
372 SRCDIR_PARENT=`pwd`
373 TOP_SRCDIR="${SRCDIR_PARENT}/src"
374 DESTDIR="${SRCDIR_PARENT}/${AFS_SYSNAME}/dest/"
375 SRCDIR="${SRCDIR_PARENT}/${AFS_SYSNAME}/dest/"
376
377 dnl checks for header files.
378 AC_HEADER_STDC
379 AC_HEADER_SYS_WAIT
380 AC_HEADER_DIRENT
381 AC_CHECK_HEADERS(stdlib.h string.h unistd.h fcntl.h sys/time.h sys/file.h)
382 AC_CHECK_HEADERS(netinet/in.h netdb.h sys/fcntl.h sys/mnttab.h sys/mntent.h)
383 AC_CHECK_HEADERS(mntent.h sys/vfs.h sys/param.h sys/fs_types.h)
384 AC_CHECK_HEADERS(sys/mount.h strings.h termios.h signal.h)
385 AC_CHECK_HEADERS(windows.h malloc.h winsock2.h direct.h io.h)
386 AC_CHECK_HEADERS(security/pam_modules.h siad.h usersec.h)
387
388 AC_CHECK_FUNCS(utimes random srandom getdtablesize snprintf re_comp re_exec)
389
390 if test "x$enable_kernel_module" = "xyes"; then
391 ENABLE_KERNEL_MODULE=libafs
392 fi
393
394 AC_SUBST(AFS_SYSNAME)
395 AC_SUBST(ENABLE_KERNEL_MODULE)
396 AC_SUBST(LIB_AFSDB)
397 AC_SUBST(LINUX_KERNEL_PATH)
398 AC_SUBST(LINUX_VERSION)
399 AC_SUBST(MKAFS_OSTYPE)
400 AC_SUBST(TOP_SRCDIR)
401 AC_SUBST(DESTDIR)
402 AC_SUBST(SRCDIR)
403 AC_SUBST(WITH_OBSOLETE)
404 AC_SUBST(WITH_INSECURE)
405
406 AC_OUTPUT(             \
407 Makefile               \
408 src/config/Makefile.version-NOCML \
409 src/config/Makefile.${AFS_SYSNAME} \
410 src/libafs/MakefileProto.${MKAFS_OSTYPE} \
411 src/libuafs/MakefileProto.${MKAFS_OSTYPE} \
412 src/pam/Makefile \
413 src/afsd/afs.ppc_darwin.plist \
414 src/afs/Makefile \
415 src/afsd/Makefile \
416 src/afsmonitor/Makefile \
417 src/afsweb/Makefile \
418 src/audit/Makefile \
419 src/auth/test/Makefile \
420 src/auth/Makefile \
421 src/bozo/test/Makefile \
422 src/bozo/Makefile \
423 src/bu_utils/Makefile \
424 src/bubasics/Makefile \
425 src/bucoord/Makefile \
426 src/budb/Makefile \
427 src/butc/Makefile \
428 src/butm/Makefile \
429 src/cmd/test/Makefile \
430 src/cmd/Makefile \
431 src/comerr/test/Makefile \
432 src/comerr/Makefile \
433 src/config/Makefile \
434 src/dauth/Makefile \
435 src/des/test/Makefile \
436 src/des/Makefile \
437 src/des_stub/Makefile \
438 src/dir/test/Makefile \
439 src/dir/Makefile \
440 src/export/Makefile \
441 src/finale/Makefile \
442 src/fsint/Makefile \
443 src/fsprobe/Makefile \
444 src/ftpd43+/Makefile \
445 src/gtx/Makefile \
446 src/inetd/Makefile \
447 src/kauth/test/Makefile \
448 src/kauth/Makefile \
449 src/libacl/test/Makefile \
450 src/libacl/Makefile \
451 src/libadmin/adminutil/Makefile \
452 src/libadmin/Makefile \
453 src/libadmin/bos/Makefile \
454 src/libadmin/cfg/test/Makefile \
455 src/libadmin/cfg/Makefile \
456 src/libadmin/client/Makefile \
457 src/libadmin/kas/Makefile \
458 src/libadmin/pts/Makefile \
459 src/libadmin/samples/Makefile \
460 src/libadmin/test/Makefile \
461 src/libadmin/vos/Makefile \
462 src/libafsauthent/Makefile \
463 src/libafsrpc/Makefile \
464 src/log/test/Makefile \
465 src/log/Makefile \
466 src/login/Makefile \
467 src/lwp/test/Makefile \
468 src/lwp/Makefile \
469 src/mpp/Makefile \
470 src/ntp/Makefile \
471 src/null/Makefile \
472 src/package/Makefile \
473 src/pam/Makefile \
474 src/pinstall/test/Makefile \
475 src/pinstall/Makefile \
476 src/procmgmt/Makefile \
477 src/procmgmt/test/Makefile \
478 src/ptserver/Makefile \
479 src/rcp/Makefile \
480 src/rlogind/Makefile \
481 src/rsh/Makefile \
482 src/rx/Makefile \
483 src/rx/bulk.example/Makefile \
484 src/rx/bulktest/Makefile \
485 src/rx/multi.example/Makefile \
486 src/rx/simple.example/Makefile \
487 src/rx/test/Makefile \
488 src/rxgen/Makefile \
489 src/rxkad/Makefile \
490 src/rxkad/test/Makefile \
491 src/rxstat/Makefile \
492 src/scout/Makefile \
493 src/sgistuff/Makefile \
494 src/sia/Makefile \
495 src/sys/Makefile \
496 src/tbutc/Makefile \
497 src/tsm41/Makefile \
498 src/tviced/Makefile \
499 src/ubik/Makefile \
500 src/update/Makefile \
501 src/usd/test/Makefile \
502 src/usd/Makefile \
503 src/uss/Makefile \
504 src/util/Makefile \
505 src/util/test/Makefile \
506 src/venus/test/Makefile \
507 src/venus/Makefile \
508 src/vfsck/Makefile \
509 src/viced/Makefile \
510 src/vlserver/Makefile \
511 src/vol/Makefile \
512 src/vol/test/Makefile \
513 src/volser/Makefile \
514 src/wsadmin.src/Makefile \
515 src/xstat/Makefile \
516 )