darwin-update-plist-building-20010912
[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_FS_STRUCT_INODE_HAS_I_BYTES
116                  LINUX_FS_STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK
117                  LINUX_FS_STRUCT_INODE_HAS_I_CDEV
118                  LINUX_FS_STRUCT_INODE_HAS_I_TRUNCATE_SEM
119                  LINUX_FS_STRUCT_INODE_HAS_I_DIRTY_DATA_BUFFERS
120                  LINUX_FS_STRUCT_INODE_HAS_I_MAPPING_OVERLOAD
121                  LINUX_FS_STRUCT_INODE_HAS_I_MMAP_SHARED
122                  LINUX_INODE_SETATTR_RETURN_TYPE
123                  LINUX_NEED_RHCONFIG
124                  LINUX_WHICH_MODULES
125                  if test "x$ac_cv_linux_func_inode_setattr_returns_int" = "xyes" ; then
126                   AC_DEFINE(INODE_SETATTR_NOT_VOID)
127                  fi
128                  if test "x$ac_cv_linux_fs_struct_inode_has_i_dirty_data_buffers" = "xyes"; then 
129                   AC_DEFINE(STRUCT_INODE_HAS_I_DIRTY_DATA_BUFFERS)
130                  fi
131                  if test "x$ac_cv_linux_fs_struct_inode_has_i_mmap_shared" = "xyes"; then 
132                   AC_DEFINE(STRUCT_INODE_HAS_I_MMAP_SHARED)
133                  fi
134                  if test "x$ac_cv_linux_fs_struct_inode_has_i_mapping_overload" = "xyes"; then 
135                   AC_DEFINE(STRUCT_INODE_HAS_I_MAPPING_OVERLOAD)
136                  fi
137                  if test "x$ac_cv_linux_fs_struct_inode_has_i_cdev" = "xyes"; then 
138                   AC_DEFINE(STRUCT_INODE_HAS_I_CDEV)
139                  fi
140                  if test "x$ac_cv_linux_fs_struct_inode_has_i_truncate_sem" = "xyes"; then 
141                   AC_DEFINE(STRUCT_INODE_HAS_I_TRUNCATE_SEM)
142                  fi
143                  if test "x$ac_cv_linux_fs_struct_inode_has_i_bytes" = "xyes"; then 
144                   AC_DEFINE(STRUCT_INODE_HAS_I_BYTES)
145                  fi
146                  if test "x$ac_cv_linux_fs_struct_address_space_has_page_lock" = "xyes"; then 
147                   AC_DEFINE(STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK)
148                  fi
149                 :
150                 fi
151                 ;;
152         *-solaris*)
153                 MKAFS_OSTYPE=SOLARIS
154                 AC_MSG_RESULT(sun4)
155                 SOLARIS_UFSVFS_HAS_DQRWLOCK
156                 ;;
157         *-hpux*)
158                 MKAFS_OSTYPE=HPUX
159                 AC_MSG_RESULT(hp_ux)
160                 ;;
161         *-irix*)
162                 MKAFS_OSTYPE=IRIX
163                 AC_MSG_RESULT(sgi)
164                 ;;
165         *-aix*)
166                 MKAFS_OSTYPE=AIX
167                 AC_MSG_RESULT(rs_aix)
168                 ;;
169         *-osf*)
170                 MKAFS_OSTYPE=DUX
171                 AC_MSG_RESULT(alpha_dux)
172                 if test "x$enable_kernel_module" = "xyes"; then
173                  if test "x$with_dux_kernel_headers" != "x"; then
174                    HEADER_RT=`ls ${with_dux_kernel_headers}/rt_preempt.h | head -1 | sed 's,/rt_preempt.h,,;s,/usr/sys/,,'`
175                  else
176                    HEADER_RT=`ls /usr/sys/*/rt_preempt.h | head -1 | sed 's,/rt_preempt.h,,;s,/usr/sys/,,'`
177                  fi
178                 fi
179                 if test "$HEADER_RT" = "*" ; then
180                         AC_MSG_ERROR([Need a configured kernel directory])
181                 fi
182                 AC_SUBST([HEADER_RT])
183                 ;;
184         *-darwin*)
185                 MKAFS_OSTYPE=DARWIN
186                 AC_MSG_RESULT(ppc_darwin)
187                 ;;
188         *-freebsd*)
189                 MKAFS_OSTYPE=FBSD
190                 AC_MSG_RESULT(i386_fbsd)
191                 ;;
192         *)
193                 AC_MSG_RESULT($system)
194                 ;;
195 esac
196
197 if test "x$with_afs_sysname" != "x"; then
198         AFS_SYSNAME="$with_afs_sysname"
199 else
200         AC_MSG_CHECKING(your AFS sysname)
201         case $host in
202                 i?86-*-freebsd4.2*)
203                         AFS_SYSNAME="i386_fbsd_42"
204                         ;;
205                 hppa*-hp-hpux11*)
206                         AFS_SYSNAME="hp_ux110"
207                         ;;
208                 hppa*-hp-hpux10*)
209                         AFS_SYSNAME="hp_ux102"
210                         ;;
211                 powerpc-apple-darwin1.2*)
212                         AFS_SYSNAME="ppc_darwin_12"
213                         DARWIN_PLIST=afs.${AFS_SYSNAME}.plist
214                         DARWIN_INFOFILE=afs.${AFS_SYSNAME}.plist
215                         ;;
216                 powerpc-apple-darwin1.3*)
217                         AFS_SYSNAME="ppc_darwin_13"
218                         DARWIN_PLIST=afs.${AFS_SYSNAME}.plist
219                         DARWIN_INFOFILE=afs.${AFS_SYSNAME}.plist
220                         ;;
221                 powerpc-apple-darwin1.4*)
222                         AFS_SYSNAME="ppc_darwin_14"
223                         DARWIN_PLIST=afs.${AFS_SYSNAME}.plist
224                         DARWIN_INFOFILE=afs.${AFS_SYSNAME}.plist
225                         ;;
226                 sparc-sun-solaris2.5*)
227                         AFS_SYSNAME="sun4x_55"
228                         ;;
229                 sparc-sun-solaris2.6)
230                         AFS_SYSNAME="sun4x_56"
231                         ;;
232                 sparc-sun-solaris2.7)
233                         AFS_SYSNAME="sun4x_57"
234                         ;;
235                 sparc-sun-solaris2.8)
236                         AFS_SYSNAME="sun4x_58"
237                         ;;
238                 alpha*-dec-osf4.0*)
239                         AFS_SYSNAME="alpha_dux40"
240                         ;;
241                 alpha*-dec-osf5.0*)
242                         AFS_SYSNAME="alpha_dux50"
243                         ;;
244                 mips-sgi-irix6.5)
245                         AFS_SYSNAME="sgi_65"
246                         ;;
247                 ia64-*-linux*)
248                         AFS_SYSNAME="ia64_linuxXX"
249                         ;;
250                 powerpc-*-linux*)
251                         AFS_SYSNAME="ppc_linuxXX"
252                         ;;
253                 alpha*-linux*)
254                         AFS_SYSNAME="alpha_linux_XX"
255                         ;;
256                 s390-*-linux*)
257                         AFS_SYSNAME="s390_linuxXX"
258                         ;;
259                 sparc-*-linux*)
260                         AFS_SYSNAME="sparc_linuxXX"
261                         ;;
262                 sparc64-*-linux*)
263                         AFS_SYSNAME="sparc64_linuxXX"
264                         ;;
265                 i?86-*-linux*)
266                         AFS_SYSNAME="i386_linuxXX"
267                         ;;
268                 power*-ibm-aix4.2*)
269                         AFS_SYSNAME="rs_aix42"
270                         ;;
271                 power*-ibm-aix4.3*)
272                         AFS_SYSNAME="rs_aix42"
273                         ;;
274                 *)
275                         AC_MSG_ERROR(An AFS sysname is required)
276                         exit 1
277                         ;;
278         esac
279         case $AFS_SYSNAME in
280                 *_linux*)
281                         AFS_SYSKVERS=`echo $LINUX_VERSION | awk -F\. '{print $1 $2}'`
282                         if test "x${AFS_SYSKVERS}" = "x"; then
283                          AC_MSG_ERROR(Couldn't guess your Linux version. Please use the --with-afs-sysname option to configure an AFS sysname.)
284                         fi
285                         _AFS_SYSNAME=`echo $AFS_SYSNAME|sed s/XX\$/$AFS_SYSKVERS/`
286                         AFS_SYSNAME="$_AFS_SYSNAME"
287                         ;;
288         esac
289         AC_MSG_RESULT($AFS_SYSNAME)
290 fi
291
292
293 if test "x${MKAFS_OSTYPE}" = "xIRIX"; then
294         echo Skipping library tests because they confuse Irix.
295 else
296   AC_CHECK_FUNCS(socket)
297
298   if test "$ac_cv_func_socket" = no; then
299     for lib in socket inet; do
300         if test "$HAVE_SOCKET" != 1; then
301                 AC_CHECK_LIB(${lib}, socket,LIBS="$LIBS -l$lib";HAVE_SOCKET=1;AC_DEFINE(HAVE_SOCKET))
302         fi
303     done
304   fi
305   
306   AC_CHECK_FUNCS(connect)       
307
308   if test "$ac_cv_func_connect" = no; then
309     for lib in nsl; do
310         if test "$HAVE_CONNECT" != 1; then
311                 AC_CHECK_LIB(${lib}, connect,LIBS="$LIBS -l$lib";HAVE_CONNECT=1;AC_DEFINE(HAVE_CONNECT))
312         fi
313     done
314   fi
315
316   AC_CHECK_FUNCS(gethostbyname)
317   if test "$ac_cv_func_gethostbyname" = no; then
318         for lib in dns nsl resolv; do
319           if test "$HAVE_GETHOSTBYNAME" != 1; then
320             AC_CHECK_LIB(${lib}, gethostbyname, LIBS="$LIBS -l$lib";HAVE_GETHOSTBYNAME=1;AC_DEFINE(HAVE_GETHOSTBYNAME))
321           fi
322         done    
323   fi    
324
325   AC_CHECK_FUNCS(res_search)
326   if test "$ac_cv_func_res_search" = no; then
327         for lib in dns nsl resolv; do
328           if test "$HAVE_RES_SEARCH" != 1; then
329             AC_CHECK_LIB(${lib}, res_search, LIBS="$LIBS -l$lib";HAVE_RES_SEARCH=1;AC_DEFINE(HAVE_RES_SEARCH))
330           fi
331         done    
332         if test "$HAVE_RES_SEARCH" = 1; then
333           LIB_res_search="-l$lib"       
334         fi
335   fi    
336 fi
337
338 PTHREAD_LIBS=error
339 AC_CHECK_LIB(pthread, pthread_attr_init,
340              PTHREAD_LIBS="-lpthread")
341 if test "x$PTHREAD_LIBS" = xerror; then
342         AC_CHECK_LIB(pthreads, pthread_attr_init,
343                 PTHREAD_LIBS="-lpthreads")
344 fi
345 if test "x$PTHREAD_LIBS" = xerror; then
346         AC_CHECK_LIB(c_r, pthread_attr_init,
347                 PTHREAD_LIBS="-lc_r")
348 fi
349 if test "x$PTHREAD_LIBS" = xerror; then
350         AC_CHECK_FUNC(pthread_attr_init, PTHREAD_LIBS="")
351 fi
352 if test "x$PTHREAD_LIBS" = xerror; then
353         AC_MSG_WARN(*** Unable to locate working posix thread library ***)
354 fi
355 AC_SUBST(PTHREAD_LIBS)
356
357 WITH_OBSOLETE=NO
358 if test "$enable_obsolete" = "yes"; then
359         WITH_OBSOLETE=YES
360 fi
361
362 WITH_INSECURE=NO
363 if test "$enable_insecure" = "yes"; then
364         WITH_INSECURE=YES
365 fi
366
367 # Fast restart
368 if test "$enable_fast_restart" = "yes"; then
369         AC_DEFINE(FAST_RESTART)
370 fi
371
372 if test "$enable_bitmap_later" = "yes"; then
373         AC_DEFINE(BITMAP_LATER)
374 fi
375
376 if test "$enable_full_vos_listvol_switch" = "yes"; then
377         AC_DEFINE(FULL_LISTVOL_SWITCH)
378 fi
379
380 if test "$enable_bos_restricted_mode" = "yes"; then
381         AC_DEFINE(BOS_RESTRICTED_MODE)
382 fi
383
384 if test "$enable_namei_fileserver" = "yes"; then
385         AC_DEFINE(AFS_NAMEI_ENV)
386 fi
387
388 if test "$enable_afsdb" = "yes"; then
389         LIB_AFSDB="$LIB_res_search"
390         AC_DEFINE(AFS_AFSDB_ENV)
391 fi
392
393 SRCDIR_PARENT=`pwd`
394 TOP_SRCDIR="${SRCDIR_PARENT}"
395 DESTDIR="${SRCDIR_PARENT}/${AFS_SYSNAME}/dest/"
396 TOP_INCDIR="${SRCDIR_PARENT}/include"
397 TOP_LIBDIR="${SRCDIR_PARENT}/lib"
398
399 dnl checks for header files.
400 AC_HEADER_STDC
401 AC_HEADER_SYS_WAIT
402 AC_HEADER_DIRENT
403 AC_CHECK_HEADERS(stdlib.h string.h unistd.h fcntl.h sys/time.h sys/file.h)
404 AC_CHECK_HEADERS(netinet/in.h netdb.h sys/fcntl.h sys/mnttab.h sys/mntent.h)
405 AC_CHECK_HEADERS(mntent.h sys/vfs.h sys/param.h sys/fs_types.h)
406 AC_CHECK_HEADERS(sys/mount.h strings.h termios.h signal.h)
407 AC_CHECK_HEADERS(windows.h malloc.h winsock2.h direct.h io.h)
408 AC_CHECK_HEADERS(security/pam_modules.h siad.h usersec.h)
409
410 AC_CHECK_FUNCS(utimes random srandom getdtablesize snprintf re_comp re_exec)
411
412 dnl Directory PATH handling
413 if test "x$enable_transarc_paths" = "xyes"  ; then 
414     afsconfdir=${afsconfdir=/usr/afs/etc}
415     viceetcdir=${viceetcdir=/usr/vice/etc}
416     afskerneldir=${afskerneldir=${viceetcdir}}
417     afssrvbindir=${afssrvbindir=/usr/afs/bin}
418     afssrvsbindir=${afssrvsbindir=/usr/afs/bin}
419     afssrvlibexecdir=${afssrvlibexecdir=/usr/afs/bin}
420     afsdbdir=${afsdbdir=/usr/afs/db}
421     afslogsdir=${afslogsdir=/usr/afs/logs}
422     afslocaldir=${afslocaldir=/usr/afs/local}
423     afsbackupdir=${afsbackupdir=/usr/afs/backup}
424     afsbosconfigdir=${afsbosconfigdir=/usr/afs/local}
425     else 
426     afsconfdir=${afsconfdir=$sysconfdir/openafs/server}
427     viceetcdir=${viceetcdir=$sysconfdir/openafs}
428     afskerneldir=${afskerneldir=$libdir/openafs}
429     afssrvbindir=${afssrvbindir=$bindir}
430     afssrvsbindir=${afssrvsbindir=$sbindir}
431     afssrvlibexecdir=${afssrvlibexecdir=$libexecdir/openafs}
432     afsdbdir=${afsdbdir=$localstatedir/openafs/db}
433     afslogsdir=${afslogsdir=$localstatedir/openafs/logs}
434     afslocaldir=${afslocaldir=$localstatedir/openafs}
435     afsbackupdir=${afsbackupdir=$localstatedir/openafs/backup}
436     afsbosconfigdir=${afsbosconfigdir=$sysconfdir/openafs}
437
438 fi
439 AC_SUBST(afsconfdir)
440 AC_SUBST(viceetcdir)
441 AC_SUBST(afskerneldir)
442 AC_SUBST(afssrvbindir)
443 AC_SUBST(afssrvsbindir)
444 AC_SUBST(afssrvlibexecdir)
445 AC_SUBST(afsdbdir)
446 AC_SUBST(afslogsdir)
447 AC_SUBST(afslocaldir)
448 AC_SUBST(afsbackupdir)
449 AC_SUBST(afsbosconfigdir)
450
451 if test "x$enable_kernel_module" = "xyes"; then
452 ENABLE_KERNEL_MODULE=libafs
453 fi
454
455 AC_SUBST(AFS_SYSNAME)
456 AC_SUBST(ENABLE_KERNEL_MODULE)
457 AC_SUBST(LIB_AFSDB)
458 AC_SUBST(LINUX_KERNEL_PATH)
459 AC_SUBST(LINUX_VERSION)
460 AC_SUBST(MKAFS_OSTYPE)
461 AC_SUBST(TOP_SRCDIR)
462 AC_SUBST(TOP_INCDIR)
463 AC_SUBST(TOP_LIBDIR)
464 AC_SUBST(DEST)
465 AC_SUBST(WITH_OBSOLETE)
466 AC_SUBST(WITH_INSECURE)
467 AC_SUBST(DARWIN_INFOFILE)
468
469 AC_OUTPUT(             \
470 Makefile               \
471 config/Makefile.${AFS_SYSNAME} \
472 )