cvsignore-updates-kolya-20011005
[openafs.git] / configure-libafs.in
1 AC_INIT(Makefile.common)
2 AM_INIT_AUTOMAKE(openafs-libafs,devel)
3 AC_CANONICAL_HOST
4 AC_CONFIG_HEADER(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 AC_ARG_ENABLE(transarc-paths,
39 [  --enable-transarc-paths                      Use Transarc style paths like /usr/afs and /usr/vice],, enable_transarc_paths="no"
40 )
41
42 AC_PROG_CC
43
44 dnl weird ass systems
45 AC_AIX
46 AC_ISC_POSIX
47 AC_MINIX
48
49 dnl Various compiler setup.
50 AC_C_INLINE
51 AC_C_CONST
52 AC_TYPE_PID_T
53 AC_TYPE_SIZE_T
54 AC_TYPE_SIGNAL
55
56 dnl Checks for programs.
57 AC_PROG_INSTALL
58 AC_PROG_LN_S
59 AC_PROG_RANLIB
60 AC_PROG_YACC
61 AM_PROG_LEX
62
63 OPENAFS_CHECK_BIGENDIAN
64
65 AC_MSG_CHECKING(your OS)
66 system=$host
67 case $system in
68         *-linux*)
69                 MKAFS_OSTYPE=LINUX
70                 if test "x$enable_redhat_buildsys" = "xyes"; then
71                  AC_DEFINE(ENABLE_REDHAT_BUILDSYS)
72                 fi
73                 if test "x$enable_kernel_module" = "xyes"; then
74                  if test "x$with_linux_kernel_headers" != "x"; then
75                    LINUX_KERNEL_PATH="$with_linux_kernel_headers"
76                  else
77                    LINUX_KERNEL_PATH="/usr/src/linux"
78                  fi
79                  if test -f "$LINUX_KERNEL_PATH/include/linux/version.h"; then
80                   linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_PATH/include/linux/version.h |awk 'BEGIN { FS="\"" } { print $2 }'|tail -1`
81                   if test "x$linux_kvers" = "x"; then
82                     if test -f "$LINUX_KERNEL_PATH/include/linux/version-up.h"; then
83                       linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_PATH/include/linux/version-up.h |awk 'BEGIN { FS="\"" } { print $2 }'|tail -1`
84                       if test "x$linux_kvers" = "x"; then
85
86                         AC_MSG_ERROR(Linux headers lack version definition [2])
87                         exit 1
88                       else
89                         LINUX_VERSION="$linux_kvers"
90                       fi
91                     else
92                       AC_MSG_ERROR(Linux headers lack version definition)
93                       exit 1
94                     fi
95                   else
96                     LINUX_VERSION="$linux_kvers"
97                   fi
98                  else
99                     enable_kernel_module="no"
100                  fi
101                  if test ! -f "$LINUX_KERNEL_PATH/include/linux/autoconf.h"; then
102                      enable_kernel_module="no"
103                  fi
104                  if test "x$enable_kernel_module" = "xno"; then
105                   if test "x$with_linux_kernel_headers" != "x"; then
106                    AC_MSG_ERROR(No usable linux headers found at $LINUX_KERNEL_PATH)
107                    exit 1
108                   else
109                    AC_MSG_WARN(No usable linux headers found at $LINUX_KERNEL_PATH so disabling kernel module)
110                   fi
111                  fi
112                 fi
113                 AC_MSG_RESULT(linux)
114                 if test "x$enable_kernel_module" = "xyes"; then
115                  LINUX_BUILD_VNODE_FROM_INODE(config,afs)
116                  LINUX_FS_STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK
117                  LINUX_INODE_SETATTR_RETURN_TYPE
118                  LINUX_NEED_RHCONFIG
119                  LINUX_WHICH_MODULES
120                  if test "x$ac_cv_linux_func_inode_setattr_returns_int" = "xyes" ; then
121                   AC_DEFINE(INODE_SETATTR_NOT_VOID)
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         *-openbsd*)
170                 MKAFS_OSTYPE=OBSD
171                 AC_MSG_RESULT(i386_obsd)
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                 hppa*-hp-hpux11*)
187                         AFS_SYSNAME="hp_ux110"
188                         ;;
189                 hppa*-hp-hpux10*)
190                         AFS_SYSNAME="hp_ux102"
191                         ;;
192                 powerpc-apple-darwin1.2*)
193                         AFS_SYSNAME="ppc_darwin_12"
194                         DARWIN_PLIST=afs.${AFS_SYSNAME}.plist
195                         DARWIN_INFOFILE=afs.${AFS_SYSNAME}.plist
196                         ;;
197                 powerpc-apple-darwin1.3*)
198                         AFS_SYSNAME="ppc_darwin_13"
199                         DARWIN_PLIST=afs.${AFS_SYSNAME}.plist
200                         DARWIN_INFOFILE=afs.${AFS_SYSNAME}.plist
201                         ;;
202                 powerpc-apple-darwin1.4*)
203                         AFS_SYSNAME="ppc_darwin_14"
204                         DARWIN_PLIST=afs.${AFS_SYSNAME}.plist
205                         DARWIN_INFOFILE=afs.${AFS_SYSNAME}.plist
206                         ;;
207                 sparc-sun-solaris2.5*)
208                         AFS_SYSNAME="sun4x_55"
209                         ;;
210                 sparc-sun-solaris2.6)
211                         AFS_SYSNAME="sun4x_56"
212                         ;;
213                 sparc-sun-solaris2.7)
214                         AFS_SYSNAME="sun4x_57"
215                         ;;
216                 sparc-sun-solaris2.8)
217                         AFS_SYSNAME="sun4x_58"
218                         ;;
219                 alpha*-dec-osf4.0*)
220                         AFS_SYSNAME="alpha_dux40"
221                         ;;
222                 alpha*-dec-osf5.0*)
223                         AFS_SYSNAME="alpha_dux50"
224                         ;;
225                 mips-sgi-irix6.5)
226                         AFS_SYSNAME="sgi_65"
227                         ;;
228                 ia64-*-linux*)
229                         AFS_SYSNAME="ia64_linuxXX"
230                         ;;
231                 powerpc-*-linux*)
232                         AFS_SYSNAME="ppc_linuxXX"
233                         ;;
234                 alpha*-linux*)
235                         AFS_SYSNAME="alpha_linux_XX"
236                         ;;
237                 s390-*-linux*)
238                         AFS_SYSNAME="s390_linuxXX"
239                         ;;
240                 sparc-*-linux*)
241                         AFS_SYSNAME="sparc_linuxXX"
242                         ;;
243                 sparc64-*-linux*)
244                         AFS_SYSNAME="sparc64_linuxXX"
245                         ;;
246                 i?86-*-linux*)
247                         AFS_SYSNAME="i386_linuxXX"
248                         ;;
249                 power*-ibm-aix4.2*)
250                         AFS_SYSNAME="rs_aix42"
251                         ;;
252                 power*-ibm-aix4.3*)
253                         AFS_SYSNAME="rs_aix42"
254                         ;;
255                 *)
256                         AC_MSG_ERROR(An AFS sysname is required)
257                         exit 1
258                         ;;
259         esac
260         case $AFS_SYSNAME in
261                 *_linux*)
262                         AFS_SYSKVERS=`echo $LINUX_VERSION | awk -F\. '{print $1 $2}'`
263                         if test "x${AFS_SYSKVERS}" = "x"; then
264                          AC_MSG_ERROR(Couldn't guess your Linux version. Please use the --with-afs-sysname option to configure an AFS sysname.)
265                         fi
266                         _AFS_SYSNAME=`echo $AFS_SYSNAME|sed s/XX\$/$AFS_SYSKVERS/`
267                         AFS_SYSNAME="$_AFS_SYSNAME"
268                         ;;
269         esac
270         AC_MSG_RESULT($AFS_SYSNAME)
271 fi
272
273
274 if test "x${MKAFS_OSTYPE}" = "xIRIX"; then
275         echo Skipping library tests because they confuse Irix.
276 else
277   AC_CHECK_FUNCS(socket)
278
279   if test "$ac_cv_func_socket" = no; then
280     for lib in socket inet; do
281         if test "$HAVE_SOCKET" != 1; then
282                 AC_CHECK_LIB(${lib}, socket,LIBS="$LIBS -l$lib";HAVE_SOCKET=1;AC_DEFINE(HAVE_SOCKET))
283         fi
284     done
285   fi
286   
287   AC_CHECK_FUNCS(connect)       
288
289   if test "$ac_cv_func_connect" = no; then
290     for lib in nsl; do
291         if test "$HAVE_CONNECT" != 1; then
292                 AC_CHECK_LIB(${lib}, connect,LIBS="$LIBS -l$lib";HAVE_CONNECT=1;AC_DEFINE(HAVE_CONNECT))
293         fi
294     done
295   fi
296
297   AC_CHECK_FUNCS(gethostbyname)
298   if test "$ac_cv_func_gethostbyname" = no; then
299         for lib in dns nsl resolv; do
300           if test "$HAVE_GETHOSTBYNAME" != 1; then
301             AC_CHECK_LIB(${lib}, gethostbyname, LIBS="$LIBS -l$lib";HAVE_GETHOSTBYNAME=1;AC_DEFINE(HAVE_GETHOSTBYNAME))
302           fi
303         done    
304   fi    
305
306   AC_CHECK_FUNCS(res_search)
307   if test "$ac_cv_func_res_search" = no; then
308         for lib in dns nsl resolv; do
309           if test "$HAVE_RES_SEARCH" != 1; then
310             AC_CHECK_LIB(${lib}, res_search, LIBS="$LIBS -l$lib";HAVE_RES_SEARCH=1;AC_DEFINE(HAVE_RES_SEARCH))
311           fi
312         done    
313         if test "$HAVE_RES_SEARCH" = 1; then
314           LIB_res_search="-l$lib"       
315         fi
316   fi    
317 fi
318
319 PTHREAD_LIBS=error
320 AC_CHECK_LIB(pthread, pthread_attr_init,
321              PTHREAD_LIBS="-lpthread")
322 if test "x$PTHREAD_LIBS" = xerror; then
323         AC_CHECK_LIB(pthreads, pthread_attr_init,
324                 PTHREAD_LIBS="-lpthreads")
325 fi
326 if test "x$PTHREAD_LIBS" = xerror; then
327         AC_CHECK_LIB(c_r, pthread_attr_init,
328                 PTHREAD_LIBS="-lc_r")
329 fi
330 if test "x$PTHREAD_LIBS" = xerror; then
331         AC_CHECK_FUNC(pthread_attr_init, PTHREAD_LIBS="")
332 fi
333 if test "x$PTHREAD_LIBS" = xerror; then
334         AC_MSG_WARN(*** Unable to locate working posix thread library ***)
335 fi
336 AC_SUBST(PTHREAD_LIBS)
337
338 WITH_OBSOLETE=NO
339 if test "$enable_obsolete" = "yes"; then
340         WITH_OBSOLETE=YES
341 fi
342
343 WITH_INSECURE=NO
344 if test "$enable_insecure" = "yes"; then
345         WITH_INSECURE=YES
346 fi
347
348 # Fast restart
349 if test "$enable_fast_restart" = "yes"; then
350         AC_DEFINE(FAST_RESTART)
351 fi
352
353 if test "$enable_bitmap_later" = "yes"; then
354         AC_DEFINE(BITMAP_LATER)
355 fi
356
357 if test "$enable_full_vos_listvol_switch" = "yes"; then
358         AC_DEFINE(FULL_LISTVOL_SWITCH)
359 fi
360
361 if test "$enable_bos_restricted_mode" = "yes"; then
362         AC_DEFINE(BOS_RESTRICTED_MODE)
363 fi
364
365 if test "$enable_namei_fileserver" = "yes"; then
366         AC_DEFINE(AFS_NAMEI_ENV)
367 fi
368
369 if test "$enable_afsdb" = "yes"; then
370         LIB_AFSDB="$LIB_res_search"
371         AC_DEFINE(AFS_AFSDB_ENV)
372 fi
373
374 SRCDIR_PARENT=`pwd`
375 TOP_SRCDIR="${SRCDIR_PARENT}"
376 DESTDIR="${SRCDIR_PARENT}/${AFS_SYSNAME}/dest/"
377 TOP_INCDIR="${SRCDIR_PARENT}/include"
378 TOP_LIBDIR="${SRCDIR_PARENT}/lib"
379
380 dnl checks for header files.
381 AC_HEADER_STDC
382 AC_HEADER_SYS_WAIT
383 AC_HEADER_DIRENT
384 AC_CHECK_HEADERS(stdlib.h string.h unistd.h fcntl.h sys/time.h sys/file.h)
385 AC_CHECK_HEADERS(netinet/in.h netdb.h sys/fcntl.h sys/mnttab.h sys/mntent.h)
386 AC_CHECK_HEADERS(mntent.h sys/vfs.h sys/param.h sys/fs_types.h)
387 AC_CHECK_HEADERS(sys/mount.h strings.h termios.h signal.h)
388 AC_CHECK_HEADERS(windows.h malloc.h winsock2.h direct.h io.h)
389 AC_CHECK_HEADERS(security/pam_modules.h siad.h usersec.h)
390
391 AC_CHECK_FUNCS(utimes random srandom getdtablesize snprintf re_comp re_exec)
392
393 dnl Directory PATH handling
394 if test "x$enable_transarc_paths" = "xyes"  ; then 
395     afsconfdir=${afsconfdir=/usr/afs/etc}
396     viceetcdir=${viceetcdir=/usr/vice/etc}
397     afskerneldir=${afskerneldir=${viceetcdir}}
398     afssrvbindir=${afssrvbindir=/usr/afs/bin}
399     afssrvsbindir=${afssrvsbindir=/usr/afs/bin}
400     afssrvlibexecdir=${afssrvlibexecdir=/usr/afs/bin}
401     afsdbdir=${afsdbdir=/usr/afs/db}
402     afslogsdir=${afslogsdir=/usr/afs/logs}
403     afslocaldir=${afslocaldir=/usr/afs/local}
404     afsbackupdir=${afsbackupdir=/usr/afs/backup}
405     afsbosconfigdir=${afsbosconfigdir=/usr/afs/local}
406     else 
407     afsconfdir=${afsconfdir=$sysconfdir/openafs/server}
408     viceetcdir=${viceetcdir=$sysconfdir/openafs}
409     afskerneldir=${afskerneldir=$libdir/openafs}
410     afssrvbindir=${afssrvbindir=$bindir}
411     afssrvsbindir=${afssrvsbindir=$sbindir}
412     afssrvlibexecdir=${afssrvlibexecdir=$libexecdir/openafs}
413     afsdbdir=${afsdbdir=$localstatedir/openafs/db}
414     afslogsdir=${afslogsdir=$localstatedir/openafs/logs}
415     afslocaldir=${afslocaldir=$localstatedir/openafs}
416     afsbackupdir=${afsbackupdir=$localstatedir/openafs/backup}
417     afsbosconfigdir=${afsbosconfigdir=$sysconfdir/openafs}
418
419 fi
420 AC_SUBST(afsconfdir)
421 AC_SUBST(viceetcdir)
422 AC_SUBST(afskerneldir)
423 AC_SUBST(afssrvbindir)
424 AC_SUBST(afssrvsbindir)
425 AC_SUBST(afssrvlibexecdir)
426 AC_SUBST(afsdbdir)
427 AC_SUBST(afslogsdir)
428 AC_SUBST(afslocaldir)
429 AC_SUBST(afsbackupdir)
430 AC_SUBST(afsbosconfigdir)
431
432 if test "x$enable_kernel_module" = "xyes"; then
433 ENABLE_KERNEL_MODULE=libafs
434 fi
435
436 AC_SUBST(AFS_SYSNAME)
437 AC_SUBST(ENABLE_KERNEL_MODULE)
438 AC_SUBST(LIB_AFSDB)
439 AC_SUBST(LINUX_KERNEL_PATH)
440 AC_SUBST(LINUX_VERSION)
441 AC_SUBST(MKAFS_OSTYPE)
442 AC_SUBST(TOP_SRCDIR)
443 AC_SUBST(TOP_INCDIR)
444 AC_SUBST(TOP_LIBDIR)
445 AC_SUBST(DEST)
446 AC_SUBST(WITH_OBSOLETE)
447 AC_SUBST(WITH_INSECURE)
448 AC_SUBST(DARWIN_INFOFILE)
449
450 AC_OUTPUT(             \
451 Makefile               \
452 config/Makefile.${AFS_SYSNAME} \
453 )