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