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