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