fix-destdir-support-for-fsconv-and-xfs-binaries-20011001
[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         *-openbsd*)
193                 MKAFS_OSTYPE=OBSD
194                 AC_MSG_RESULT(i386_obsd)
195                 ;;
196         *)
197                 AC_MSG_RESULT($system)
198                 ;;
199 esac
200
201 if test "x$with_afs_sysname" != "x"; then
202         AFS_SYSNAME="$with_afs_sysname"
203 else
204         AC_MSG_CHECKING(your AFS sysname)
205         case $host in
206                 i?86-*-freebsd4.2*)
207                         AFS_SYSNAME="i386_fbsd_42"
208                         ;;
209                 hppa*-hp-hpux11*)
210                         AFS_SYSNAME="hp_ux110"
211                         ;;
212                 hppa*-hp-hpux10*)
213                         AFS_SYSNAME="hp_ux102"
214                         ;;
215                 powerpc-apple-darwin1.2*)
216                         AFS_SYSNAME="ppc_darwin_12"
217                         DARWIN_PLIST=afs.${AFS_SYSNAME}.plist
218                         DARWIN_INFOFILE=afs.${AFS_SYSNAME}.plist
219                         ;;
220                 powerpc-apple-darwin1.3*)
221                         AFS_SYSNAME="ppc_darwin_13"
222                         DARWIN_PLIST=afs.${AFS_SYSNAME}.plist
223                         DARWIN_INFOFILE=afs.${AFS_SYSNAME}.plist
224                         ;;
225                 powerpc-apple-darwin1.4*)
226                         AFS_SYSNAME="ppc_darwin_14"
227                         DARWIN_PLIST=afs.${AFS_SYSNAME}.plist
228                         DARWIN_INFOFILE=afs.${AFS_SYSNAME}.plist
229                         ;;
230                 sparc-sun-solaris2.5*)
231                         AFS_SYSNAME="sun4x_55"
232                         ;;
233                 sparc-sun-solaris2.6)
234                         AFS_SYSNAME="sun4x_56"
235                         ;;
236                 sparc-sun-solaris2.7)
237                         AFS_SYSNAME="sun4x_57"
238                         ;;
239                 sparc-sun-solaris2.8)
240                         AFS_SYSNAME="sun4x_58"
241                         ;;
242                 alpha*-dec-osf4.0*)
243                         AFS_SYSNAME="alpha_dux40"
244                         ;;
245                 alpha*-dec-osf5.0*)
246                         AFS_SYSNAME="alpha_dux50"
247                         ;;
248                 mips-sgi-irix6.5)
249                         AFS_SYSNAME="sgi_65"
250                         ;;
251                 ia64-*-linux*)
252                         AFS_SYSNAME="ia64_linuxXX"
253                         ;;
254                 powerpc-*-linux*)
255                         AFS_SYSNAME="ppc_linuxXX"
256                         ;;
257                 alpha*-linux*)
258                         AFS_SYSNAME="alpha_linux_XX"
259                         ;;
260                 s390-*-linux*)
261                         AFS_SYSNAME="s390_linuxXX"
262                         ;;
263                 sparc-*-linux*)
264                         AFS_SYSNAME="sparc_linuxXX"
265                         ;;
266                 sparc64-*-linux*)
267                         AFS_SYSNAME="sparc64_linuxXX"
268                         ;;
269                 i?86-*-linux*)
270                         AFS_SYSNAME="i386_linuxXX"
271                         ;;
272                 power*-ibm-aix4.2*)
273                         AFS_SYSNAME="rs_aix42"
274                         ;;
275                 power*-ibm-aix4.3*)
276                         AFS_SYSNAME="rs_aix42"
277                         ;;
278                 *)
279                         AC_MSG_ERROR(An AFS sysname is required)
280                         exit 1
281                         ;;
282         esac
283         case $AFS_SYSNAME in
284                 *_linux*)
285                         AFS_SYSKVERS=`echo $LINUX_VERSION | awk -F\. '{print $1 $2}'`
286                         if test "x${AFS_SYSKVERS}" = "x"; then
287                          AC_MSG_ERROR(Couldn't guess your Linux version. Please use the --with-afs-sysname option to configure an AFS sysname.)
288                         fi
289                         _AFS_SYSNAME=`echo $AFS_SYSNAME|sed s/XX\$/$AFS_SYSKVERS/`
290                         AFS_SYSNAME="$_AFS_SYSNAME"
291                         ;;
292         esac
293         AC_MSG_RESULT($AFS_SYSNAME)
294 fi
295
296
297 if test "x${MKAFS_OSTYPE}" = "xIRIX"; then
298         echo Skipping library tests because they confuse Irix.
299 else
300   AC_CHECK_FUNCS(socket)
301
302   if test "$ac_cv_func_socket" = no; then
303     for lib in socket inet; do
304         if test "$HAVE_SOCKET" != 1; then
305                 AC_CHECK_LIB(${lib}, socket,LIBS="$LIBS -l$lib";HAVE_SOCKET=1;AC_DEFINE(HAVE_SOCKET))
306         fi
307     done
308   fi
309   
310   AC_CHECK_FUNCS(connect)       
311
312   if test "$ac_cv_func_connect" = no; then
313     for lib in nsl; do
314         if test "$HAVE_CONNECT" != 1; then
315                 AC_CHECK_LIB(${lib}, connect,LIBS="$LIBS -l$lib";HAVE_CONNECT=1;AC_DEFINE(HAVE_CONNECT))
316         fi
317     done
318   fi
319
320   AC_CHECK_FUNCS(gethostbyname)
321   if test "$ac_cv_func_gethostbyname" = no; then
322         for lib in dns nsl resolv; do
323           if test "$HAVE_GETHOSTBYNAME" != 1; then
324             AC_CHECK_LIB(${lib}, gethostbyname, LIBS="$LIBS -l$lib";HAVE_GETHOSTBYNAME=1;AC_DEFINE(HAVE_GETHOSTBYNAME))
325           fi
326         done    
327   fi    
328
329   AC_CHECK_FUNCS(res_search)
330   if test "$ac_cv_func_res_search" = no; then
331         for lib in dns nsl resolv; do
332           if test "$HAVE_RES_SEARCH" != 1; then
333             AC_CHECK_LIB(${lib}, res_search, LIBS="$LIBS -l$lib";HAVE_RES_SEARCH=1;AC_DEFINE(HAVE_RES_SEARCH))
334           fi
335         done    
336         if test "$HAVE_RES_SEARCH" = 1; then
337           LIB_res_search="-l$lib"       
338         fi
339   fi    
340 fi
341
342 PTHREAD_LIBS=error
343 AC_CHECK_LIB(pthread, pthread_attr_init,
344              PTHREAD_LIBS="-lpthread")
345 if test "x$PTHREAD_LIBS" = xerror; then
346         AC_CHECK_LIB(pthreads, pthread_attr_init,
347                 PTHREAD_LIBS="-lpthreads")
348 fi
349 if test "x$PTHREAD_LIBS" = xerror; then
350         AC_CHECK_LIB(c_r, pthread_attr_init,
351                 PTHREAD_LIBS="-lc_r")
352 fi
353 if test "x$PTHREAD_LIBS" = xerror; then
354         AC_CHECK_FUNC(pthread_attr_init, PTHREAD_LIBS="")
355 fi
356 if test "x$PTHREAD_LIBS" = xerror; then
357         AC_MSG_WARN(*** Unable to locate working posix thread library ***)
358 fi
359 AC_SUBST(PTHREAD_LIBS)
360
361 WITH_OBSOLETE=NO
362 if test "$enable_obsolete" = "yes"; then
363         WITH_OBSOLETE=YES
364 fi
365
366 WITH_INSECURE=NO
367 if test "$enable_insecure" = "yes"; then
368         WITH_INSECURE=YES
369 fi
370
371 # Fast restart
372 if test "$enable_fast_restart" = "yes"; then
373         AC_DEFINE(FAST_RESTART)
374 fi
375
376 if test "$enable_bitmap_later" = "yes"; then
377         AC_DEFINE(BITMAP_LATER)
378 fi
379
380 if test "$enable_full_vos_listvol_switch" = "yes"; then
381         AC_DEFINE(FULL_LISTVOL_SWITCH)
382 fi
383
384 if test "$enable_bos_restricted_mode" = "yes"; then
385         AC_DEFINE(BOS_RESTRICTED_MODE)
386 fi
387
388 if test "$enable_namei_fileserver" = "yes"; then
389         AC_DEFINE(AFS_NAMEI_ENV)
390 fi
391
392 if test "$enable_afsdb" = "yes"; then
393         LIB_AFSDB="$LIB_res_search"
394         AC_DEFINE(AFS_AFSDB_ENV)
395 fi
396
397 SRCDIR_PARENT=`pwd`
398 TOP_SRCDIR="${SRCDIR_PARENT}"
399 DESTDIR="${SRCDIR_PARENT}/${AFS_SYSNAME}/dest/"
400 TOP_INCDIR="${SRCDIR_PARENT}/include"
401 TOP_LIBDIR="${SRCDIR_PARENT}/lib"
402
403 dnl checks for header files.
404 AC_HEADER_STDC
405 AC_HEADER_SYS_WAIT
406 AC_HEADER_DIRENT
407 AC_CHECK_HEADERS(stdlib.h string.h unistd.h fcntl.h sys/time.h sys/file.h)
408 AC_CHECK_HEADERS(netinet/in.h netdb.h sys/fcntl.h sys/mnttab.h sys/mntent.h)
409 AC_CHECK_HEADERS(mntent.h sys/vfs.h sys/param.h sys/fs_types.h)
410 AC_CHECK_HEADERS(sys/mount.h strings.h termios.h signal.h)
411 AC_CHECK_HEADERS(windows.h malloc.h winsock2.h direct.h io.h)
412 AC_CHECK_HEADERS(security/pam_modules.h siad.h usersec.h)
413
414 AC_CHECK_FUNCS(utimes random srandom getdtablesize snprintf re_comp re_exec)
415
416 dnl Directory PATH handling
417 if test "x$enable_transarc_paths" = "xyes"  ; then 
418     afsconfdir=${afsconfdir=/usr/afs/etc}
419     viceetcdir=${viceetcdir=/usr/vice/etc}
420     afskerneldir=${afskerneldir=${viceetcdir}}
421     afssrvbindir=${afssrvbindir=/usr/afs/bin}
422     afssrvsbindir=${afssrvsbindir=/usr/afs/bin}
423     afssrvlibexecdir=${afssrvlibexecdir=/usr/afs/bin}
424     afsdbdir=${afsdbdir=/usr/afs/db}
425     afslogsdir=${afslogsdir=/usr/afs/logs}
426     afslocaldir=${afslocaldir=/usr/afs/local}
427     afsbackupdir=${afsbackupdir=/usr/afs/backup}
428     afsbosconfigdir=${afsbosconfigdir=/usr/afs/local}
429     else 
430     afsconfdir=${afsconfdir=$sysconfdir/openafs/server}
431     viceetcdir=${viceetcdir=$sysconfdir/openafs}
432     afskerneldir=${afskerneldir=$libdir/openafs}
433     afssrvbindir=${afssrvbindir=$bindir}
434     afssrvsbindir=${afssrvsbindir=$sbindir}
435     afssrvlibexecdir=${afssrvlibexecdir=$libexecdir/openafs}
436     afsdbdir=${afsdbdir=$localstatedir/openafs/db}
437     afslogsdir=${afslogsdir=$localstatedir/openafs/logs}
438     afslocaldir=${afslocaldir=$localstatedir/openafs}
439     afsbackupdir=${afsbackupdir=$localstatedir/openafs/backup}
440     afsbosconfigdir=${afsbosconfigdir=$sysconfdir/openafs}
441
442 fi
443 AC_SUBST(afsconfdir)
444 AC_SUBST(viceetcdir)
445 AC_SUBST(afskerneldir)
446 AC_SUBST(afssrvbindir)
447 AC_SUBST(afssrvsbindir)
448 AC_SUBST(afssrvlibexecdir)
449 AC_SUBST(afsdbdir)
450 AC_SUBST(afslogsdir)
451 AC_SUBST(afslocaldir)
452 AC_SUBST(afsbackupdir)
453 AC_SUBST(afsbosconfigdir)
454
455 if test "x$enable_kernel_module" = "xyes"; then
456 ENABLE_KERNEL_MODULE=libafs
457 fi
458
459 AC_SUBST(AFS_SYSNAME)
460 AC_SUBST(ENABLE_KERNEL_MODULE)
461 AC_SUBST(LIB_AFSDB)
462 AC_SUBST(LINUX_KERNEL_PATH)
463 AC_SUBST(LINUX_VERSION)
464 AC_SUBST(MKAFS_OSTYPE)
465 AC_SUBST(TOP_SRCDIR)
466 AC_SUBST(TOP_INCDIR)
467 AC_SUBST(TOP_LIBDIR)
468 AC_SUBST(DEST)
469 AC_SUBST(WITH_OBSOLETE)
470 AC_SUBST(WITH_INSECURE)
471 AC_SUBST(DARWIN_INFOFILE)
472
473 AC_OUTPUT(             \
474 Makefile               \
475 config/Makefile.${AFS_SYSNAME} \
476 )