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