Introduce TAP tests of man pages for command_subcommand
[openafs.git] / acinclude.m4
1 dnl This file contains the common configuration code which would
2 dnl otherwise be duplicated between configure and configure-libafs.
3 dnl
4 dnl NB: Because this code is a macro, references to positional shell
5 dnl parameters must be done like $[]1 instead of $1
6
7 AC_DEFUN([OPENAFS_CONFIGURE_COMMON],[
8 AH_BOTTOM([
9 #undef HAVE_RES_SEARCH
10 #undef STRUCT_SOCKADDR_HAS_SA_LEN
11 #if !defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)
12 # if ENDIANESS_IN_SYS_PARAM_H
13 #  ifndef KERNEL
14 #   include <sys/types.h>
15 #   include <sys/param.h>
16 #   if BYTE_ORDER == BIG_ENDIAN
17 #   define WORDS_BIGENDIAN 1
18 #   endif
19 #  else
20 #   if defined(AUTOCONF_FOUND_BIGENDIAN)
21 #    define WORDS_BIGENDIAN 1
22 #   else
23 #    undef WORDS_BIGENDIAN
24 #   endif
25 #  endif
26 # else
27 #  if defined(AUTOCONF_FOUND_BIGENDIAN)
28 #   define WORDS_BIGENDIAN 1
29 #  else
30 #   undef WORDS_BIGENDIAN
31 #  endif
32 # endif
33 #else
34 # if defined(__BIG_ENDIAN__)
35 #  define WORDS_BIGENDIAN 1
36 # else
37 #  undef WORDS_BIGENDIAN
38 # endif
39 #endif
40 #ifdef UKERNEL
41 /*
42  * Always use 64-bit file offsets for UKERNEL code. Needed for UKERNEL stuff to
43  * play nice with some other interfaces like FUSE. We technically only would
44  * need to define this when building for such interfaces, but set it always to
45  * try and reduce potential confusion. 
46  */
47 #define _FILE_OFFSET_BITS 64
48 #define AFS_CACHE_VNODE_PATH
49 #endif
50
51 #undef AFS_NAMEI_ENV
52 #undef BITMAP_LATER
53 #undef FAST_RESTART
54 #undef DEFINED_FOR_EACH_PROCESS
55 #undef DEFINED_PREV_TASK
56 #undef EXPORTED_SYS_CALL_TABLE
57 #undef EXPORTED_IA32_SYS_CALL_TABLE
58 #undef IRIX_HAS_MEM_FUNCS
59 #undef RECALC_SIGPENDING_TAKES_VOID
60 #undef STRUCT_FS_HAS_FS_ROLLED
61 #undef ssize_t
62 /* glue for RedHat kernel bug */
63 #undef ENABLE_REDHAT_BUILDSYS
64 #if defined(ENABLE_REDHAT_BUILDSYS) && defined(KERNEL) && defined(REDHAT_FIX)
65 #include "redhat-fix.h"
66 #endif])
67
68 AC_CANONICAL_HOST
69 SRCDIR_PARENT=`pwd`
70
71 #BOZO_SAVE_CORES pam
72
73 dnl System identity.
74 AC_ARG_WITH([afs-sysname],
75     [AS_HELP_STRING([--with-afs-sysname=sys], [use sys for the afs sysname])])
76
77 dnl General feature options.
78 AC_ARG_ENABLE([pam],
79     [AS_HELP_STRING([--disable-pam], [disable PAM support])],
80     ,
81     [enable_pam="yes"])
82 AC_ARG_ENABLE([namei-fileserver],
83     [AS_HELP_STRING([--enable-namei-fileserver],
84         [force compilation of namei fileserver in preference to inode
85          fileserver])],
86     , 
87     [enable_namei_fileserver="default"])
88 AC_ARG_ENABLE([supergroups],
89     [AS_HELP_STRING([--enable-supergroups],
90         [enable support for nested pts groups])],
91     , 
92     [enable_supergroups="no"])
93 AC_ARG_ENABLE([bitmap-later],
94     [AS_HELP_STRING([--enable-bitmap-later],
95         [enable fast startup of file server by not reading bitmap till
96          needed])],
97     , 
98     [enable_bitmap_later="no"])
99 AC_ARG_ENABLE([unix-sockets],
100     [AS_HELP_STRING([--disable-unix-sockets],
101         [disable use of unix domain sockets for fssync (defaults to enabled)])],
102     ,
103     [enable_unix_sockets="yes"])
104 AC_ARG_ENABLE([tivoli-tsm],
105     [AS_HELP_STRING([--enable-tivoli-tsm],
106         [enable use of the Tivoli TSM API libraries for butc support])],
107     , 
108     [enable_tivoli_tsm="no"])
109 AC_ARG_ENABLE([pthreaded-ubik],
110     [AS_HELP_STRING([--enable-pthreaded-ubik],
111         [enable installation of pthreaded ubik applications (defaults to
112          disabled)])],
113     ,
114     [enable_pthreaded_ubik="no"])
115
116 dnl Kernel module build options.
117 AC_ARG_WITH([linux-kernel-headers],
118     [AS_HELP_STRING([--with-linux-kernel-headers=path],
119         [use the kernel headers found at path (optional, defaults to
120          /usr/src/linux-2.4, then /usr/src/linux)])])
121 AC_ARG_WITH([linux-kernel-build],
122     [AS_HELP_STRING([--with-linux-kernel-build=path],
123         [use the kernel build found at path(optional, defaults to 
124         /usr/src/linux-2.4, then /usr/src/linux)])])
125 AC_ARG_WITH([bsd-kernel-headers],
126     [AS_HELP_STRING([--with-bsd-kernel-headers=path],
127         [use the kernel headers found at path (optional, defaults to
128          /usr/src/sys)])])
129 AC_ARG_WITH([bsd-kernel-build],
130     [AS_HELP_STRING([--with-bsd-kernel-build=path], 
131         [use the kernel build found at path (optional, defaults to
132          KSRC/i386/compile/GENERIC)])])
133 AC_ARG_WITH([linux-kernel-packaging],
134     [AS_HELP_STRING([--with-linux-kernel-packaging],
135         [use standard naming conventions to aid Linux kernel build packaging
136          (disables MPS, sets the kernel module name to openafs.ko, and
137          installs kernel modules into the standard Linux location)])],
138     [AC_SUBST(LINUX_KERNEL_PACKAGING, "yes")
139      AC_SUBST(LINUX_LIBAFS_NAME, "openafs")],
140     [AC_SUBST(LINUX_LIBAFS_NAME, "libafs")])
141 AC_ARG_ENABLE([kernel-module],
142     [AS_HELP_STRING([--disable-kernel-module],
143         [disable compilation of the kernel module (defaults to enabled)])],
144     , 
145     [enable_kernel_module="yes"])
146 AC_ARG_ENABLE([redhat-buildsys],
147     [AS_HELP_STRING([--enable-redhat-buildsys],
148         [enable compilation of the redhat build system kernel (defaults to
149          disabled)])],
150     ,
151     [enable_redhat_buildsys="no"])
152
153 dnl Installation locations.
154 AC_ARG_ENABLE([transarc-paths],
155     [AS_HELP_STRING([--enable-transarc-paths],
156         [use Transarc style paths like /usr/afs and /usr/vice])],
157     , 
158     [enable_transarc_paths="no"])
159
160 dnl Optimization and debugging flags.
161 AC_ARG_ENABLE([strip-binaries],
162     [AS_HELP_STRING([--disable-strip-binaries],
163         [disable stripping of symbol information from binaries (defaults to
164          enabled)])],
165     ,
166     [enable_strip_binaries="maybe"])
167 AC_ARG_ENABLE([debug],
168     [AS_HELP_STRING([--enable-debug],
169         [enable compilation of the user space code with debugging information
170          (defaults to disabled)])],
171     , 
172     [enable_debug="no"])
173 AC_ARG_ENABLE([optimize],
174     [AS_HELP_STRING([--disable-optimize],
175         [disable optimization for compilation of the user space code (defaults
176          to enabled)])],
177     , 
178     [enable_optimize="yes"])
179 AC_ARG_ENABLE([warnings],
180     [AS_HELP_STRING([--enable-warnings],
181         [enable compilation warnings when building with gcc (defaults to
182          disabled)])],
183     ,
184     [enable_warnings="no"])
185 AC_ARG_ENABLE([checking],
186     [AS_HELP_STRING([--enable-checking],
187         [turn compilation warnings into errors when building with gcc (defaults
188          to disabled)])],
189     [enable_checking="$enableval"],
190     [enable_checking="no"])
191 AC_ARG_ENABLE([debug-kernel],
192     [AS_HELP_STRING([--enable-debug-kernel],
193         [enable compilation of the kernel module with debugging information
194          (defaults to disabled)])],
195     ,
196     [enable_debug_kernel="no"])
197 AC_ARG_ENABLE([optimize-kernel],
198     [AS_HELP_STRING([--disable-optimize-kernel],
199         [disable compilation of the kernel module with optimization (defaults
200          based on platform)])],
201     , 
202     [enable_optimize_kernel="yes"])
203 AC_ARG_ENABLE([debug-lwp],
204     [AS_HELP_STRING([--enable-debug-lwp],
205         [enable compilation of the LWP code with debugging information
206          (defaults to disabled)])],
207     ,
208     [enable_debug_lwp="no"])
209 AC_ARG_ENABLE([optimize-lwp],
210     [AS_HELP_STRING([--disable-optimize-lwp],
211         [disable optimization for compilation of the LWP code (defaults to
212          enabled)])],
213     ,
214     [enable_optimize_lwp="yes"])
215 AC_ARG_ENABLE([debug-pam],
216     [AS_HELP_STRING([--enable-debug-pam],
217         [enable compilation of the PAM code with debugging information
218          (defaults to disabled)])],
219     ,
220     [enable_debug_pam="no"])
221 AC_ARG_ENABLE([optimize-pam],
222     [AS_HELP_STRING([--disable-optimize-pam],
223         [disable optimization for compilation of the PAM code (defaults to
224          enabled)])],
225     ,
226     [enable_optimize_pam="yes"])
227 AC_ARG_ENABLE([linux-syscall-probing],
228     [AS_HELP_STRING([--enable-linux-syscall-probing],
229         [enable Linux syscall probing (defaults to autodetect)])],
230     ,
231     [enable_linux_syscall_probing="maybe"])
232     
233 AC_ARG_WITH([xslt-processor],
234         AS_HELP_STRING([--with-xslt-processor=ARG],
235         [which XSLT processor to use (possible choices are: libxslt, saxon, xalan-j, xsltproc)]),
236         [XSLTPROC="$withval"],
237         AC_CHECK_PROGS([XSLTPROC], [libxslt saxon xalan-j xsltproc], [echo]))
238
239 AC_ARG_WITH([html-xsl], 
240         AS_HELP_STRING([--with-html-xsl],
241         [build HTML documentation using this stylesheet (default is html/chunk.dsl; specify either html/chunk.xsl or html/docbook.xsl)]),
242         [HTML_XSL="$withval"],
243         [HTML_XSL="html/chunk.xsl"])
244
245 AC_ARG_WITH([docbook2pdf],
246         AS_HELP_STRING([--with-docbook2pdf=ARG],
247         [which Docbook to PDF utility to use (possible choices are: fop, docbook2pdf, dblatex)]),
248         [DOCBOOK2PDF="$withval"],
249         AC_CHECK_PROGS([DOCBOOK2PDF], [fop docbook2pdf dblatex], [echo]))
250
251 AC_ARG_WITH([docbook-stylesheets],
252         AS_HELP_STRING([--with-docbook-stylesheets=ARG],
253         [location of DocBook stylesheets (default is to search a set of likely paths)]),
254         [DOCBOOK_STYLESHEETS="$withval"],
255         OPENAFS_SEARCH_DIRLIST([DOCBOOK_STYLESHEETS], [/usr/share/xml/docbook/stylesheet/nwalsh/current /usr/share/xml/docbook/stylesheet/nwalsh /usr/share/xml/docbook/xsl-stylesheets /usr/share/sgml/docbook/docbook-xsl-stylesheets /usr/share/sgml/docbook/xsl-stylesheets /usr/share/docbook-xsl /usr/share/sgml/docbkxsl /usr/local/share/xsl/docbook /sw/share/xml/xsl/docbook-xsl /opt/local/share/xsl/docbook-xsl], [$HTML_XSL])
256         if test "x$DOCBOOK_STYLESHEETS" == "x"; then
257                 AC_WARN([Docbook stylesheets not found; some documentation can't be built])
258         fi)
259
260 enable_login="no"
261
262 dnl weird ass systems
263 dnl AC_AIX
264 AC_ISC_POSIX
265 dnl AC_MINIX
266
267 dnl Various compiler setup.
268 AC_TYPE_PID_T
269 AC_TYPE_SIZE_T
270
271 dnl Checks for programs.
272 AC_PROG_INSTALL
273 AC_PROG_LN_S
274 AC_PROG_RANLIB
275 AC_PROG_YACC
276 AM_PROG_LEX
277 dnl if we are flex, be lex-compatible
278 OPENAFS_LEX_IS_FLEX([AC_SUBST([LEX], ["$LEX -l"])])
279
280 OPENAFS_FORCE_ABS_INSTALL
281 OPENAFS_CHECK_BIGENDIAN
282 OPENAFS_PRINTF_TAKES_Z_LEN
283
284 AC_MSG_CHECKING(your OS)
285 system=$host
286 case $system in
287         *-linux*)
288
289                 MKAFS_OSTYPE=LINUX
290                 if test "x$enable_redhat_buildsys" = "xyes"; then
291                  AC_DEFINE(ENABLE_REDHAT_BUILDSYS, 1, [define if you have redhat buildsystem])
292                 fi
293                 if test "x$enable_kernel_module" = "xyes"; then
294                  if test "x$with_linux_kernel_headers" != "x"; then
295                    LINUX_KERNEL_PATH="$with_linux_kernel_headers"
296                  else
297                    LINUX_KERNEL_PATH="/lib/modules/`uname -r`/source"
298                    if test ! -f "$LINUX_KERNEL_PATH/include/linux/version.h"; then
299                      LINUX_KERNEL_PATH="/lib/modules/`uname -r`/build"
300                    fi
301                    if test ! -f "$LINUX_KERNEL_PATH/include/linux/version.h"; then
302                      LINUX_KERNEL_PATH="/usr/src/linux-2.4"
303                    fi
304                    if test ! -f "$LINUX_KERNEL_PATH/include/linux/version.h"; then
305                      LINUX_KERNEL_PATH="/usr/src/linux"
306                    fi
307                  fi
308                  if test "x$with_linux_kernel_build" != "x"; then
309                          LINUX_KERNEL_BUILD="$with_linux_kernel_build"
310                  else
311                    LINUX_KERNEL_BUILD=$LINUX_KERNEL_PATH
312                  fi
313                  if test -f "$LINUX_KERNEL_BUILD/include/generated/utsrelease.h"; then
314                    linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_BUILD/include/generated/utsrelease.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -n 1`
315                    LINUX_VERSION="$linux_kvers"
316                  else
317                    if test -f "$LINUX_KERNEL_BUILD/include/linux/utsrelease.h"; then
318                      linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_BUILD/include/linux/utsrelease.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -n 1`
319                      LINUX_VERSION="$linux_kvers"
320                    else
321                      if test -f "$LINUX_KERNEL_BUILD/include/linux/version.h"; then
322                        linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_BUILD/include/linux/version.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -n 1`
323                        if test "x$linux_kvers" = "x"; then
324                          if test -f "$LINUX_KERNEL_BUILD/include/linux/version-up.h"; then
325                            linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_BUILD/include/linux/version-up.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -n 1`
326                            if test "x$linux_kvers" = "x"; then
327                              AC_MSG_ERROR(Linux headers lack version definition [2])
328                              exit 1
329                            else
330                              LINUX_VERSION="$linux_kvers"
331                            fi
332                          else
333                            AC_MSG_ERROR(Linux headers lack version definition)
334                            exit 1
335                          fi
336                        else
337                          LINUX_VERSION="$linux_kvers"
338                        fi
339                      else
340                        enable_kernel_module="no"
341                      fi
342                    fi
343                  fi
344                  if test ! -f "$LINUX_KERNEL_BUILD/include/generated/autoconf.h" &&
345                     test ! -f "$LINUX_KERNEL_BUILD/include/linux/autoconf.h"; then
346                      enable_kernel_module="no"
347                  fi
348                  if test "x$enable_kernel_module" = "xno"; then
349                   if test "x$with_linux_kernel_headers" != "x"; then
350                    AC_MSG_ERROR(No usable linux headers found at $LINUX_KERNEL_PATH)
351                    exit 1
352                   else
353                    AC_MSG_WARN(No usable linux headers found at $LINUX_KERNEL_PATH so disabling kernel module)
354                   fi
355                  fi
356                  dnl do we need to determine SUBARCH from autoconf.h
357                  SUBARCH=default
358                 fi
359                 AC_MSG_RESULT(linux)
360                 if test "x$enable_kernel_module" = "xyes"; then
361                  AFS_SYSKVERS=`echo $LINUX_VERSION | awk -F\. '{print $[]1 $[]2}'`
362                  if test "x${AFS_SYSKVERS}" = "x"; then
363                   AC_MSG_ERROR(Couldn't guess your Linux version [2])
364                  fi
365                 fi
366                 ;;
367         *-solaris*)
368                 MKAFS_OSTYPE=SOLARIS
369                 AC_MSG_RESULT(sun4)
370                 AC_PATH_PROG(SOLARISCC, [cc], ,
371                     [/opt/SUNWspro/bin:/opt/SunStudioExpress/bin])
372                 SOLARIS_UFSVFS_HAS_DQRWLOCK
373                 SOLARIS_FS_HAS_FS_ROLLED
374                 SOLARIS_SOLOOKUP_TAKES_SOCKPARAMS
375                 ;;
376         *-sunos*)
377                 MKAFS_OSTYPE=SUNOS
378                 enable_kernel_module=no
379                 AC_MSG_RESULT(sun4)
380                 ;;
381         *-hpux*)
382                 MKAFS_OSTYPE=HPUX
383                 AC_MSG_RESULT(hp_ux)
384                 if test -f "/usr/old/usr/include/ndir.h"; then
385                  AC_DEFINE(HAVE_USR_OLD_USR_INCLUDE_NDIR_H, 1, [define if you have old ndir.h])
386                 fi
387                 ;;
388         *-irix*)
389                 if test -d /usr/include/sys/SN/SN1; then
390                  IRIX_BUILD_IP35="IP35"
391                 fi
392                 MKAFS_OSTYPE=IRIX
393                 AC_MSG_RESULT(sgi)
394                 ;;
395         *-aix*)
396                 MKAFS_OSTYPE=AIX
397                 AC_MSG_RESULT(rs_aix)
398                 ;;
399         arm-*-darwin*)
400                 MKAFS_OSTYPE=DARWIN
401                 AC_MSG_RESULT(arm_darwin)
402                 ;;
403         powerpc-*-darwin*)
404                 MKAFS_OSTYPE=DARWIN
405                 AC_MSG_RESULT(ppc_darwin)
406                 ;;
407         i386-*-darwin*)
408                 MKAFS_OSTYPE=DARWIN
409                 AC_MSG_RESULT(x86_darwin)
410                 ;;
411         x86_64-*-darwin*)
412                 MKAFS_OSTYPE=DARWIN
413                 AC_MSG_RESULT(x86_darwin)
414                 ;;
415         i386-*-freebsd*)
416                 MKAFS_OSTYPE=FBSD
417                 AC_MSG_RESULT(i386_fbsd)
418                 ;;
419         x86_64-*-freebsd*)
420                 MKAFS_OSTYPE=FBSD
421                 AC_MSG_RESULT(amd64_fbsd)
422                 ;;
423         *-netbsd*)
424                 MKAFS_OSTYPE=NBSD
425                 AC_MSG_RESULT(nbsd)
426                 ;;
427         x86_64-*-openbsd*)
428                 MKAFS_OSTYPE=OBSD
429                 AC_MSG_RESULT(amd64_obsd)
430                 ;;
431         i386-*-openbsd*)
432                 MKAFS_OSTYPE=OBSD
433                 AC_MSG_RESULT(i386_obsd)
434                 ;;
435         *-dragonfly*)
436                 MKAFS_OSTYPE=DFBSD
437                 AC_MSG_RESULT(i386_dfbsd)
438                 ;;
439         *)
440                 AC_MSG_RESULT($system)
441                 ;;
442 esac
443
444 if test "x$with_afs_sysname" != "x"; then
445         AFS_SYSNAME="$with_afs_sysname"
446 else
447         AC_MSG_CHECKING(your AFS sysname)
448         case $host in
449                 i?86-*-openbsd?.?)
450                         v=${host#*openbsd}
451                         vM=${v%.*}
452                         vm=${v#*.}
453                         AFS_SYSNAME="i386_obsd${vM}${vm}"
454                         ;;
455                 sparc64-*-openbsd?.?)
456                         v=${host#*openbsd}
457                         vM=${v%.*}
458                         vm=${v#*.}
459                         AFS_SYSNAME="sparc64_obsd${vM}${vm}"
460                         ;;
461                 x86_64-*-openbsd?.?)
462                         v=${host#*openbsd}
463                         vM=${v%.*}
464                         vm=${v#*.}
465                         AFS_SYSNAME="amd64_obsd${vM}${vm}"
466                         ;;
467                 i?86-*-freebsd?.*)
468                         v=${host#*freebsd}
469                         vM=${v%.*}
470                         vm=${v#*.}
471                         AFS_SYSNAME="i386_fbsd_${vM}${vm}"
472                         ;;
473                 x86_64-*-freebsd?.*)
474                         v=${host#*freebsd}
475                         vM=${v%.*}
476                         vm=${v#*.}
477                         AFS_SYSNAME="amd64_fbsd_${vM}${vm}"
478                         ;;
479                 i386-*-dragonfly?.*)
480                         v=${host#*dragonfly}
481                         vM=${v%.*}
482                         vm=${v#*.}
483                         AFS_SYSNAME="i386_dfbsd_${vM}${vm}"
484                         ;;
485                 i?86-*-netbsd*1.6[[M-Z]]*)
486                         AFS_SYSNAME="i386_nbsd20"
487                         ;;
488                 powerpc-*-netbsd*1.6[[M-Z]]*)
489                         AFS_SYSNAME="ppc_nbsd20"
490                         ;;
491                 *-*-netbsd*)
492                         arch=${host%%-unknown*}
493                         arch=$(echo $arch |sed -e 's/x86_64/amd64/g' \
494                                                -e 's/powerpc/ppc/g')
495                         v=${host#*netbsd}
496                         v=${v#*aout}
497                         v=${v#*ecoff}
498                         v=${v#*elf}
499                         vM=${v%%.*}
500                         vM=${vM%.*}
501                         v=${v#*.}
502                         vm=${v%%.*}
503                         vm=${vm%.*}
504                         vm=${vm%%[[_A-Z]]*}
505                         if test $vm -eq 99 ; then
506                                 vM=$((vM+1))
507                         fi
508                         if test $vM -gt 1 ; then
509                                 vm=0
510                         fi
511                         AFS_SYSNAME="${arch}_nbsd${vM}${vm}"
512                         ;;
513                 hppa*-hp-hpux11.0*)
514                         AFS_SYSNAME="hp_ux110"
515                         ;;
516                 hppa*-hp-hpux11.11)
517                         AFS_SYSNAME="hp_ux11i"
518                         ;;
519                 hppa*-hp-hpux11.23)
520                         AFS_SYSNAME="hp_ux1123"
521                         ;;
522                 ia64-hp-hpux11.22)
523                         AFS_SYSNAME="ia64_hpux1122"
524                         ;;
525                 ia64-hp-hpux*)
526                         AFS_SYSNAME="ia64_hpux1123"
527                         ;;
528                 hppa*-hp-hpux10*)
529                         AFS_SYSNAME="hp_ux102"
530                         ;;
531                 powerpc-apple-darwin7*)
532                         AFS_SYSNAME="ppc_darwin_70"
533                         OSXSDK="macosx10.3"
534                         ;;
535                 powerpc-apple-darwin8.*)
536                         AFS_SYSNAME="ppc_darwin_80"
537                         OSXSDK="macosx10.4"
538                         ;;
539                 i386-apple-darwin8.*)
540                         AFS_SYSNAME="x86_darwin_80"
541                         OSXSDK="macosx10.4"
542                         ;;
543                 powerpc-apple-darwin9.*)
544                         AFS_SYSNAME="ppc_darwin_90"
545                         OSXSDK="macosx10.5"
546                         ;;
547                 i386-apple-darwin9.*)
548                         AFS_SYSNAME="x86_darwin_90"
549                         OSXSDK="macosx10.5"
550                         ;;
551                 i?86-apple-darwin10.*)
552                         AFS_SYSNAME="x86_darwin_100"
553                         OSXSDK="macosx10.6"
554                         ;;
555                 x86_64-apple-darwin10.*)
556                         AFS_SYSNAME="x86_darwin_100"
557                         OSXSDK="macosx10.6"
558                         ;;
559                 arm-apple-darwin10.*)
560                         AFS_SYSNAME="arm_darwin_100"
561                         OSXSDK="iphoneos4.0"
562                         ;;
563                 x86_64-apple-darwin11.*)
564                         AFS_SYSNAME="x86_darwin_110"
565                         OSXSDK="macosx10.7"
566                         ;;
567                 i?86-apple-darwin11.*)
568                         AFS_SYSNAME="x86_darwin_110"
569                         OSXSDK="macosx10.7"
570                         ;;
571                 sparc-sun-solaris2.5*)
572                         AFS_SYSNAME="sun4x_55"
573                         enable_login="yes"
574                         ;;
575                 sparc-sun-solaris2.6)
576                         AFS_SYSNAME="sun4x_56"
577                         ;;
578                 sparc-sun-solaris2.7)
579                         AFS_SYSNAME="sun4x_57"
580                         ;;
581                 sparc-sun-solaris2.8)
582                         AFS_SYSNAME="sun4x_58"
583                         ;;
584                 sparc-sun-solaris2.9)
585                         AFS_SYSNAME="sun4x_59"
586                         ;;
587                 sparc-sun-solaris2.10)
588                         AFS_SYSNAME="sun4x_510"
589                         ;;
590                 sparc-sun-solaris2.11)
591                         AFS_SYSNAME="sun4x_511"
592                         ;;
593                 sparc-sun-sunos4*)
594                         AFS_SYSNAME="sun4_413"
595                         enable_login="yes"
596                         ;;
597                 i386-pc-solaris2.7)
598                         AFS_SYSNAME="sunx86_57"
599                         ;;
600                 i386-pc-solaris2.8)
601                         AFS_SYSNAME="sunx86_58"
602                         ;;
603                 i386-pc-solaris2.9)
604                         AFS_SYSNAME="sunx86_59"
605                         ;;
606                 i386-pc-solaris2.10)
607                         AFS_SYSNAME="sunx86_510"
608                         ;;
609                 i386-pc-solaris2.11)
610                         AFS_SYSNAME="sunx86_511"
611                         ;;
612                 alpha*-dec-osf4.0*)
613                         AFS_SYSNAME="alpha_dux40"
614                         ;;
615                 alpha*-dec-osf5.0*)
616                         AFS_SYSNAME="alpha_dux50"
617                         ;;
618                 alpha*-dec-osf5.1*)
619                         AFS_SYSNAME="alpha_dux51"
620                         ;;
621                 mips-sgi-irix6.5)
622                         AFS_SYSNAME="sgi_65"
623                         ;;
624                 ia64-*-linux*)
625                         AFS_SYSNAME="ia64_linuxXX"
626                         ;;
627                 powerpc-*-linux*)
628                         AFS_SYSNAME="`/bin/arch`_linuxXX"
629                         ;;
630                 powerpc64-*-linux*)
631                         AFS_SYSNAME="ppc64_linuxXX"
632                         ;;
633                 alpha*-linux*)
634                         AFS_SYSNAME="alpha_linux_XX"
635                         ;;
636                 s390-*-linux*)
637                         AFS_SYSNAME="s390_linuxXX"
638                         ;;
639                 s390x-*-linux*)
640                         AFS_SYSNAME="s390x_linuxXX"
641                         ;;
642                 sparc-*-linux*)
643                         AFS_SYSNAME="`/bin/arch`_linuxXX"
644                         ;;
645                 sparc64-*-linux*)
646                         AFS_SYSNAME="sparc64_linuxXX"
647                         ;;
648                 i?86-*-linux*)
649                         AFS_SYSNAME="i386_linuxXX"
650                         ;;
651                 arm*-linux*)
652                         AFS_SYSNAME="arm_linuxXX"
653                         ;;
654                 parisc-*-linux-gnu|hppa-*-linux-gnu)
655                         AFS_SYSNAME="parisc_linuxXX"
656                         enable_pam="no"
657                         ;;
658                 power*-ibm-aix4.2*)
659                         AFS_SYSNAME="rs_aix42"
660                         enable_pam="no"
661                         ;;
662                 power*-ibm-aix4.3*)
663                         AFS_SYSNAME="rs_aix42"
664                         enable_pam="no"
665                         ;;
666                 power*-ibm-aix5.1*)
667                         AFS_SYSNAME="rs_aix51"
668                         enable_pam="no"
669                         ;;
670                 power*-ibm-aix5.2*)
671                         AFS_SYSNAME="rs_aix52"
672                         enable_pam="no"
673                         ;;
674                 power*-ibm-aix5.3*)
675                         AFS_SYSNAME="rs_aix53"
676                         enable_pam="no"
677                         ;;
678                 power*-ibm-aix6.1*)
679                         AFS_SYSNAME="rs_aix61"
680                         enable_pam="no"
681                         ;;
682                 x86_64-*-linux-gnu)
683                         AFS_SYSNAME="amd64_linuxXX"
684                         enable_pam="yes"
685                         ;;
686                 *)
687                         AC_MSG_ERROR(An AFS sysname is required)
688                         exit 1
689                         ;;
690         esac
691         case $AFS_SYSNAME in
692                 *_linux* | *_umlinux*)
693                         if test "x${AFS_SYSKVERS}" = "x"; then
694                          AC_MSG_ERROR(Couldn't guess your Linux version. Please use the --with-afs-sysname option to configure an AFS sysname.)
695                         fi
696                         _AFS_SYSNAME=`echo $AFS_SYSNAME|sed s/XX\$/$AFS_SYSKVERS/`
697                         AFS_SYSNAME="$_AFS_SYSNAME"
698                         AC_TRY_KBUILD(
699                          [],
700                          [#ifndef CONFIG_USERMODE
701                           #error not UML
702                           #endif],
703                          ac_cv_linux_is_uml=yes,)
704                         if test "${ac_cv_linux_is_uml}" = yes; then
705                          _AFS_SYSNAME=`echo $AFS_SYSNAME|sed s/linux/umlinux/`
706                         fi
707                         AFS_SYSNAME="$_AFS_SYSNAME"
708                         ;;
709         esac
710         AC_MSG_RESULT($AFS_SYSNAME)
711 fi
712
713 case $AFS_SYSNAME in
714         *_darwin*)
715                 AC_CHECK_HEADERS(crt_externs.h)
716                 DARWIN_PLIST=src/libafs/afs.${AFS_SYSNAME}.plist
717                 DARWIN_INFOFILE=afs.${AFS_SYSNAME}.plist
718                 AC_SUBST(OSXSDK)
719                 ;;
720 esac
721
722 dnl Some hosts have a separate common param file they should include.  Figure
723 dnl out if we're on one of them now that we know the sysname.
724 case $AFS_SYSNAME in
725     *_nbsd15)   AFS_PARAM_COMMON=param.nbsd15.h  ;;
726     *_nbsd16)   AFS_PARAM_COMMON=param.nbsd16.h  ;;
727     *_nbsd20)   AFS_PARAM_COMMON=param.nbsd20.h  ;;
728     *_nbsd21)   AFS_PARAM_COMMON=param.nbsd21.h  ;;
729     *_nbsd30)   AFS_PARAM_COMMON=param.nbsd30.h  ;;
730     *_nbsd40)   AFS_PARAM_COMMON=param.nbsd40.h  ;;
731     *_nbsd50)   AFS_PARAM_COMMON=param.nbsd50.h  ;;
732     *_nbsd60)   AFS_PARAM_COMMON=param.nbsd60.h  ;;
733     *_obsd31)   AFS_PARAM_COMMON=param.obsd31.h  ;;
734     *_obsd32)   AFS_PARAM_COMMON=param.obsd32.h  ;;
735     *_obsd33)   AFS_PARAM_COMMON=param.obsd33.h  ;;
736     *_obsd34)   AFS_PARAM_COMMON=param.obsd34.h  ;;
737     *_obsd35)   AFS_PARAM_COMMON=param.obsd35.h  ;;
738     *_obsd36)   AFS_PARAM_COMMON=param.obsd36.h  ;;
739     *_obsd37)   AFS_PARAM_COMMON=param.obsd37.h  ;;
740     *_obsd38)   AFS_PARAM_COMMON=param.obsd38.h  ;;
741     *_obsd39)   AFS_PARAM_COMMON=param.obsd39.h  ;;
742     *_obsd40)   AFS_PARAM_COMMON=param.obsd40.h  ;;
743     *_obsd41)   AFS_PARAM_COMMON=param.obsd41.h  ;;
744     *_obsd42)   AFS_PARAM_COMMON=param.obsd42.h  ;;
745     *_obsd43)   AFS_PARAM_COMMON=param.obsd43.h  ;;
746     *_obsd44)   AFS_PARAM_COMMON=param.obsd44.h  ;;
747     *_obsd45)   AFS_PARAM_COMMON=param.obsd45.h  ;;
748     *_obsd46)   AFS_PARAM_COMMON=param.obsd46.h  ;;
749     *_obsd47)   AFS_PARAM_COMMON=param.obsd47.h  ;;
750     *_obsd48)   AFS_PARAM_COMMON=param.obsd48.h  ;;
751     *_linux22)  AFS_PARAM_COMMON=param.linux22.h ;;
752     *_linux24)  AFS_PARAM_COMMON=param.linux24.h ;;
753     *_linux26)  AFS_PARAM_COMMON=param.linux26.h ;;
754 # Linux alpha adds an extra underscore for no good reason.
755     *_linux_22) AFS_PARAM_COMMON=param.linux22.h ;;
756     *_linux_24) AFS_PARAM_COMMON=param.linux24.h ;;
757     *_linux_26) AFS_PARAM_COMMON=param.linux26.h ;;
758 esac
759
760 case $AFS_SYSNAME in *_linux* | *_umlinux*)
761
762                 # Add (sub-) architecture-specific paths needed by conftests
763                 case $AFS_SYSNAME  in
764                         *_umlinux26)
765                                 UMLINUX26_FLAGS="-I$LINUX_KERNEL_PATH/arch/um/include"
766                                 UMLINUX26_FLAGS="$UMLINUX26_FLAGS -I$LINUX_KERNEL_PATH/arch/um/kernel/tt/include"
767                                 UMLINUX26_FLAGS="$UMLINUX26_FLAGS -I$LINUX_KERNEL_PATH/arch/um/kernel/skas/include"
768                                 CPPFLAGS="$CPPFLAGS $UMLINUX26_FLAGS"
769                 esac
770
771                 if test "x$enable_kernel_module" = "xyes"; then
772                  if test "x$enable_debug_kernel" = "xno"; then
773                         LINUX_GCC_KOPTS="$LINUX_GCC_KOPTS -fomit-frame-pointer"
774                  fi
775                  OPENAFS_GCC_SUPPORTS_MARCH
776                  AC_SUBST(P5PLUS_KOPTS)
777                  OPENAFS_GCC_NEEDS_NO_STRENGTH_REDUCE
778                  OPENAFS_GCC_NEEDS_NO_STRICT_ALIASING
779                  OPENAFS_GCC_SUPPORTS_NO_COMMON
780                  OPENAFS_GCC_SUPPORTS_PIPE
781                  AC_SUBST(LINUX_GCC_KOPTS)
782
783                  dnl Setup the kernel build environment
784                  LINUX_KBUILD_USES_EXTRA_CFLAGS
785                  LINUX_KERNEL_COMPILE_WORKS
786
787                  dnl Check for header files
788                  AC_CHECK_LINUX_HEADER([config.h])
789                  AC_CHECK_LINUX_HEADER([completion.h])
790                  AC_CHECK_LINUX_HEADER([exportfs.h])
791                  AC_CHECK_LINUX_HEADER([freezer.h])
792                  AC_CHECK_LINUX_HEADER([key-type.h])
793                  AC_CHECK_LINUX_HEADER([semaphore.h])
794                  AC_CHECK_LINUX_HEADER([seq_file.h])
795
796                  dnl Check for structure elements
797                  AC_CHECK_LINUX_STRUCT([address_space_operations],
798                                        [write_begin], [fs.h])
799                  AC_CHECK_LINUX_STRUCT([backing_dev_info], [name],
800                                        [backing-dev.h])
801                  AC_CHECK_LINUX_STRUCT([ctl_table], [ctl_name], [sysctl.h])
802                  AC_CHECK_LINUX_STRUCT([inode], [i_alloc_sem], [fs.h])
803                  AC_CHECK_LINUX_STRUCT([inode], [i_blkbits], [fs.h])
804                  AC_CHECK_LINUX_STRUCT([inode], [i_blksize], [fs.h])
805                  AC_CHECK_LINUX_STRUCT([inode], [i_mutex], [fs.h])
806                  AC_CHECK_LINUX_STRUCT([inode], [i_security], [fs.h])
807                  AC_CHECK_LINUX_STRUCT([file_operations], [flock], [fs.h])
808                  AC_CHECK_LINUX_STRUCT([file_operations], [sendfile], [fs.h])
809                  AC_CHECK_LINUX_STRUCT([file_system_type], [mount], [fs.h])
810                  AC_CHECK_LINUX_STRUCT([nameidata], [path], [namei.h])
811                  AC_CHECK_LINUX_STRUCT([proc_dir_entry], [owner], [proc_fs.h])
812                  AC_CHECK_LINUX_STRUCT([super_block], [s_bdi], [fs.h])
813                  AC_CHECK_LINUX_STRUCT([super_block], [s_d_op], [fs.h])
814                  AC_CHECK_LINUX_STRUCT([super_operations], [alloc_inode],
815                                        [fs.h])
816                  AC_CHECK_LINUX_STRUCT([super_operations], [evict_inode],
817                                        [fs.h])
818                  AC_CHECK_LINUX_STRUCT([task_struct], [cred], [sched.h])
819                  AC_CHECK_LINUX_STRUCT([task_struct], [exit_state], [sched.h])
820                  AC_CHECK_LINUX_STRUCT([task_struct], [parent], [sched.h])
821                  AC_CHECK_LINUX_STRUCT([task_struct], [real_parent], [sched.h])
822                  AC_CHECK_LINUX_STRUCT([task_struct], [rlim], [sched.h])
823                  AC_CHECK_LINUX_STRUCT([task_struct], [sig], [sched.h])
824                  AC_CHECK_LINUX_STRUCT([task_struct], [sighand], [sched.h])
825                  AC_CHECK_LINUX_STRUCT([task_struct], [sigmask_lock], [sched.h])
826                  AC_CHECK_LINUX_STRUCT([task_struct], [tgid], [sched.h])
827                  AC_CHECK_LINUX_STRUCT([task_struct], [thread_info], [sched.h])
828                  LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM
829
830                  dnl Check for typed structure elements
831                  AC_CHECK_LINUX_TYPED_STRUCT([read_descriptor_t],
832                                              [buf], [fs.h])
833
834                  dnl Function existence checks
835
836                  AC_CHECK_LINUX_FUNC([bdi_init],
837                                      [#include <linux/backing-dev.h>],
838                                      [bdi_init(NULL);])
839                  AC_CHECK_LINUX_FUNC([PageChecked],
840                                      [#include <linux/mm.h>
841 #include <linux/page-flags.h>],
842                                      [struct page *_page;
843                                       int bchecked = PageChecked(_page);])
844                  AC_CHECK_LINUX_FUNC([PageFsMisc],
845                                      [#include <linux/mm.h>
846 #include <linux/page-flags.h>],
847                                      [struct page *_page;
848                                       int bchecked = PageFsMisc(_page);])
849                  AC_CHECK_LINUX_FUNC([current_kernel_time],
850                                      [#include <linux/time.h>],
851                                      [struct timespec s;
852                                       s = current_kernel_time();])
853                  AC_CHECK_LINUX_FUNC([d_alloc_anon],
854                                      [#include <linux/fs.h>],
855                                      [d_alloc_anon(NULL);])
856                  AC_CHECK_LINUX_FUNC([do_sync_read],
857                                      [#include <linux/fs.h>],
858                                      [do_sync_read(NULL, NULL, 0, NULL);])
859                  AC_CHECK_LINUX_FUNC([find_task_by_pid],
860                                      [#include <linux/sched.h>],
861                                      [pid_t p; find_task_by_pid(p);])
862                  AC_CHECK_LINUX_FUNC([generic_file_aio_read],
863                                      [#include <linux/fs.h>],
864                                      [generic_file_aio_read(NULL,NULL,0,0);])
865                  AC_CHECK_LINUX_FUNC([grab_cache_page_write_begin],
866                                      [#include <linux/pagemap.h>],
867                                      [grab_cache_page_write_begin(NULL, 0, 0);])
868                  AC_CHECK_LINUX_FUNC([hlist_unhashed],
869                                      [#include <linux/list.h>],
870                                      [hlist_unhashed(0);])
871                  AC_CHECK_LINUX_FUNC([i_size_read],
872                                      [#include <linux/fs.h>],
873                                      [i_size_read(NULL);])
874                  AC_CHECK_LINUX_FUNC([inode_setattr],
875                                      [#include <linux/fs.h>],
876                                      [inode_setattr(NULL, NULL);])
877                  AC_CHECK_LINUX_FUNC([kernel_setsockopt],
878                                      [#include <linux/net.h>],
879                                      [kernel_setsockopt(NULL, 0, 0, NULL, 0);])
880                  AC_CHECK_LINUX_FUNC([page_follow_link],
881                                      [#include <linux/fs.h>],
882                                      [page_follow_link(0,0);])
883                  AC_CHECK_LINUX_FUNC([page_offset],
884                                      [#include <linux/pagemap.h>],
885                                      [page_offset(NULL);])
886                  AC_CHECK_LINUX_FUNC([pagevec_lru_add_file],
887                                      [#include <linux/pagevec.h>],
888                                      [__pagevec_lru_add_file(NULL);])
889                  AC_CHECK_LINUX_FUNC([path_lookup],
890                                      [#include <linux/fs.h>
891                                       #include <linux/namei.h>],
892                                      [path_lookup(NULL, 0, NULL);])
893                  AC_CHECK_LINUX_FUNC([rcu_read_lock],
894                                      [#include <linux/rcupdate.h>],
895                                      [rcu_read_lock();])
896                  AC_CHECK_LINUX_FUNC([splice_direct_to_actor],
897                                      [#include <linux/splice.h>],
898                                      [splice_direct_to_actor(NULL,NULL,NULL);])
899                  AC_CHECK_LINUX_FUNC([svc_addr_in],
900                                      [#include <linux/sunrpc/svc.h>],
901                                      [svc_addr_in(NULL);])
902                  AC_CHECK_LINUX_FUNC([zero_user_segments],
903                                      [#include <linux/highmem.h>],
904                                      [zero_user_segments(NULL, 0, 0, 0, 0);])
905
906                  dnl Consequences - things which get set as a result of the
907                  dnl                above tests
908                  AS_IF([test "x$ac_cv_linux_func_d_alloc_anon" = "xno"],
909                        [AC_DEFINE([AFS_NONFSTRANS], 1,
910                                   [define to disable the nfs translator])])
911
912                  dnl Assorted more complex tests
913                  LINUX_EXPORTS_PROC_ROOT_FS
914                  LINUX_KMEM_CACHE_INIT
915                  LINUX_HAVE_KMEM_CACHE_T
916                  LINUX_KMEM_CACHE_CREATE_TAKES_DTOR
917                  LINUX_KMEM_CACHE_CREATE_CTOR_TAKES_VOID
918                  LINUX_D_PATH_TAKES_STRUCT_PATH
919                  LINUX_NEW_EXPORT_OPS
920                  LINUX_INODE_SETATTR_RETURN_TYPE
921                  LINUX_IOP_I_CREATE_TAKES_NAMEIDATA
922                  LINUX_IOP_I_LOOKUP_TAKES_NAMEIDATA
923                  LINUX_IOP_I_PERMISSION_TAKES_FLAGS
924                  LINUX_IOP_I_PERMISSION_TAKES_NAMEIDATA
925                  LINUX_IOP_I_PUT_LINK_TAKES_COOKIE
926                  LINUX_DOP_D_REVALIDATE_TAKES_NAMEIDATA
927                  LINUX_FOP_F_FLUSH_TAKES_FL_OWNER_T
928                  LINUX_FOP_F_FSYNC_TAKES_DENTRY
929                  LINUX_AOP_WRITEBACK_CONTROL
930                  LINUX_FS_STRUCT_FOP_HAS_SPLICE
931                  LINUX_KERNEL_POSIX_LOCK_FILE_WAIT_ARG
932                  LINUX_POSIX_TEST_LOCK_RETURNS_CONFLICT
933                  LINUX_POSIX_TEST_LOCK_CONFLICT_ARG
934                  LINUX_KERNEL_SOCK_CREATE
935                  LINUX_EXPORTS_KEY_TYPE_KEYRING
936                  LINUX_NEED_RHCONFIG
937                  LINUX_RECALC_SIGPENDING_ARG_TYPE
938                  LINUX_EXPORTS_TASKLIST_LOCK
939                  LINUX_GET_SB_HAS_STRUCT_VFSMOUNT
940                  LINUX_STATFS_TAKES_DENTRY
941                  LINUX_REFRIGERATOR
942                  LINUX_HAVE_TRY_TO_FREEZE
943                  LINUX_LINUX_KEYRING_SUPPORT
944                  LINUX_KEY_ALLOC_NEEDS_STRUCT_TASK
945                  LINUX_KEY_ALLOC_NEEDS_CRED
946                  LINUX_INIT_WORK_HAS_DATA
947                  LINUX_REGISTER_SYSCTL_TABLE_NOFLAG
948                  LINUX_HAVE_DCACHE_LOCK
949                  LINUX_D_COUNT_IS_INT
950
951                  dnl If we are guaranteed that keyrings will work - that is
952                  dnl  a) The kernel has keyrings enabled
953                  dnl  b) The code is new enough to give us a key_type_keyring
954                  dnl then we just disable syscall probing unless we've been
955                  dnl told otherwise
956
957                  AS_IF([test "$enable_linux_syscall_probing" = "maybe"],
958                    [AS_IF([test "$ac_cv_linux_keyring_support" = "yes" -a "$ac_cv_linux_exports_key_type_keyring" = "yes"],
959                           [enable_linux_syscall_probing="no"],
960                           [enable_linux_syscall_probing="yes"])
961                  ])
962
963                  dnl Syscall probing needs a few tests of its own, and just
964                  dnl won't work if the kernel doesn't export init_mm
965                  AS_IF([test "$enable_linux_syscall_probing" = "yes"], [
966                    LINUX_EXPORTS_INIT_MM
967                    AS_IF([test "$ac_cv_linux_exports_init_mm" = "no"], [
968                      AC_MSG_ERROR(
969                        [Can't do syscall probing without exported init_mm])
970                    ])
971                    LINUX_EXPORTS_SYS_CHDIR
972                    LINUX_EXPORTS_SYS_OPEN
973                    AC_DEFINE(ENABLE_LINUX_SYSCALL_PROBING, 1,
974                              [define to enable syscall table probes])
975                  ])
976
977                  dnl Packaging and SMP build
978                  if test "x$with_linux_kernel_packaging" != "xyes" ; then
979                    LINUX_WHICH_MODULES
980                  else
981                    AC_SUBST(MPS,'SP')
982                  fi
983
984                  dnl Syscall probing
985                  if test "x$ac_cv_linux_config_modversions" = "xno" -o $AFS_SYSKVERS -ge 26; then
986                    AS_IF([test "$enable_linux_syscall_probing" = "yes"], [
987                      AC_MSG_WARN([Cannot determine sys_call_table status. assuming it isn't exported])
988                    ])
989                    ac_cv_linux_exports_sys_call_table=no
990                    if test -f "$LINUX_KERNEL_PATH/include/asm/ia32_unistd.h"; then
991                      ac_cv_linux_exports_ia32_sys_call_table=yes
992                    fi
993                  else
994                    LINUX_EXPORTS_KALLSYMS_ADDRESS
995                    LINUX_EXPORTS_KALLSYMS_SYMBOL
996                    LINUX_EXPORTS_SYS_CALL_TABLE
997                    LINUX_EXPORTS_IA32_SYS_CALL_TABLE
998                    if test "x$ac_cv_linux_exports_sys_call_table" = "xno"; then
999                          linux_syscall_method=none
1000                          if test "x$ac_cv_linux_exports_init_mm" = "xyes"; then
1001                             linux_syscall_method=scan
1002                             if test "x$ac_cv_linux_exports_kallsyms_address" = "xyes"; then
1003                                linux_syscall_method=scan_with_kallsyms_address
1004                             fi
1005                          fi
1006                          if test "x$ac_cv_linux_exports_kallsyms_symbol" = "xyes"; then
1007                             linux_syscall_method=kallsyms_symbol
1008                          fi
1009                          if test "x$linux_syscall_method" = "xnone"; then
1010                             AC_MSG_WARN([no available sys_call_table access method -- guessing scan])
1011                             linux_syscall_method=scan
1012                          fi
1013                    fi
1014                  fi
1015                  if test -f "$LINUX_KERNEL_PATH/include/linux/in_systm.h"; then
1016                   AC_DEFINE(HAVE_IN_SYSTM_H, 1, [define if you have in_systm.h header file])
1017                  fi
1018                  if test -f "$LINUX_KERNEL_PATH/include/linux/mm_inline.h"; then
1019                   AC_DEFINE(HAVE_MM_INLINE_H, 1, [define if you have mm_inline.h header file])
1020                  fi
1021                  if test "x$ac_cv_linux_kernel_page_follow_link" = "xyes" -o "x$ac_cv_linux_func_i_put_link_takes_cookie" = "xyes"; then
1022                   AC_DEFINE(USABLE_KERNEL_PAGE_SYMLINK_CACHE, 1, [define if your kernel has a usable symlink cache API])
1023                  else
1024                   AC_MSG_WARN([your kernel does not have a usable symlink cache API])
1025                  fi
1026                 :
1027                 fi
1028 dnl Linux-only, but just enable always.
1029                 AC_DEFINE(AFS_CACHE_BYPASS, 1, [define to activate cache bypassing Unix client])
1030 esac
1031
1032 AC_CACHE_CHECK([if compiler has __sync_add_and_fetch],
1033     [ac_cv_sync_fetch_and_add],
1034     [AC_TRY_LINK(, [int var; return __sync_add_and_fetch(&var, 1);],
1035                     [ac_cv_sync_fetch_and_add=yes],
1036                     [ac_cv_sync_fetch_and_add=no])
1037 ])
1038 AS_IF([test "$ac_cv_sync_fetch_and_add" = "yes"],
1039       [AC_DEFINE(HAVE_SYNC_FETCH_AND_ADD, 1,
1040                 [define if your C compiler has __sync_add_and_fetch])])
1041
1042 AC_CACHE_CHECK([if struct sockaddr has sa_len field],
1043     [ac_cv_sockaddr_len],
1044     [AC_TRY_COMPILE( [#include <sys/types.h>
1045 #include <sys/socket.h>],
1046                      [struct sockaddr *a; a->sa_len=0;],
1047                      [ac_cv_sockaddr_len=yes],
1048                      [ac_cv_sockaddr_len=no])
1049 ])
1050 AS_IF([test "$ac_cv_sockaddr_len" = "yes"],
1051       [AC_DEFINE(STRUCT_SOCKADDR_HAS_SA_LEN, 1,
1052                  [define if you struct sockaddr sa_len])])
1053
1054 if test "x${MKAFS_OSTYPE}" = "xIRIX"; then
1055         echo Skipping library tests because they confuse Irix.
1056 else
1057   AC_SEARCH_LIBS([socket], [socket inet])
1058   AC_SEARCH_LIBS([connect], [nsl])
1059   AC_SEARCH_LIBS([gethostbyname], [dns nsl resolv])
1060
1061   dnl darwin wants it, aix hates it
1062   AC_MSG_CHECKING(for the useability of arpa/nameser_compat.h)
1063   AC_TRY_COMPILE([
1064   #include <stdlib.h>
1065   #include <stdio.h>
1066   #include <sys/types.h>
1067   #include <sys/socket.h>
1068   #include <netinet/in.h>
1069   #include <arpa/inet.h>
1070   #include <arpa/nameser.h>
1071   #include <arpa/nameser_compat.h>
1072   #include <resolv.h>
1073   ], [static int i; i = 0;],
1074   [AC_MSG_RESULT(yes)
1075    AC_DEFINE(HAVE_ARPA_NAMESER_COMPAT_H, 1, [define if arpa/nameser_compat.h exists])],
1076   [AC_MSG_RESULT(no)
1077    ])
1078
1079   openafs_save_libs="$LIBS"
1080   AC_MSG_CHECKING([for res_search])
1081   AC_FUNC_RES_SEARCH
1082
1083   if test "$ac_cv_func_res_search" = no; then
1084       for lib in dns nsl resolv; do
1085         if test "$ac_cv_func_res_search" != yes; then
1086           LIBS="-l$lib $LIBS"
1087           AC_FUNC_RES_SEARCH
1088           LIBS="$openafs_save_libs"
1089         fi
1090       done    
1091       if test "$ac_cv_func_res_search" = yes; then
1092         LIB_AFSDB="-l$lib"
1093         AC_DEFINE(HAVE_RES_SEARCH, 1, [])
1094         AC_MSG_RESULT([yes, in lib$lib])
1095       else
1096         AC_MSG_RESULT(no)
1097       fi
1098   else
1099     AC_DEFINE(HAVE_RES_SEARCH, 1, [])
1100     AC_MSG_RESULT(yes)
1101   fi
1102   
1103 fi
1104
1105 AC_CHECK_RESOLV_RETRANS
1106
1107 AC_CACHE_CHECK([for setsockopt(, SOL_IP, IP_RECVERR)],
1108     [ac_cv_setsockopt_iprecverr],
1109     [AC_TRY_COMPILE( [
1110 #include <sys/types.h>
1111 #include <sys/socket.h>
1112 #include <netinet/in.h>],
1113 [int on=1;
1114 setsockopt(0, SOL_IP, IP_RECVERR, &on, sizeof(on));],
1115         [ac_cv_setsockopt_iprecverr=yes],
1116         [ac_cv_setsockopt_iprecverr=no])])
1117
1118 AS_IF([test "$ac_cv_setsockopt_iprecverr" = "yes"],
1119       [AC_DEFINE(ADAPT_PMTU_RECVERR, 1,
1120                  [define if asynchronous socket errors can be received])])
1121
1122 PTHREAD_LIBS=error
1123 if test "x$MKAFS_OSTYPE" = OBSD; then
1124         PTHREAD_LIBS="-pthread"
1125 fi
1126 if test "x$MKAFS_OSTYPE" = xDFBSD; then
1127         PTHREAD_LIBS="-pthread"
1128 fi
1129 if test "x$PTHREAD_LIBS" = xerror; then
1130         AC_CHECK_LIB(pthread, pthread_attr_init,
1131                 PTHREAD_LIBS="-lpthread")
1132 fi
1133 if test "x$PTHREAD_LIBS" = xerror; then
1134         AC_CHECK_LIB(pthreads, pthread_attr_init,
1135                 PTHREAD_LIBS="-lpthreads")
1136 fi
1137 if test "x$PTHREAD_LIBS" = xerror; then
1138         AC_CHECK_LIB(c_r, pthread_attr_init,
1139                 PTHREAD_LIBS="-lc_r")
1140 fi
1141 if test "x$PTHREAD_LIBS" = xerror; then
1142         AC_CHECK_FUNC(pthread_attr_init, PTHREAD_LIBS="")
1143 fi
1144 if test "x$PTHREAD_LIBS" = xerror; then
1145         # pthread_attr_init is a macro under HPUX 11.0 and 11.11
1146         AC_CHECK_LIB(pthread, pthread_attr_destroy,
1147                 PTHREAD_LIBS="-lpthread")
1148 fi
1149 if test "x$PTHREAD_LIBS" = xerror; then
1150         AC_MSG_WARN(*** Unable to locate working posix thread library ***)
1151 fi
1152 AC_SUBST(PTHREAD_LIBS)
1153
1154 HOST_CPU="$host_cpu"
1155
1156 if test "x$with_bsd_kernel_headers" != "x"; then
1157         BSD_KERNEL_PATH="$with_bsd_kernel_headers"
1158 else
1159         BSD_KERNEL_PATH="/usr/src/sys"
1160 fi
1161
1162 if test "x$with_bsd_kernel_build" != "x"; then
1163         BSD_KERNEL_BUILD="$with_bsd_kernel_build"
1164 else
1165         case $AFS_SYSNAME in
1166                 *_fbsd_*)
1167                         BSD_KERNEL_BUILD="${BSD_KERNEL_PATH}/${HOST_CPU}/compile/GENERIC"
1168                         ;;
1169                 *_nbsd*)
1170                         BSD_KERNEL_BUILD="${BSD_KERNEL_PATH}/arch/${HOST_CPU}/compile/GENERIC"
1171         esac
1172 fi
1173
1174 # Fast restart
1175 if test "$enable_supergroups" = "yes"; then
1176         AC_DEFINE(SUPERGROUPS, 1, [define if you want to have support for nested pts groups])
1177 fi
1178
1179 if test "$enable_bitmap_later" = "yes"; then
1180         AC_DEFINE(BITMAP_LATER, 1, [define if you want to salvager to check bitmasks later])
1181 fi
1182
1183 if test "$enable_unix_sockets" = "yes"; then
1184         AC_DEFINE(USE_UNIX_SOCKETS, 1, [define if you want to use UNIX sockets for fssync.])
1185         USE_UNIX_SOCKETS="yes"
1186 else
1187         USE_UNIX_SOCKETS="no"
1188 fi
1189 AC_SUBST(USE_UNIX_SOCKETS)
1190
1191 dnl if test "$ac_cv_setsockopt_iprecverr" = "yes"; then
1192 dnl     AC_DEFINE(ADAPT_PMTU, 1, [define if you want to decode icmp unreachable packets to discover path mtu])
1193 dnl fi
1194
1195 if test "$enable_namei_fileserver" = "yes"; then
1196         AC_DEFINE(AFS_NAMEI_ENV, 1, [define if you want to want namei fileserver])
1197         VFSCK=""
1198 else
1199         if test "$enable_namei_fileserver" = "default"; then
1200                 case $host in
1201                         *-solaris2.10*)
1202                                 AC_MSG_WARN(Some Solaris 10 versions are not safe with the inode fileserver. Forcing namei. Override with --disable-namei-fileserver)
1203                                 AC_DEFINE(AFS_NAMEI_ENV, 1, [define if you want to want namei fileserver])
1204                                 VFSCK=""
1205                                 ;;
1206                         *-solaris2.11*)
1207                                 AC_MSG_WARN(Solaris 11 versions are not safe with the inode fileserver. Forcing namei. Override with --disable-namei-fileserver)
1208                                 AC_DEFINE(AFS_NAMEI_ENV, 1, [define if you want to want namei fileserver])
1209                                 VFSCK=""
1210                                 ;;
1211                         *)
1212                                 VFSCK="vfsck"
1213                                 ;;
1214                 esac
1215         else
1216                 VFSCK="vfsck"
1217         fi
1218 fi
1219
1220 dnl check for tivoli
1221 AC_MSG_CHECKING(for tivoli tsm butc support)
1222 XBSA_CFLAGS=""
1223 if test "$enable_tivoli_tsm" = "yes"; then
1224         XBSADIR1=/usr/tivoli/tsm/client/api/bin/xopen
1225         XBSADIR2=/opt/tivoli/tsm/client/api/bin/xopen
1226         XBSADIR3=/usr/tivoli/tsm/client/api/bin/sample
1227         XBSADIR4=/opt/tivoli/tsm/client/api/bin/sample
1228
1229         if test -r "$XBSADIR3/dsmapifp.h"; then
1230                 XBSA_CFLAGS="-Dxbsa -DNEW_XBSA -I$XBSADIR3"
1231                 XBSA_XLIBS="-ldl"
1232                 AC_MSG_RESULT([yes, $XBSA_CFLAGS])
1233         elif test -r "$XBSADIR4/dsmapifp.h"; then
1234                 XBSA_CFLAGS="-Dxbsa -DNEW_XBSA -I$XBSADIR4"
1235                 XBSA_XLIBS="-ldl"
1236                 AC_MSG_RESULT([yes, $XBSA_CFLAGS])
1237         elif test -r "$XBSADIR1/xbsa.h"; then
1238                 XBSA_CFLAGS="-Dxbsa -I$XBSADIR1"
1239                 XBSA_XLIBS=""
1240                 AC_MSG_RESULT([yes, $XBSA_CFLAGS])
1241         elif test -r "$XBSADIR2/xbsa.h"; then
1242                 XBSA_CFLAGS="-Dxbsa -I$XBSADIR2"
1243                 XBSA_XLIBS=""
1244                 AC_MSG_RESULT([yes, $XBSA_CFLAGS])
1245         else
1246                 AC_MSG_RESULT([no, missing xbsa.h and dsmapifp.h header files])
1247         fi
1248 else
1249         AC_MSG_RESULT([no])
1250 fi
1251 AC_SUBST(XBSA_CFLAGS)
1252 AC_SUBST(XBSA_XLIBS) 
1253
1254 dnl checks for header files.
1255 AC_HEADER_STDC
1256 AC_HEADER_SYS_WAIT
1257 AC_HEADER_DIRENT
1258 AC_CHECK_HEADERS([ \
1259                    arpa/inet.h \
1260                    arpa/nameser.h \
1261                    curses.h\
1262                    direct.h \
1263                    et/com_err.h \
1264                    errno.h \
1265                    fcntl.h \
1266                    grp.h \
1267                    math.h \
1268                    mntent.h \
1269                    ncurses.h \
1270                    netdb.h \
1271                    netinet/in.h \
1272                    pwd.h \
1273                    regex.h \
1274                    resolv.h \
1275                    security/pam_appl.h \
1276                    signal.h \
1277                    stdint.h \
1278                    stdio_ext.h \
1279                    stdlib.h \
1280                    string.h \
1281                    strings.h \
1282                    sys/bitypes.h \
1283                    sys/bswap.h \
1284                    sys/dk.h \
1285                    sys/fcntl.h \
1286                    sys/file.h \
1287                    sys/fs_types.h \
1288                    sys/fstyp.h \
1289                    sys/ioctl.h \
1290                    sys/ipc.h \
1291                    sys/lockf.h \
1292                    sys/map.h \
1293                    sys/mount.h \
1294                    sys/mntent.h \
1295                    sys/mnttab.h \
1296                    sys/pag.h \
1297                    sys/param.h \
1298                    sys/resource.h \
1299                    sys/select.h \
1300                    sys/statfs.h \
1301                    sys/statvfs.h \
1302                    sys/socket.h \
1303                    sys/sysctl.h \
1304                    sys/time.h \
1305                    sys/types.h \
1306                    sys/uio.h \
1307                    sys/un.h \
1308                    sys/vfs.h \
1309                    syslog.h \
1310                    termios.h \
1311                    time.h \
1312                    ucontext.h \
1313                    unistd.h \
1314                    windows.h \
1315                 ])
1316 AC_CHECK_HEADERS([net/if.h],[],[],[AC_INCLUDES_DEFAULT
1317 #ifdef HAVE_SYS_SOCKET_H
1318 # include <sys/socket.h>
1319 #endif])
1320
1321 AC_CHECK_HEADERS([netinet/if_ether.h],[],[],[AC_INCLUDES_DEFAULT
1322 #ifdef HAVE_NET_IF_H
1323 # include <net/if.h>
1324 #endif])
1325
1326 AC_CHECK_HEADERS([security/pam_modules.h],[],[],[AC_INCLUDES_DEFAULT
1327 #ifdef HAVE_SECURITY_PAM_APPL_H
1328 # include <security/pam_appl.h>
1329 #endif])
1330
1331 AC_CHECK_HEADERS(linux/errqueue.h,,,[#include <linux/types.h>])
1332
1333 AC_CHECK_TYPES([fsblkcnt_t],,,[
1334 #include <sys/types.h>
1335 #ifdef HAVE_SYS_BITYPES_H
1336 #include <sys/bitypes.h>
1337 #endif
1338 #ifdef HAVE_SYS_STATFS_H
1339 #include <sys/statfs.h>
1340 #endif
1341 #ifdef HAVE_SYS_STATVFS_H
1342 #include <sys/statvfs.h>
1343 #endif
1344 ])
1345
1346 dnl check for curses-lib
1347 save_LIBS=$LIBS
1348 AC_CHECK_LIB( [ncurses], [setupterm],
1349 [LIB_curses=-lncurses],
1350     [AC_CHECK_LIB([Hcurses], [setupterm], [LIB_curses=-lHcurses],
1351         [AC_CHECK_LIB([curses], [setupterm], [LIB_curses=-lcurses])
1352     ])
1353 ])
1354 LIBS=$save_LIBS
1355 AC_SUBST(LIB_curses)
1356
1357 OPENAFS_TEST_PACKAGE(libintl,[#include <libintl.h>],[-lintl],,,INTL)
1358
1359 dnl Don't build PAM on IRIX; the interface doesn't work for us.
1360 if test "$ac_cv_header_security_pam_modules_h" = yes -a "$enable_pam" = yes; then
1361         case $AFS_SYSNAME in
1362         sgi_*)
1363                 HAVE_PAM="no"
1364                 ;;
1365         *)
1366                 HAVE_PAM="yes"
1367                 ;;
1368         esac
1369 else
1370         HAVE_PAM="no"
1371 fi
1372 AC_SUBST(HAVE_PAM)
1373
1374 if test "$enable_login" = yes; then
1375         BUILD_LOGIN="yes"
1376 else
1377         BUILD_LOGIN="no"
1378 fi
1379 AC_SUBST(BUILD_LOGIN)
1380
1381 AC_CHECK_FUNCS([ \
1382         arc4random \
1383         fcntl \
1384         fseeko64 \
1385         ftello64 \
1386         getcwd \
1387         getegid \
1388         geteuid \
1389         getgid \
1390         getuid \
1391         getprogname \
1392         getrlimit \
1393         issetugid \
1394         mkstemp \
1395         pread \
1396         preadv \
1397         preadv64 \
1398         pwrite \
1399         pwritev \
1400         pwritev64 \
1401         regcomp \
1402         regerror \
1403         regexec \
1404         setitimer \
1405         setprogname \
1406         setvbuf \
1407         sigaction \
1408         strcasestr \
1409         strerror \
1410         sysconf \
1411         sysctl \
1412         timegm \
1413 ])
1414
1415 OPENAFS_ROKEN()
1416 OPENAFS_C_ATTRIBUTE()
1417
1418 dnl Functions that Heimdal's libroken provides, but that we
1419 dnl haven't found a need for yet, and so haven't imported
1420 AC_CHECK_FUNCS([ \
1421         chown \
1422         fchown \
1423         gethostname \
1424         lstat \
1425         inet_aton \
1426         inet_ntop \
1427         inet_pton \
1428         putenv \
1429         readv \
1430         setenv \
1431         strdup \
1432         strftime \
1433         strndup \
1434         strsep \
1435         unsetenv \
1436 ])
1437
1438 dnl Functions that are in objects that we always build from libroken
1439 AC_CHECK_FUNCS([ \
1440         asprintf \
1441         asnprintf \
1442         vasprintf \
1443         vasnprintf \
1444         vsnprintf \
1445         snprintf \
1446 ])
1447
1448 dnl Functions that we're going to try and get from libroken
1449 AC_REPLACE_FUNCS([ \
1450         daemon \
1451         ecalloc \
1452         emalloc \
1453         erealloc \
1454         err \
1455         errx \
1456         flock \
1457         getdtablesize \
1458         getopt \
1459         getprogname \
1460         gettimeofday \
1461         localtime_r \
1462         mkstemp \
1463         strcasecmp \
1464         strlcat \
1465         strnlen \
1466         strlcpy \
1467         strsep \
1468         tdelete \
1469         tfind \
1470         tsearch \
1471         twalk \
1472         verr \
1473         verrx \
1474         vsyslog \
1475         vwarn \
1476         vwarnx \
1477         warn \
1478         warnx \
1479 ])
1480
1481 dnl Headers that we're going to try and get from libroken
1482 AC_CHECK_HEADERS([ \
1483         err.h \
1484         search.h \
1485 ])
1486
1487 AC_CHECK_DECLS([h_errno], [], [], [
1488 #include <sys/types.h>
1489 #ifdef HAVE_NETDB_H
1490 #include <netdb.h>
1491 #endif
1492 ])
1493
1494 AC_HEADER_TIME
1495
1496 ROKEN_HEADERS=
1497 AS_IF([test "$ac_cv_header_err_h" != "yes" ],
1498       [ROKEN_HEADERS="$ROKEN_HEADERS \$(TOP_INCDIR)/err.h"],
1499       [])
1500 AC_SUBST(ROKEN_HEADERS)
1501
1502 dnl Stuff that's harder ...
1503 AC_MSG_CHECKING([for bswap16])
1504 AC_LINK_IFELSE([AC_LANG_PROGRAM([
1505 #ifdef HAVE_SYS_TYPES_H
1506 #include <sys/types.h>
1507 #endif
1508 #ifdef HAVE_SYS_BSWAP_H
1509 #include <sys/bswap.h>
1510 #endif
1511 ],
1512 [short a, b; b = bswap16(a); ])],
1513 [AC_MSG_RESULT(yes)
1514  AC_DEFINE(HAVE_BSWAP16, 1, [Define to 1 if you have the bswap16 function])
1515 ],
1516 [AC_MSG_RESULT(no)])
1517
1518 AC_MSG_CHECKING([for bswap32])
1519 AC_LINK_IFELSE([AC_LANG_PROGRAM([#ifdef HAVE_SYS_TYPES_H
1520 #include <sys/types.h>
1521 #endif
1522 #ifdef HAVE_SYS_BSWAP_H
1523 #include <sys/bswap.h>
1524 #endif
1525 ],
1526 [int a, b; b = bswap32(a); ])],
1527 [AC_MSG_RESULT(yes)
1528  AC_DEFINE(HAVE_BSWAP32, 1, [Define to 1 if you have the bswap32 function])
1529 ],
1530 [AC_MSG_RESULT(no)])
1531
1532 case $AFS_SYSNAME in
1533 *hp_ux* | *hpux*)
1534    AC_MSG_WARN([Some versions of HP-UX have a buggy positional I/O implementation. Forcing no positional I/O.])
1535    ;;
1536 *)
1537    AC_MSG_CHECKING([for positional I/O])
1538    if test "$ac_cv_func_pread" = "yes" && \
1539            test "$ac_cv_func_pwrite" = "yes"; then
1540       AC_DEFINE(HAVE_PIO, 1, [define if you have pread() and pwrite()])
1541       AC_MSG_RESULT(yes)
1542    else
1543      AC_MSG_RESULT(no)
1544    fi
1545    AC_MSG_CHECKING([for vectored positional I/O])
1546    AS_IF([test "$ac_cv_func_preadv" = "yes" -a \
1547                "$ac_cv_func_pwritev" = "yes" -a \
1548                "$ac_cv_func_preadv64" = "yes" -a \
1549                "$ac_cv_func_pwritev64" = "yes"],
1550          [AC_DEFINE(HAVE_PIOV, 1, [define if you have preadv() and pwritev()])
1551           AC_MSG_RESULT(yes)],
1552          [AC_MSG_RESULT(no)])
1553    ;;
1554 esac
1555
1556 AC_MSG_CHECKING([for POSIX regex library])
1557 if test "$ac_cv_header_regex_h" = "yes" && \
1558         test "$ac_cv_func_regcomp" = "yes" && \
1559         test "$ac_cv_func_regexec" = "yes" && \
1560         test "$ac_cv_func_regerror" = "yes"; then
1561     AC_DEFINE(HAVE_POSIX_REGEX, 1, [define if you have POSIX regex library])
1562     AC_MSG_RESULT(yes)
1563 else
1564     AC_MSG_RESULT(no)
1565 fi
1566
1567 AC_TYPE_SIGNAL
1568 OPENAFS_RETSIGTYPE
1569 AC_CHECK_SIZEOF(void *)
1570 AC_CHECK_SIZEOF(unsigned long long)
1571 AC_CHECK_SIZEOF(unsigned long)
1572 AC_CHECK_SIZEOF(unsigned int)
1573 AC_TYPE_INTPTR_T
1574 AC_TYPE_UINTPTR_T
1575 AC_TYPE_SSIZE_T
1576 AC_CHECK_TYPE([sig_atomic_t],[],
1577     [AC_DEFINE([sig_atomic_t], [int],
1578         [Define to int if <signal.h> does not define.])],
1579 [#include <sys/types.h>
1580 #include <signal.h>])
1581 AC_CHECK_TYPE([socklen_t],[],
1582     [AC_DEFINE([socklen_t], [int],
1583         [Define to int if <sys/socket.h> does not define.])],
1584 [#include <sys/types.h>
1585 #include <sys/socket.h>])
1586 AC_CHECK_TYPES(off64_t)
1587 AC_CHECK_TYPES([ssize_t], [], [], [#include <unistd.h>])
1588 AC_CHECK_TYPES([struct winsize], [], [], [
1589 #ifdef HAVE_TERMIOS_H
1590 # include <termios.h>
1591 #else
1592 # include <sys/termios.h>
1593 #endif
1594 #include <sys/ioctl.h>])
1595 AC_CHECK_TYPES([sa_family_t, socklen_t, struct sockaddr,
1596                 struct sockaddr_storage],
1597                [], [], [
1598 #include <sys/types.h>
1599 #include <sys/socket.h>
1600 ])
1601 AC_CHECK_TYPES([sa_family_t], [], [], [
1602 #include <sys/types.h>
1603 #include <sys/socket.h>
1604 ])
1605 AC_CHECK_TYPES([struct addrinfo], [], [], [
1606 #include <sys/types.h>
1607 #ifdef HAVE_NETDB_H
1608 #include <netdb.h>
1609 #endif
1610 ])
1611 AC_CHECK_TYPES([long long], [], [], [])
1612
1613 AC_SIZEOF_TYPE(long)
1614
1615 RRA_HEADER_PAM_CONST
1616
1617
1618 dnl Directory PATH handling
1619 if test "x$enable_transarc_paths" = "xyes"  ; then 
1620     afsconfdir=${afsconfdir=/usr/afs/etc}
1621     viceetcdir=${viceetcdir=/usr/vice/etc}
1622     afskerneldir=${afskerneldir=${viceetcdir}}
1623     afssrvbindir=${afssrvbindir=/usr/afs/bin}
1624     afssrvsbindir=${afssrvsbindir=/usr/afs/bin}
1625     afssrvlibexecdir=${afssrvlibexecdir=/usr/afs/bin}
1626     afsdbdir=${afsdbdir=/usr/afs/db}
1627     afslogsdir=${afslogsdir=/usr/afs/logs}
1628     afslocaldir=${afslocaldir=/usr/afs/local}
1629     afsbackupdir=${afsbackupdir=/usr/afs/backup}
1630     afsbosconfigdir=${afsbosconfigdir=/usr/afs/local}
1631     afsdatadir=${afsdatadir=/usr/vice/etc}
1632 else 
1633     afsconfdir=${afsconfdir='${sysconfdir}/openafs/server'}
1634     viceetcdir=${viceetcdir='${sysconfdir}/openafs'}
1635     afskerneldir=${afskerneldir='${libdir}/openafs'}
1636     afssrvbindir=${afssrvbindir='${bindir}'}
1637     afssrvsbindir=${afssrvsbindir='${sbindir}'}
1638     afssrvlibexecdir=${afssrvlibexecdir='${libexecdir}/openafs'}
1639     afsdbdir=${afsdbdir='${localstatedir}/openafs/db'}
1640     afslogsdir=${afslogsdir='${localstatedir}/openafs/logs'}
1641     afslocaldir=${afslocaldir='${localstatedir}/openafs'}
1642     afsbackupdir=${afsbackupdir='${localstatedir}/openafs/backup'}
1643     afsbosconfigdir=${afsbosconfigdir='${sysconfdir}/openafs'}
1644     afsdatadir=${afsdatadir='${datadir}/openafs'}
1645 fi
1646 AC_SUBST(afsconfdir)
1647 AC_SUBST(viceetcdir)
1648 AC_SUBST(afskerneldir)
1649 AC_SUBST(afssrvbindir)
1650 AC_SUBST(afssrvsbindir)
1651 AC_SUBST(afssrvlibexecdir)
1652 AC_SUBST(afsdbdir)
1653 AC_SUBST(afslogsdir)
1654 AC_SUBST(afslocaldir)
1655 AC_SUBST(afsbackupdir)
1656 AC_SUBST(afsbosconfigdir)
1657 AC_SUBST(afsdatadir)
1658
1659 if test "x$enable_kernel_module" = "xyes"; then
1660 ENABLE_KERNEL_MODULE=libafs
1661 fi
1662
1663 if test "x$enable_pthreaded_ubik" = "xyes"; then
1664 ENABLE_PTHREADED_UBIK=yes
1665 fi
1666
1667 AC_SUBST(VFSCK)
1668 AC_SUBST(AFS_SYSNAME)
1669 AC_SUBST(AFS_PARAM_COMMON)
1670 AC_SUBST(ENABLE_KERNEL_MODULE)
1671 AC_SUBST(ENABLE_PTHREADED_UBIK)
1672 AC_SUBST(LIB_AFSDB)
1673 AC_SUBST(LINUX_KERNEL_PATH)
1674 AC_SUBST(LINUX_KERNEL_BUILD)
1675 AC_SUBST(HOST_CPU)
1676 AC_SUBST(BSD_KERNEL_PATH)
1677 AC_SUBST(BSD_KERNEL_BUILD)
1678 AC_SUBST(LINUX_VERSION)
1679 AC_SUBST(MKAFS_OSTYPE)
1680 AC_SUBST(TOP_OBJDIR)
1681 AC_SUBST(TOP_SRCDIR)
1682 AC_SUBST(TOP_INCDIR)
1683 AC_SUBST(TOP_LIBDIR)
1684 AC_SUBST(DEST)
1685 AC_SUBST(DARWIN_INFOFILE)
1686 AC_SUBST(IRIX_BUILD_IP35)
1687 AC_SUBST(HTML_XSL)
1688 AC_SUBST(XSLTPROC)
1689 AC_SUBST(DOCBOOK2PDF)
1690 AC_SUBST(DOCBOOK_STYLESHEETS)
1691
1692 OPENAFS_OSCONF
1693 OPENAFS_FUSE
1694
1695 TOP_SRCDIR="${srcdir}/src"
1696 dnl
1697 dnl If we're using ./configure, need a more reasonable TOP_SRCDIR, since relative links don't work everywhere
1698 dnl
1699 case $TOP_SRCDIR in
1700         /*)
1701                 ;;
1702         *)
1703                 TOP_SRCDIR=`cd $TOP_SRCDIR; pwd`
1704                 ;;
1705 esac
1706
1707 TOP_OBJDIR="${SRCDIR_PARENT}"
1708 TOP_INCDIR="${SRCDIR_PARENT}/include"
1709 TOP_LIBDIR="${SRCDIR_PARENT}/lib"
1710 if test "${DEST}x" = "x"; then
1711         DEST="${SRCDIR_PARENT}/${AFS_SYSNAME}/dest"
1712 fi
1713
1714 HELPER_SPLINT="${TOP_SRCDIR}/helper-splint.sh"
1715 HELPER_SPLINTCFG="${TOP_SRCDIR}/splint.cfg"
1716 AC_SUBST(HELPER_SPLINT)
1717 AC_SUBST(HELPER_SPLINTCFG)
1718
1719 mkdir -p ${TOP_OBJDIR}/src/JAVA/libjafs
1720
1721 dnl Check to see if crypt lives in a different library
1722 AC_CHECK_LIB(crypt, crypt, LIB_crypt="-lcrypt")
1723 AC_SUBST(LIB_crypt)
1724
1725 dnl Check to see if the compiler support labels in structs
1726 AC_MSG_CHECKING(for label support in structs)
1727 AC_TRY_COMPILE([], [
1728 extern void osi_UFSOpen(void);
1729 struct labeltest {
1730    void (*open) (void);
1731 };
1732 struct labeltest struct_labeltest = {
1733    .open       = osi_UFSOpen,
1734 }
1735 ],
1736 [AC_MSG_RESULT(yes)
1737  AC_DEFINE(HAVE_STRUCT_LABEL_SUPPORT, 1, [Define to 1 if your compiler supports labels in structs.])
1738 ],
1739 [AC_MSG_RESULT(no)
1740 ])
1741
1742 AC_MSG_CHECKING([checking for dirfd])
1743 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1744 #ifdef HAVE_DIRENT_H
1745 #include <dirent.h>
1746 #endif
1747 ]],
1748         [[DIR *d = 0; dirfd(d);]])],
1749         [ac_rk_have_dirfd=yes], [ac_rk_have_dirfd=no])
1750 if test "$ac_rk_have_dirfd" = "yes" ; then
1751         AC_DEFINE_UNQUOTED(HAVE_DIRFD, 1, [have a dirfd function/macro])
1752 fi
1753 AC_MSG_RESULT($ac_rk_have_dirfd)
1754
1755 OPENAFS_HAVE_STRUCT_FIELD(DIR, dd_fd, [#include <sys/types.h>
1756 #ifdef HAVE_DIRENT_H
1757 #include <dirent.h>
1758 #endif])
1759
1760 dnl Eventually, this will look for the system one, or for OpenSSL
1761 LIB_hcrypto="-lafshcrypto"
1762 LDFLAGS_hcrypto="-L\$(TOP_LIBDIR)"
1763 AC_SUBST(LIB_hcrypto)
1764 AC_SUBST(LDFLAGS_hcrypto)
1765 ])
1766
1767 AC_DEFUN([SUMMARY], [
1768     # Print a configuration summary
1769 echo 
1770 echo "**************************************"
1771 echo configure summary
1772 echo
1773 AS_IF([test $LIB_curses],[
1774 echo "LIB_curses :                $LIB_curses" ],[
1775 echo "XXX LIB_curses  not found! not building scout and afsmonitor!"
1776 ])
1777 echo 
1778 echo "**************************************"
1779 ])