Add src/tests/OpenAFS/Dirpath.sh to .gitignore
[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 #undef HAVE_ARPA_NAMESER_COMPAT_H
63 /* glue for RedHat kernel bug */
64 #undef ENABLE_REDHAT_BUILDSYS
65 #if defined(ENABLE_REDHAT_BUILDSYS) && defined(KERNEL) && defined(REDHAT_FIX)
66 #include "redhat-fix.h"
67 #endif])
68
69 AC_CANONICAL_HOST
70 SRCDIR_PARENT=`pwd`
71
72 #BOZO_SAVE_CORES pam
73
74 dnl System identity.
75 AC_ARG_WITH([afs-sysname],
76     [AS_HELP_STRING([--with-afs-sysname=sys], [use sys for the afs sysname])])
77
78 dnl General feature options.
79 AC_ARG_ENABLE([pam],
80     [AS_HELP_STRING([--disable-pam], [disable PAM support])],
81     ,
82     [enable_pam="yes"])
83 AC_ARG_ENABLE([namei-fileserver],
84     [AS_HELP_STRING([--enable-namei-fileserver],
85         [force compilation of namei fileserver in preference to inode
86          fileserver])],
87     , 
88     [enable_namei_fileserver="default"])
89 AC_ARG_ENABLE([cache-bypass],
90     [AS_HELP_STRING([--enable-cache-bypass],
91         [enable client support for cache bypass])],
92     , 
93     [enable_cache_bypass="no"])
94 AC_ARG_ENABLE([supergroups],
95     [AS_HELP_STRING([--enable-supergroups],
96         [enable support for nested pts groups])],
97     , 
98     [enable_supergroups="no"])
99 AC_ARG_ENABLE([fast-restart],
100     [AS_HELP_STRING([--enable-fast-restart],
101         [enable fast startup of file server without salvaging])],
102     , 
103     [enable_fast_restart="no"])
104 AC_ARG_ENABLE([bitmap-later],
105     [AS_HELP_STRING([--enable-bitmap-later],
106         [enable fast startup of file server by not reading bitmap till
107          needed])],
108     , 
109     [enable_bitmap_later="no"])
110 AC_ARG_ENABLE([demand-attach-fs],
111     [AS_HELP_STRING([--enable-demand-attach-fs],
112         [enable Demand Attach Fileserver (please see documentation)])],
113     , 
114     [enable_demand_attach_fs="no"])
115 AC_ARG_ENABLE([disconnected],
116     [AS_HELP_STRING([--enable-disconnected],
117         [enable disconnected support in cache manager (experimental)])],
118     , 
119     [enable_disconnected="no"])
120 AC_ARG_ENABLE([unix-sockets],
121     [AS_HELP_STRING([--enable-unix-sockets],
122         [enable use of unix domain sockets for fssync])],
123     ,
124     [enable_unix_sockets="yes"])
125 AC_ARG_ENABLE([icmp-pmtu-discovery],
126     [AS_HELP_STRING([--enable-icmp-pmtu-discovery],
127         [enable path MTU discovery by decoding ICMP unreachable replies])],
128     , 
129     [enable_icmp_pmtu_discovery="no"])
130 AC_ARG_ENABLE([tivoli-tsm],
131     [AS_HELP_STRING([--enable-tivoli-tsm],
132         [enable use of the Tivoli TSM API libraries for butc support])],
133     , 
134     [enable_tivoli_tsm="no"])
135 AC_ARG_ENABLE([pthreaded-ubik],
136     [AS_HELP_STRING([--enable-pthreaded-ubik],
137         [enable installation of pthreaded ubik applications (defaults to
138          disabled)])],
139     ,
140     [enable_pthreaded_ubik="no"])
141
142 dnl Kernel module build options.
143 AC_ARG_WITH([dux-kernel-headers],
144     [AS_HELP_STRING([--with-dux-kernel-headers=path],
145         [use the kernel headers found at path (optional, defaults to first
146          match in /usr/sys)])])
147 AC_ARG_WITH([linux-kernel-headers],
148     [AS_HELP_STRING([--with-linux-kernel-headers=path],
149         [use the kernel headers found at path (optional, defaults to
150          /usr/src/linux-2.4, then /usr/src/linux)])])
151 AC_ARG_WITH([linux-kernel-build],
152     [AS_HELP_STRING([--with-linux-kernel-build=path],
153         [use the kernel build found at path(optional, defaults to 
154         /usr/src/linux-2.4, then /usr/src/linux)])])
155 AC_ARG_WITH([bsd-kernel-headers],
156     [AS_HELP_STRING([--with-bsd-kernel-headers=path],
157         [use the kernel headers found at path (optional, defaults to
158          /usr/src/sys)])])
159 AC_ARG_WITH([bsd-kernel-build],
160     [AS_HELP_STRING([--with-bsd-kernel-build=path], 
161         [use the kernel build found at path (optional, defaults to
162          KSRC/i386/compile/GENERIC)])])
163 AC_ARG_WITH([linux-kernel-packaging],
164     [AS_HELP_STRING([--with-linux-kernel-packaging],
165         [use standard naming conventions to aid Linux kernel build packaging
166          (disables MPS, sets the kernel module name to openafs.ko, and
167          installs kernel modules into the standard Linux location)])],
168     [AC_SUBST(LINUX_KERNEL_PACKAGING, "yes")
169      AC_SUBST(LINUX_LIBAFS_NAME, "openafs")],
170     [AC_SUBST(LINUX_LIBAFS_NAME, "libafs")])
171 AC_ARG_ENABLE([kernel-module],
172     [AS_HELP_STRING([--disable-kernel-module],
173         [disable compilation of the kernel module (defaults to enabled)])],
174     , 
175     [enable_kernel_module="yes"])
176 AC_ARG_ENABLE([redhat-buildsys],
177     [AS_HELP_STRING([--enable-redhat-buildsys],
178         [enable compilation of the redhat build system kernel (defaults to
179          disabled)])],
180     ,
181     [enable_redhat_buildsys="no"])
182
183 dnl Installation locations.
184 AC_ARG_ENABLE([transarc-paths],
185     [AS_HELP_STRING([--enable-transarc-paths],
186         [use Transarc style paths like /usr/afs and /usr/vice])],
187     , 
188     [enable_transarc_paths="no"])
189
190 dnl Optimization and debugging flags.
191 AC_ARG_ENABLE([strip-binaries],
192     [AS_HELP_STRING([--disable-strip-binaries],
193         [disable stripping of symbol information from binaries (defaults to
194          enabled)])],
195     ,
196     [enable_strip_binaries="maybe"])
197 AC_ARG_ENABLE([debug],
198     [AS_HELP_STRING([--enable-debug],
199         [enable compilation of the user space code with debugging information
200          (defaults to disabled)])],
201     , 
202     [enable_debug="no"])
203 AC_ARG_ENABLE([optimize],
204     [AS_HELP_STRING([--disable-optimize],
205         [disable optimization for compilation of the user space code (defaults
206          to enabled)])],
207     , 
208     [enable_optimize="yes"])
209 AC_ARG_ENABLE([warnings],
210     [AS_HELP_STRING([--enable-warnings],
211         [enable compilation warnings when building with gcc (defaults to
212          disabled)])],
213     ,
214     [enable_warnings="no"])
215 AC_ARG_ENABLE([checking],
216     [AS_HELP_STRING([--enable-checking],
217         [turn compilation warnings into errors when building with gcc (defaults
218          to disabled)])],
219     [enable_checking="$enableval"],
220     [enable_checking="no"])
221 AC_ARG_ENABLE([debug-kernel],
222     [AS_HELP_STRING([--enable-debug-kernel],
223         [enable compilation of the kernel module with debugging information
224          (defaults to disabled)])],
225     ,
226     [enable_debug_kernel="no"])
227 AC_ARG_ENABLE([optimize-kernel],
228     [AS_HELP_STRING([--disable-optimize-kernel],
229         [disable compilation of the kernel module with optimization (defaults
230          based on platform)])],
231     , 
232     [enable_optimize_kernel="yes"])
233 AC_ARG_ENABLE([debug-lwp],
234     [AS_HELP_STRING([--enable-debug-lwp],
235         [enable compilation of the LWP code with debugging information
236          (defaults to disabled)])],
237     ,
238     [enable_debug_lwp="no"])
239 AC_ARG_ENABLE([optimize-lwp],
240     [AS_HELP_STRING([--disable-optimize-lwp],
241         [disable optimization for compilation of the LWP code (defaults to
242          enabled)])],
243     ,
244     [enable_optimize_lwp="yes"])
245 AC_ARG_ENABLE([debug-pam],
246     [AS_HELP_STRING([--enable-debug-pam],
247         [enable compilation of the PAM code with debugging information
248          (defaults to disabled)])],
249     ,
250     [enable_debug_pam="no"])
251 AC_ARG_ENABLE([optimize-pam],
252     [AS_HELP_STRING([--disable-optimize-pam],
253         [disable optimization for compilation of the PAM code (defaults to
254          enabled)])],
255     ,
256     [enable_optimize_pam="yes"])
257 AC_ARG_ENABLE([linux-syscall-probing],
258     [AS_HELP_STRING([--enable-linux-syscall-probing],
259         [enable Linux syscall probing (defaults to autodetect)])],
260     ,
261     [enable_linux_syscall_probing="maybe"])
262     
263
264 AC_ARG_WITH([xslt-processor],
265         AS_HELP_STRING([--with-xslt-processor=ARG],
266         [which XSLT processor to use (possible choices are: libxslt, saxon, xalan-j, xsltproc)]),
267         XSLTPROC="$withval",
268         XSLTPROC="libxslt")
269
270 AC_ARG_WITH([html-xsl], 
271         AS_HELP_STRING([--with-html-xsl],
272         [build HTML documentation using Norman Walsh's DocBook XSL stylesheets (default is no; specify a path to chunk.xsl or docbook.xsl)]),
273         HTML_XSL="$withval",
274         HTML_XSL=no)
275
276 enable_login="no"
277
278 dnl weird ass systems
279 dnl AC_AIX
280 AC_ISC_POSIX
281 dnl AC_MINIX
282
283 dnl Various compiler setup.
284 AC_TYPE_PID_T
285 AC_TYPE_SIZE_T
286
287 dnl Checks for programs.
288 AC_PROG_INSTALL
289 AC_PROG_LN_S
290 AC_PROG_RANLIB
291 AC_PROG_YACC
292 AM_PROG_LEX
293
294 OPENAFS_CHECK_BIGENDIAN
295 OPENAFS_PRINTF_TAKES_Z_LEN
296
297 AC_MSG_CHECKING(your OS)
298 system=$host
299 case $system in
300         *-linux*)
301
302                 MKAFS_OSTYPE=LINUX
303                 if test "x$enable_redhat_buildsys" = "xyes"; then
304                  AC_DEFINE(ENABLE_REDHAT_BUILDSYS, 1, [define if you have redhat buildsystem])
305                 fi
306                 if test "x$enable_kernel_module" = "xyes"; then
307                  if test "x$with_linux_kernel_headers" != "x"; then
308                    LINUX_KERNEL_PATH="$with_linux_kernel_headers"
309                  else
310                    LINUX_KERNEL_PATH="/lib/modules/`uname -r`/source"
311                    if test ! -f "$LINUX_KERNEL_PATH/include/linux/version.h"; then
312                      LINUX_KERNEL_PATH="/lib/modules/`uname -r`/build"
313                    fi
314                    if test ! -f "$LINUX_KERNEL_PATH/include/linux/version.h"; then
315                      LINUX_KERNEL_PATH="/usr/src/linux-2.4"
316                    fi
317                    if test ! -f "$LINUX_KERNEL_PATH/include/linux/version.h"; then
318                      LINUX_KERNEL_PATH="/usr/src/linux"
319                    fi
320                  fi
321                  if test "x$with_linux_kernel_build" != "x"; then
322                          LINUX_KERNEL_BUILD="$with_linux_kernel_build"
323                  else
324                    LINUX_KERNEL_BUILD=$LINUX_KERNEL_PATH
325                  fi
326                  if test -f "$LINUX_KERNEL_BUILD/include/generated/utsrelease.h"; then
327                    linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_BUILD/include/generated/utsrelease.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -n 1`
328                    LINUX_VERSION="$linux_kvers"
329                  else
330                    if test -f "$LINUX_KERNEL_BUILD/include/linux/utsrelease.h"; then
331                      linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_BUILD/include/linux/utsrelease.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -n 1`
332                      LINUX_VERSION="$linux_kvers"
333                    else
334                      if test -f "$LINUX_KERNEL_BUILD/include/linux/version.h"; then
335                        linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_BUILD/include/linux/version.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -n 1`
336                        if test "x$linux_kvers" = "x"; then
337                          if test -f "$LINUX_KERNEL_BUILD/include/linux/version-up.h"; then
338                            linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_BUILD/include/linux/version-up.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -n 1`
339                            if test "x$linux_kvers" = "x"; then
340                              AC_MSG_ERROR(Linux headers lack version definition [2])
341                              exit 1
342                            else
343                              LINUX_VERSION="$linux_kvers"
344                            fi
345                          else
346                            AC_MSG_ERROR(Linux headers lack version definition)
347                            exit 1
348                          fi
349                        else
350                          LINUX_VERSION="$linux_kvers"
351                        fi
352                      else
353                        enable_kernel_module="no"
354                      fi
355                    fi
356                  fi
357                  if test ! -f "$LINUX_KERNEL_BUILD/include/generated/autoconf.h" &&
358                     test ! -f "$LINUX_KERNEL_BUILD/include/linux/autoconf.h"; then
359                      enable_kernel_module="no"
360                  fi
361                  if test "x$enable_kernel_module" = "xno"; then
362                   if test "x$with_linux_kernel_headers" != "x"; then
363                    AC_MSG_ERROR(No usable linux headers found at $LINUX_KERNEL_PATH)
364                    exit 1
365                   else
366                    AC_MSG_WARN(No usable linux headers found at $LINUX_KERNEL_PATH so disabling kernel module)
367                   fi
368                  fi
369                  dnl do we need to determine SUBARCH from autoconf.h
370                  SUBARCH=default
371                 fi
372                 AC_MSG_RESULT(linux)
373                 if test "x$enable_kernel_module" = "xyes"; then
374                  AFS_SYSKVERS=`echo $LINUX_VERSION | awk -F\. '{print $[]1 $[]2}'`
375                  if test "x${AFS_SYSKVERS}" = "x"; then
376                   AC_MSG_ERROR(Couldn't guess your Linux version [2])
377                  fi
378                 fi
379                 ;;
380         *-solaris*)
381                 MKAFS_OSTYPE=SOLARIS
382                 AC_MSG_RESULT(sun4)
383                 AC_PATH_PROG(SOLARISCC, [cc], ,
384                     [/opt/SUNWspro/bin:/opt/SunStudioExpress/bin])
385                 SOLARIS_UFSVFS_HAS_DQRWLOCK
386                 SOLARIS_FS_HAS_FS_ROLLED
387                 SOLARIS_SOLOOKUP_TAKES_SOCKPARAMS
388                 ;;
389         *-sunos*)
390                 MKAFS_OSTYPE=SUNOS
391                 enable_kernel_module=no
392                 AC_MSG_RESULT(sun4)
393                 ;;
394         *-hpux*)
395                 MKAFS_OSTYPE=HPUX
396                 AC_MSG_RESULT(hp_ux)
397                 if test -f "/usr/old/usr/include/ndir.h"; then
398                  AC_DEFINE(HAVE_USR_OLD_USR_INCLUDE_NDIR_H, 1, [define if you have old ndir.h])
399                 fi
400                 ;;
401         *-irix*)
402                 if test -d /usr/include/sys/SN/SN1; then
403                  IRIX_BUILD_IP35="IP35"
404                 fi
405                 MKAFS_OSTYPE=IRIX
406                 AC_MSG_RESULT(sgi)
407                 ;;
408         *-aix*)
409                 MKAFS_OSTYPE=AIX
410                 AC_MSG_RESULT(rs_aix)
411                 ;;
412         *-osf*)
413                 MKAFS_OSTYPE=DUX
414                 AC_MSG_RESULT(alpha_dux)
415                 ;;
416         powerpc-*-darwin*)
417                 MKAFS_OSTYPE=DARWIN
418                 AC_MSG_RESULT(ppc_darwin)
419                 ;;
420         i386-*-darwin*)
421                 MKAFS_OSTYPE=DARWIN
422                 AC_MSG_RESULT(x86_darwin)
423                 ;;
424         i386-*-freebsd*)
425                 MKAFS_OSTYPE=FBSD
426                 AC_MSG_RESULT(i386_fbsd)
427                 ;;
428         x86_64-*-freebsd*)
429                 MKAFS_OSTYPE=FBSD
430                 AC_MSG_RESULT(amd64_fbsd)
431                 ;;
432         *-netbsd*)
433                 MKAFS_OSTYPE=NBSD
434                 AC_MSG_RESULT(nbsd)
435                 ;;
436         x86_64-*-openbsd*)
437                 MKAFS_OSTYPE=OBSD
438                 AC_MSG_RESULT(amd64_obsd)
439                 ;;
440         i386-*-openbsd*)
441                 MKAFS_OSTYPE=OBSD
442                 AC_MSG_RESULT(i386_obsd)
443                 ;;
444         *-dragonfly*)
445                 MKAFS_OSTYPE=DFBSD
446                 AC_MSG_RESULT(i386_dfbsd)
447                 ;;
448         *)
449                 AC_MSG_RESULT($system)
450                 ;;
451 esac
452
453 if test "x$with_afs_sysname" != "x"; then
454         AFS_SYSNAME="$with_afs_sysname"
455 else
456         AC_MSG_CHECKING(your AFS sysname)
457         case $host in
458                 i?86-*-openbsd?.?)
459                         v=${host#*openbsd}
460                         vM=${v%.*}
461                         vm=${v#*.}
462                         AFS_SYSNAME="i386_obsd${vM}${vm}"
463                         ;;
464                 sparc64-*-openbsd?.?)
465                         v=${host#*openbsd}
466                         vM=${v%.*}
467                         vm=${v#*.}
468                         AFS_SYSNAME="sparc64_obsd${vM}${vm}"
469                         ;;
470                 x86_64-*-openbsd?.?)
471                         v=${host#*openbsd}
472                         vM=${v%.*}
473                         vm=${v#*.}
474                         AFS_SYSNAME="amd64_obsd${vM}${vm}"
475                         ;;
476                 i?86-*-freebsd?.*)
477                         v=${host#*freebsd}
478                         vM=${v%.*}
479                         vm=${v#*.}
480                         AFS_SYSNAME="i386_fbsd_${vM}${vm}"
481                         ;;
482                 x86_64-*-freebsd?.*)
483                         v=${host#*freebsd}
484                         vM=${v%.*}
485                         vm=${v#*.}
486                         AFS_SYSNAME="amd64_fbsd_${vM}${vm}"
487                         ;;
488                 i386-*-dragonfly2.2*)
489                         AFS_SYSNAME="i386_dfbsd_23"
490                         ;;
491                 i386-*-dragonfly2.3*)
492                         AFS_SYSNAME="i386_dfbsd_23"
493                         ;;
494                 i?86-*-netbsd*1.6[[M-Z]]*)
495                         AFS_SYSNAME="i386_nbsd20"
496                         ;;
497                 powerpc-*-netbsd*1.6[[M-Z]]*)
498                         AFS_SYSNAME="ppc_nbsd20"
499                         ;;
500                 *-*-netbsd*)
501                         arch=${host%%-unknown*}
502                         arch=$(echo $arch |sed -e 's/x86_64/amd64/g' \
503                                                -e 's/powerpc/ppc/g')
504                         v=${host#*netbsd}
505                         v=${v#*aout}
506                         v=${v#*ecoff}
507                         v=${v#*elf}
508                         vM=${v%%.*}
509                         vM=${vM%.*}
510                         v=${v#*.}
511                         vm=${v%%.*}
512                         vm=${vm%.*}
513                         vm=${vm%%[[_A-Z]]*}
514                         if test $vm -eq 99 ; then
515                                 vM=$((vM+1))
516                         fi
517                         if test $vM -gt 1 ; then
518                                 vm=0
519                         fi
520                         AFS_SYSNAME="${arch}_nbsd${vM}${vm}"
521                         ;;
522                 hppa*-hp-hpux11.0*)
523                         AFS_SYSNAME="hp_ux110"
524                         ;;
525                 hppa*-hp-hpux11.11)
526                         AFS_SYSNAME="hp_ux11i"
527                         ;;
528                 hppa*-hp-hpux11.23)
529                         AFS_SYSNAME="hp_ux1123"
530                         ;;
531                 ia64-hp-hpux11.22)
532                         AFS_SYSNAME="ia64_hpux1122"
533                         ;;
534                 ia64-hp-hpux*)
535                         AFS_SYSNAME="ia64_hpux1123"
536                         ;;
537                 hppa*-hp-hpux10*)
538                         AFS_SYSNAME="hp_ux102"
539                         ;;
540                 powerpc-apple-darwin7*)
541                         AFS_SYSNAME="ppc_darwin_70"
542                         ;;
543                 powerpc-apple-darwin8.*)
544                         AFS_SYSNAME="ppc_darwin_80"
545                         ;;
546                 i386-apple-darwin8.*)
547                         AFS_SYSNAME="x86_darwin_80"
548                         ;;
549                 powerpc-apple-darwin9.*)
550                         AFS_SYSNAME="ppc_darwin_90"
551                         ;;
552                 i386-apple-darwin9.*)
553                         AFS_SYSNAME="x86_darwin_90"
554                         ;;
555                 i?86-apple-darwin10.*)
556                         AFS_SYSNAME="x86_darwin_100"
557                         ;;
558                 sparc-sun-solaris2.5*)
559                         AFS_SYSNAME="sun4x_55"
560                         enable_login="yes"
561                         ;;
562                 sparc-sun-solaris2.6)
563                         AFS_SYSNAME="sun4x_56"
564                         ;;
565                 sparc-sun-solaris2.7)
566                         AFS_SYSNAME="sun4x_57"
567                         ;;
568                 sparc-sun-solaris2.8)
569                         AFS_SYSNAME="sun4x_58"
570                         ;;
571                 sparc-sun-solaris2.9)
572                         AFS_SYSNAME="sun4x_59"
573                         ;;
574                 sparc-sun-solaris2.10)
575                         AFS_SYSNAME="sun4x_510"
576                         ;;
577                 sparc-sun-solaris2.11)
578                         AFS_SYSNAME="sun4x_511"
579                         ;;
580                 sparc-sun-sunos4*)
581                         AFS_SYSNAME="sun4_413"
582                         enable_login="yes"
583                         ;;
584                 i386-pc-solaris2.7)
585                         AFS_SYSNAME="sunx86_57"
586                         ;;
587                 i386-pc-solaris2.8)
588                         AFS_SYSNAME="sunx86_58"
589                         ;;
590                 i386-pc-solaris2.9)
591                         AFS_SYSNAME="sunx86_59"
592                         ;;
593                 i386-pc-solaris2.10)
594                         AFS_SYSNAME="sunx86_510"
595                         ;;
596                 i386-pc-solaris2.11)
597                         AFS_SYSNAME="sunx86_511"
598                         ;;
599                 alpha*-dec-osf4.0*)
600                         AFS_SYSNAME="alpha_dux40"
601                         ;;
602                 alpha*-dec-osf5.0*)
603                         AFS_SYSNAME="alpha_dux50"
604                         ;;
605                 alpha*-dec-osf5.1*)
606                         AFS_SYSNAME="alpha_dux51"
607                         ;;
608                 mips-sgi-irix6.5)
609                         AFS_SYSNAME="sgi_65"
610                         ;;
611                 ia64-*-linux*)
612                         AFS_SYSNAME="ia64_linuxXX"
613                         ;;
614                 powerpc-*-linux*)
615                         AFS_SYSNAME="`/bin/arch`_linuxXX"
616                         ;;
617                 powerpc64-*-linux*)
618                         AFS_SYSNAME="ppc64_linuxXX"
619                         ;;
620                 alpha*-linux*)
621                         AFS_SYSNAME="alpha_linux_XX"
622                         ;;
623                 s390-*-linux*)
624                         AFS_SYSNAME="s390_linuxXX"
625                         ;;
626                 s390x-*-linux*)
627                         AFS_SYSNAME="s390x_linuxXX"
628                         ;;
629                 sparc-*-linux*)
630                         AFS_SYSNAME="`/bin/arch`_linuxXX"
631                         ;;
632                 sparc64-*-linux*)
633                         AFS_SYSNAME="sparc64_linuxXX"
634                         ;;
635                 i?86-*-linux*)
636                         AFS_SYSNAME="i386_linuxXX"
637                         ;;
638                 arm*-linux*)
639                         AFS_SYSNAME="arm_linuxXX"
640                         ;;
641                 parisc-*-linux-gnu|hppa-*-linux-gnu)
642                         AFS_SYSNAME="parisc_linuxXX"
643                         enable_pam="no"
644                         ;;
645                 power*-ibm-aix4.2*)
646                         AFS_SYSNAME="rs_aix42"
647                         enable_pam="no"
648                         ;;
649                 power*-ibm-aix4.3*)
650                         AFS_SYSNAME="rs_aix42"
651                         enable_pam="no"
652                         ;;
653                 power*-ibm-aix5.1*)
654                         AFS_SYSNAME="rs_aix51"
655                         enable_pam="no"
656                         ;;
657                 power*-ibm-aix5.2*)
658                         AFS_SYSNAME="rs_aix52"
659                         enable_pam="no"
660                         ;;
661                 power*-ibm-aix5.3*)
662                         AFS_SYSNAME="rs_aix53"
663                         enable_pam="no"
664                         ;;
665                 power*-ibm-aix6.1*)
666                         AFS_SYSNAME="rs_aix61"
667                         enable_pam="no"
668                         ;;
669                 x86_64-*-linux-gnu)
670                         AFS_SYSNAME="amd64_linuxXX"
671                         enable_pam="yes"
672                         ;;
673                 *)
674                         AC_MSG_ERROR(An AFS sysname is required)
675                         exit 1
676                         ;;
677         esac
678         case $AFS_SYSNAME in
679                 *_linux* | *_umlinux*)
680                         if test "x${AFS_SYSKVERS}" = "x"; then
681                          AC_MSG_ERROR(Couldn't guess your Linux version. Please use the --with-afs-sysname option to configure an AFS sysname.)
682                         fi
683                         _AFS_SYSNAME=`echo $AFS_SYSNAME|sed s/XX\$/$AFS_SYSKVERS/`
684                         AFS_SYSNAME="$_AFS_SYSNAME"
685                         AC_TRY_KBUILD(
686                          [],
687                          [#ifndef CONFIG_USERMODE
688                           #error not UML
689                           #endif],
690                          ac_cv_linux_is_uml=yes,)
691                         if test "${ac_cv_linux_is_uml}" = yes; then
692                          _AFS_SYSNAME=`echo $AFS_SYSNAME|sed s/linux/umlinux/`
693                         fi
694                         AFS_SYSNAME="$_AFS_SYSNAME"
695                         ;;
696         esac
697         AC_MSG_RESULT($AFS_SYSNAME)
698 fi
699
700 case $AFS_SYSNAME in
701         *_darwin*)
702                 DARWIN_PLIST=src/libafs/afs.${AFS_SYSNAME}.plist
703                 DARWIN_INFOFILE=afs.${AFS_SYSNAME}.plist
704                 ;;
705 esac
706
707 dnl Some hosts have a separate common param file they should include.  Figure
708 dnl out if we're on one of them now that we know the sysname.
709 case $AFS_SYSNAME in
710     *_nbsd15)   AFS_PARAM_COMMON=param.nbsd15.h  ;;
711     *_nbsd16)   AFS_PARAM_COMMON=param.nbsd16.h  ;;
712     *_nbsd20)   AFS_PARAM_COMMON=param.nbsd20.h  ;;
713     *_nbsd21)   AFS_PARAM_COMMON=param.nbsd21.h  ;;
714     *_nbsd30)   AFS_PARAM_COMMON=param.nbsd30.h  ;;
715     *_nbsd40)   AFS_PARAM_COMMON=param.nbsd40.h  ;;
716     *_nbsd50)   AFS_PARAM_COMMON=param.nbsd50.h  ;;
717     *_obsd31)   AFS_PARAM_COMMON=param.obsd31.h  ;;
718     *_obsd32)   AFS_PARAM_COMMON=param.obsd32.h  ;;
719     *_obsd33)   AFS_PARAM_COMMON=param.obsd33.h  ;;
720     *_obsd34)   AFS_PARAM_COMMON=param.obsd34.h  ;;
721     *_obsd35)   AFS_PARAM_COMMON=param.obsd35.h  ;;
722     *_obsd36)   AFS_PARAM_COMMON=param.obsd36.h  ;;
723     *_obsd37)   AFS_PARAM_COMMON=param.obsd37.h  ;;
724     *_obsd38)   AFS_PARAM_COMMON=param.obsd38.h  ;;
725     *_obsd39)   AFS_PARAM_COMMON=param.obsd39.h  ;;
726     *_obsd40)   AFS_PARAM_COMMON=param.obsd40.h  ;;
727     *_obsd41)   AFS_PARAM_COMMON=param.obsd41.h  ;;
728     *_obsd42)   AFS_PARAM_COMMON=param.obsd42.h  ;;
729     *_obsd43)   AFS_PARAM_COMMON=param.obsd43.h  ;;
730     *_obsd44)   AFS_PARAM_COMMON=param.obsd44.h  ;;
731     *_obsd45)   AFS_PARAM_COMMON=param.obsd45.h  ;;
732     *_obsd46)   AFS_PARAM_COMMON=param.obsd46.h  ;;
733     *_linux22)  AFS_PARAM_COMMON=param.linux22.h ;;
734     *_linux24)  AFS_PARAM_COMMON=param.linux24.h ;;
735     *_linux26)  AFS_PARAM_COMMON=param.linux26.h ;;
736 # Linux alpha adds an extra underscore for no good reason.
737     *_linux_22) AFS_PARAM_COMMON=param.linux22.h ;;
738     *_linux_24) AFS_PARAM_COMMON=param.linux24.h ;;
739     *_linux_26) AFS_PARAM_COMMON=param.linux26.h ;;
740 esac
741
742 case $AFS_SYSNAME in *_linux* | *_umlinux*)
743
744                 # Add (sub-) architecture-specific paths needed by conftests
745                 case $AFS_SYSNAME  in
746                         *_umlinux26)
747                                 UMLINUX26_FLAGS="-I$LINUX_KERNEL_PATH/arch/um/include"
748                                 UMLINUX26_FLAGS="$UMLINUX26_FLAGS -I$LINUX_KERNEL_PATH/arch/um/kernel/tt/include"
749                                 UMLINUX26_FLAGS="$UMLINUX26_FLAGS -I$LINUX_KERNEL_PATH/arch/um/kernel/skas/include"
750                                 CPPFLAGS="$CPPFLAGS $UMLINUX26_FLAGS"
751                 esac
752
753                 if test "x$enable_kernel_module" = "xyes"; then
754                  if test "x$enable_debug_kernel" = "xno"; then
755                         LINUX_GCC_KOPTS="$LINUX_GCC_KOPTS -fomit-frame-pointer"
756                  fi
757                  OPENAFS_GCC_SUPPORTS_MARCH
758                  AC_SUBST(P5PLUS_KOPTS)
759                  OPENAFS_GCC_NEEDS_NO_STRENGTH_REDUCE
760                  OPENAFS_GCC_NEEDS_NO_STRICT_ALIASING
761                  OPENAFS_GCC_SUPPORTS_NO_COMMON
762                  OPENAFS_GCC_SUPPORTS_PIPE
763                  AC_SUBST(LINUX_GCC_KOPTS)
764
765                  dnl Setup the kernel build environment
766                  LINUX_KBUILD_USES_EXTRA_CFLAGS
767                  LINUX_KERNEL_COMPILE_WORKS
768
769                  dnl Check for header files
770                  AC_CHECK_LINUX_HEADER([config.h])
771                  AC_CHECK_LINUX_HEADER([completion.h])
772                  AC_CHECK_LINUX_HEADER([exportfs.h])
773                  AC_CHECK_LINUX_HEADER([freezer.h])
774                  AC_CHECK_LINUX_HEADER([key-type.h])
775                  AC_CHECK_LINUX_HEADER([semaphore.h])
776                  AC_CHECK_LINUX_HEADER([seq_file.h])
777
778                  dnl Check for structure elements
779                  AC_CHECK_LINUX_STRUCT([address_space_operations],
780                                        [write_begin], [fs.h])
781                  AC_CHECK_LINUX_STRUCT([backing_dev_info], [name],
782                                        [backing-dev.h])
783                  AC_CHECK_LINUX_STRUCT([ctl_table], [ctl_name], [sysctl.h])
784                  AC_CHECK_LINUX_STRUCT([inode], [i_alloc_sem], [fs.h])
785                  AC_CHECK_LINUX_STRUCT([inode], [i_blkbits], [fs.h])
786                  AC_CHECK_LINUX_STRUCT([inode], [i_blksize], [fs.h])
787                  AC_CHECK_LINUX_STRUCT([inode], [i_mutex], [fs.h])
788                  AC_CHECK_LINUX_STRUCT([inode], [i_security], [fs.h])
789                  AC_CHECK_LINUX_STRUCT([file_operations], [flock], [fs.h])
790                  AC_CHECK_LINUX_STRUCT([file_operations], [sendfile], [fs.h])
791                  AC_CHECK_LINUX_STRUCT([nameidata], [path], [namei.h])
792                  AC_CHECK_LINUX_STRUCT([proc_dir_entry], [owner], [proc_fs.h])
793                  AC_CHECK_LINUX_STRUCT([super_block], [s_bdi], [fs.h])
794                  AC_CHECK_LINUX_STRUCT([super_operations], [alloc_inode],
795                                        [fs.h])
796                  AC_CHECK_LINUX_STRUCT([task_struct], [cred], [sched.h])
797                  AC_CHECK_LINUX_STRUCT([task_struct], [exit_state], [sched.h])
798                  AC_CHECK_LINUX_STRUCT([task_struct], [parent], [sched.h])
799                  AC_CHECK_LINUX_STRUCT([task_struct], [real_parent], [sched.h])
800                  AC_CHECK_LINUX_STRUCT([task_struct], [rlim], [sched.h])
801                  AC_CHECK_LINUX_STRUCT([task_struct], [sig], [sched.h])
802                  AC_CHECK_LINUX_STRUCT([task_struct], [sighand], [sched.h])
803                  AC_CHECK_LINUX_STRUCT([task_struct], [sigmask_lock], [sched.h])
804                  AC_CHECK_LINUX_STRUCT([task_struct], [tgid], [sched.h])
805                  AC_CHECK_LINUX_STRUCT([task_struct], [thread_info], [sched.h])
806                  LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM
807
808                  dnl Function existence checks
809
810                  AC_CHECK_LINUX_FUNC([bdi_init],
811                                      [#include <linux/backing-dev.h>],
812                                      [bdi_init(NULL);])
813                  AC_CHECK_LINUX_FUNC([PageChecked],
814                                      [#include <linux/mm.h>
815 #include <linux/page-flags.h>],
816                                      [struct page *_page;
817                                       int bchecked = PageChecked(_page);])
818                  AC_CHECK_LINUX_FUNC([PageFsMisc],
819                                      [#include <linux/mm.h>
820 #include <linux/page-flags.h>],
821                                      [struct page *_page;
822                                       int bchecked = PageFsMisc(_page);])
823                  AC_CHECK_LINUX_FUNC([current_kernel_time],
824                                      [#include <linux/time.h>],
825                                      [struct timespec s;
826                                       s = current_kernel_time();])
827                  AC_CHECK_LINUX_FUNC([d_alloc_anon],
828                                      [#include <linux/dcache.h>],
829                                      [d_alloc_anon(NULL);])
830                  AC_CHECK_LINUX_FUNC([do_sync_read],
831                                      [#include <linux/fs.h>],
832                                      [do_sync_read(NULL, NULL, 0, NULL);])
833                  AC_CHECK_LINUX_FUNC([find_task_by_pid],
834                                      [#include <linux/sched.h>],
835                                      [pid_t p; find_task_by_pid(p);])
836                  AC_CHECK_LINUX_FUNC([generic_file_aio_read],
837                                      [#include <linux/fs.h>],
838                                      [generic_file_aio_read(NULL,NULL,0,0);])
839                  AC_CHECK_LINUX_FUNC([grab_cache_page_write_begin],
840                                      [#include <linux/pagemap.h>],
841                                      [grab_cache_page_write_begin(NULL, 0, 0);])
842                  AC_CHECK_LINUX_FUNC([hlist_unhashed],
843                                      [#include <linux/list.h>],
844                                      [hlist_unhashed(0);])
845                  AC_CHECK_LINUX_FUNC([i_size_read],
846                                      [#include <linux/fs.h>],
847                                      [i_size_read(NULL);])
848                  AC_CHECK_LINUX_FUNC([iget],
849                                      [#include <linux/fs.h>],
850                                      [iget(NULL, NULL);])
851                  AC_CHECK_LINUX_FUNC([kernel_setsockopt],
852                                      [#include <linux/net.h>],
853                                      [kernel_setsockopt(NULL, 0, 0, NULL, 0);])
854                  AC_CHECK_LINUX_FUNC([page_follow_link],
855                                      [#include <linux/fs.h>],
856                                      [page_follow_link(0,0);])
857                  AC_CHECK_LINUX_FUNC([page_offset],
858                                      [#include <linux/pagemap.h>],
859                                      [page_offset(NULL);])
860                  AC_CHECK_LINUX_FUNC([pagevec_lru_add_file],
861                                      [#include <linux/pagevec.h>],
862                                      [__pagevec_lru_add_file(NULL);])
863                  AC_CHECK_LINUX_FUNC([rcu_read_lock],
864                                      [#include <linux/rcupdate.h>],
865                                      [rcu_read_lock();])
866                  AC_CHECK_LINUX_FUNC([splice_direct_to_actor],
867                                      [#include <linux/splice.h>],
868                                      [splice_direct_to_actor(NULL,NULL,NULL);])
869                  AC_CHECK_LINUX_FUNC([svc_addr_in],
870                                      [#include <linux/sunrpc/svc.h>],
871                                      [svc_addr_in(NULL);])
872                  AC_CHECK_LINUX_FUNC([zero_user_segments],
873                                      [#include <linux/highmem.h>],
874                                      [zero_user_segments(NULL, 0, 0, 0, 0);])
875
876                  dnl Consequences - things which get set as a result of the
877                  dnl                above tests
878                  AS_IF([test "x$ac_cv_linux_func_iget" = "xno"],
879                        [AC_DEFINE([LINUX_USE_FH], 1,
880                           [define to use linux file handles for cache files])])
881                  AS_IF([test "x$ac_cv_linux_func_d_alloc_anon" = "xno"],
882                        [AC_DEFINE([AFS_NONFSTRANS], 1,
883                                   [define to disable the nfs translator])])
884
885                  dnl Assorted more complex tests
886                  LINUX_EXPORTS_PROC_ROOT_FS
887                  LINUX_KMEM_CACHE_INIT
888                  LINUX_HAVE_KMEM_CACHE_T
889                  LINUX_KMEM_CACHE_CREATE_TAKES_DTOR
890                  LINUX_KMEM_CACHE_CREATE_CTOR_TAKES_VOID
891                  LINUX_D_PATH_TAKES_STRUCT_PATH
892                  LINUX_NEW_EXPORT_OPS
893                  LINUX_INODE_SETATTR_RETURN_TYPE
894                  LINUX_IOP_I_CREATE_TAKES_NAMEIDATA
895                  LINUX_IOP_I_LOOKUP_TAKES_NAMEIDATA
896                  LINUX_IOP_I_PERMISSION_TAKES_NAMEIDATA
897                  LINUX_IOP_I_PUT_LINK_TAKES_COOKIE
898                  LINUX_DOP_D_REVALIDATE_TAKES_NAMEIDATA
899                  LINUX_FOP_F_FLUSH_TAKES_FL_OWNER_T
900                  LINUX_FOP_F_FSYNC_TAKES_DENTRY
901                  LINUX_AOP_WRITEBACK_CONTROL
902                  LINUX_FS_STRUCT_FOP_HAS_SPLICE
903                  LINUX_KERNEL_POSIX_LOCK_FILE_WAIT_ARG
904                  LINUX_POSIX_TEST_LOCK_RETURNS_CONFLICT
905                  LINUX_POSIX_TEST_LOCK_CONFLICT_ARG
906                  LINUX_KERNEL_SOCK_CREATE
907                  LINUX_EXPORTS_KEY_TYPE_KEYRING
908                  LINUX_KEYS_HAVE_SESSION_TO_PARENT
909                  LINUX_NEED_RHCONFIG
910                  LINUX_RECALC_SIGPENDING_ARG_TYPE
911                  LINUX_EXPORTS_TASKLIST_LOCK
912                  LINUX_GET_SB_HAS_STRUCT_VFSMOUNT
913                  LINUX_STATFS_TAKES_DENTRY
914                  LINUX_REFRIGERATOR
915                  LINUX_HAVE_TRY_TO_FREEZE
916                  LINUX_LINUX_KEYRING_SUPPORT
917                  LINUX_KEY_ALLOC_NEEDS_STRUCT_TASK
918                  LINUX_KEY_ALLOC_NEEDS_CRED
919                  LINUX_INIT_WORK_HAS_DATA
920                  LINUX_REGISTER_SYSCTL_TABLE_NOFLAG
921
922                  dnl If we are guaranteed that keyrings will work - that is
923                  dnl  a) The kernel has keyrings enabled
924                  dnl  b) The code is new enough to give us a key_type_keyring
925                  dnl then we just disable syscall probing unless we've been
926                  dnl told otherwise
927
928                  AS_IF([test "$enable_linux_syscall_probing" = "maybe"],
929                    [AS_IF([test "$ac_cv_linux_keyring_support" = "yes" -a "$ac_cv_linux_exports_key_type_keyring" = "yes"],
930                           [enable_linux_syscall_probing="no"],
931                           [enable_linux_syscall_probing="yes"])
932                  ])
933
934                  dnl Syscall probing needs a few tests of its own, and just
935                  dnl won't work if the kernel doesn't export init_mm
936                  AS_IF([test "$enable_linux_syscall_probing" = "yes"], [
937                    LINUX_EXPORTS_INIT_MM
938                    AS_IF([test "$ac_cv_linux_exports_init_mm" = "no"], [
939                      AC_MSG_ERROR(
940                        [Can't do syscall probing without exported init_mm])
941                    ])
942                    LINUX_EXPORTS_SYS_CHDIR
943                    LINUX_EXPORTS_SYS_OPEN
944                    AC_DEFINE(ENABLE_LINUX_SYSCALL_PROBING, 1,
945                              [define to enable syscall table probes])
946                  ])
947
948                  dnl Packaging and SMP build
949                  if test "x$with_linux_kernel_packaging" = "xno" ; then
950                    LINUX_WHICH_MODULES
951                  else
952                    AC_SUBST(MPS,'SP')
953                  fi
954
955                  dnl Syscall probing
956                  if test "x$ac_cv_linux_config_modversions" = "xno" -o $AFS_SYSKVERS -ge 26; then
957                    AS_IF([test "$enable_linux_syscall_probing" = "yes"], [
958                      AC_MSG_WARN([Cannot determine sys_call_table status. assuming it isn't exported])
959                    ])
960                    ac_cv_linux_exports_sys_call_table=no
961                    if test -f "$LINUX_KERNEL_PATH/include/asm/ia32_unistd.h"; then
962                      ac_cv_linux_exports_ia32_sys_call_table=yes
963                    fi
964                  else
965                    LINUX_EXPORTS_KALLSYMS_ADDRESS
966                    LINUX_EXPORTS_KALLSYMS_SYMBOL
967                    LINUX_EXPORTS_SYS_CALL_TABLE
968                    LINUX_EXPORTS_IA32_SYS_CALL_TABLE
969                    if test "x$ac_cv_linux_exports_sys_call_table" = "xno"; then
970                          linux_syscall_method=none
971                          if test "x$ac_cv_linux_exports_init_mm" = "xyes"; then
972                             linux_syscall_method=scan
973                             if test "x$ac_cv_linux_exports_kallsyms_address" = "xyes"; then
974                                linux_syscall_method=scan_with_kallsyms_address
975                             fi
976                          fi
977                          if test "x$ac_cv_linux_exports_kallsyms_symbol" = "xyes"; then
978                             linux_syscall_method=kallsyms_symbol
979                          fi
980                          if test "x$linux_syscall_method" = "xnone"; then
981                             AC_MSG_WARN([no available sys_call_table access method -- guessing scan])
982                             linux_syscall_method=scan
983                          fi
984                    fi
985                  fi
986                  if test -f "$LINUX_KERNEL_PATH/include/linux/in_systm.h"; then
987                   AC_DEFINE(HAVE_IN_SYSTM_H, 1, [define if you have in_systm.h header file])
988                  fi
989                  if test -f "$LINUX_KERNEL_PATH/include/linux/mm_inline.h"; then
990                   AC_DEFINE(HAVE_MM_INLINE_H, 1, [define if you have mm_inline.h header file])
991                  fi
992                  if test "x$ac_cv_linux_kernel_page_follow_link" = "xyes" -o "x$ac_cv_linux_func_i_put_link_takes_cookie" = "xyes"; then
993                   AC_DEFINE(USABLE_KERNEL_PAGE_SYMLINK_CACHE, 1, [define if your kernel has a usable symlink cache API])
994                  else
995                   AC_MSG_WARN([your kernel does not have a usable symlink cache API])
996                  fi
997                 :
998                 fi
999 esac
1000
1001 AC_CACHE_CHECK([if struct sockaddr has sa_len field],
1002     [ac_cv_sockaddr_len],
1003     [AC_TRY_COMPILE( [#include <sys/types.h>
1004 #include <sys/socket.h>],
1005                      [struct sockaddr *a; a->sa_len=0;],
1006                      [ac_cv_sockaddr_len=yes],
1007                      [ac_cv_sockaddr_len=no])
1008 ])
1009 AS_IF([test "$ac_cv_sockaddr_len" = "yes"],
1010       [AC_DEFINE(STRUCT_SOCKADDR_HAS_SA_LEN, 1,
1011                  [define if you struct sockaddr sa_len])])
1012
1013 if test "x${MKAFS_OSTYPE}" = "xIRIX"; then
1014         echo Skipping library tests because they confuse Irix.
1015 else
1016   AC_SEARCH_LIBS([socket], [socket inet])
1017   AC_SEARCH_LIBS([connect], [nsl])
1018   AC_SEARCH_LIBS([gethostbyname], [dns nsl resolv])
1019
1020   dnl darwin wants it, aix hates it
1021   AC_MSG_CHECKING(for the useability of arpa/nameser_compat.h)
1022   AC_TRY_COMPILE([
1023   #include <stdlib.h>
1024   #include <stdio.h>
1025   #include <sys/types.h>
1026   #include <sys/socket.h>
1027   #include <netinet/in.h>
1028   #include <arpa/inet.h>
1029   #include <arpa/nameser.h>
1030   #include <arpa/nameser_compat.h>
1031   #include <resolv.h>
1032   ], [static int i; i = 0;],
1033   [AC_MSG_RESULT(yes)
1034    AC_DEFINE(HAVE_ARPA_NAMESER_COMPAT_H, 1, [define if arpa/nameser_compat.h exists])],
1035   [AC_MSG_RESULT(no)
1036    ])
1037
1038   openafs_save_libs="$LIBS"
1039   AC_MSG_CHECKING([for res_search])
1040   AC_FUNC_RES_SEARCH
1041
1042   if test "$ac_cv_func_res_search" = no; then
1043       for lib in dns nsl resolv; do
1044         if test "$ac_cv_func_res_search" != yes; then
1045           LIBS="-l$lib $LIBS"
1046           AC_FUNC_RES_SEARCH
1047           LIBS="$openafs_save_libs"
1048         fi
1049       done    
1050       if test "$ac_cv_func_res_search" = yes; then
1051         LIB_AFSDB="-l$lib"
1052         AC_DEFINE(HAVE_RES_SEARCH, 1, [])
1053         AC_MSG_RESULT([yes, in lib$lib])
1054       else
1055         AC_MSG_RESULT(no)
1056       fi
1057   else
1058     AC_DEFINE(HAVE_RES_SEARCH, 1, [])
1059     AC_MSG_RESULT(yes)
1060   fi
1061   
1062 fi
1063
1064 AC_CHECK_RESOLV_RETRANS
1065
1066 AC_CACHE_CHECK([for setsockopt(, SOL_IP, IP_RECVERR)],
1067     [ac_cv_setsockopt_iprecverr],
1068     [AC_TRY_COMPILE( [
1069 #include <sys/types.h>
1070 #include <sys/socket.h>
1071 #include <netinet/in.h>],
1072 [int on=1;
1073 setsockopt(0, SOL_IP, IP_RECVERR, &on, sizeof(on));],
1074         [ac_cv_setsockopt_iprecverr=yes],
1075         [ac_cv_setsockopt_iprecverr=no])])
1076
1077 AS_IF([test "$ac_cv_setsockopt_iprecverr" = "yes"],
1078       [AC_DEFINE(ADAPT_PMTU_RECVERR, 1,
1079                  [define if asynchronous socket errors can be received])])
1080
1081 PTHREAD_LIBS=error
1082 if test "x$MKAFS_OSTYPE" = OBSD; then
1083         PTHREAD_LIBS="-pthread"
1084 fi
1085 if test "x$MKAFS_OSTYPE" = xDFBSD; then
1086         PTHREAD_LIBS="-pthread"
1087 fi
1088 if test "x$PTHREAD_LIBS" = xerror; then
1089         AC_CHECK_LIB(pthread, pthread_attr_init,
1090                 PTHREAD_LIBS="-lpthread")
1091 fi
1092 if test "x$PTHREAD_LIBS" = xerror; then
1093         AC_CHECK_LIB(pthreads, pthread_attr_init,
1094                 PTHREAD_LIBS="-lpthreads")
1095 fi
1096 if test "x$PTHREAD_LIBS" = xerror; then
1097         AC_CHECK_LIB(c_r, pthread_attr_init,
1098                 PTHREAD_LIBS="-lc_r")
1099 fi
1100 if test "x$PTHREAD_LIBS" = xerror; then
1101         AC_CHECK_FUNC(pthread_attr_init, PTHREAD_LIBS="")
1102 fi
1103 if test "x$PTHREAD_LIBS" = xerror; then
1104         # pthread_attr_init is a macro under HPUX 11.0 and 11.11
1105         AC_CHECK_LIB(pthread, pthread_attr_destroy,
1106                 PTHREAD_LIBS="-lpthread")
1107 fi
1108 if test "x$PTHREAD_LIBS" = xerror; then
1109         AC_MSG_WARN(*** Unable to locate working posix thread library ***)
1110 fi
1111 AC_SUBST(PTHREAD_LIBS)
1112
1113 HOST_CPU="$host_cpu"
1114
1115 if test "x$with_bsd_kernel_headers" != "x"; then
1116         BSD_KERNEL_PATH="$with_bsd_kernel_headers"
1117 else
1118         BSD_KERNEL_PATH="/usr/src/sys"
1119 fi
1120
1121 if test "x$with_bsd_kernel_build" != "x"; then
1122         BSD_KERNEL_BUILD="$with_bsd_kernel_build"
1123 else
1124         case $AFS_SYSNAME in
1125                 *_fbsd_*)
1126                         BSD_KERNEL_BUILD="${BSD_KERNEL_PATH}/${HOST_CPU}/compile/GENERIC"
1127                         ;;
1128                 *_nbsd*)
1129                         BSD_KERNEL_BUILD="${BSD_KERNEL_PATH}/arch/${HOST_CPU}/compile/GENERIC"
1130         esac
1131 fi
1132
1133 # Fast restart
1134 if test "$enable_supergroups" = "yes"; then
1135         AC_DEFINE(SUPERGROUPS, 1, [define if you want to have support for nested pts groups])
1136 fi
1137
1138 if test "$enable_fast_restart" = "yes"; then
1139         AC_DEFINE(FAST_RESTART, 1, [define if you want to have fast restart])
1140 fi
1141
1142 if test "$enable_bitmap_later" = "yes"; then
1143         AC_DEFINE(BITMAP_LATER, 1, [define if you want to salvager to check bitmasks later])
1144 fi
1145
1146 if test "$enable_demand_attach_fs" = "yes"; then
1147         AC_DEFINE(DEMAND_ATTACH_ENABLE, 1, [define if you want the demand attach fileserver])
1148         DEMAND_ATTACH="yes"
1149 else
1150         DEMAND_ATTACH="no"
1151 fi
1152 AC_SUBST(DEMAND_ATTACH)
1153
1154 if test "$enable_disconnected" = "yes"; then
1155         AC_DEFINE(AFS_DISCON_ENV, 1, [define if you want support for disconnected operation])
1156 fi
1157
1158 if test "$enable_unix_sockets" = "yes"; then
1159         AC_DEFINE(USE_UNIX_SOCKETS, 1, [define if you want to use UNIX sockets for fssync.])
1160         USE_UNIX_SOCKETS="yes"
1161 else
1162         USE_UNIX_SOCKETS="no"
1163 fi
1164 AC_SUBST(USE_UNIX_SOCKETS)
1165
1166 if test "$enable_fast_restart" = "yes" &&
1167    test "$enable_demand_attach_fs" = "yes" ; then
1168         AC_MSG_ERROR([The Demand Attach and Fast Restart extensions are mutually exclusive.  Demand Attach fileservers automatically salvage volumes in the background, thereby making Fast Restart pointless.])
1169         exit 1
1170 fi
1171
1172 if test "$enable_icmp_pmtu_discovery" = "yes"; then
1173    if test "$ac_cv_setsockopt_iprecverr" = "yes"; then
1174         AC_DEFINE(ADAPT_PMTU, 1, [define if you want to decode icmp unreachable packets to discover path mtu])
1175    fi
1176 fi
1177
1178 if test "$enable_cache_bypass" = "yes"; then
1179         AC_DEFINE(AFS_CACHE_BYPASS, 1, [define to activate cache bypassing Unix client])
1180 fi
1181
1182 if test "$enable_namei_fileserver" = "yes"; then
1183         AC_DEFINE(AFS_NAMEI_ENV, 1, [define if you want to want namei fileserver])
1184         VFSCK=""
1185 else
1186         if test "$enable_namei_fileserver" = "default"; then
1187                 case $host in
1188                         *-solaris2.10*)
1189                                 AC_MSG_WARN(Some Solaris 10 versions are not safe with the inode fileserver. Forcing namei. Override with --disable-namei-fileserver)
1190                                 AC_DEFINE(AFS_NAMEI_ENV, 1, [define if you want to want namei fileserver])
1191                                 VFSCK=""
1192                                 ;;
1193                         *-solaris2.11*)
1194                                 AC_MSG_WARN(Solaris 11 versions are not safe with the inode fileserver. Forcing namei. Override with --disable-namei-fileserver)
1195                                 AC_DEFINE(AFS_NAMEI_ENV, 1, [define if you want to want namei fileserver])
1196                                 VFSCK=""
1197                                 ;;
1198                         *)
1199                                 VFSCK="vfsck"
1200                                 ;;
1201                 esac
1202         else
1203                 VFSCK="vfsck"
1204         fi
1205 fi
1206
1207 dnl check for tivoli
1208 AC_MSG_CHECKING(for tivoli tsm butc support)
1209 XBSA_CFLAGS=""
1210 if test "$enable_tivoli_tsm" = "yes"; then
1211         XBSADIR1=/usr/tivoli/tsm/client/api/bin/xopen
1212         XBSADIR2=/opt/tivoli/tsm/client/api/bin/xopen
1213         XBSADIR3=/usr/tivoli/tsm/client/api/bin/sample
1214         XBSADIR4=/opt/tivoli/tsm/client/api/bin/sample
1215
1216         if test -r "$XBSADIR3/dsmapifp.h"; then
1217                 XBSA_CFLAGS="-Dxbsa -DNEW_XBSA -I$XBSADIR3"
1218                 XBSA_XLIBS="-ldl"
1219                 AC_MSG_RESULT([yes, $XBSA_CFLAGS])
1220         elif test -r "$XBSADIR4/dsmapifp.h"; then
1221                 XBSA_CFLAGS="-Dxbsa -DNEW_XBSA -I$XBSADIR4"
1222                 XBSA_XLIBS="-ldl"
1223                 AC_MSG_RESULT([yes, $XBSA_CFLAGS])
1224         elif test -r "$XBSADIR1/xbsa.h"; then
1225                 XBSA_CFLAGS="-Dxbsa -I$XBSADIR1"
1226                 XBSA_XLIBS=""
1227                 AC_MSG_RESULT([yes, $XBSA_CFLAGS])
1228         elif test -r "$XBSADIR2/xbsa.h"; then
1229                 XBSA_CFLAGS="-Dxbsa -I$XBSADIR2"
1230                 XBSA_XLIBS=""
1231                 AC_MSG_RESULT([yes, $XBSA_CFLAGS])
1232         else
1233                 AC_MSG_RESULT([no, missing xbsa.h and dsmapifp.h header files])
1234         fi
1235 else
1236         AC_MSG_RESULT([no])
1237 fi
1238 AC_SUBST(XBSA_CFLAGS)
1239 AC_SUBST(XBSA_XLIBS) 
1240
1241 dnl checks for header files.
1242 AC_HEADER_STDC
1243 AC_HEADER_SYS_WAIT
1244 AC_HEADER_DIRENT
1245 AC_CHECK_HEADERS(stdlib.h string.h unistd.h fcntl.h sys/time.h sys/file.h grp.h)
1246 AC_CHECK_HEADERS(netinet/in.h netdb.h sys/fcntl.h sys/mnttab.h sys/mntent.h)
1247 AC_CHECK_HEADERS(mntent.h sys/vfs.h sys/param.h sys/fs_types.h sys/fstyp.h)
1248 AC_CHECK_HEADERS(sys/mount.h strings.h termios.h signal.h sys/pag.h)
1249 AC_CHECK_HEADERS(windows.h direct.h sys/ipc.h)
1250 AC_CHECK_HEADERS(security/pam_modules.h ucontext.h regex.h sys/statvfs.h sys/statfs.h sys/bitypes.h)
1251 AC_CHECK_HEADERS(linux/errqueue.h,,,[#include <linux/types.h>])
1252 AC_CHECK_HEADERS(et/com_err.h)
1253
1254 AC_CHECK_TYPES([fsblkcnt_t],,,[
1255 #include <sys/types.h>
1256 #ifdef HAVE_SYS_BITYPES_H
1257 #include <sys/bitypes.h>
1258 #endif
1259 #ifdef HAVE_SYS_STATFS_H
1260 #include <sys/statfs.h>
1261 #endif
1262 #ifdef HAVE_SYS_STATVFS_H
1263 #include <sys/statvfs.h>
1264 #endif
1265 ])
1266
1267 OPENAFS_TEST_PACKAGE(libintl,[#include <libintl.h>],[-lintl],,,INTL)
1268
1269 dnl Don't build PAM on IRIX; the interface doesn't work for us.
1270 if test "$ac_cv_header_security_pam_modules_h" = yes -a "$enable_pam" = yes; then
1271         case $AFS_SYSNAME in
1272         sgi_*)
1273                 HAVE_PAM="no"
1274                 ;;
1275         *)
1276                 HAVE_PAM="yes"
1277                 ;;
1278         esac
1279 else
1280         HAVE_PAM="no"
1281 fi
1282 AC_SUBST(HAVE_PAM)
1283
1284 if test "$enable_login" = yes; then
1285         BUILD_LOGIN="yes"
1286 else
1287         BUILD_LOGIN="no"
1288 fi
1289 AC_SUBST(BUILD_LOGIN)
1290
1291 AC_CHECK_FUNCS(snprintf strlcat strlcpy flock)
1292 AC_CHECK_FUNCS(setprogname getprogname sigaction mkstemp vsnprintf strerror strcasestr)
1293 AC_CHECK_FUNCS(setvbuf vsyslog getcwd)
1294 AC_CHECK_FUNCS(regcomp regexec regerror)
1295 AC_MSG_CHECKING([for POSIX regex library])
1296 if test "$ac_cv_header_regex_h" = "yes" && \
1297         test "$ac_cv_func_regcomp" = "yes" && \
1298         test "$ac_cv_func_regexec" = "yes" && \
1299         test "$ac_cv_func_regerror" = "yes"; then
1300     AC_DEFINE(HAVE_POSIX_REGEX, 1, [define if you have POSIX regex library])
1301     AC_MSG_RESULT(yes)
1302 else
1303     AC_MSG_RESULT(no)
1304 fi
1305
1306 AC_TYPE_SIGNAL
1307 AC_CHECK_SIZEOF(void *)
1308 AC_CHECK_SIZEOF(unsigned long long)
1309 AC_CHECK_SIZEOF(unsigned long)
1310 AC_CHECK_SIZEOF(unsigned int)
1311 AC_TYPE_INTPTR_T
1312 AC_TYPE_UINTPTR_T
1313 AC_TYPE_SSIZE_T
1314 AC_CHECK_TYPE([sig_atomic_t],[],
1315     [AC_DEFINE([sig_atomic_t], [int],
1316         [Define to int if <signal.h> does not define.])],
1317 [#include <sys/types.h>
1318 #include <signal.h>])
1319 AC_CHECK_TYPE([socklen_t],[],
1320     [AC_DEFINE([socklen_t], [int],
1321         [Define to int if <sys/socket.h> does not define.])],
1322 [#include <sys/types.h>
1323 #include <sys/socket.h>])
1324 AC_SIZEOF_TYPE(long)
1325
1326 AC_HEADER_PAM_CONST
1327
1328 AC_CHECK_FUNCS(timegm)
1329 AC_CHECK_FUNCS(daemon)
1330
1331 dnl Directory PATH handling
1332 if test "x$enable_transarc_paths" = "xyes"  ; then 
1333     afsconfdir=${afsconfdir=/usr/afs/etc}
1334     viceetcdir=${viceetcdir=/usr/vice/etc}
1335     afskerneldir=${afskerneldir=${viceetcdir}}
1336     afssrvbindir=${afssrvbindir=/usr/afs/bin}
1337     afssrvsbindir=${afssrvsbindir=/usr/afs/bin}
1338     afssrvlibexecdir=${afssrvlibexecdir=/usr/afs/bin}
1339     afsdbdir=${afsdbdir=/usr/afs/db}
1340     afslogsdir=${afslogsdir=/usr/afs/logs}
1341     afslocaldir=${afslocaldir=/usr/afs/local}
1342     afsbackupdir=${afsbackupdir=/usr/afs/backup}
1343     afsbosconfigdir=${afsbosconfigdir=/usr/afs/local}
1344     afsdatadir=${afsdatadir=/usr/vice/etc}
1345 else 
1346     afsconfdir=${afsconfdir='${sysconfdir}/openafs/server'}
1347     viceetcdir=${viceetcdir='${sysconfdir}/openafs'}
1348     afskerneldir=${afskerneldir='${libdir}/openafs'}
1349     afssrvbindir=${afssrvbindir='${bindir}'}
1350     afssrvsbindir=${afssrvsbindir='${sbindir}'}
1351     afssrvlibexecdir=${afssrvlibexecdir='${libexecdir}/openafs'}
1352     afsdbdir=${afsdbdir='${localstatedir}/openafs/db'}
1353     afslogsdir=${afslogsdir='${localstatedir}/openafs/logs'}
1354     afslocaldir=${afslocaldir='${localstatedir}/openafs'}
1355     afsbackupdir=${afsbackupdir='${localstatedir}/openafs/backup'}
1356     afsbosconfigdir=${afsbosconfigdir='${sysconfdir}/openafs'}
1357     afsdatadir=${afsdatadir='${datadir}/openafs'}
1358 fi
1359 AC_SUBST(afsconfdir)
1360 AC_SUBST(viceetcdir)
1361 AC_SUBST(afskerneldir)
1362 AC_SUBST(afssrvbindir)
1363 AC_SUBST(afssrvsbindir)
1364 AC_SUBST(afssrvlibexecdir)
1365 AC_SUBST(afsdbdir)
1366 AC_SUBST(afslogsdir)
1367 AC_SUBST(afslocaldir)
1368 AC_SUBST(afsbackupdir)
1369 AC_SUBST(afsbosconfigdir)
1370 AC_SUBST(afsdatadir)
1371
1372 if test "x$enable_kernel_module" = "xyes"; then
1373 ENABLE_KERNEL_MODULE=libafs
1374 fi
1375
1376 if test "x$enable_pthreaded_ubik" = "xyes"; then
1377 ENABLE_PTHREADED_UBIK=yes
1378 fi
1379
1380 AC_SUBST(VFSCK)
1381 AC_SUBST(AFS_SYSNAME)
1382 AC_SUBST(AFS_PARAM_COMMON)
1383 AC_SUBST(ENABLE_KERNEL_MODULE)
1384 AC_SUBST(ENABLE_PTHREADED_UBIK)
1385 AC_SUBST(LIB_AFSDB)
1386 AC_SUBST(LINUX_KERNEL_PATH)
1387 AC_SUBST(LINUX_KERNEL_BUILD)
1388 AC_SUBST(HOST_CPU)
1389 AC_SUBST(BSD_KERNEL_PATH)
1390 AC_SUBST(BSD_KERNEL_BUILD)
1391 AC_SUBST(LINUX_VERSION)
1392 AC_SUBST(MKAFS_OSTYPE)
1393 AC_SUBST(TOP_OBJDIR)
1394 AC_SUBST(TOP_SRCDIR)
1395 AC_SUBST(TOP_INCDIR)
1396 AC_SUBST(TOP_LIBDIR)
1397 AC_SUBST(DEST)
1398 AC_SUBST(DARWIN_INFOFILE)
1399 AC_SUBST(IRIX_BUILD_IP35)
1400 AC_SUBST(HTML_XSL)
1401 AC_SUBST(XSLTPROC)
1402
1403 OPENAFS_OSCONF
1404 OPENAFS_KRB5CONF
1405 OPENAFS_FUSE
1406
1407 TOP_SRCDIR="${srcdir}/src"
1408 dnl
1409 dnl If we're using ./configure, need a more reasonable TOP_SRCDIR, since relative links don't work everywhere
1410 dnl
1411 case $TOP_SRCDIR in
1412         /*)
1413                 ;;
1414         *)
1415                 TOP_SRCDIR=`cd $TOP_SRCDIR; pwd`
1416                 ;;
1417 esac
1418
1419 TOP_OBJDIR="${SRCDIR_PARENT}"
1420 TOP_INCDIR="${SRCDIR_PARENT}/include"
1421 TOP_LIBDIR="${SRCDIR_PARENT}/lib"
1422 if test "${DEST}x" = "x"; then
1423         DEST="${SRCDIR_PARENT}/${AFS_SYSNAME}/dest"
1424 fi
1425
1426 HELPER_SPLINT="${TOP_SRCDIR}/helper-splint.sh"
1427 HELPER_SPLINTCFG="${TOP_SRCDIR}/splint.cfg"
1428 AC_SUBST(HELPER_SPLINT)
1429 AC_SUBST(HELPER_SPLINTCFG)
1430
1431 mkdir -p ${TOP_OBJDIR}/src/JAVA/libjafs
1432
1433 ])