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