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