Linux: Don't preprocess osi_vfs.h
[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.5*)
496                         AFS_SYSNAME="i386_nbsd15"
497                         ;;
498                 alpha-*-netbsd*1.5*)
499                         AFS_SYSNAME="alpha_nbsd15"
500                         ;;
501                 i?86-*-netbsd*1.6[[M-Z]]*)
502                         AFS_SYSNAME="i386_nbsd20"
503                         ;;
504                 powerpc-*-netbsd*1.6[[M-Z]]*)
505                         AFS_SYSNAME="ppc_nbsd20"
506                         ;;
507                 i?86-*-netbsd*2.0*)
508                         AFS_SYSNAME="i386_nbsd20"
509                         ;;
510                 amd64-*-netbsd*2.0*)
511                         AFS_SYSNAME="amd64_nbsd20"
512                         ;;
513                 x86_64-*-netbsd*3.[[0-8]]*)
514 # XXX AFS_PARAM_COMMON handled separately, redundant?
515                         AFS_PARAM_COMMON=param.nbsd30.h
516                         AFS_SYSNAME="amd64_nbsd30"
517                         ;;
518                 x86_64-*-netbsd*4.[[0-8]]*)
519 # XXX AFS_PARAM_COMMON handled separately, redundant?
520                         AFS_PARAM_COMMON=param.nbsd40.h
521                         AFS_SYSNAME="amd64_nbsd40"
522                         ;;
523                 powerpc-*-netbsd*2.0*)
524                         AFS_SYSNAME="ppc_nbsd20"
525                         ;;
526                 i?86-*-netbsd*1.6*)
527                         AFS_SYSNAME="i386_nbsd16"
528                         ;;
529                 alpha-*-netbsd*1.6*)
530                         AFS_SYSNAME="alpha_nbsd16"
531                         ;;
532                 powerpc-*-netbsd*1.6*)
533                         AFS_SYSNAME="ppc_nbsd16"
534                         ;;
535                 i?86-*-netbsd*2.1*)
536                         AFS_SYSNAME="i386_nbsd21"
537                         ;;
538                 i?86-*-netbsd*2.99*)
539                         AFS_SYSNAME="i386_nbsd30"
540                         ;;
541                 i?86-*-netbsd*3.[[0-8]]*)
542                         AFS_SYSNAME="i386_nbsd30"
543                         ;;
544                 i?86-*-netbsd*3.99*)
545                         AFS_SYSNAME="i386_nbsd30"
546                         ;;
547                 i?86-*-netbsd*4.[[0-8]]*)
548                         AFS_SYSNAME="i386_nbsd40"
549                         ;;
550                 i?86-*-netbsd*4.99*)
551                         AFS_SYSNAME="i386_nbsd40"
552                         ;;
553                 hppa*-hp-hpux11.0*)
554                         AFS_SYSNAME="hp_ux110"
555                         ;;
556                 hppa*-hp-hpux11.11)
557                         AFS_SYSNAME="hp_ux11i"
558                         ;;
559                 hppa*-hp-hpux11.23)
560                         AFS_SYSNAME="hp_ux1123"
561                         ;;
562                 ia64-hp-hpux11.22)
563                         AFS_SYSNAME="ia64_hpux1122"
564                         ;;
565                 ia64-hp-hpux*)
566                         AFS_SYSNAME="ia64_hpux1123"
567                         ;;
568                 hppa*-hp-hpux10*)
569                         AFS_SYSNAME="hp_ux102"
570                         ;;
571                 powerpc-apple-darwin7*)
572                         AFS_SYSNAME="ppc_darwin_70"
573                         ;;
574                 powerpc-apple-darwin8.*)
575                         AFS_SYSNAME="ppc_darwin_80"
576                         ;;
577                 i386-apple-darwin8.*)
578                         AFS_SYSNAME="x86_darwin_80"
579                         ;;
580                 powerpc-apple-darwin9.*)
581                         AFS_SYSNAME="ppc_darwin_90"
582                         ;;
583                 i386-apple-darwin9.*)
584                         AFS_SYSNAME="x86_darwin_90"
585                         ;;
586                 i?86-apple-darwin10.*)
587                         AFS_SYSNAME="x86_darwin_100"
588                         ;;
589                 sparc-sun-solaris2.5*)
590                         AFS_SYSNAME="sun4x_55"
591                         enable_login="yes"
592                         ;;
593                 sparc-sun-solaris2.6)
594                         AFS_SYSNAME="sun4x_56"
595                         ;;
596                 sparc-sun-solaris2.7)
597                         AFS_SYSNAME="sun4x_57"
598                         ;;
599                 sparc-sun-solaris2.8)
600                         AFS_SYSNAME="sun4x_58"
601                         ;;
602                 sparc-sun-solaris2.9)
603                         AFS_SYSNAME="sun4x_59"
604                         ;;
605                 sparc-sun-solaris2.10)
606                         AFS_SYSNAME="sun4x_510"
607                         ;;
608                 sparc-sun-solaris2.11)
609                         AFS_SYSNAME="sun4x_511"
610                         ;;
611                 sparc-sun-sunos4*)
612                         AFS_SYSNAME="sun4_413"
613                         enable_login="yes"
614                         ;;
615                 i386-pc-solaris2.7)
616                         AFS_SYSNAME="sunx86_57"
617                         ;;
618                 i386-pc-solaris2.8)
619                         AFS_SYSNAME="sunx86_58"
620                         ;;
621                 i386-pc-solaris2.9)
622                         AFS_SYSNAME="sunx86_59"
623                         ;;
624                 i386-pc-solaris2.10)
625                         AFS_SYSNAME="sunx86_510"
626                         ;;
627                 i386-pc-solaris2.11)
628                         AFS_SYSNAME="sunx86_511"
629                         ;;
630                 alpha*-dec-osf4.0*)
631                         AFS_SYSNAME="alpha_dux40"
632                         ;;
633                 alpha*-dec-osf5.0*)
634                         AFS_SYSNAME="alpha_dux50"
635                         ;;
636                 alpha*-dec-osf5.1*)
637                         AFS_SYSNAME="alpha_dux51"
638                         ;;
639                 mips-sgi-irix6.5)
640                         AFS_SYSNAME="sgi_65"
641                         ;;
642                 ia64-*-linux*)
643                         AFS_SYSNAME="ia64_linuxXX"
644                         ;;
645                 powerpc-*-linux*)
646                         AFS_SYSNAME="`/bin/arch`_linuxXX"
647                         ;;
648                 powerpc64-*-linux*)
649                         AFS_SYSNAME="ppc64_linuxXX"
650                         ;;
651                 alpha*-linux*)
652                         AFS_SYSNAME="alpha_linux_XX"
653                         ;;
654                 s390-*-linux*)
655                         AFS_SYSNAME="s390_linuxXX"
656                         ;;
657                 s390x-*-linux*)
658                         AFS_SYSNAME="s390x_linuxXX"
659                         ;;
660                 sparc-*-linux*)
661                         AFS_SYSNAME="`/bin/arch`_linuxXX"
662                         ;;
663                 sparc64-*-linux*)
664                         AFS_SYSNAME="sparc64_linuxXX"
665                         ;;
666                 i?86-*-linux*)
667                         AFS_SYSNAME="i386_linuxXX"
668                         ;;
669                 arm*-linux*)
670                         AFS_SYSNAME="arm_linuxXX"
671                         ;;
672                 parisc-*-linux-gnu|hppa-*-linux-gnu)
673                         AFS_SYSNAME="parisc_linuxXX"
674                         enable_pam="no"
675                         ;;
676                 power*-ibm-aix4.2*)
677                         AFS_SYSNAME="rs_aix42"
678                         enable_pam="no"
679                         ;;
680                 power*-ibm-aix4.3*)
681                         AFS_SYSNAME="rs_aix42"
682                         enable_pam="no"
683                         ;;
684                 power*-ibm-aix5.1*)
685                         AFS_SYSNAME="rs_aix51"
686                         enable_pam="no"
687                         ;;
688                 power*-ibm-aix5.2*)
689                         AFS_SYSNAME="rs_aix52"
690                         enable_pam="no"
691                         ;;
692                 power*-ibm-aix5.3*)
693                         AFS_SYSNAME="rs_aix53"
694                         enable_pam="no"
695                         ;;
696                 power*-ibm-aix6.1*)
697                         AFS_SYSNAME="rs_aix61"
698                         enable_pam="no"
699                         ;;
700                 x86_64-*-linux-gnu)
701                         AFS_SYSNAME="amd64_linuxXX"
702                         enable_pam="yes"
703                         ;;
704                 *)
705                         AC_MSG_ERROR(An AFS sysname is required)
706                         exit 1
707                         ;;
708         esac
709         case $AFS_SYSNAME in
710                 *_linux* | *_umlinux*)
711                         if test "x${AFS_SYSKVERS}" = "x"; then
712                          AC_MSG_ERROR(Couldn't guess your Linux version. Please use the --with-afs-sysname option to configure an AFS sysname.)
713                         fi
714                         _AFS_SYSNAME=`echo $AFS_SYSNAME|sed s/XX\$/$AFS_SYSKVERS/`
715                         AFS_SYSNAME="$_AFS_SYSNAME"
716                         AC_TRY_KBUILD(
717                          [],
718                          [#ifndef CONFIG_USERMODE
719                           #error not UML
720                           #endif],
721                          ac_cv_linux_is_uml=yes,)
722                         if test "${ac_cv_linux_is_uml}" = yes; then
723                          _AFS_SYSNAME=`echo $AFS_SYSNAME|sed s/linux/umlinux/`
724                         fi
725                         AFS_SYSNAME="$_AFS_SYSNAME"
726                         ;;
727         esac
728         AC_MSG_RESULT($AFS_SYSNAME)
729 fi
730
731 case $AFS_SYSNAME in
732         *_darwin*)
733                 DARWIN_PLIST=src/libafs/afs.${AFS_SYSNAME}.plist
734                 DARWIN_INFOFILE=afs.${AFS_SYSNAME}.plist
735                 ;;
736 esac
737
738 dnl Some hosts have a separate common param file they should include.  Figure
739 dnl out if we're on one of them now that we know the sysname.
740 case $AFS_SYSNAME in
741     *_nbsd15)   AFS_PARAM_COMMON=param.nbsd15.h  ;;
742     *_nbsd16)   AFS_PARAM_COMMON=param.nbsd16.h  ;;
743     *_nbsd20)   AFS_PARAM_COMMON=param.nbsd20.h  ;;
744     *_nbsd21)   AFS_PARAM_COMMON=param.nbsd21.h  ;;
745     *_nbsd30)   AFS_PARAM_COMMON=param.nbsd30.h  ;;
746     *_nbsd40)   AFS_PARAM_COMMON=param.nbsd40.h  ;;
747     *_obsd31)   AFS_PARAM_COMMON=param.obsd31.h  ;;
748     *_obsd32)   AFS_PARAM_COMMON=param.obsd32.h  ;;
749     *_obsd33)   AFS_PARAM_COMMON=param.obsd33.h  ;;
750     *_obsd34)   AFS_PARAM_COMMON=param.obsd34.h  ;;
751     *_obsd35)   AFS_PARAM_COMMON=param.obsd35.h  ;;
752     *_obsd36)   AFS_PARAM_COMMON=param.obsd36.h  ;;
753     *_obsd37)   AFS_PARAM_COMMON=param.obsd37.h  ;;
754     *_obsd38)   AFS_PARAM_COMMON=param.obsd38.h  ;;
755     *_obsd39)   AFS_PARAM_COMMON=param.obsd39.h  ;;
756     *_obsd40)   AFS_PARAM_COMMON=param.obsd40.h  ;;
757     *_obsd41)   AFS_PARAM_COMMON=param.obsd41.h  ;;
758     *_obsd42)   AFS_PARAM_COMMON=param.obsd42.h  ;;
759     *_obsd43)   AFS_PARAM_COMMON=param.obsd43.h  ;;
760     *_obsd44)   AFS_PARAM_COMMON=param.obsd44.h  ;;
761     *_obsd45)   AFS_PARAM_COMMON=param.obsd45.h  ;;
762     *_obsd46)   AFS_PARAM_COMMON=param.obsd46.h  ;;
763     *_linux22)  AFS_PARAM_COMMON=param.linux22.h ;;
764     *_linux24)  AFS_PARAM_COMMON=param.linux24.h ;;
765     *_linux26)  AFS_PARAM_COMMON=param.linux26.h ;;
766 esac
767
768 case $AFS_SYSNAME in *_linux* | *_umlinux*)
769
770                 # Add (sub-) architecture-specific paths needed by conftests
771                 case $AFS_SYSNAME  in
772                         *_umlinux26)
773                                 UMLINUX26_FLAGS="-I$LINUX_KERNEL_PATH/arch/um/include"
774                                 UMLINUX26_FLAGS="$UMLINUX26_FLAGS -I$LINUX_KERNEL_PATH/arch/um/kernel/tt/include"
775                                 UMLINUX26_FLAGS="$UMLINUX26_FLAGS -I$LINUX_KERNEL_PATH/arch/um/kernel/skas/include"
776                                 CPPFLAGS="$CPPFLAGS $UMLINUX26_FLAGS"
777                 esac
778
779                 if test "x$enable_kernel_module" = "xyes"; then
780                  if test "x$enable_debug_kernel" = "xno"; then
781                         LINUX_GCC_KOPTS="$LINUX_GCC_KOPTS -fomit-frame-pointer"
782                  fi
783                  OPENAFS_GCC_SUPPORTS_MARCH
784                  AC_SUBST(P5PLUS_KOPTS)
785                  OPENAFS_GCC_NEEDS_NO_STRENGTH_REDUCE
786                  OPENAFS_GCC_NEEDS_NO_STRICT_ALIASING
787                  OPENAFS_GCC_SUPPORTS_NO_COMMON
788                  OPENAFS_GCC_SUPPORTS_PIPE
789                  AC_SUBST(LINUX_GCC_KOPTS)
790
791                  LINUX_KBUILD_USES_EXTRA_CFLAGS
792                  LINUX_KERNEL_COMPILE_WORKS
793                  AC_CHECK_LINUX_FUNC([find_task_by_pid],
794                                      [#include <linux/sched.h>],
795                                      [pid_t p; find_task_by_pid(p);])
796                  LINUX_EXPORTS_PROC_ROOT_FS
797                  AC_CHECK_LINUX_FUNC([current_kernel_time],
798                                      [#include <linux/time.h>],
799                                    [struct timespec s = current_kernel_time();])
800                  AC_CHECK_LINUX_STRUCT([address_space_operations],
801                                        [write_begin], [fs.h])
802                  AC_CHECK_LINUX_FUNC([bdi_init],
803                                      [#include <linux/backing-dev.h>],
804                                      [bdi_init(NULL);])
805                  LINUX_KMEM_CACHE_INIT
806                  LINUX_HAVE_GRAB_CACHE_PAGE_WRITE_BEGIN
807                  LINUX_HAVE_PAGEVEC_LRU_ADD_FILE
808                  LINUX_HAVE_SPLICE_DIRECT_TO_ACTOR
809                  LINUX_HAVE_PAGE_OFFSET
810                  LINUX_HAVE_ZERO_USER_SEGMENTS
811                  LINUX_HAVE_VFS_LLSEEK
812                  LINUX_HAVE_KERNEL_SETSOCKOPT
813                  AC_CHECK_LINUX_FUNC([grap_cache_page_write_begin],
814                                      [#include <linux/pagemap.h>],
815                                     [grab_cache_page_write_begin(NULL, 0, 0);])
816                  AC_CHECK_LINUX_FUNC([pagevec_lru_add_file],
817                                      [#include <linux/pagevec.h>],
818                                      [__pagevec_lru_add_file(NULL);])
819                  AC_CHECK_LINUX_FUNC([splice_direct_to_actor],
820                                      [#include <linux/splice.h>],
821                                     [splice_direct_to_actor(NULL, NULL, NULL);])
822                  AC_CHECK_LINUX_FUNC([page_offset],
823                                      [#include <linux/pagemap.h>],
824                                      [page_offset(NULL);])
825                  AC_CHECK_LINUX_FUNC([zero_user_segments],
826                                      [#include <linux/highmem.h>],
827                                      [zero_user_segments(NULL, 0, 0, 0, 0);])
828                  AC_CHECK_LINUX_FUNC([vfs_llseek],
829                                      [#include <linux/fs.h>],
830                                      [vfs_llseek(NULL, 0, 0);])
831                  AC_CHECK_LINUX_FUNC([kernel_setsockopt],
832                                      [#include <linux/net.h>],
833                                      [kernel_setsockopt(NULL, 0, 0, NULL, 0);])
834                  AC_CHECK_LINUX_STRUCT([task_struct], [cred], [sched.h])
835                  AC_CHECK_LINUX_STRUCT([proc_dir_entry], [owner], [proc_fs.h])
836                  LINUX_HAVE_KMEM_CACHE_T
837                  LINUX_KMEM_CACHE_CREATE_CTOR_TAKES_VOID
838                  LINUX_D_PATH_TAKES_STRUCT_PATH
839                  LINUX_NEW_EXPORT_OPS
840                  AC_CHECK_LINUX_HEADER([config.h])
841                  AC_CHECK_LINUX_HEADER([completion.h])
842                  AC_CHECK_LINUX_HEADER([semaphore.h])
843                  AC_CHECK_LINUX_HEADER([exportfs.h])
844                  AC_CHECK_LINUX_STRUCT([super_operations], [alloc_inode],
845                                        [fs.h])
846                  AC_CHECK_LINUX_STRUCT([super_block], [s_bdi], [fs.h])
847                  AC_CHECK_LINUX_STRUCT([backing_dev_info], [name],
848                                        [backing-dev.h])
849                  AC_CHECK_LINUX_STRUCT([inode], [i_blksize], [fs.h])
850                  AC_CHECK_LINUX_STRUCT([inode], [i_alloc_sem], [fs.h])
851                  AC_CHECK_LINUX_STRUCT([inode], [i_blkbits], [fs.h])
852                  AC_CHECK_LINUX_STRUCT([inode], [i_mutex], [fs.h])
853                  AC_CHECK_LINUX_STRUCT([inode], [i_security], [fs.h])
854                  LINUX_INODE_SETATTR_RETURN_TYPE
855                  LINUX_IOP_I_CREATE_TAKES_NAMEIDATA
856                  LINUX_IOP_I_LOOKUP_TAKES_NAMEIDATA
857                  LINUX_IOP_I_PERMISSION_TAKES_NAMEIDATA
858                  LINUX_IOP_I_PUT_LINK_TAKES_COOKIE
859                  LINUX_DOP_D_REVALIDATE_TAKES_NAMEIDATA
860                  LINUX_FOP_F_FLUSH_TAKES_FL_OWNER_T
861                  LINUX_AOP_WRITEBACK_CONTROL
862                  AC_CHECK_LINUX_STRUCT([file_operations], [flock], [fs.h])
863                  AC_CHECK_LINUX_STRUCT([file_operations], [sendfile], [fs.h])
864                  LINUX_FS_STRUCT_FOP_HAS_SPLICE
865                  AC_CHECK_LINUX_HEADER([seq_file.h])
866                  LINUX_KERNEL_POSIX_LOCK_FILE_WAIT_ARG
867                  LINUX_POSIX_TEST_LOCK_RETURNS_CONFLICT
868                  LINUX_POSIX_TEST_LOCK_CONFLICT_ARG
869                  LINUX_KERNEL_SOCK_CREATE
870                  AC_CHECK_LINUX_FUNC([page_follow_link],
871                                      [#include <linux/fs.h>],
872                                      [page_follow_link(0,0);])
873                  AC_CHECK_LINUX_FUNC([hlist_unhashed],
874                                      [#include <linux/list.h>],
875                                      [hlist_unhashed(0);])
876                  AC_CHECK_LINUX_HEADER([key-type.h])
877                  LINUX_EXPORTS_KEY_TYPE_KEYRING
878                  LINUX_KEYS_HAVE_SESSION_TO_PARENT
879                  LINUX_NEED_RHCONFIG
880                  LINUX_RECALC_SIGPENDING_ARG_TYPE
881                  AC_CHECK_LINUX_STRUCT([task_struct], [parent], [sched.h])
882                  AC_CHECK_LINUX_STRUCT([task_struct], [real_parent], [sched.h])
883                  AC_CHECK_LINUX_STRUCT([task_struct], [sig], [sched.h])
884                  AC_CHECK_LINUX_STRUCT([task_struct], [sighand], [sched.h])
885                  AC_CHECK_LINUX_STRUCT([task_struct], [sigmask_lock], [sched.h])
886                  AC_CHECK_LINUX_STRUCT([task_struct], [rlim], [sched.h])
887                  LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM
888                  AC_CHECK_LINUX_STRUCT([task_struct], [exit_state], [sched.h])
889                  AC_CHECK_LINUX_STRUCT([task_struct], [tgid], [sched.h])
890                  AC_CHECK_LINUX_STRUCT([task_struct], [thread_info], [sched.h])
891                  LINUX_EXPORTS_TASKLIST_LOCK
892                  LINUX_GET_SB_HAS_STRUCT_VFSMOUNT
893                  LINUX_STATFS_TAKES_DENTRY
894                  AC_CHECK_LINUX_HEADER([freezer.h])
895                  AC_CHECK_LINUX_FUNC([svc_addr_in],
896                                      [#include <linux/sunrpc/svc.h>],
897                                      [svc_addr_in(NULL);])
898                  LINUX_REFRIGERATOR
899                  LINUX_HAVE_TRY_TO_FREEZE
900                  LINUX_LINUX_KEYRING_SUPPORT
901                  LINUX_KEY_ALLOC_NEEDS_STRUCT_TASK
902                  LINUX_KEY_ALLOC_NEEDS_CRED
903                  AC_CHECK_LINUX_FUNC([do_sync_read],
904                                      [#include <linux/fs.h>],
905                                      [do_sync_read(NULL, NULL, 0, NULL);])
906                  AC_CHECK_LINUX_FUNC([generic_file_aio_read],
907                                      [#include <linux/fs.h>],
908                                    [generic_file_aio_read(NULL, NULL, 0, 0);])
909                  LINUX_INIT_WORK_HAS_DATA
910                  LINUX_REGISTER_SYSCTL_TABLE_NOFLAG
911                  LINUX_SYSCTL_TABLE_CHECKING
912                  AC_CHECK_LINUX_FUNC([ctl_table], [ctl_name], [sysctl.h])
913                  AC_CHECK_LINUX_FUNC([iget],
914                                      [#include <linux/fs.h>],
915                                      [iget(NULL, NULL);])
916                  AS_IF([test "x$ac_cv_linux_func_iget" = "xno"],
917                        [AC_DEFINE([LINUX_USE_FH], 1,
918                           [define to use linux file handles for cache files])])
919                  AC_CHECK_LINUX_FUNC([i_size_read],
920                                      [#include <linux/fs.h>],
921                                      [i_size_read(NULL);])
922                  AC_CHECK_LINUX_FUNC([d_alloc_anon],
923                                      [#include <linux/dcache.h>],
924                                      [d_alloc_anon(NULL);])
925                  AS_IF([test "x$ac_cv_linux_func_d_alloc_anon" = "xno"],
926                        [AC_DEFINE([AFS_NONFSTRANS], 1,
927                                   [define to disable the nfs translator])])
928                  AC_CHECK_LINUX_STRUCT([nameidata], [path], [namei.h])
929                  LINUX_EXPORTS_INIT_MM
930                  LINUX_EXPORTS_SYS_CHDIR
931                  LINUX_EXPORTS_SYS_OPEN
932                  AC_CHECK_LINUX_FUNC([rcu_read_lock],
933                                      [#include <linux/rcupdate.h>],
934                                      [rcu_read_lock();])
935                  if test "x$with_linux_kernel_packaging" = "xno" ; then
936                    LINUX_WHICH_MODULES
937                  else
938                    AC_SUBST(MPS,'SP')
939                  fi
940                  if test "x$ac_cv_linux_config_modversions" = "xno" -o $AFS_SYSKVERS -ge 26; then
941                    AC_MSG_WARN([Cannot determine sys_call_table status. assuming it isn't exported])
942                    ac_cv_linux_exports_sys_call_table=no
943                    if test -f "$LINUX_KERNEL_PATH/include/asm/ia32_unistd.h"; then
944                      ac_cv_linux_exports_ia32_sys_call_table=yes
945                    fi
946                  else
947                    LINUX_EXPORTS_KALLSYMS_ADDRESS
948                    LINUX_EXPORTS_KALLSYMS_SYMBOL
949                    LINUX_EXPORTS_SYS_CALL_TABLE
950                    LINUX_EXPORTS_IA32_SYS_CALL_TABLE
951                    if test "x$ac_cv_linux_exports_sys_call_table" = "xno"; then
952                          linux_syscall_method=none
953                          if test "x$ac_cv_linux_exports_init_mm" = "xyes"; then
954                             linux_syscall_method=scan
955                             if test "x$ac_cv_linux_exports_kallsyms_address" = "xyes"; then
956                                linux_syscall_method=scan_with_kallsyms_address
957                             fi
958                          fi
959                          if test "x$ac_cv_linux_exports_kallsyms_symbol" = "xyes"; then
960                             linux_syscall_method=kallsyms_symbol
961                          fi
962                          if test "x$linux_syscall_method" = "xnone"; then
963                             AC_MSG_WARN([no available sys_call_table access method -- guessing scan])
964                             linux_syscall_method=scan
965                          fi
966                    fi
967                  fi
968                  if test -f "$LINUX_KERNEL_PATH/include/linux/in_systm.h"; then
969                   AC_DEFINE(HAVE_IN_SYSTM_H, 1, [define if you have in_systm.h header file])
970                  fi
971                  if test -f "$LINUX_KERNEL_PATH/include/linux/mm_inline.h"; then
972                   AC_DEFINE(HAVE_MM_INLINE_H, 1, [define if you have mm_inline.h header file])
973                  fi
974                  if test "x$ac_cv_linux_kernel_page_follow_link" = "xyes" -o "x$ac_cv_linux_func_i_put_link_takes_cookie" = "xyes"; then
975                   AC_DEFINE(USABLE_KERNEL_PAGE_SYMLINK_CACHE, 1, [define if your kernel has a usable symlink cache API])
976                  else
977                   AC_MSG_WARN([your kernel does not have a usable symlink cache API])
978                  fi
979                 :
980                 fi
981 esac
982
983 AC_CACHE_VAL(ac_cv_sockaddr_len,
984 [
985 AC_MSG_CHECKING([if struct sockaddr has sa_len field])
986 AC_TRY_COMPILE( [#include <sys/types.h>
987 #include <sys/socket.h>],
988 [struct sockaddr *a;
989 a->sa_len=0;], ac_cv_sockaddr_len=yes, ac_cv_sockaddr_len=no)
990 AC_MSG_RESULT($ac_cv_sockaddr_len)])
991 if test "$ac_cv_sockaddr_len" = "yes"; then
992    AC_DEFINE(STRUCT_SOCKADDR_HAS_SA_LEN, 1, [define if you struct sockaddr sa_len])
993 fi
994 if test "x${MKAFS_OSTYPE}" = "xIRIX"; then
995         echo Skipping library tests because they confuse Irix.
996 else
997   AC_SEARCH_LIBS([socket], [socket inet])
998   AC_SEARCH_LIBS([connect], [nsl])
999   AC_SEARCH_LIBS([gethostbyname], [dns nsl resolv])
1000
1001   dnl darwin wants it, aix hates it
1002   AC_MSG_CHECKING(for the useability of arpa/nameser_compat.h)
1003   AC_TRY_COMPILE([
1004   #include <stdlib.h>
1005   #include <stdio.h>
1006   #include <sys/types.h>
1007   #include <sys/socket.h>
1008   #include <netinet/in.h>
1009   #include <arpa/inet.h>
1010   #include <arpa/nameser.h>
1011   #include <arpa/nameser_compat.h>
1012   #include <resolv.h>
1013   ], [static int i; i = 0;],
1014   [AC_MSG_RESULT(yes)
1015    AC_DEFINE(HAVE_ARPA_NAMESER_COMPAT_H, 1, [define if arpa/nameser_compat.h exists])],
1016   [AC_MSG_RESULT(no)
1017    ])
1018
1019   openafs_save_libs="$LIBS"
1020   AC_MSG_CHECKING([for res_search])
1021   AC_FUNC_RES_SEARCH
1022
1023   if test "$ac_cv_func_res_search" = no; then
1024       for lib in dns nsl resolv; do
1025         if test "$ac_cv_func_res_search" != yes; then
1026           LIBS="-l$lib $LIBS"
1027           AC_FUNC_RES_SEARCH
1028           LIBS="$openafs_save_libs"
1029         fi
1030       done    
1031       if test "$ac_cv_func_res_search" = yes; then
1032         LIB_AFSDB="-l$lib"
1033         AC_DEFINE(HAVE_RES_SEARCH, 1, [])
1034         AC_MSG_RESULT([yes, in lib$lib])
1035       else
1036         AC_MSG_RESULT(no)
1037       fi
1038   else
1039     AC_DEFINE(HAVE_RES_SEARCH, 1, [])
1040     AC_MSG_RESULT(yes)
1041   fi
1042   
1043 fi
1044
1045 AC_CHECK_RESOLV_RETRANS
1046
1047 AC_CACHE_VAL(ac_cv_setsockopt_iprecverr,
1048 [
1049 AC_MSG_CHECKING([for setsockopt(, SOL_IP, IP_RECVERR)])
1050 AC_TRY_COMPILE( [#include <sys/types.h>
1051 #include <sys/socket.h>
1052 #include <netinet/in.h>],
1053 [int on=1;
1054 setsockopt(0, SOL_IP, IP_RECVERR, &on, sizeof(on));], ac_cv_setsockopt_iprecverr=yes, ac_cv_setsockopt_iprecverr=no)
1055 AC_MSG_RESULT($ac_cv_setsockopt_iprecverr)])
1056 if test "$ac_cv_setsockopt_iprecverr" = "yes"; then
1057    AC_DEFINE(ADAPT_PMTU_RECVERR, 1, [define if asynchronous socket errors can be received])
1058 fi
1059
1060 PTHREAD_LIBS=error
1061 if test "x$MKAFS_OSTYPE" = OBSD; then
1062         PTHREAD_LIBS="-pthread"
1063 fi
1064 if test "x$MKAFS_OSTYPE" = xDFBSD; then
1065         PTHREAD_LIBS="-pthread"
1066 fi
1067 if test "x$PTHREAD_LIBS" = xerror; then
1068         AC_CHECK_LIB(pthread, pthread_attr_init,
1069                 PTHREAD_LIBS="-lpthread")
1070 fi
1071 if test "x$PTHREAD_LIBS" = xerror; then
1072         AC_CHECK_LIB(pthreads, pthread_attr_init,
1073                 PTHREAD_LIBS="-lpthreads")
1074 fi
1075 if test "x$PTHREAD_LIBS" = xerror; then
1076         AC_CHECK_LIB(c_r, pthread_attr_init,
1077                 PTHREAD_LIBS="-lc_r")
1078 fi
1079 if test "x$PTHREAD_LIBS" = xerror; then
1080         AC_CHECK_FUNC(pthread_attr_init, PTHREAD_LIBS="")
1081 fi
1082 if test "x$PTHREAD_LIBS" = xerror; then
1083         # pthread_attr_init is a macro under HPUX 11.0 and 11.11
1084         AC_CHECK_LIB(pthread, pthread_attr_destroy,
1085                 PTHREAD_LIBS="-lpthread")
1086 fi
1087 if test "x$PTHREAD_LIBS" = xerror; then
1088         AC_MSG_WARN(*** Unable to locate working posix thread library ***)
1089 fi
1090 AC_SUBST(PTHREAD_LIBS)
1091
1092 HOST_CPU="$host_cpu"
1093
1094 if test "x$with_bsd_kernel_headers" != "x"; then
1095         BSD_KERNEL_PATH="$with_bsd_kernel_headers"
1096 else
1097         BSD_KERNEL_PATH="/usr/src/sys"
1098 fi
1099
1100 if test "x$with_bsd_kernel_build" != "x"; then
1101         BSD_KERNEL_BUILD="$with_bsd_kernel_build"
1102 else
1103         case $AFS_SYSNAME in
1104                 *_fbsd_4?)
1105                         BSD_KERNEL_BUILD="${BSD_KERNEL_PATH}/compile/GENERIC"
1106                         ;;
1107                 *_fbsd_*)
1108                         BSD_KERNEL_BUILD="${BSD_KERNEL_PATH}/${HOST_CPU}/compile/GENERIC"
1109                         ;;
1110         esac
1111 fi
1112
1113 # Fast restart
1114 if test "$enable_supergroups" = "yes"; then
1115         AC_DEFINE(SUPERGROUPS, 1, [define if you want to have support for nested pts groups])
1116 fi
1117
1118 if test "$enable_fast_restart" = "yes"; then
1119         AC_DEFINE(FAST_RESTART, 1, [define if you want to have fast restart])
1120 fi
1121
1122 if test "$enable_bitmap_later" = "yes"; then
1123         AC_DEFINE(BITMAP_LATER, 1, [define if you want to salvager to check bitmasks later])
1124 fi
1125
1126 if test "$enable_demand_attach_fs" = "yes"; then
1127         AC_DEFINE(DEMAND_ATTACH_ENABLE, 1, [define if you want the demand attach fileserver])
1128         DEMAND_ATTACH="yes"
1129 else
1130         DEMAND_ATTACH="no"
1131 fi
1132 AC_SUBST(DEMAND_ATTACH)
1133
1134 if test "$enable_disconnected" = "yes"; then
1135         AC_DEFINE(AFS_DISCON_ENV, 1, [define if you want support for disconnected operation])
1136 fi
1137
1138 if test "$enable_unix_sockets" = "yes"; then
1139         AC_DEFINE(USE_UNIX_SOCKETS, 1, [define if you want to use UNIX sockets for fssync.])
1140         USE_UNIX_SOCKETS="yes"
1141 else
1142         USE_UNIX_SOCKETS="no"
1143 fi
1144 AC_SUBST(USE_UNIX_SOCKETS)
1145
1146 if test "$enable_fast_restart" = "yes" &&
1147    test "$enable_demand_attach_fs" = "yes" ; then
1148         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.])
1149         exit 1
1150 fi
1151
1152 if test "$enable_icmp_pmtu_discovery" = "yes"; then
1153    if test "$ac_cv_setsockopt_iprecverr" = "yes"; then
1154         AC_DEFINE(ADAPT_PMTU, 1, [define if you want to decode icmp unreachable packets to discover path mtu])
1155    fi
1156 fi
1157
1158 if test "$enable_cache_bypass" = "yes"; then
1159         AC_DEFINE(AFS_CACHE_BYPASS, 1, [define to activate cache bypassing Unix client])
1160 fi
1161
1162 if test "$enable_namei_fileserver" = "yes"; then
1163         AC_DEFINE(AFS_NAMEI_ENV, 1, [define if you want to want namei fileserver])
1164         VFSCK=""
1165 else
1166         if test "$enable_namei_fileserver" = "default"; then
1167                 case $host in
1168                         *-solaris2.10*)
1169                                 AC_MSG_WARN(Some Solaris 10 versions are not safe with the inode fileserver. Forcing namei. Override with --disable-namei-fileserver)
1170                                 AC_DEFINE(AFS_NAMEI_ENV, 1, [define if you want to want namei fileserver])
1171                                 VFSCK=""
1172                                 ;;
1173                         *-solaris2.11*)
1174                                 AC_MSG_WARN(Solaris 11 versions are not safe with the inode fileserver. Forcing namei. Override with --disable-namei-fileserver)
1175                                 AC_DEFINE(AFS_NAMEI_ENV, 1, [define if you want to want namei fileserver])
1176                                 VFSCK=""
1177                                 ;;
1178                         *)
1179                                 VFSCK="vfsck"
1180                                 ;;
1181                 esac
1182         else
1183                 VFSCK="vfsck"
1184         fi
1185 fi
1186
1187 dnl check for tivoli
1188 AC_MSG_CHECKING(for tivoli tsm butc support)
1189 XBSA_CFLAGS=""
1190 if test "$enable_tivoli_tsm" = "yes"; then
1191         XBSADIR1=/usr/tivoli/tsm/client/api/bin/xopen
1192         XBSADIR2=/opt/tivoli/tsm/client/api/bin/xopen
1193         XBSADIR3=/usr/tivoli/tsm/client/api/bin/sample
1194         XBSADIR4=/opt/tivoli/tsm/client/api/bin/sample
1195
1196         if test -r "$XBSADIR3/dsmapifp.h"; then
1197                 XBSA_CFLAGS="-Dxbsa -DNEW_XBSA -I$XBSADIR3"
1198                 XBSA_XLIBS="-ldl"
1199                 AC_MSG_RESULT([yes, $XBSA_CFLAGS])
1200         elif test -r "$XBSADIR4/dsmapifp.h"; then
1201                 XBSA_CFLAGS="-Dxbsa -DNEW_XBSA -I$XBSADIR4"
1202                 XBSA_XLIBS="-ldl"
1203                 AC_MSG_RESULT([yes, $XBSA_CFLAGS])
1204         elif test -r "$XBSADIR1/xbsa.h"; then
1205                 XBSA_CFLAGS="-Dxbsa -I$XBSADIR1"
1206                 XBSA_XLIBS=""
1207                 AC_MSG_RESULT([yes, $XBSA_CFLAGS])
1208         elif test -r "$XBSADIR2/xbsa.h"; then
1209                 XBSA_CFLAGS="-Dxbsa -I$XBSADIR2"
1210                 XBSA_XLIBS=""
1211                 AC_MSG_RESULT([yes, $XBSA_CFLAGS])
1212         else
1213                 AC_MSG_RESULT([no, missing xbsa.h and dsmapifp.h header files])
1214         fi
1215 else
1216         AC_MSG_RESULT([no])
1217 fi
1218 AC_SUBST(XBSA_CFLAGS)
1219 AC_SUBST(XBSA_XLIBS) 
1220
1221 dnl checks for header files.
1222 AC_HEADER_STDC
1223 AC_HEADER_SYS_WAIT
1224 AC_HEADER_DIRENT
1225 AC_CHECK_HEADERS(stdlib.h string.h unistd.h fcntl.h sys/time.h sys/file.h grp.h)
1226 AC_CHECK_HEADERS(netinet/in.h netdb.h sys/fcntl.h sys/mnttab.h sys/mntent.h)
1227 AC_CHECK_HEADERS(mntent.h sys/vfs.h sys/param.h sys/fs_types.h sys/fstyp.h)
1228 AC_CHECK_HEADERS(sys/mount.h strings.h termios.h signal.h sys/pag.h)
1229 AC_CHECK_HEADERS(windows.h direct.h sys/ipc.h)
1230 AC_CHECK_HEADERS(security/pam_modules.h ucontext.h regex.h sys/statvfs.h sys/statfs.h sys/bitypes.h)
1231 AC_CHECK_HEADERS(linux/errqueue.h,,,[#include <linux/types.h>])
1232 AC_CHECK_HEADERS(et/com_err.h)
1233
1234 AC_CHECK_TYPES([fsblkcnt_t],,,[
1235 #include <sys/types.h>
1236 #ifdef HAVE_SYS_BITYPES_H
1237 #include <sys/bitypes.h>
1238 #endif
1239 #ifdef HAVE_SYS_STATFS_H
1240 #include <sys/statfs.h>
1241 #endif
1242 #ifdef HAVE_SYS_STATVFS_H
1243 #include <sys/statvfs.h>
1244 #endif
1245 ])
1246
1247 OPENAFS_TEST_PACKAGE(libintl,[#include <libintl.h>],[-lintl],,,INTL)
1248
1249 dnl Don't build PAM on IRIX; the interface doesn't work for us.
1250 if test "$ac_cv_header_security_pam_modules_h" = yes -a "$enable_pam" = yes; then
1251         case $AFS_SYSNAME in
1252         sgi_*)
1253                 HAVE_PAM="no"
1254                 ;;
1255         *)
1256                 HAVE_PAM="yes"
1257                 ;;
1258         esac
1259 else
1260         HAVE_PAM="no"
1261 fi
1262 AC_SUBST(HAVE_PAM)
1263
1264 if test "$enable_login" = yes; then
1265         BUILD_LOGIN="yes"
1266 else
1267         BUILD_LOGIN="no"
1268 fi
1269 AC_SUBST(BUILD_LOGIN)
1270
1271 AC_CHECK_FUNCS(snprintf strlcat strlcpy flock)
1272 AC_CHECK_FUNCS(setprogname getprogname sigaction mkstemp vsnprintf strerror strcasestr)
1273 AC_CHECK_FUNCS(setvbuf vsyslog getcwd)
1274 AC_CHECK_FUNCS(regcomp regexec regerror)
1275 AC_MSG_CHECKING([for POSIX regex library])
1276 if test "$ac_cv_header_regex_h" = "yes" && \
1277         test "$ac_cv_func_regcomp" = "yes" && \
1278         test "$ac_cv_func_regexec" = "yes" && \
1279         test "$ac_cv_func_regerror" = "yes"; then
1280     AC_DEFINE(HAVE_POSIX_REGEX, 1, [define if you have POSIX regex library])
1281     AC_MSG_RESULT(yes)
1282 else
1283     AC_MSG_RESULT(no)
1284 fi
1285
1286 AC_TYPE_SOCKLEN_T
1287 AC_TYPE_SIGNAL
1288 AC_CHECK_SIZEOF(void *)
1289 AC_CHECK_SIZEOF(unsigned long long)
1290 AC_CHECK_SIZEOF(unsigned long)
1291 AC_CHECK_SIZEOF(unsigned int)
1292 AC_TYPE_INTPTR_T
1293 AC_TYPE_UINTPTR_T
1294 AC_CHECK_TYPE(ssize_t, int)
1295 AC_CHECK_TYPE([sig_atomic_t], ,
1296     [AC_DEFINE([sig_atomic_t], [int],
1297         [Define to int if <signal.h> does not define.])],
1298 [#include <sys/types.h>
1299 #include <signal.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_KRB5CONF
1381 OPENAFS_FUSE
1382
1383 TOP_SRCDIR="${srcdir}/src"
1384 dnl
1385 dnl If we're using ./configure, need a more reasonable TOP_SRCDIR, since relative links don't work everywhere
1386 dnl
1387 case $TOP_SRCDIR in
1388         /*)
1389                 ;;
1390         *)
1391                 TOP_SRCDIR=`cd $TOP_SRCDIR; pwd`
1392                 ;;
1393 esac
1394
1395 TOP_OBJDIR="${SRCDIR_PARENT}"
1396 TOP_INCDIR="${SRCDIR_PARENT}/include"
1397 TOP_LIBDIR="${SRCDIR_PARENT}/lib"
1398 if test "${DEST}x" = "x"; then
1399         DEST="${SRCDIR_PARENT}/${AFS_SYSNAME}/dest"
1400 fi
1401
1402 HELPER_SPLINT="${TOP_SRCDIR}/helper-splint.sh"
1403 HELPER_SPLINTCFG="${TOP_SRCDIR}/splint.cfg"
1404 AC_SUBST(HELPER_SPLINT)
1405 AC_SUBST(HELPER_SPLINTCFG)
1406
1407 mkdir -p ${TOP_OBJDIR}/src/JAVA/libjafs
1408
1409 ])