pam: Fix password torching const-ness
[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                         ;;
520                 powerpc-apple-darwin8.*)
521                         AFS_SYSNAME="ppc_darwin_80"
522                         ;;
523                 i386-apple-darwin8.*)
524                         AFS_SYSNAME="x86_darwin_80"
525                         ;;
526                 powerpc-apple-darwin9.*)
527                         AFS_SYSNAME="ppc_darwin_90"
528                         ;;
529                 i386-apple-darwin9.*)
530                         AFS_SYSNAME="x86_darwin_90"
531                         ;;
532                 i?86-apple-darwin10.*)
533                         AFS_SYSNAME="x86_darwin_100"
534                         ;;
535                 x86_64-apple-darwin10.*)
536                         AFS_SYSNAME="x86_darwin_100"
537                         ;;
538                 sparc-sun-solaris2.5*)
539                         AFS_SYSNAME="sun4x_55"
540                         enable_login="yes"
541                         ;;
542                 sparc-sun-solaris2.6)
543                         AFS_SYSNAME="sun4x_56"
544                         ;;
545                 sparc-sun-solaris2.7)
546                         AFS_SYSNAME="sun4x_57"
547                         ;;
548                 sparc-sun-solaris2.8)
549                         AFS_SYSNAME="sun4x_58"
550                         ;;
551                 sparc-sun-solaris2.9)
552                         AFS_SYSNAME="sun4x_59"
553                         ;;
554                 sparc-sun-solaris2.10)
555                         AFS_SYSNAME="sun4x_510"
556                         ;;
557                 sparc-sun-solaris2.11)
558                         AFS_SYSNAME="sun4x_511"
559                         ;;
560                 sparc-sun-sunos4*)
561                         AFS_SYSNAME="sun4_413"
562                         enable_login="yes"
563                         ;;
564                 i386-pc-solaris2.7)
565                         AFS_SYSNAME="sunx86_57"
566                         ;;
567                 i386-pc-solaris2.8)
568                         AFS_SYSNAME="sunx86_58"
569                         ;;
570                 i386-pc-solaris2.9)
571                         AFS_SYSNAME="sunx86_59"
572                         ;;
573                 i386-pc-solaris2.10)
574                         AFS_SYSNAME="sunx86_510"
575                         ;;
576                 i386-pc-solaris2.11)
577                         AFS_SYSNAME="sunx86_511"
578                         ;;
579                 alpha*-dec-osf4.0*)
580                         AFS_SYSNAME="alpha_dux40"
581                         ;;
582                 alpha*-dec-osf5.0*)
583                         AFS_SYSNAME="alpha_dux50"
584                         ;;
585                 alpha*-dec-osf5.1*)
586                         AFS_SYSNAME="alpha_dux51"
587                         ;;
588                 mips-sgi-irix6.5)
589                         AFS_SYSNAME="sgi_65"
590                         ;;
591                 ia64-*-linux*)
592                         AFS_SYSNAME="ia64_linuxXX"
593                         ;;
594                 powerpc-*-linux*)
595                         AFS_SYSNAME="`/bin/arch`_linuxXX"
596                         ;;
597                 powerpc64-*-linux*)
598                         AFS_SYSNAME="ppc64_linuxXX"
599                         ;;
600                 alpha*-linux*)
601                         AFS_SYSNAME="alpha_linux_XX"
602                         ;;
603                 s390-*-linux*)
604                         AFS_SYSNAME="s390_linuxXX"
605                         ;;
606                 s390x-*-linux*)
607                         AFS_SYSNAME="s390x_linuxXX"
608                         ;;
609                 sparc-*-linux*)
610                         AFS_SYSNAME="`/bin/arch`_linuxXX"
611                         ;;
612                 sparc64-*-linux*)
613                         AFS_SYSNAME="sparc64_linuxXX"
614                         ;;
615                 i?86-*-linux*)
616                         AFS_SYSNAME="i386_linuxXX"
617                         ;;
618                 arm*-linux*)
619                         AFS_SYSNAME="arm_linuxXX"
620                         ;;
621                 parisc-*-linux-gnu|hppa-*-linux-gnu)
622                         AFS_SYSNAME="parisc_linuxXX"
623                         enable_pam="no"
624                         ;;
625                 power*-ibm-aix4.2*)
626                         AFS_SYSNAME="rs_aix42"
627                         enable_pam="no"
628                         ;;
629                 power*-ibm-aix4.3*)
630                         AFS_SYSNAME="rs_aix42"
631                         enable_pam="no"
632                         ;;
633                 power*-ibm-aix5.1*)
634                         AFS_SYSNAME="rs_aix51"
635                         enable_pam="no"
636                         ;;
637                 power*-ibm-aix5.2*)
638                         AFS_SYSNAME="rs_aix52"
639                         enable_pam="no"
640                         ;;
641                 power*-ibm-aix5.3*)
642                         AFS_SYSNAME="rs_aix53"
643                         enable_pam="no"
644                         ;;
645                 power*-ibm-aix6.1*)
646                         AFS_SYSNAME="rs_aix61"
647                         enable_pam="no"
648                         ;;
649                 x86_64-*-linux-gnu)
650                         AFS_SYSNAME="amd64_linuxXX"
651                         enable_pam="yes"
652                         ;;
653                 *)
654                         AC_MSG_ERROR(An AFS sysname is required)
655                         exit 1
656                         ;;
657         esac
658         case $AFS_SYSNAME in
659                 *_linux* | *_umlinux*)
660                         if test "x${AFS_SYSKVERS}" = "x"; then
661                          AC_MSG_ERROR(Couldn't guess your Linux version. Please use the --with-afs-sysname option to configure an AFS sysname.)
662                         fi
663                         _AFS_SYSNAME=`echo $AFS_SYSNAME|sed s/XX\$/$AFS_SYSKVERS/`
664                         AFS_SYSNAME="$_AFS_SYSNAME"
665                         AC_TRY_KBUILD(
666                          [],
667                          [#ifndef CONFIG_USERMODE
668                           #error not UML
669                           #endif],
670                          ac_cv_linux_is_uml=yes,)
671                         if test "${ac_cv_linux_is_uml}" = yes; then
672                          _AFS_SYSNAME=`echo $AFS_SYSNAME|sed s/linux/umlinux/`
673                         fi
674                         AFS_SYSNAME="$_AFS_SYSNAME"
675                         ;;
676         esac
677         AC_MSG_RESULT($AFS_SYSNAME)
678 fi
679
680 case $AFS_SYSNAME in
681         *_darwin*)
682                 AC_CHECK_HEADERS(crt_externs.h)
683                 DARWIN_PLIST=src/libafs/afs.${AFS_SYSNAME}.plist
684                 DARWIN_INFOFILE=afs.${AFS_SYSNAME}.plist
685                 ;;
686 esac
687
688 dnl Some hosts have a separate common param file they should include.  Figure
689 dnl out if we're on one of them now that we know the sysname.
690 case $AFS_SYSNAME in
691     *_nbsd15)   AFS_PARAM_COMMON=param.nbsd15.h  ;;
692     *_nbsd16)   AFS_PARAM_COMMON=param.nbsd16.h  ;;
693     *_nbsd20)   AFS_PARAM_COMMON=param.nbsd20.h  ;;
694     *_nbsd21)   AFS_PARAM_COMMON=param.nbsd21.h  ;;
695     *_nbsd30)   AFS_PARAM_COMMON=param.nbsd30.h  ;;
696     *_nbsd40)   AFS_PARAM_COMMON=param.nbsd40.h  ;;
697     *_nbsd50)   AFS_PARAM_COMMON=param.nbsd50.h  ;;
698     *_nbsd60)   AFS_PARAM_COMMON=param.nbsd60.h  ;;
699     *_obsd31)   AFS_PARAM_COMMON=param.obsd31.h  ;;
700     *_obsd32)   AFS_PARAM_COMMON=param.obsd32.h  ;;
701     *_obsd33)   AFS_PARAM_COMMON=param.obsd33.h  ;;
702     *_obsd34)   AFS_PARAM_COMMON=param.obsd34.h  ;;
703     *_obsd35)   AFS_PARAM_COMMON=param.obsd35.h  ;;
704     *_obsd36)   AFS_PARAM_COMMON=param.obsd36.h  ;;
705     *_obsd37)   AFS_PARAM_COMMON=param.obsd37.h  ;;
706     *_obsd38)   AFS_PARAM_COMMON=param.obsd38.h  ;;
707     *_obsd39)   AFS_PARAM_COMMON=param.obsd39.h  ;;
708     *_obsd40)   AFS_PARAM_COMMON=param.obsd40.h  ;;
709     *_obsd41)   AFS_PARAM_COMMON=param.obsd41.h  ;;
710     *_obsd42)   AFS_PARAM_COMMON=param.obsd42.h  ;;
711     *_obsd43)   AFS_PARAM_COMMON=param.obsd43.h  ;;
712     *_obsd44)   AFS_PARAM_COMMON=param.obsd44.h  ;;
713     *_obsd45)   AFS_PARAM_COMMON=param.obsd45.h  ;;
714     *_obsd46)   AFS_PARAM_COMMON=param.obsd46.h  ;;
715     *_obsd47)   AFS_PARAM_COMMON=param.obsd47.h  ;;
716     *_obsd48)   AFS_PARAM_COMMON=param.obsd48.h  ;;
717     *_linux22)  AFS_PARAM_COMMON=param.linux22.h ;;
718     *_linux24)  AFS_PARAM_COMMON=param.linux24.h ;;
719     *_linux26)  AFS_PARAM_COMMON=param.linux26.h ;;
720 # Linux alpha adds an extra underscore for no good reason.
721     *_linux_22) AFS_PARAM_COMMON=param.linux22.h ;;
722     *_linux_24) AFS_PARAM_COMMON=param.linux24.h ;;
723     *_linux_26) AFS_PARAM_COMMON=param.linux26.h ;;
724 esac
725
726 case $AFS_SYSNAME in *_linux* | *_umlinux*)
727
728                 # Add (sub-) architecture-specific paths needed by conftests
729                 case $AFS_SYSNAME  in
730                         *_umlinux26)
731                                 UMLINUX26_FLAGS="-I$LINUX_KERNEL_PATH/arch/um/include"
732                                 UMLINUX26_FLAGS="$UMLINUX26_FLAGS -I$LINUX_KERNEL_PATH/arch/um/kernel/tt/include"
733                                 UMLINUX26_FLAGS="$UMLINUX26_FLAGS -I$LINUX_KERNEL_PATH/arch/um/kernel/skas/include"
734                                 CPPFLAGS="$CPPFLAGS $UMLINUX26_FLAGS"
735                 esac
736
737                 if test "x$enable_kernel_module" = "xyes"; then
738                  if test "x$enable_debug_kernel" = "xno"; then
739                         LINUX_GCC_KOPTS="$LINUX_GCC_KOPTS -fomit-frame-pointer"
740                  fi
741                  OPENAFS_GCC_SUPPORTS_MARCH
742                  AC_SUBST(P5PLUS_KOPTS)
743                  OPENAFS_GCC_NEEDS_NO_STRENGTH_REDUCE
744                  OPENAFS_GCC_NEEDS_NO_STRICT_ALIASING
745                  OPENAFS_GCC_SUPPORTS_NO_COMMON
746                  OPENAFS_GCC_SUPPORTS_PIPE
747                  AC_SUBST(LINUX_GCC_KOPTS)
748
749                  dnl Setup the kernel build environment
750                  LINUX_KBUILD_USES_EXTRA_CFLAGS
751                  LINUX_KERNEL_COMPILE_WORKS
752
753                  dnl Check for header files
754                  AC_CHECK_LINUX_HEADER([config.h])
755                  AC_CHECK_LINUX_HEADER([completion.h])
756                  AC_CHECK_LINUX_HEADER([exportfs.h])
757                  AC_CHECK_LINUX_HEADER([freezer.h])
758                  AC_CHECK_LINUX_HEADER([key-type.h])
759                  AC_CHECK_LINUX_HEADER([semaphore.h])
760                  AC_CHECK_LINUX_HEADER([seq_file.h])
761
762                  dnl Check for structure elements
763                  AC_CHECK_LINUX_STRUCT([address_space_operations],
764                                        [write_begin], [fs.h])
765                  AC_CHECK_LINUX_STRUCT([backing_dev_info], [name],
766                                        [backing-dev.h])
767                  AC_CHECK_LINUX_STRUCT([ctl_table], [ctl_name], [sysctl.h])
768                  AC_CHECK_LINUX_STRUCT([inode], [i_alloc_sem], [fs.h])
769                  AC_CHECK_LINUX_STRUCT([inode], [i_blkbits], [fs.h])
770                  AC_CHECK_LINUX_STRUCT([inode], [i_blksize], [fs.h])
771                  AC_CHECK_LINUX_STRUCT([inode], [i_mutex], [fs.h])
772                  AC_CHECK_LINUX_STRUCT([inode], [i_security], [fs.h])
773                  AC_CHECK_LINUX_STRUCT([file_operations], [flock], [fs.h])
774                  AC_CHECK_LINUX_STRUCT([file_operations], [sendfile], [fs.h])
775                  AC_CHECK_LINUX_STRUCT([file_system_type], [mount], [fs.h])
776                  AC_CHECK_LINUX_STRUCT([nameidata], [path], [namei.h])
777                  AC_CHECK_LINUX_STRUCT([proc_dir_entry], [owner], [proc_fs.h])
778                  AC_CHECK_LINUX_STRUCT([super_block], [s_bdi], [fs.h])
779                  AC_CHECK_LINUX_STRUCT([super_block], [s_d_op], [fs.h])
780                  AC_CHECK_LINUX_STRUCT([super_operations], [alloc_inode],
781                                        [fs.h])
782                  AC_CHECK_LINUX_STRUCT([super_operations], [evict_inode],
783                                        [fs.h])
784                  AC_CHECK_LINUX_STRUCT([task_struct], [cred], [sched.h])
785                  AC_CHECK_LINUX_STRUCT([task_struct], [exit_state], [sched.h])
786                  AC_CHECK_LINUX_STRUCT([task_struct], [parent], [sched.h])
787                  AC_CHECK_LINUX_STRUCT([task_struct], [real_parent], [sched.h])
788                  AC_CHECK_LINUX_STRUCT([task_struct], [rlim], [sched.h])
789                  AC_CHECK_LINUX_STRUCT([task_struct], [sig], [sched.h])
790                  AC_CHECK_LINUX_STRUCT([task_struct], [sighand], [sched.h])
791                  AC_CHECK_LINUX_STRUCT([task_struct], [sigmask_lock], [sched.h])
792                  AC_CHECK_LINUX_STRUCT([task_struct], [tgid], [sched.h])
793                  AC_CHECK_LINUX_STRUCT([task_struct], [thread_info], [sched.h])
794                  LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM
795
796                  dnl Function existence checks
797
798                  AC_CHECK_LINUX_FUNC([bdi_init],
799                                      [#include <linux/backing-dev.h>],
800                                      [bdi_init(NULL);])
801                  AC_CHECK_LINUX_FUNC([PageChecked],
802                                      [#include <linux/mm.h>
803 #include <linux/page-flags.h>],
804                                      [struct page *_page;
805                                       int bchecked = PageChecked(_page);])
806                  AC_CHECK_LINUX_FUNC([PageFsMisc],
807                                      [#include <linux/mm.h>
808 #include <linux/page-flags.h>],
809                                      [struct page *_page;
810                                       int bchecked = PageFsMisc(_page);])
811                  AC_CHECK_LINUX_FUNC([current_kernel_time],
812                                      [#include <linux/time.h>],
813                                      [struct timespec s;
814                                       s = current_kernel_time();])
815                  AC_CHECK_LINUX_FUNC([d_alloc_anon],
816                                      [#include <linux/fs.h>],
817                                      [d_alloc_anon(NULL);])
818                  AC_CHECK_LINUX_FUNC([do_sync_read],
819                                      [#include <linux/fs.h>],
820                                      [do_sync_read(NULL, NULL, 0, NULL);])
821                  AC_CHECK_LINUX_FUNC([find_task_by_pid],
822                                      [#include <linux/sched.h>],
823                                      [pid_t p; find_task_by_pid(p);])
824                  AC_CHECK_LINUX_FUNC([generic_file_aio_read],
825                                      [#include <linux/fs.h>],
826                                      [generic_file_aio_read(NULL,NULL,0,0);])
827                  AC_CHECK_LINUX_FUNC([grab_cache_page_write_begin],
828                                      [#include <linux/pagemap.h>],
829                                      [grab_cache_page_write_begin(NULL, 0, 0);])
830                  AC_CHECK_LINUX_FUNC([hlist_unhashed],
831                                      [#include <linux/list.h>],
832                                      [hlist_unhashed(0);])
833                  AC_CHECK_LINUX_FUNC([i_size_read],
834                                      [#include <linux/fs.h>],
835                                      [i_size_read(NULL);])
836                  AC_CHECK_LINUX_FUNC([inode_setattr],
837                                      [#include <linux/fs.h>],
838                                      [inode_setattr(NULL, NULL);])
839                  AC_CHECK_LINUX_FUNC([kernel_setsockopt],
840                                      [#include <linux/net.h>],
841                                      [kernel_setsockopt(NULL, 0, 0, NULL, 0);])
842                  AC_CHECK_LINUX_FUNC([page_follow_link],
843                                      [#include <linux/fs.h>],
844                                      [page_follow_link(0,0);])
845                  AC_CHECK_LINUX_FUNC([page_offset],
846                                      [#include <linux/pagemap.h>],
847                                      [page_offset(NULL);])
848                  AC_CHECK_LINUX_FUNC([pagevec_lru_add_file],
849                                      [#include <linux/pagevec.h>],
850                                      [__pagevec_lru_add_file(NULL);])
851                  AC_CHECK_LINUX_FUNC([path_lookup],
852                                      [#include <linux/fs.h>
853                                       #include <linux/namei.h>],
854                                      [path_lookup(NULL, 0, NULL);])
855                  AC_CHECK_LINUX_FUNC([rcu_read_lock],
856                                      [#include <linux/rcupdate.h>],
857                                      [rcu_read_lock();])
858                  AC_CHECK_LINUX_FUNC([splice_direct_to_actor],
859                                      [#include <linux/splice.h>],
860                                      [splice_direct_to_actor(NULL,NULL,NULL);])
861                  AC_CHECK_LINUX_FUNC([svc_addr_in],
862                                      [#include <linux/sunrpc/svc.h>],
863                                      [svc_addr_in(NULL);])
864                  AC_CHECK_LINUX_FUNC([zero_user_segments],
865                                      [#include <linux/highmem.h>],
866                                      [zero_user_segments(NULL, 0, 0, 0, 0);])
867
868                  dnl Consequences - things which get set as a result of the
869                  dnl                above tests
870                  AS_IF([test "x$ac_cv_linux_func_d_alloc_anon" = "xno"],
871                        [AC_DEFINE([AFS_NONFSTRANS], 1,
872                                   [define to disable the nfs translator])])
873
874                  dnl Assorted more complex tests
875                  LINUX_EXPORTS_PROC_ROOT_FS
876                  LINUX_KMEM_CACHE_INIT
877                  LINUX_HAVE_KMEM_CACHE_T
878                  LINUX_KMEM_CACHE_CREATE_TAKES_DTOR
879                  LINUX_KMEM_CACHE_CREATE_CTOR_TAKES_VOID
880                  LINUX_D_PATH_TAKES_STRUCT_PATH
881                  LINUX_NEW_EXPORT_OPS
882                  LINUX_INODE_SETATTR_RETURN_TYPE
883                  LINUX_IOP_I_CREATE_TAKES_NAMEIDATA
884                  LINUX_IOP_I_LOOKUP_TAKES_NAMEIDATA
885                  LINUX_IOP_I_PERMISSION_TAKES_FLAGS
886                  LINUX_IOP_I_PERMISSION_TAKES_NAMEIDATA
887                  LINUX_IOP_I_PUT_LINK_TAKES_COOKIE
888                  LINUX_DOP_D_REVALIDATE_TAKES_NAMEIDATA
889                  LINUX_FOP_F_FLUSH_TAKES_FL_OWNER_T
890                  LINUX_FOP_F_FSYNC_TAKES_DENTRY
891                  LINUX_AOP_WRITEBACK_CONTROL
892                  LINUX_FS_STRUCT_FOP_HAS_SPLICE
893                  LINUX_KERNEL_POSIX_LOCK_FILE_WAIT_ARG
894                  LINUX_POSIX_TEST_LOCK_RETURNS_CONFLICT
895                  LINUX_POSIX_TEST_LOCK_CONFLICT_ARG
896                  LINUX_KERNEL_SOCK_CREATE
897                  LINUX_EXPORTS_KEY_TYPE_KEYRING
898                  LINUX_NEED_RHCONFIG
899                  LINUX_RECALC_SIGPENDING_ARG_TYPE
900                  LINUX_EXPORTS_TASKLIST_LOCK
901                  LINUX_GET_SB_HAS_STRUCT_VFSMOUNT
902                  LINUX_STATFS_TAKES_DENTRY
903                  LINUX_REFRIGERATOR
904                  LINUX_HAVE_TRY_TO_FREEZE
905                  LINUX_LINUX_KEYRING_SUPPORT
906                  LINUX_KEY_ALLOC_NEEDS_STRUCT_TASK
907                  LINUX_KEY_ALLOC_NEEDS_CRED
908                  LINUX_INIT_WORK_HAS_DATA
909                  LINUX_REGISTER_SYSCTL_TABLE_NOFLAG
910                  LINUX_HAVE_DCACHE_LOCK
911                  LINUX_D_COUNT_IS_INT
912
913                  dnl If we are guaranteed that keyrings will work - that is
914                  dnl  a) The kernel has keyrings enabled
915                  dnl  b) The code is new enough to give us a key_type_keyring
916                  dnl then we just disable syscall probing unless we've been
917                  dnl told otherwise
918
919                  AS_IF([test "$enable_linux_syscall_probing" = "maybe"],
920                    [AS_IF([test "$ac_cv_linux_keyring_support" = "yes" -a "$ac_cv_linux_exports_key_type_keyring" = "yes"],
921                           [enable_linux_syscall_probing="no"],
922                           [enable_linux_syscall_probing="yes"])
923                  ])
924
925                  dnl Syscall probing needs a few tests of its own, and just
926                  dnl won't work if the kernel doesn't export init_mm
927                  AS_IF([test "$enable_linux_syscall_probing" = "yes"], [
928                    LINUX_EXPORTS_INIT_MM
929                    AS_IF([test "$ac_cv_linux_exports_init_mm" = "no"], [
930                      AC_MSG_ERROR(
931                        [Can't do syscall probing without exported init_mm])
932                    ])
933                    LINUX_EXPORTS_SYS_CHDIR
934                    LINUX_EXPORTS_SYS_OPEN
935                    AC_DEFINE(ENABLE_LINUX_SYSCALL_PROBING, 1,
936                              [define to enable syscall table probes])
937                  ])
938
939                  dnl Packaging and SMP build
940                  if test "x$with_linux_kernel_packaging" != "xyes" ; then
941                    LINUX_WHICH_MODULES
942                  else
943                    AC_SUBST(MPS,'SP')
944                  fi
945
946                  dnl Syscall probing
947                  if test "x$ac_cv_linux_config_modversions" = "xno" -o $AFS_SYSKVERS -ge 26; then
948                    AS_IF([test "$enable_linux_syscall_probing" = "yes"], [
949                      AC_MSG_WARN([Cannot determine sys_call_table status. assuming it isn't exported])
950                    ])
951                    ac_cv_linux_exports_sys_call_table=no
952                    if test -f "$LINUX_KERNEL_PATH/include/asm/ia32_unistd.h"; then
953                      ac_cv_linux_exports_ia32_sys_call_table=yes
954                    fi
955                  else
956                    LINUX_EXPORTS_KALLSYMS_ADDRESS
957                    LINUX_EXPORTS_KALLSYMS_SYMBOL
958                    LINUX_EXPORTS_SYS_CALL_TABLE
959                    LINUX_EXPORTS_IA32_SYS_CALL_TABLE
960                    if test "x$ac_cv_linux_exports_sys_call_table" = "xno"; then
961                          linux_syscall_method=none
962                          if test "x$ac_cv_linux_exports_init_mm" = "xyes"; then
963                             linux_syscall_method=scan
964                             if test "x$ac_cv_linux_exports_kallsyms_address" = "xyes"; then
965                                linux_syscall_method=scan_with_kallsyms_address
966                             fi
967                          fi
968                          if test "x$ac_cv_linux_exports_kallsyms_symbol" = "xyes"; then
969                             linux_syscall_method=kallsyms_symbol
970                          fi
971                          if test "x$linux_syscall_method" = "xnone"; then
972                             AC_MSG_WARN([no available sys_call_table access method -- guessing scan])
973                             linux_syscall_method=scan
974                          fi
975                    fi
976                  fi
977                  if test -f "$LINUX_KERNEL_PATH/include/linux/in_systm.h"; then
978                   AC_DEFINE(HAVE_IN_SYSTM_H, 1, [define if you have in_systm.h header file])
979                  fi
980                  if test -f "$LINUX_KERNEL_PATH/include/linux/mm_inline.h"; then
981                   AC_DEFINE(HAVE_MM_INLINE_H, 1, [define if you have mm_inline.h header file])
982                  fi
983                  if test "x$ac_cv_linux_kernel_page_follow_link" = "xyes" -o "x$ac_cv_linux_func_i_put_link_takes_cookie" = "xyes"; then
984                   AC_DEFINE(USABLE_KERNEL_PAGE_SYMLINK_CACHE, 1, [define if your kernel has a usable symlink cache API])
985                  else
986                   AC_MSG_WARN([your kernel does not have a usable symlink cache API])
987                  fi
988                 :
989                 fi
990 dnl Linux-only, but just enable always.
991                 AC_DEFINE(AFS_CACHE_BYPASS, 1, [define to activate cache bypassing Unix client])
992 esac
993
994 AC_CACHE_CHECK([if compiler has __sync_add_and_fetch],
995     [ac_cv_sync_fetch_and_add],
996     [AC_TRY_LINK(, [int var; return __sync_add_and_fetch(&var, 1);],
997                     [ac_cv_sync_fetch_and_add=yes],
998                     [ac_cv_sync_fetch_and_add=no])
999 ])
1000 AS_IF([test "$ac_cv_sync_fetch_and_add" = "yes"],
1001       [AC_DEFINE(HAVE_SYNC_FETCH_AND_ADD, 1,
1002                 [define if your C compiler has __sync_add_and_fetch])])
1003
1004 AC_CACHE_CHECK([if struct sockaddr has sa_len field],
1005     [ac_cv_sockaddr_len],
1006     [AC_TRY_COMPILE( [#include <sys/types.h>
1007 #include <sys/socket.h>],
1008                      [struct sockaddr *a; a->sa_len=0;],
1009                      [ac_cv_sockaddr_len=yes],
1010                      [ac_cv_sockaddr_len=no])
1011 ])
1012 AS_IF([test "$ac_cv_sockaddr_len" = "yes"],
1013       [AC_DEFINE(STRUCT_SOCKADDR_HAS_SA_LEN, 1,
1014                  [define if you struct sockaddr sa_len])])
1015
1016 if test "x${MKAFS_OSTYPE}" = "xIRIX"; then
1017         echo Skipping library tests because they confuse Irix.
1018 else
1019   AC_SEARCH_LIBS([socket], [socket inet])
1020   AC_SEARCH_LIBS([connect], [nsl])
1021   AC_SEARCH_LIBS([gethostbyname], [dns nsl resolv])
1022
1023   dnl darwin wants it, aix hates it
1024   AC_MSG_CHECKING(for the useability of arpa/nameser_compat.h)
1025   AC_TRY_COMPILE([
1026   #include <stdlib.h>
1027   #include <stdio.h>
1028   #include <sys/types.h>
1029   #include <sys/socket.h>
1030   #include <netinet/in.h>
1031   #include <arpa/inet.h>
1032   #include <arpa/nameser.h>
1033   #include <arpa/nameser_compat.h>
1034   #include <resolv.h>
1035   ], [static int i; i = 0;],
1036   [AC_MSG_RESULT(yes)
1037    AC_DEFINE(HAVE_ARPA_NAMESER_COMPAT_H, 1, [define if arpa/nameser_compat.h exists])],
1038   [AC_MSG_RESULT(no)
1039    ])
1040
1041   openafs_save_libs="$LIBS"
1042   AC_MSG_CHECKING([for res_search])
1043   AC_FUNC_RES_SEARCH
1044
1045   if test "$ac_cv_func_res_search" = no; then
1046       for lib in dns nsl resolv; do
1047         if test "$ac_cv_func_res_search" != yes; then
1048           LIBS="-l$lib $LIBS"
1049           AC_FUNC_RES_SEARCH
1050           LIBS="$openafs_save_libs"
1051         fi
1052       done    
1053       if test "$ac_cv_func_res_search" = yes; then
1054         LIB_AFSDB="-l$lib"
1055         AC_DEFINE(HAVE_RES_SEARCH, 1, [])
1056         AC_MSG_RESULT([yes, in lib$lib])
1057       else
1058         AC_MSG_RESULT(no)
1059       fi
1060   else
1061     AC_DEFINE(HAVE_RES_SEARCH, 1, [])
1062     AC_MSG_RESULT(yes)
1063   fi
1064   
1065 fi
1066
1067 AC_CHECK_RESOLV_RETRANS
1068
1069 AC_CACHE_CHECK([for setsockopt(, SOL_IP, IP_RECVERR)],
1070     [ac_cv_setsockopt_iprecverr],
1071     [AC_TRY_COMPILE( [
1072 #include <sys/types.h>
1073 #include <sys/socket.h>
1074 #include <netinet/in.h>],
1075 [int on=1;
1076 setsockopt(0, SOL_IP, IP_RECVERR, &on, sizeof(on));],
1077         [ac_cv_setsockopt_iprecverr=yes],
1078         [ac_cv_setsockopt_iprecverr=no])])
1079
1080 AS_IF([test "$ac_cv_setsockopt_iprecverr" = "yes"],
1081       [AC_DEFINE(ADAPT_PMTU_RECVERR, 1,
1082                  [define if asynchronous socket errors can be received])])
1083
1084 PTHREAD_LIBS=error
1085 if test "x$MKAFS_OSTYPE" = OBSD; then
1086         PTHREAD_LIBS="-pthread"
1087 fi
1088 if test "x$MKAFS_OSTYPE" = xDFBSD; then
1089         PTHREAD_LIBS="-pthread"
1090 fi
1091 if test "x$PTHREAD_LIBS" = xerror; then
1092         AC_CHECK_LIB(pthread, pthread_attr_init,
1093                 PTHREAD_LIBS="-lpthread")
1094 fi
1095 if test "x$PTHREAD_LIBS" = xerror; then
1096         AC_CHECK_LIB(pthreads, pthread_attr_init,
1097                 PTHREAD_LIBS="-lpthreads")
1098 fi
1099 if test "x$PTHREAD_LIBS" = xerror; then
1100         AC_CHECK_LIB(c_r, pthread_attr_init,
1101                 PTHREAD_LIBS="-lc_r")
1102 fi
1103 if test "x$PTHREAD_LIBS" = xerror; then
1104         AC_CHECK_FUNC(pthread_attr_init, PTHREAD_LIBS="")
1105 fi
1106 if test "x$PTHREAD_LIBS" = xerror; then
1107         # pthread_attr_init is a macro under HPUX 11.0 and 11.11
1108         AC_CHECK_LIB(pthread, pthread_attr_destroy,
1109                 PTHREAD_LIBS="-lpthread")
1110 fi
1111 if test "x$PTHREAD_LIBS" = xerror; then
1112         AC_MSG_WARN(*** Unable to locate working posix thread library ***)
1113 fi
1114 AC_SUBST(PTHREAD_LIBS)
1115
1116 HOST_CPU="$host_cpu"
1117
1118 if test "x$with_bsd_kernel_headers" != "x"; then
1119         BSD_KERNEL_PATH="$with_bsd_kernel_headers"
1120 else
1121         BSD_KERNEL_PATH="/usr/src/sys"
1122 fi
1123
1124 if test "x$with_bsd_kernel_build" != "x"; then
1125         BSD_KERNEL_BUILD="$with_bsd_kernel_build"
1126 else
1127         case $AFS_SYSNAME in
1128                 *_fbsd_*)
1129                         BSD_KERNEL_BUILD="${BSD_KERNEL_PATH}/${HOST_CPU}/compile/GENERIC"
1130                         ;;
1131                 *_nbsd*)
1132                         BSD_KERNEL_BUILD="${BSD_KERNEL_PATH}/arch/${HOST_CPU}/compile/GENERIC"
1133         esac
1134 fi
1135
1136 # Fast restart
1137 if test "$enable_supergroups" = "yes"; then
1138         AC_DEFINE(SUPERGROUPS, 1, [define if you want to have support for nested pts groups])
1139 fi
1140
1141 if test "$enable_bitmap_later" = "yes"; then
1142         AC_DEFINE(BITMAP_LATER, 1, [define if you want to salvager to check bitmasks later])
1143 fi
1144
1145 if test "$enable_unix_sockets" = "yes"; then
1146         AC_DEFINE(USE_UNIX_SOCKETS, 1, [define if you want to use UNIX sockets for fssync.])
1147         USE_UNIX_SOCKETS="yes"
1148 else
1149         USE_UNIX_SOCKETS="no"
1150 fi
1151 AC_SUBST(USE_UNIX_SOCKETS)
1152
1153 dnl if test "$ac_cv_setsockopt_iprecverr" = "yes"; then
1154 dnl     AC_DEFINE(ADAPT_PMTU, 1, [define if you want to decode icmp unreachable packets to discover path mtu])
1155 dnl fi
1156
1157 if test "$enable_namei_fileserver" = "yes"; then
1158         AC_DEFINE(AFS_NAMEI_ENV, 1, [define if you want to want namei fileserver])
1159         VFSCK=""
1160 else
1161         if test "$enable_namei_fileserver" = "default"; then
1162                 case $host in
1163                         *-solaris2.10*)
1164                                 AC_MSG_WARN(Some Solaris 10 versions are not safe with the inode fileserver. Forcing namei. Override with --disable-namei-fileserver)
1165                                 AC_DEFINE(AFS_NAMEI_ENV, 1, [define if you want to want namei fileserver])
1166                                 VFSCK=""
1167                                 ;;
1168                         *-solaris2.11*)
1169                                 AC_MSG_WARN(Solaris 11 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                         *)
1174                                 VFSCK="vfsck"
1175                                 ;;
1176                 esac
1177         else
1178                 VFSCK="vfsck"
1179         fi
1180 fi
1181
1182 dnl check for tivoli
1183 AC_MSG_CHECKING(for tivoli tsm butc support)
1184 XBSA_CFLAGS=""
1185 if test "$enable_tivoli_tsm" = "yes"; then
1186         XBSADIR1=/usr/tivoli/tsm/client/api/bin/xopen
1187         XBSADIR2=/opt/tivoli/tsm/client/api/bin/xopen
1188         XBSADIR3=/usr/tivoli/tsm/client/api/bin/sample
1189         XBSADIR4=/opt/tivoli/tsm/client/api/bin/sample
1190
1191         if test -r "$XBSADIR3/dsmapifp.h"; then
1192                 XBSA_CFLAGS="-Dxbsa -DNEW_XBSA -I$XBSADIR3"
1193                 XBSA_XLIBS="-ldl"
1194                 AC_MSG_RESULT([yes, $XBSA_CFLAGS])
1195         elif test -r "$XBSADIR4/dsmapifp.h"; then
1196                 XBSA_CFLAGS="-Dxbsa -DNEW_XBSA -I$XBSADIR4"
1197                 XBSA_XLIBS="-ldl"
1198                 AC_MSG_RESULT([yes, $XBSA_CFLAGS])
1199         elif test -r "$XBSADIR1/xbsa.h"; then
1200                 XBSA_CFLAGS="-Dxbsa -I$XBSADIR1"
1201                 XBSA_XLIBS=""
1202                 AC_MSG_RESULT([yes, $XBSA_CFLAGS])
1203         elif test -r "$XBSADIR2/xbsa.h"; then
1204                 XBSA_CFLAGS="-Dxbsa -I$XBSADIR2"
1205                 XBSA_XLIBS=""
1206                 AC_MSG_RESULT([yes, $XBSA_CFLAGS])
1207         else
1208                 AC_MSG_RESULT([no, missing xbsa.h and dsmapifp.h header files])
1209         fi
1210 else
1211         AC_MSG_RESULT([no])
1212 fi
1213 AC_SUBST(XBSA_CFLAGS)
1214 AC_SUBST(XBSA_XLIBS) 
1215
1216 dnl checks for header files.
1217 AC_HEADER_STDC
1218 AC_HEADER_SYS_WAIT
1219 AC_HEADER_DIRENT
1220 AC_CHECK_HEADERS([ \
1221                    arpa/inet.h \
1222                    arpa/nameser.h \
1223                    curses.h\
1224                    direct.h \
1225                    et/com_err.h \
1226                    errno.h \
1227                    fcntl.h \
1228                    grp.h \
1229                    math.h \
1230                    mntent.h \
1231                    ncurses.h \
1232                    netdb.h \
1233                    netinet/in.h \
1234                    pwd.h \
1235                    regex.h \
1236                    resolv.h \
1237                    security/pam_appl.h \
1238                    signal.h \
1239                    stdint.h \
1240                    stdio_ext.h \
1241                    stdlib.h \
1242                    string.h \
1243                    strings.h \
1244                    sys/bitypes.h \
1245                    sys/bswap.h \
1246                    sys/dk.h \
1247                    sys/fcntl.h \
1248                    sys/file.h \
1249                    sys/fs_types.h \
1250                    sys/fstyp.h \
1251                    sys/ioctl.h \
1252                    sys/ipc.h \
1253                    sys/lockf.h \
1254                    sys/map.h \
1255                    sys/mount.h \
1256                    sys/mntent.h \
1257                    sys/mnttab.h \
1258                    sys/pag.h \
1259                    sys/param.h \
1260                    sys/resource.h \
1261                    sys/select.h \
1262                    sys/statfs.h \
1263                    sys/statvfs.h \
1264                    sys/socket.h \
1265                    sys/sysctl.h \
1266                    sys/time.h \
1267                    sys/types.h \
1268                    sys/uio.h \
1269                    sys/un.h \
1270                    sys/vfs.h \
1271                    syslog.h \
1272                    termios.h \
1273                    time.h \
1274                    ucontext.h \
1275                    unistd.h \
1276                    windows.h \
1277                 ])
1278 AC_CHECK_HEADERS([net/if.h],[],[],[AC_INCLUDES_DEFAULT
1279 #ifdef HAVE_SYS_SOCKET_H
1280 # include <sys/socket.h>
1281 #endif])
1282
1283 AC_CHECK_HEADERS([netinet/if_ether.h],[],[],[AC_INCLUDES_DEFAULT
1284 #ifdef HAVE_NET_IF_H
1285 # include <net/if.h>
1286 #endif])
1287
1288 AC_CHECK_HEADERS([security/pam_modules.h],[],[],[AC_INCLUDES_DEFAULT
1289 #ifdef HAVE_SECURITY_PAM_APPL_H
1290 # include <security/pam_appl.h>
1291 #endif])
1292
1293 AC_CHECK_HEADERS(linux/errqueue.h,,,[#include <linux/types.h>])
1294
1295 AC_CHECK_TYPES([fsblkcnt_t],,,[
1296 #include <sys/types.h>
1297 #ifdef HAVE_SYS_BITYPES_H
1298 #include <sys/bitypes.h>
1299 #endif
1300 #ifdef HAVE_SYS_STATFS_H
1301 #include <sys/statfs.h>
1302 #endif
1303 #ifdef HAVE_SYS_STATVFS_H
1304 #include <sys/statvfs.h>
1305 #endif
1306 ])
1307
1308 dnl check for curses-lib
1309 save_LIBS=$LIBS
1310 AC_CHECK_LIB( [ncurses], [setupterm],
1311 [LIB_curses=-lncurses],
1312     [AC_CHECK_LIB([Hcurses], [setupterm], [LIB_curses=-lHcurses],
1313         [AC_CHECK_LIB([curses], [setupterm], [LIB_curses=-lcurses])
1314     ])
1315 ])
1316 LIBS=$save_LIBS
1317 AC_SUBST(LIB_curses)
1318
1319 OPENAFS_TEST_PACKAGE(libintl,[#include <libintl.h>],[-lintl],,,INTL)
1320
1321 dnl Don't build PAM on IRIX; the interface doesn't work for us.
1322 if test "$ac_cv_header_security_pam_modules_h" = yes -a "$enable_pam" = yes; then
1323         case $AFS_SYSNAME in
1324         sgi_*)
1325                 HAVE_PAM="no"
1326                 ;;
1327         *)
1328                 HAVE_PAM="yes"
1329                 ;;
1330         esac
1331 else
1332         HAVE_PAM="no"
1333 fi
1334 AC_SUBST(HAVE_PAM)
1335
1336 if test "$enable_login" = yes; then
1337         BUILD_LOGIN="yes"
1338 else
1339         BUILD_LOGIN="no"
1340 fi
1341 AC_SUBST(BUILD_LOGIN)
1342
1343 AC_CHECK_FUNCS([ \
1344         arc4random \
1345         fcntl \
1346         fseeko64 \
1347         ftello64 \
1348         getcwd \
1349         getegid \
1350         geteuid \
1351         getgid \
1352         getuid \
1353         getprogname \
1354         getrlimit \
1355         issetugid \
1356         mkstemp \
1357         pread \
1358         preadv \
1359         preadv64 \
1360         pwrite \
1361         pwritev \
1362         pwritev64 \
1363         regcomp \
1364         regerror \
1365         regexec \
1366         setitimer \
1367         setprogname \
1368         setvbuf \
1369         sigaction \
1370         strcasestr \
1371         strerror \
1372         sysconf \
1373         sysctl \
1374         timegm \
1375 ])
1376
1377 OPENAFS_ROKEN()
1378 OPENAFS_C_ATTRIBUTE()
1379
1380 dnl Functions that Heimdal's libroken provides, but that we
1381 dnl haven't found a need for yet, and so haven't imported
1382 AC_CHECK_FUNCS([ \
1383         chown \
1384         fchown \
1385         gethostname \
1386         lstat \
1387         inet_aton \
1388         inet_ntop \
1389         inet_pton \
1390         putenv \
1391         readv \
1392         setenv \
1393         strdup \
1394         strftime \
1395         strndup \
1396         strsep \
1397         unsetenv \
1398 ])
1399
1400 dnl Functions that are in objects that we always build from libroken
1401 AC_CHECK_FUNCS([ \
1402         asprintf \
1403         asnprintf \
1404         vasprintf \
1405         vasnprintf \
1406         vsnprintf \
1407         snprintf \
1408 ])
1409
1410 dnl Functions that we're going to try and get from libroken
1411 AC_REPLACE_FUNCS([ \
1412         daemon \
1413         ecalloc \
1414         emalloc \
1415         erealloc \
1416         err \
1417         errx \
1418         flock \
1419         getdtablesize \
1420         getopt \
1421         getprogname \
1422         gettimeofday \
1423         localtime_r \
1424         mkstemp \
1425         strcasecmp \
1426         strlcat \
1427         strnlen \
1428         strlcpy \
1429         strsep \
1430         tdelete \
1431         tfind \
1432         tsearch \
1433         twalk \
1434         verr \
1435         verrx \
1436         vsyslog \
1437         vwarn \
1438         vwarnx \
1439         warn \
1440         warnx \
1441 ])
1442
1443 dnl Headers that we're going to try and get from libroken
1444 AC_CHECK_HEADERS([ \
1445         err.h \
1446         search.h \
1447 ])
1448
1449 AC_CHECK_DECLS([h_errno], [], [], [
1450 #include <sys/types.h>
1451 #ifdef HAVE_NETDB_H
1452 #include <netdb.h>
1453 #endif
1454 ])
1455
1456 AC_HEADER_TIME
1457
1458 ROKEN_HEADERS=
1459 AS_IF([test "$ac_cv_header_err_h" != "yes" ],
1460       [ROKEN_HEADERS="$ROKEN_HEADERS \$(TOP_INCDIR)/err.h"],
1461       [])
1462 AC_SUBST(ROKEN_HEADERS)
1463
1464 dnl Stuff that's harder ...
1465 AC_MSG_CHECKING([for bswap16])
1466 AC_LINK_IFELSE([AC_LANG_PROGRAM([
1467 #ifdef HAVE_SYS_TYPES_H
1468 #include <sys/types.h>
1469 #endif
1470 #ifdef HAVE_SYS_BSWAP_H
1471 #include <sys/bswap.h>
1472 #endif
1473 ],
1474 [short a, b; b = bswap16(a); ])],
1475 [AC_MSG_RESULT(yes)
1476  AC_DEFINE(HAVE_BSWAP16, 1, [Define to 1 if you have the bswap16 function])
1477 ],
1478 [AC_MSG_RESULT(no)])
1479
1480 AC_MSG_CHECKING([for bswap32])
1481 AC_LINK_IFELSE([AC_LANG_PROGRAM([#ifdef HAVE_SYS_TYPES_H
1482 #include <sys/types.h>
1483 #endif
1484 #ifdef HAVE_SYS_BSWAP_H
1485 #include <sys/bswap.h>
1486 #endif
1487 ],
1488 [int a, b; b = bswap32(a); ])],
1489 [AC_MSG_RESULT(yes)
1490  AC_DEFINE(HAVE_BSWAP32, 1, [Define to 1 if you have the bswap32 function])
1491 ],
1492 [AC_MSG_RESULT(no)])
1493
1494 case $AFS_SYSNAME in
1495 *hp_ux* | *hpux*)
1496    AC_MSG_WARN([Some versions of HP-UX have a buggy positional I/O implementation. Forcing no positional I/O.])
1497    ;;
1498 *)
1499    AC_MSG_CHECKING([for positional I/O])
1500    if test "$ac_cv_func_pread" = "yes" && \
1501            test "$ac_cv_func_pwrite" = "yes"; then
1502       AC_DEFINE(HAVE_PIO, 1, [define if you have pread() and pwrite()])
1503       AC_MSG_RESULT(yes)
1504    else
1505      AC_MSG_RESULT(no)
1506    fi
1507    AC_MSG_CHECKING([for vectored positional I/O])
1508    AS_IF([test "$ac_cv_func_preadv" = "yes" -a \
1509                "$ac_cv_func_pwritev" = "yes" -a \
1510                "$ac_cv_func_preadv64" = "yes" -a \
1511                "$ac_cv_func_pwritev64" = "yes"],
1512          [AC_DEFINE(HAVE_PIOV, 1, [define if you have preadv() and pwritev()])
1513           AC_MSG_RESULT(yes)],
1514          [AC_MSG_RESULT(no)])
1515    ;;
1516 esac
1517
1518 AC_MSG_CHECKING([for POSIX regex library])
1519 if test "$ac_cv_header_regex_h" = "yes" && \
1520         test "$ac_cv_func_regcomp" = "yes" && \
1521         test "$ac_cv_func_regexec" = "yes" && \
1522         test "$ac_cv_func_regerror" = "yes"; then
1523     AC_DEFINE(HAVE_POSIX_REGEX, 1, [define if you have POSIX regex library])
1524     AC_MSG_RESULT(yes)
1525 else
1526     AC_MSG_RESULT(no)
1527 fi
1528
1529 AC_TYPE_SIGNAL
1530 OPENAFS_RETSIGTYPE
1531 AC_CHECK_SIZEOF(void *)
1532 AC_CHECK_SIZEOF(unsigned long long)
1533 AC_CHECK_SIZEOF(unsigned long)
1534 AC_CHECK_SIZEOF(unsigned int)
1535 AC_TYPE_INTPTR_T
1536 AC_TYPE_UINTPTR_T
1537 AC_TYPE_SSIZE_T
1538 AC_CHECK_TYPE([sig_atomic_t],[],
1539     [AC_DEFINE([sig_atomic_t], [int],
1540         [Define to int if <signal.h> does not define.])],
1541 [#include <sys/types.h>
1542 #include <signal.h>])
1543 AC_CHECK_TYPE([socklen_t],[],
1544     [AC_DEFINE([socklen_t], [int],
1545         [Define to int if <sys/socket.h> does not define.])],
1546 [#include <sys/types.h>
1547 #include <sys/socket.h>])
1548 AC_CHECK_TYPES(off64_t)
1549 AC_CHECK_TYPES([ssize_t], [], [], [#include <unistd.h>])
1550 AC_CHECK_TYPES([struct winsize], [], [], [
1551 #ifdef HAVE_TERMIOS_H
1552 # include <termios.h>
1553 #else
1554 # include <sys/termios.h>
1555 #endif
1556 #include <sys/ioctl.h>])
1557 AC_CHECK_TYPES([sa_family_t, socklen_t, struct sockaddr,
1558                 struct sockaddr_storage],
1559                [], [], [
1560 #include <sys/types.h>
1561 #include <sys/socket.h>
1562 ])
1563 AC_CHECK_TYPES([sa_family_t], [], [], [
1564 #include <sys/types.h>
1565 #include <sys/socket.h>
1566 ])
1567 AC_CHECK_TYPES([struct addrinfo], [], [], [
1568 #include <sys/types.h>
1569 #ifdef HAVE_NETDB_H
1570 #include <netdb.h>
1571 #endif
1572 ])
1573 AC_CHECK_TYPES([long long], [], [], [])
1574
1575 AC_SIZEOF_TYPE(long)
1576
1577 AC_HEADER_PAM_CONST
1578
1579
1580 dnl Directory PATH handling
1581 if test "x$enable_transarc_paths" = "xyes"  ; then 
1582     afsconfdir=${afsconfdir=/usr/afs/etc}
1583     viceetcdir=${viceetcdir=/usr/vice/etc}
1584     afskerneldir=${afskerneldir=${viceetcdir}}
1585     afssrvbindir=${afssrvbindir=/usr/afs/bin}
1586     afssrvsbindir=${afssrvsbindir=/usr/afs/bin}
1587     afssrvlibexecdir=${afssrvlibexecdir=/usr/afs/bin}
1588     afsdbdir=${afsdbdir=/usr/afs/db}
1589     afslogsdir=${afslogsdir=/usr/afs/logs}
1590     afslocaldir=${afslocaldir=/usr/afs/local}
1591     afsbackupdir=${afsbackupdir=/usr/afs/backup}
1592     afsbosconfigdir=${afsbosconfigdir=/usr/afs/local}
1593     afsdatadir=${afsdatadir=/usr/vice/etc}
1594 else 
1595     afsconfdir=${afsconfdir='${sysconfdir}/openafs/server'}
1596     viceetcdir=${viceetcdir='${sysconfdir}/openafs'}
1597     afskerneldir=${afskerneldir='${libdir}/openafs'}
1598     afssrvbindir=${afssrvbindir='${bindir}'}
1599     afssrvsbindir=${afssrvsbindir='${sbindir}'}
1600     afssrvlibexecdir=${afssrvlibexecdir='${libexecdir}/openafs'}
1601     afsdbdir=${afsdbdir='${localstatedir}/openafs/db'}
1602     afslogsdir=${afslogsdir='${localstatedir}/openafs/logs'}
1603     afslocaldir=${afslocaldir='${localstatedir}/openafs'}
1604     afsbackupdir=${afsbackupdir='${localstatedir}/openafs/backup'}
1605     afsbosconfigdir=${afsbosconfigdir='${sysconfdir}/openafs'}
1606     afsdatadir=${afsdatadir='${datadir}/openafs'}
1607 fi
1608 AC_SUBST(afsconfdir)
1609 AC_SUBST(viceetcdir)
1610 AC_SUBST(afskerneldir)
1611 AC_SUBST(afssrvbindir)
1612 AC_SUBST(afssrvsbindir)
1613 AC_SUBST(afssrvlibexecdir)
1614 AC_SUBST(afsdbdir)
1615 AC_SUBST(afslogsdir)
1616 AC_SUBST(afslocaldir)
1617 AC_SUBST(afsbackupdir)
1618 AC_SUBST(afsbosconfigdir)
1619 AC_SUBST(afsdatadir)
1620
1621 if test "x$enable_kernel_module" = "xyes"; then
1622 ENABLE_KERNEL_MODULE=libafs
1623 fi
1624
1625 if test "x$enable_pthreaded_ubik" = "xyes"; then
1626 ENABLE_PTHREADED_UBIK=yes
1627 fi
1628
1629 AC_SUBST(VFSCK)
1630 AC_SUBST(AFS_SYSNAME)
1631 AC_SUBST(AFS_PARAM_COMMON)
1632 AC_SUBST(ENABLE_KERNEL_MODULE)
1633 AC_SUBST(ENABLE_PTHREADED_UBIK)
1634 AC_SUBST(LIB_AFSDB)
1635 AC_SUBST(LINUX_KERNEL_PATH)
1636 AC_SUBST(LINUX_KERNEL_BUILD)
1637 AC_SUBST(HOST_CPU)
1638 AC_SUBST(BSD_KERNEL_PATH)
1639 AC_SUBST(BSD_KERNEL_BUILD)
1640 AC_SUBST(LINUX_VERSION)
1641 AC_SUBST(MKAFS_OSTYPE)
1642 AC_SUBST(TOP_OBJDIR)
1643 AC_SUBST(TOP_SRCDIR)
1644 AC_SUBST(TOP_INCDIR)
1645 AC_SUBST(TOP_LIBDIR)
1646 AC_SUBST(DEST)
1647 AC_SUBST(DARWIN_INFOFILE)
1648 AC_SUBST(IRIX_BUILD_IP35)
1649 AC_SUBST(HTML_XSL)
1650 AC_SUBST(XSLTPROC)
1651
1652 OPENAFS_OSCONF
1653 OPENAFS_FUSE
1654
1655 TOP_SRCDIR="${srcdir}/src"
1656 dnl
1657 dnl If we're using ./configure, need a more reasonable TOP_SRCDIR, since relative links don't work everywhere
1658 dnl
1659 case $TOP_SRCDIR in
1660         /*)
1661                 ;;
1662         *)
1663                 TOP_SRCDIR=`cd $TOP_SRCDIR; pwd`
1664                 ;;
1665 esac
1666
1667 TOP_OBJDIR="${SRCDIR_PARENT}"
1668 TOP_INCDIR="${SRCDIR_PARENT}/include"
1669 TOP_LIBDIR="${SRCDIR_PARENT}/lib"
1670 if test "${DEST}x" = "x"; then
1671         DEST="${SRCDIR_PARENT}/${AFS_SYSNAME}/dest"
1672 fi
1673
1674 HELPER_SPLINT="${TOP_SRCDIR}/helper-splint.sh"
1675 HELPER_SPLINTCFG="${TOP_SRCDIR}/splint.cfg"
1676 AC_SUBST(HELPER_SPLINT)
1677 AC_SUBST(HELPER_SPLINTCFG)
1678
1679 mkdir -p ${TOP_OBJDIR}/src/JAVA/libjafs
1680
1681 dnl Check to see if crypt lives in a different library
1682 AC_CHECK_LIB(crypt, crypt, LIB_crypt="-lcrypt")
1683 AC_SUBST(LIB_crypt)
1684
1685 dnl Check to see if the compiler support labels in structs
1686 AC_MSG_CHECKING(for label support in structs)
1687 AC_TRY_COMPILE([], [
1688 extern void osi_UFSOpen(void);
1689 struct labeltest {
1690    void (*open) (void);
1691 };
1692 struct labeltest struct_labeltest = {
1693    .open       = osi_UFSOpen,
1694 }
1695 ],
1696 [AC_MSG_RESULT(yes)
1697  AC_DEFINE(HAVE_STRUCT_LABEL_SUPPORT, 1, [Define to 1 if your compiler supports labels in structs.])
1698 ],
1699 [AC_MSG_RESULT(no)
1700 ])
1701
1702 AC_MSG_CHECKING([checking for dirfd])
1703 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1704 #ifdef HAVE_DIRENT_H
1705 #include <dirent.h>
1706 #endif
1707 ]],
1708         [[DIR *d = 0; dirfd(d);]])],
1709         [ac_rk_have_dirfd=yes], [ac_rk_have_dirfd=no])
1710 if test "$ac_rk_have_dirfd" = "yes" ; then
1711         AC_DEFINE_UNQUOTED(HAVE_DIRFD, 1, [have a dirfd function/macro])
1712 fi
1713 AC_MSG_RESULT($ac_rk_have_dirfd)
1714
1715 OPENAFS_HAVE_STRUCT_FIELD(DIR, dd_fd, [#include <sys/types.h>
1716 #ifdef HAVE_DIRENT_H
1717 #include <dirent.h>
1718 #endif])
1719
1720 dnl Eventually, this will look for the system one, or for OpenSSL
1721 LIB_hcrypto="-lafshcrypto"
1722 LDFLAGS_hcrypto="-L\$(TOP_LIBDIR)"
1723 AC_SUBST(LIB_hcrypto)
1724 AC_SUBST(LDFLAGS_hcrypto)
1725 ])
1726
1727 AC_DEFUN([SUMMARY], [
1728     # Print a configuration summary
1729 echo 
1730 echo "**************************************"
1731 echo configure summary
1732 echo
1733 AS_IF([test $LIB_curses],[
1734 echo "LIB_curses :                $LIB_curses" ],[
1735 echo "XXX LIB_curses  not found! not building scout and afsmonitor!"
1736 ])
1737 echo 
1738 echo "**************************************"
1739 ])