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