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