source: trunk/third/openafs/aclocal.m4 @ 18113

Revision 18113, 38.9 KB checked in by zacheiss, 22 years ago (diff)
Merge with OpenAFS 1.2.8.
Line 
1dnl aclocal.m4 generated automatically by aclocal 1.4
2
3dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8dnl This program is distributed in the hope that it will be useful,
9dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11dnl PARTICULAR PURPOSE.
12
13dnl This file contains the common configuration code which would
14dnl otherwise be duplicated between configure and configure-libafs.
15dnl
16dnl NB: Because this code is a macro, references to positional shell
17dnl parameters must be done like $[]1 instead of $1
18
19AC_DEFUN(OPENAFS_CONFIGURE_COMMON,[
20
21AC_CANONICAL_HOST
22SRCDIR_PARENT=`pwd`
23
24#BOZO_SAVE_CORES BOS_RESTRICTED_MODE BOS_NEW_CONFIG pam sia
25AC_ARG_WITH(afs-sysname,
26[  --with-afs-sysname=sys    use sys for the afs sysname]
27)
28AC_ARG_ENABLE( obsolete,
29[  --enable-obsolete                    enable obsolete portions of AFS (mpp, ntp and package)],, enable_obsolete="no")
30AC_ARG_ENABLE( insecure,
31[  --enable-insecure                    enable insecure portions of AFS (ftpd, inetd, rcp, rlogind and rsh)],, enable_insecure="no")
32AC_ARG_ENABLE( afsdb,
33[  --disable-afsdb                      disable AFSDB RR support],, enable_afsdb="yes")
34AC_ARG_ENABLE( bos-restricted-mode,
35[  --enable-bos-restricted-mode         enable bosserver restricted mode which disables certain bosserver functionality],, enable_bos_restricted_mode="no")
36AC_ARG_ENABLE( namei-fileserver,
37[  --enable-namei-fileserver            force compilation of namei fileserver in preference to inode fileserver],, enable_namei_fileserver="no")
38AC_ARG_ENABLE( fast-restart,
39[  --enable-fast-restart                enable fast startup of file server without salvaging],, enable_fast_restart="no")
40AC_ARG_ENABLE( bitmap-later,
41[  --enable-bitmap-later                enable fast startup of file server by not reading bitmap till needed],, enable_bitmap_later="no")
42AC_ARG_ENABLE( full-vos-listvol-switch,
43[  --enable-full-vos-listvol-switch     enable vos full listvol switch for formatted output],, enable_full_vos_listvol_switch="no")
44AC_ARG_WITH(dux-kernel-headers,
45[  --with-dux-kernel-headers=path       use the kernel headers found at path(optional, defaults to first match in /usr/sys)]
46)
47AC_ARG_WITH(linux-kernel-headers,
48[  --with-linux-kernel-headers=path     use the kernel headers found at path(optional, defaults to /usr/src/linux)]
49)
50AC_ARG_ENABLE(kernel-module,
51[  --disable-kernel-module              disable compilation of the kernel module (defaults to enabled)],, enable_kernel_module="yes"
52)
53AC_ARG_ENABLE(redhat-buildsys,
54[  --enable-redhat-buildsys             enable compilation of the redhat build system kernel (defaults to disabled)],, enable_redhat_buildsys="no"
55)
56AC_ARG_ENABLE(transarc-paths,
57[  --enable-transarc-paths                      Use Transarc style paths like /usr/afs and /usr/vice],, enable_transarc_paths="no"
58)
59AC_ARG_ENABLE(tivoli-tsm,
60[  --enable-tivoli-tsm                  Enable use of the Tivoli TSM API libraries for butc support],, enable_tivoli_tsm="no"
61)
62AC_ARG_ENABLE(debug-kernel,
63[  --enable-debug-kernel                enable compilation of the kernel module with debugging information (defaults to disabled)],, enable_debug_kernel="no"
64)
65
66dnl weird ass systems
67AC_AIX
68AC_ISC_POSIX
69AC_MINIX
70
71dnl Various compiler setup.
72AC_TYPE_PID_T
73AC_TYPE_SIZE_T
74AC_TYPE_SIGNAL
75
76dnl Checks for programs.
77AC_PROG_INSTALL
78AC_PROG_LN_S
79AC_PROG_RANLIB
80AC_PROG_YACC
81AM_PROG_LEX
82
83OPENAFS_CHECK_BIGENDIAN
84
85KERN_DEBUG_OPT=
86if test "x$enable_debug_kernel" = "xyes"; then
87  KERN_DEBUG_OPT=-g
88fi
89
90AC_MSG_CHECKING(your OS)
91system=$host
92case $system in
93        *-linux*)
94                MKAFS_OSTYPE=LINUX
95                if test "x$enable_redhat_buildsys" = "xyes"; then
96                 AC_DEFINE(ENABLE_REDHAT_BUILDSYS, 1, [define if you have redhat buildsystem])
97                fi
98                if test "x$enable_kernel_module" = "xyes"; then
99                 if test "x$with_linux_kernel_headers" != "x"; then
100                   LINUX_KERNEL_PATH="$with_linux_kernel_headers"
101                 else
102                   LINUX_KERNEL_PATH="/usr/src/linux"
103                 fi
104                 if test -f "$LINUX_KERNEL_PATH/include/linux/version.h"; then
105                  linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_PATH/include/linux/version.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -1`
106                  if test "x$linux_kvers" = "x"; then
107                    if test -f "$LINUX_KERNEL_PATH/include/linux/version-up.h"; then
108                      linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_PATH/include/linux/version-up.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -1`
109                      if test "x$linux_kvers" = "x"; then
110
111                        AC_MSG_ERROR(Linux headers lack version definition [2])
112                        exit 1
113                      else
114                        LINUX_VERSION="$linux_kvers"
115                      fi
116                    else
117                      AC_MSG_ERROR(Linux headers lack version definition)
118                      exit 1
119                    fi
120                  else
121                    LINUX_VERSION="$linux_kvers"
122                  fi
123                 else
124                    enable_kernel_module="no"
125                 fi
126                 if test ! -f "$LINUX_KERNEL_PATH/include/linux/autoconf.h"; then
127                     enable_kernel_module="no"
128                 fi
129                 if test "x$enable_kernel_module" = "xno"; then
130                  if test "x$with_linux_kernel_headers" != "x"; then
131                   AC_MSG_ERROR(No usable linux headers found at $LINUX_KERNEL_PATH)
132                   exit 1
133                  else
134                   AC_MSG_WARN(No usable linux headers found at $LINUX_KERNEL_PATH so disabling kernel module)
135                  fi
136                 fi
137                fi
138                AC_MSG_RESULT(linux)
139                if test "x$enable_kernel_module" = "xyes"; then
140                 OMIT_FRAME_POINTER=
141                 if test "x$enable_debug_kernel" = "xno"; then
142                        OMIT_FRAME_POINTER=-fomit-frame-pointer
143                 fi
144                 AC_SUBST(OMIT_FRAME_POINTER)
145                 OPENAFS_GCC_SUPPORTS_MARCH
146                 AC_SUBST(P5PLUS_KOPTS)
147                 OPENAFS_GCC_NEEDS_NO_STRENGTH_REDUCE
148                 OPENAFS_GCC_NEEDS_NO_STRICT_ALIASING
149                 OPENAFS_GCC_SUPPORTS_NO_COMMON
150                 AC_SUBST(LINUX_GCC_KOPTS)
151                 ifdef([OPENAFS_CONFIGURE_LIBAFS],
152                   [LINUX_BUILD_VNODE_FROM_INODE(config,afs)],
153                   [LINUX_BUILD_VNODE_FROM_INODE(src/config,src/afs/LINUX)]
154                 )
155                 LINUX_FS_STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK
156                 LINUX_FS_STRUCT_ADDRESS_SPACE_HAS_GFP_MASK
157                 LINUX_FS_STRUCT_INODE_HAS_I_TRUNCATE_SEM
158                 LINUX_FS_STRUCT_INODE_HAS_I_DIRTY_DATA_BUFFERS
159                 LINUX_FS_STRUCT_INODE_HAS_I_DEVICES
160                 LINUX_INODE_SETATTR_RETURN_TYPE
161                 LINUX_COMPLETION_H_EXISTS
162                 LINUX_EXPORTS_TASKLIST_LOCK
163                 LINUX_NEED_RHCONFIG
164                 LINUX_WHICH_MODULES
165                 if test "x$ac_cv_linux_config_modversions" = "xno"; then
166                   AC_MSG_WARN([Cannot determine sys_call_table status. assuming it's exported])
167                   ac_cv_linux_exports_sys_call_table=yes
168                 else
169                   LINUX_EXPORTS_SYS_CALL_TABLE
170                   LINUX_EXPORTS_KALLSYMS_SYMBOL
171                   LINUX_EXPORTS_KALLSYMS_ADDRESS
172                   LINUX_EXPORTS_INIT_MM
173                   if test "x$ac_cv_linux_exports_sys_call_table" = "xno"; then
174                         linux_syscall_method=none
175                         if test "x$ac_cv_linux_exports_init_mm" = "xyes"; then
176                            linux_syscall_method=scan
177                            if test "x$ac_cv_linux_exports_kallsyms_address" = "xyes"; then
178                               linux_syscall_method=scan_with_kallsyms_address
179                            fi
180                         fi
181                         if test "x$ac_cv_linux_exports_kallsyms_symbol" = "xyes"; then
182                            linux_syscall_method=kallsyms_symbol
183                         fi
184                         if test "x$linux_syscall_method" = "xnone"; then
185                        AC_MSG_ERROR([no available sys_call_table access method])
186                         fi
187                   fi
188                 fi
189                 if test "x$ac_cv_linux_exports_tasklist_lock" = "xyes" ; then
190                  AC_DEFINE(EXPORTED_TASKLIST_LOCK, 1, [define if your linux kernel exports tasklist_lock])
191                 fi
192                 if test "x$ac_cv_linux_exports_sys_call_table" = "xyes"; then
193                  AC_DEFINE(EXPORTED_SYS_CALL_TABLE)
194                 fi
195                 if test "x$ac_cv_linux_exports_kallsyms_symbol" = "xyes"; then
196                  AC_DEFINE(EXPORTED_KALLSYMS_SYMBOL)
197                 fi
198                 if test "x$ac_cv_linux_exports_kallsyms_address" = "xyes"; then
199                  AC_DEFINE(EXPORTED_KALLSYMS_ADDRESS)
200                 fi
201                 if test "x$ac_cv_linux_completion_h_exists" = "xyes" ; then
202                  AC_DEFINE(COMPLETION_H_EXISTS, 1, [define if your h_exists exists])
203                 fi
204                 if test "x$ac_cv_linux_func_inode_setattr_returns_int" = "xyes" ; then
205                  AC_DEFINE(INODE_SETATTR_NOT_VOID, 1, [define if your setattr return return non-void])
206                 fi
207                 if test "x$ac_cv_linux_fs_struct_address_space_has_page_lock" = "xyes"; then
208                  AC_DEFINE(STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK, 1, [define if your struct address_space has page_lock])
209                 fi
210                 if test "x$ac_cv_linux_fs_struct_address_space_has_gfp_mask" = "xyes"; then
211                  AC_DEFINE(STRUCT_ADDRESS_SPACE_HAS_GFP_MASK, 1, [define if your struct address_space has gfp_mask])
212                 fi
213                 if test "x$ac_cv_linux_fs_struct_inode_has_i_truncate_sem" = "xyes"; then
214                  AC_DEFINE(STRUCT_INODE_HAS_I_TRUNCATE_SEM, 1, [define if your struct inode has truncate_sem])
215                 fi
216                 if test "x$ac_cv_linux_fs_struct_inode_has_i_devices" = "xyes"; then
217                  AC_DEFINE(STRUCT_INODE_HAS_I_DEVICES, 1, [define if you struct inode has i_devices])
218                 fi
219                 if test "x$ac_cv_linux_fs_struct_inode_has_i_dirty_data_buffers" = "xyes"; then
220                  AC_DEFINE(STRUCT_INODE_HAS_I_DIRTY_DATA_BUFFERS, 1, [define if you struct inode has data_buffers])
221                 fi
222                :
223                fi
224                ;;
225        *-solaris*)
226                MKAFS_OSTYPE=SOLARIS
227                AC_MSG_RESULT(sun4)
228                SOLARIS_UFSVFS_HAS_DQRWLOCK
229                SOLARIS_PROC_HAS_P_COREFILE
230                ;;
231        *-sunos*)
232                MKAFS_OSTYPE=SUNOS
233                enable_kernel_module=no
234                AC_MSG_RESULT(sun4)
235                ;;
236        *-hpux*)
237                MKAFS_OSTYPE=HPUX
238                AC_MSG_RESULT(hp_ux)
239                ;;
240        *-irix*)
241                if test -d /usr/include/sys/SN/SN1; then
242                 IRIX_BUILD_IP35="IP35"
243                fi
244                MKAFS_OSTYPE=IRIX
245                AC_MSG_RESULT(sgi)
246                ;;
247        *-aix*)
248                MKAFS_OSTYPE=AIX
249                AC_MSG_RESULT(rs_aix)
250                ;;
251        *-osf*)
252                MKAFS_OSTYPE=DUX
253                AC_MSG_RESULT(alpha_dux)
254                if test "x$enable_kernel_module" = "xyes"; then
255                 if test "x$with_dux_kernel_headers" != "x"; then
256                   HEADER_RT=`ls ${with_dux_kernel_headers}/rt_preempt.h | head -1 | sed 's,/rt_preempt.h,,;s,/usr/sys/,,'`
257                 else
258                   HEADER_RT=`ls /usr/sys/*/rt_preempt.h | head -1 | sed 's,/rt_preempt.h,,;s,/usr/sys/,,'`
259                 fi
260                fi
261                if test "$HEADER_RT" = "*" ; then
262                        AC_MSG_ERROR([Need a configured kernel directory])
263                fi
264                AC_SUBST([HEADER_RT])
265                ;;
266        *-darwin*)
267                MKAFS_OSTYPE=DARWIN
268                AC_MSG_RESULT(ppc_darwin)
269                ;;
270        *-freebsd*)
271                MKAFS_OSTYPE=FBSD
272                AC_MSG_RESULT(i386_fbsd)
273                ;;
274        *-openbsd*)
275                MKAFS_OSTYPE=OBSD
276                AC_MSG_RESULT(i386_obsd)
277                ;;
278        *)
279                AC_MSG_RESULT($system)
280                ;;
281esac
282AC_SUBST(KERN_DEBUG_OPT)
283
284if test "x$with_afs_sysname" != "x"; then
285        AFS_SYSNAME="$with_afs_sysname"
286else
287        AC_MSG_CHECKING(your AFS sysname)
288        case $host in
289                i?86-*-freebsd4.2*)
290                        AFS_SYSNAME="i386_fbsd_42"
291                        ;;
292                i?86-*-freebsd4.3*)
293                        AFS_SYSNAME="i386_fbsd_43"
294                        ;;
295                i?86-*-freebsd4.4*)
296                        AFS_SYSNAME="i386_fbsd_44"
297                        ;;
298                i?86-*-freebsd4.5*)
299                        AFS_SYSNAME="i386_fbsd_45"
300                        ;;
301                i?86-*-freebsd4.6*)
302                        AFS_SYSNAME="i386_fbsd_46"
303                        ;;
304                hppa*-hp-hpux11*)
305                        AFS_SYSNAME="hp_ux110"
306                        ;;
307                hppa*-hp-hpux10*)
308                        AFS_SYSNAME="hp_ux102"
309                        ;;
310                powerpc-apple-darwin1.2*)
311                        AFS_SYSNAME="ppc_darwin_12"
312                        ;;
313                powerpc-apple-darwin1.3*)
314                        AFS_SYSNAME="ppc_darwin_13"
315                        ;;
316                powerpc-apple-darwin1.4*)
317                        AFS_SYSNAME="ppc_darwin_14"
318                        ;;
319                powerpc-apple-darwin5.1*)
320                        AFS_SYSNAME="ppc_darwin_14"
321                        ;;
322                powerpc-apple-darwin5.2*)
323                        AFS_SYSNAME="ppc_darwin_14"
324                        ;;
325                powerpc-apple-darwin5.3*)
326                        AFS_SYSNAME="ppc_darwin_14"
327                        ;;
328                powerpc-apple-darwin5.4*)
329                        AFS_SYSNAME="ppc_darwin_14"
330                        ;;
331                powerpc-apple-darwin5.5*)
332                        AFS_SYSNAME="ppc_darwin_14"
333                        ;;
334                powerpc-apple-darwin6.0*)
335                        AFS_SYSNAME="ppc_darwin_60"
336                        ;;
337                powerpc-apple-darwin6.1*)
338                        AFS_SYSNAME="ppc_darwin_60"
339                        ;;
340                powerpc-apple-darwin6.2*)
341                        AFS_SYSNAME="ppc_darwin_60"
342                        ;;
343                sparc-sun-solaris2.5*)
344                        AFS_SYSNAME="sun4x_55"
345                        ;;
346                sparc-sun-solaris2.6)
347                        AFS_SYSNAME="sun4x_56"
348                        ;;
349                sparc-sun-solaris2.7)
350                        AFS_SYSNAME="sun4x_57"
351                        ;;
352                sparc-sun-solaris2.8)
353                        AFS_SYSNAME="sun4x_58"
354                        ;;
355                sparc-sun-solaris2.9)
356                        AFS_SYSNAME="sun4x_59"
357                        ;;
358                sparc-sun-sunos4*)
359                        AFS_SYSNAME="sun4_413"
360                        ;;
361                i386-pc-solaris2.7)
362                        AFS_SYSNAME="sunx86_57"
363                        ;;
364                i386-pc-solaris2.8)
365                        AFS_SYSNAME="sunx86_58"
366                        ;;
367                i386-pc-solaris2.9)
368                        AFS_SYSNAME="sunx86_59"
369                        ;;
370                alpha*-dec-osf4.0*)
371                        AFS_SYSNAME="alpha_dux40"
372                        ;;
373                alpha*-dec-osf5.0*)
374                        AFS_SYSNAME="alpha_dux50"
375                        ;;
376                mips-sgi-irix6.5)
377                        AFS_SYSNAME="sgi_65"
378                        ;;
379                ia64-*-linux*)
380                        AFS_SYSNAME="ia64_linuxXX"
381                        ;;
382                powerpc-*-linux*)
383                        AFS_SYSNAME="ppc_linuxXX"
384                        ;;
385                alpha*-linux*)
386                        AFS_SYSNAME="alpha_linux_XX"
387                        ;;
388                s390-*-linux*)
389                        AFS_SYSNAME="s390_linuxXX"
390                        ;;
391                sparc-*-linux*)
392                        AFS_SYSNAME="sparc_linuxXX"
393                        ;;
394                sparc64-*-linux*)
395                        AFS_SYSNAME="sparc64_linuxXX"
396                        ;;
397                i?86-*-linux*)
398                        AFS_SYSNAME="i386_linuxXX"
399                        ;;
400                parisc-*-linux-gnu)
401                        AFS_SYSNAME="parisc_linuxXX"
402                        ;;
403                power*-ibm-aix4.2*)
404                        AFS_SYSNAME="rs_aix42"
405                        ;;
406                power*-ibm-aix4.3*)
407                        AFS_SYSNAME="rs_aix42"
408                        ;;
409                *)
410                        AC_MSG_ERROR(An AFS sysname is required)
411                        exit 1
412                        ;;
413        esac
414        case $AFS_SYSNAME in
415                *_linux*)
416                        AFS_SYSKVERS=`echo $LINUX_VERSION | awk -F\. '{print $[]1 $[]2}'`
417                        if test "x${AFS_SYSKVERS}" = "x"; then
418                         AC_MSG_ERROR(Couldn't guess your Linux version. Please use the --with-afs-sysname option to configure an AFS sysname.)
419                        fi
420                        _AFS_SYSNAME=`echo $AFS_SYSNAME|sed s/XX\$/$AFS_SYSKVERS/`
421                        AFS_SYSNAME="$_AFS_SYSNAME"
422                        ;;
423        esac
424        AC_MSG_RESULT($AFS_SYSNAME)
425fi
426
427case $AFS_SYSNAME in
428        *_darwin*)
429                DARWIN_PLIST=src/libafs/afs.${AFS_SYSNAME}.plist
430                DARWIN_INFOFILE=afs.${AFS_SYSNAME}.plist
431                ;;
432esac
433AC_CACHE_VAL(ac_cv_sockaddr_len,
434[
435AC_MSG_CHECKING([if struct sockaddr has sa_len field])
436AC_TRY_COMPILE( [#include <sys/types.h>
437#include <sys/socket.h>],
438[struct sockaddr *a;
439a->sa_len=0;], ac_cv_sockaddr_len=yes, ac_cv_sockaddr_len=no)
440AC_MSG_RESULT($ac_cv_sockaddr_len)])
441if test "$ac_cv_sockaddr_len" = "yes"; then
442   AC_DEFINE(STRUCT_SOCKADDR_HAS_SA_LEN, 1, [define if you struct sockaddr sa_len])
443fi
444if test "x${MKAFS_OSTYPE}" = "xIRIX"; then
445        echo Skipping library tests because they confuse Irix.
446else
447  AC_CHECK_FUNCS(socket)
448
449  if test "$ac_cv_func_socket" = no; then
450    for lib in socket inet; do
451        if test "$HAVE_SOCKET" != 1; then
452                AC_CHECK_LIB(${lib}, socket,LIBS="$LIBS -l$lib";HAVE_SOCKET=1;AC_DEFINE(HAVE_SOCKET, 1, [define if you have socket]))
453        fi
454    done
455  fi
456 
457  AC_CHECK_FUNCS(connect)       
458
459  if test "$ac_cv_func_connect" = no; then
460    for lib in nsl; do
461        if test "$HAVE_CONNECT" != 1; then
462                AC_CHECK_LIB(${lib}, connect,LIBS="$LIBS -l$lib";HAVE_CONNECT=1;AC_DEFINE(HAVE_CONNECT, 1, [define if you have connect]))
463        fi
464    done
465  fi
466
467  AC_CHECK_FUNCS(gethostbyname)
468  if test "$ac_cv_func_gethostbyname" = no; then
469        for lib in dns nsl resolv; do
470          if test "$HAVE_GETHOSTBYNAME" != 1; then
471            AC_CHECK_LIB(${lib}, gethostbyname, LIBS="$LIBS -l$lib";HAVE_GETHOSTBYNAME=1;AC_DEFINE(HAVE_GETHOSTBYNAME, 1, [define if you have gethostbyname]))
472          fi
473        done   
474  fi   
475
476  AC_CHECK_FUNCS(res_search)
477  if test "$ac_cv_func_res_search" = no; then
478        for lib in dns nsl resolv; do
479          if test "$HAVE_RES_SEARCH" != 1; then
480            AC_CHECK_LIB(${lib}, res_search, LIBS="$LIBS -l$lib";HAVE_RES_SEARCH=1;AC_DEFINE(HAVE_RES_SEARCH, 1, [define if you have res_search]))
481          fi
482        done   
483        if test "$HAVE_RES_SEARCH" = 1; then
484          LIB_res_search="-l$lib"       
485        fi
486  fi   
487fi
488
489PTHREAD_LIBS=error
490AC_CHECK_LIB(pthread, pthread_attr_init,
491             PTHREAD_LIBS="-lpthread")
492if test "x$PTHREAD_LIBS" = xerror; then
493        AC_CHECK_LIB(pthreads, pthread_attr_init,
494                PTHREAD_LIBS="-lpthreads")
495fi
496if test "x$PTHREAD_LIBS" = xerror; then
497        AC_CHECK_LIB(c_r, pthread_attr_init,
498                PTHREAD_LIBS="-lc_r")
499fi
500if test "x$PTHREAD_LIBS" = xerror; then
501        AC_CHECK_FUNC(pthread_attr_init, PTHREAD_LIBS="")
502fi
503if test "x$PTHREAD_LIBS" = xerror; then
504        AC_MSG_WARN(*** Unable to locate working posix thread library ***)
505fi
506AC_SUBST(PTHREAD_LIBS)
507
508WITH_OBSOLETE=NO
509if test "$enable_obsolete" = "yes"; then
510        WITH_OBSOLETE=YES
511fi
512
513WITH_INSECURE=NO
514if test "$enable_insecure" = "yes"; then
515        WITH_INSECURE=YES
516fi
517
518# Fast restart
519if test "$enable_fast_restart" = "yes"; then
520        AC_DEFINE(FAST_RESTART, 1, [define if you want to have fast restart])
521fi
522
523if test "$enable_bitmap_later" = "yes"; then
524        AC_DEFINE(BITMAP_LATER, 1, [define if you want to salvager to check bitmasks later])
525fi
526
527if test "$enable_full_vos_listvol_switch" = "yes"; then
528        AC_DEFINE(FULL_LISTVOL_SWITCH, 1, [define if you want to want listvol switch])
529fi
530
531if test "$enable_bos_restricted_mode" = "yes"; then
532        AC_DEFINE(BOS_RESTRICTED_MODE, 1, [define if you want to want bos restricted mode])
533fi
534
535if test "$enable_namei_fileserver" = "yes"; then
536        AC_DEFINE(AFS_NAMEI_ENV, 1, [define if you want to want namei fileserver])
537fi
538
539if test "$enable_afsdb" = "yes"; then
540        LIB_AFSDB="$LIB_res_search"
541        AC_DEFINE(AFS_AFSDB_ENV, 1, [define if you want to want search afsdb rr])
542fi
543
544dnl check for tivoli
545AC_MSG_CHECKING(for tivoli tsm butc support)
546XBSA_CFLAGS=""
547if test "$enable_tivoli_tsm" = "yes"; then
548        XBSADIR1=/usr/tivoli/tsm/client/api/bin/xopen
549        XBSADIR2=/opt/tivoli/tsm/client/api/bin/xopen
550
551        if test -e "$XBSADIR1/xbsa.h"; then
552                XBSA_CFLAGS="-Dxbsa -I$XBSADIR1"
553                AC_MSG_RESULT([yes, $XBSA_CFLAGS])
554        elif test -e "$XBSADIR2/xbsa.h"; then
555                XBSA_CFLAGS="-Dxbsa -I$XBSADIR2"
556                AC_MSG_RESULT([yes, $XBSA_CFLAGS])
557        else
558                AC_MSG_RESULT([no, missing xbsa.h header file])
559        fi
560else
561        AC_MSG_RESULT([no])
562fi
563AC_SUBST(XBSA_CFLAGS)
564
565dnl checks for header files.
566AC_HEADER_STDC
567AC_HEADER_SYS_WAIT
568AC_HEADER_DIRENT
569AC_CHECK_HEADERS(stdlib.h string.h unistd.h fcntl.h sys/time.h sys/file.h)
570AC_CHECK_HEADERS(netinet/in.h netdb.h sys/fcntl.h sys/mnttab.h sys/mntent.h)
571AC_CHECK_HEADERS(mntent.h sys/vfs.h sys/param.h sys/fs_types.h)
572AC_CHECK_HEADERS(sys/mount.h strings.h termios.h signal.h)
573AC_CHECK_HEADERS(windows.h malloc.h winsock2.h direct.h io.h)
574AC_CHECK_HEADERS(security/pam_modules.h siad.h usersec.h ucontext.h)
575
576AC_CHECK_FUNCS(utimes random srandom getdtablesize snprintf re_comp re_exec)
577AC_CHECK_FUNCS(setprogname getprogname sigaction)
578AC_CHECK_TYPE(ssize_t, int)
579
580AC_CHECK_FUNCS(timegm)
581
582dnl Directory PATH handling
583if test "x$enable_transarc_paths" = "xyes"  ; then
584    afsconfdir=${afsconfdir=/usr/afs/etc}
585    viceetcdir=${viceetcdir=/usr/vice/etc}
586    afskerneldir=${afskerneldir=${viceetcdir}}
587    afssrvbindir=${afssrvbindir=/usr/afs/bin}
588    afssrvsbindir=${afssrvsbindir=/usr/afs/bin}
589    afssrvlibexecdir=${afssrvlibexecdir=/usr/afs/bin}
590    afsdbdir=${afsdbdir=/usr/afs/db}
591    afslogsdir=${afslogsdir=/usr/afs/logs}
592    afslocaldir=${afslocaldir=/usr/afs/local}
593    afsbackupdir=${afsbackupdir=/usr/afs/backup}
594    afsbosconfigdir=${afsbosconfigdir=/usr/afs/local}
595else
596    afsconfdir=${afsconfdir='${sysconfdir}/openafs/server'}
597    viceetcdir=${viceetcdir='${sysconfdir}/openafs'}
598    afskerneldir=${afskerneldir='${libdir}/openafs'}
599    afssrvbindir=${afssrvbindir='${bindir}'}
600    afssrvsbindir=${afssrvsbindir='${sbindir}'}
601    afssrvlibexecdir=${afssrvlibexecdir='${libexecdir}/openafs'}
602    afsdbdir=${afsdbdir='${localstatedir}/openafs/db'}
603    afslogsdir=${afslogsdir='${localstatedir}/openafs/logs'}
604    afslocaldir=${afslocaldir='${localstatedir}/openafs'}
605    afsbackupdir=${afsbackupdir='${localstatedir}/openafs/backup'}
606    afsbosconfigdir=${afsbosconfigdir='${sysconfdir}/openafs'}
607fi
608AC_SUBST(afsconfdir)
609AC_SUBST(viceetcdir)
610AC_SUBST(afskerneldir)
611AC_SUBST(afssrvbindir)
612AC_SUBST(afssrvsbindir)
613AC_SUBST(afssrvlibexecdir)
614AC_SUBST(afsdbdir)
615AC_SUBST(afslogsdir)
616AC_SUBST(afslocaldir)
617AC_SUBST(afsbackupdir)
618AC_SUBST(afsbosconfigdir)
619
620if test "x$enable_kernel_module" = "xyes"; then
621ENABLE_KERNEL_MODULE=libafs
622fi
623
624AC_SUBST(AFS_SYSNAME)
625AC_SUBST(ENABLE_KERNEL_MODULE)
626AC_SUBST(LIB_AFSDB)
627AC_SUBST(LINUX_KERNEL_PATH)
628AC_SUBST(LINUX_VERSION)
629AC_SUBST(MKAFS_OSTYPE)
630AC_SUBST(TOP_SRCDIR)
631AC_SUBST(TOP_INCDIR)
632AC_SUBST(TOP_LIBDIR)
633AC_SUBST(DEST)
634AC_SUBST(WITH_OBSOLETE)
635AC_SUBST(WITH_INSECURE)
636AC_SUBST(DARWIN_INFOFILE)
637AC_SUBST(IRIX_BUILD_IP35)
638
639])
640
641
642dnl AM_PROG_LEX
643dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
644AC_DEFUN(AM_PROG_LEX,
645[missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1)
646AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex")
647AC_PROG_LEX
648AC_DECL_YYTEXT])
649
650dnl
651dnl $Id: aclocal.m4,v 1.3 2002-12-13 22:06:41 zacheiss Exp $
652dnl
653
654dnl check if this computer is little or big-endian
655dnl if we can figure it out at compile-time then don't define the cpp symbol
656dnl otherwise test for it and define it.  also allow options for overriding
657dnl it when cross-compiling
658
659AC_DEFUN(OPENAFS_CHECK_BIGENDIAN, [
660AC_ARG_ENABLE(bigendian,
661[  --enable-bigendian   the target is big endian],
662openafs_cv_c_bigendian=yes)
663AC_ARG_ENABLE(littleendian,
664[  --enable-littleendian        the target is little endian],
665openafs_cv_c_bigendian=no)
666AC_CACHE_CHECK(whether byte order is known at compile time,
667openafs_cv_c_bigendian_compile,
668[AC_TRY_COMPILE([
669#include <sys/types.h>
670#include <sys/param.h>],[
671#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
672 bogus endian macros
673#endif], openafs_cv_c_bigendian_compile=yes, openafs_cv_c_bigendian_compile=no)])
674AC_CACHE_CHECK(whether byte ordering is bigendian, openafs_cv_c_bigendian,[
675  if test "$openafs_cv_c_bigendian_compile" = "yes"; then
676    AC_TRY_COMPILE([
677#include <sys/types.h>
678#include <sys/param.h>],[
679#if BYTE_ORDER != BIG_ENDIAN
680  not big endian
681#endif], openafs_cv_c_bigendian=yes, openafs_cv_c_bigendian=no)
682  else
683    AC_TRY_RUN([main () {
684      /* Are we little or big endian?  From Harbison&Steele.  */
685      union
686      {
687        long l;
688        char c[sizeof (long)];
689    } u;
690    u.l = 1;
691    exit (u.c[sizeof (long) - 1] == 1);
692  }], openafs_cv_c_bigendian=no, openafs_cv_c_bigendian=yes,
693  AC_MSG_ERROR([specify either --enable-bigendian or --enable-littleendian]))
694  fi
695])
696if test "$openafs_cv_c_bigendian" = "yes"; then
697  AC_DEFINE(WORDS_BIGENDIAN, 1, [define if target is big endian])dnl
698fi
699if test "$openafs_cv_c_bigendian_compile" = "yes"; then
700  AC_DEFINE(ENDIANESS_IN_SYS_PARAM_H, 1, [define if sys/param.h defines the endiness])dnl
701fi
702])
703
704
705AC_DEFUN(OPENAFS_GCC_SUPPORTS_MARCH, [
706AC_MSG_CHECKING(if $CC accepts -march=pentium)
707save_CFLAGS="$CFLAGS"
708CFLAGS="-MARCH=pentium"
709AC_CACHE_VAL(openafs_gcc_supports_march,[
710AC_TRY_COMPILE(
711[],
712[int x;],
713openafs_gcc_supports_march=yes,
714openafs_gcc_supports_march=no)])
715AC_MSG_RESULT($openafs_gcc_supports_march)
716if test x$openafs_gcc_supports_march = xyes; then
717  P5PLUS_KOPTS="-march=pentium"
718else
719  P5PLUS_KOPTS="-m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2"
720fi
721CFLAGS="$save_CFLAGS"
722])
723
724AC_DEFUN(OPENAFS_GCC_NEEDS_NO_STRICT_ALIASING, [
725AC_MSG_CHECKING(if $CC needs -fno-strict-aliasing)
726save_CFLAGS="$CFLAGS"
727CFLAGS="-fno-strict-aliasing"
728AC_CACHE_VAL(openafs_gcc_needs_no_strict_aliasing,[
729AC_TRY_COMPILE(
730[],
731[int x;],
732openafs_gcc_needs_no_strict_aliasing=yes,
733openafs_gcc_needs_no_strict_aliasing=no)])
734AC_MSG_RESULT($openafs_gcc_needs_no_strict_aliasing)
735if test x$openafs_gcc_needs_no_strict_aliasing = xyes; then
736  LINUX_GCC_KOPTS="$LINUX_GCC_KOPTS -fno-strict-aliasing"
737fi
738CFLAGS="$save_CFLAGS"
739])
740
741AC_DEFUN(OPENAFS_GCC_NEEDS_NO_STRENGTH_REDUCE, [
742AC_MSG_CHECKING(if $CC needs -fno-strength-reduce)
743save_CFLAGS="$CFLAGS"
744CFLAGS="-fno-strength-reduce"
745AC_CACHE_VAL(openafs_gcc_needs_no_strength_reduce,[
746AC_TRY_COMPILE(
747[],
748[int x;],
749openafs_gcc_needs_no_strength_reduce=yes,
750openafs_gcc_needs_no_strength_reduce=no)])
751AC_MSG_RESULT($openafs_gcc_needs_no_strength_reduce)
752if test x$openafs_gcc_needs_no_strength_reduce = xyes; then
753  LINUX_GCC_KOPTS="$LINUX_GCC_KOPTS -fno-strength-reduce"
754fi
755CFLAGS="$save_CFLAGS"
756])
757
758AC_DEFUN(OPENAFS_GCC_SUPPORTS_NO_COMMON, [
759AC_MSG_CHECKING(if $CC supports -fno-common)
760save_CFLAGS="$CFLAGS"
761CFLAGS="-fno-common"
762AC_CACHE_VAL(openafs_gcc_supports_no_common,[
763AC_TRY_COMPILE(
764[],
765[int x;],
766openafs_gcc_supports_no_common=yes,
767openafs_gcc_supports_no_common=no)])
768AC_MSG_RESULT($openafs_gcc_supports_no_common)
769if test x$openafs_gcc_supports_no_common = xyes; then
770  LINUX_GCC_KOPTS="$LINUX_GCC_KOPTS -fno-common"
771fi
772CFLAGS="$save_CFLAGS"
773])
774
775
776AC_DEFUN(LINUX_FS_STRUCT_ADDRESS_SPACE_HAS_GFP_MASK, [
777AC_MSG_CHECKING(for gfp_mask in struct address_space)
778save_CPPFLAGS="$CPPFLAGS"
779CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
780AC_CACHE_VAL(ac_cv_linux_fs_struct_address_space_has_gfp_mask,
781[
782AC_TRY_COMPILE(
783[#include <linux/fs.h>],
784[struct address_space _a;
785printf("%d\n", _a.gfp_mask);],
786ac_cv_linux_fs_struct_address_space_has_gfp_mask=yes,
787ac_cv_linux_fs_struct_address_space_has_gfp_mask=no)])
788AC_MSG_RESULT($ac_cv_linux_fs_struct_address_space_has_gfp_mask)
789CPPFLAGS="$save_CPPFLAGS"])
790
791AC_DEFUN(LINUX_FS_STRUCT_INODE_HAS_I_BYTES, [
792AC_MSG_CHECKING(for i_bytes in struct inode)
793save_CPPFLAGS="$CPPFLAGS"
794CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
795AC_CACHE_VAL(ac_cv_linux_fs_struct_inode_has_i_bytes,
796[
797AC_TRY_COMPILE(
798[#include <linux/fs.h>],
799[struct inode _inode;
800printf("%d\n", _inode.i_bytes);],
801ac_cv_linux_fs_struct_inode_has_i_bytes=yes,
802ac_cv_linux_fs_struct_inode_has_i_bytes=no)])
803AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_bytes)
804CPPFLAGS="$save_CPPFLAGS"])
805
806AC_DEFUN(LINUX_FS_STRUCT_INODE_HAS_I_TRUNCATE_SEM, [
807AC_MSG_CHECKING(for i_truncate_sem in struct inode)
808save_CPPFLAGS="$CPPFLAGS"
809CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
810AC_CACHE_VAL(ac_cv_linux_fs_struct_inode_has_i_truncate_sem,
811[
812AC_TRY_COMPILE(
813[#include <linux/fs.h>],
814[struct inode _i;
815printf("%x\n", _i.i_truncate_sem);],
816ac_cv_linux_fs_struct_inode_has_i_truncate_sem=yes,
817ac_cv_linux_fs_struct_inode_has_i_truncate_sem=no)])
818AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_truncate_sem)
819CPPFLAGS="$save_CPPFLAGS"])
820
821AC_DEFUN(LINUX_FS_STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK, [
822AC_MSG_CHECKING(for page_lock in struct address_space)
823save_CPPFLAGS="$CPPFLAGS"
824CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
825AC_CACHE_VAL(ac_cv_linux_fs_struct_address_space_has_page_lock,
826[
827AC_TRY_COMPILE(
828[#include <linux/fs.h>],
829[struct address_space _a_s;
830printf("%x\n", _a_s.page_lock);],
831ac_cv_linux_fs_struct_address_space_has_page_lock=yes,
832ac_cv_linux_fs_struct_address_space_has_page_lock=no)])
833AC_MSG_RESULT($ac_cv_linux_fs_struct_address_space_has_page_lock)
834CPPFLAGS="$save_CPPFLAGS"])
835
836
837dnl LINUX_BUILD_VNODE_FROM_INODE (configdir, outputdir)
838dnl             defaults: (src/config, src/afs/LINUX)
839
840AC_DEFUN(LINUX_BUILD_VNODE_FROM_INODE, [
841AC_MSG_CHECKING(whether to build osi_vfs.h)
842configdir=ifelse([$1], ,src/config,$1)
843outputdir=ifelse([$2], ,src/afs/LINUX,$2)
844chmod +x $configdir/make_vnode.pl
845$configdir/make_vnode.pl -i $LINUX_KERNEL_PATH -o $outputdir
846])
847
848AC_DEFUN(LINUX_EXPORTS_TASKLIST_LOCK, [
849AC_MSG_CHECKING(for exported tasklist_lock)
850save_CPPFLAGS="$CPPFLAGS"
851CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
852AC_CACHE_VAL(ac_cv_linux_exports_tasklist_lock,
853[
854AC_TRY_COMPILE(
855[#include <linux/modversions.h>],
856[#ifndef __ver_tasklist_lock
857#error tasklist_lock not exported
858#endif],
859ac_cv_linux_exports_tasklist_lock=yes,
860ac_cv_linux_exports_tasklist_lock=no)])
861AC_MSG_RESULT($ac_cv_linux_exports_tasklist_lock)
862CPPFLAGS="$save_CPPFLAGS"])
863
864AC_DEFUN(LINUX_EXPORTS_SYS_CALL_TABLE, [
865AC_MSG_CHECKING(for exported sys_call_table)
866save_CPPFLAGS="$CPPFLAGS"
867CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
868AC_CACHE_VAL(ac_cv_linux_exports_sys_call_table,
869[
870AC_TRY_COMPILE(
871[#include <linux/modversions.h>],
872[#ifndef __ver_sys_call_table
873#error sys_call_table not exported
874#endif],
875ac_cv_linux_exports_sys_call_table=yes,
876ac_cv_linux_exports_sys_call_table=no)])
877AC_MSG_RESULT($ac_cv_linux_exports_sys_call_table)
878CPPFLAGS="$save_CPPFLAGS"])
879
880AC_DEFUN(LINUX_EXPORTS_INIT_MM, [
881AC_MSG_CHECKING(for exported init_mm)
882save_CPPFLAGS="$CPPFLAGS"
883CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
884AC_CACHE_VAL(ac_cv_linux_exports_init_mm,
885[
886AC_TRY_COMPILE(
887[#include <linux/modversions.h>],
888[#ifndef __ver_init_mm
889#error init_mm not exported
890#endif],
891ac_cv_linux_exports_init_mm=yes,
892ac_cv_linux_exports_init_mm=no)])
893AC_MSG_RESULT($ac_cv_linux_exports_init_mm)
894CPPFLAGS="$save_CPPFLAGS"])
895
896AC_DEFUN(LINUX_EXPORTS_KALLSYMS_SYMBOL, [
897AC_MSG_CHECKING(for exported kallsyms_symbol_to_address)
898save_CPPFLAGS="$CPPFLAGS"
899CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
900AC_CACHE_VAL(ac_cv_linux_exports_kallsyms_symbol,
901[
902AC_TRY_COMPILE(
903[#include <linux/modversions.h>],
904[#ifndef __ver_kallsyms_symbol_to_address
905#error kallsyms_symbol_to_address not exported
906#endif],
907ac_cv_linux_exports_kallsyms_symbol=yes,
908ac_cv_linux_exports_kallsyms_symbol=no)])
909AC_MSG_RESULT($ac_cv_linux_exports_kallsyms_symbol)
910CPPFLAGS="$save_CPPFLAGS"])
911
912AC_DEFUN(LINUX_EXPORTS_KALLSYMS_ADDRESS, [
913AC_MSG_CHECKING(for exported kallsyms_address_to_symbol)
914save_CPPFLAGS="$CPPFLAGS"
915CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
916AC_CACHE_VAL(ac_cv_linux_exports_kallsyms_address,
917[
918AC_TRY_COMPILE(
919[#include <linux/modversions.h>],
920[#ifndef __ver_kallsyms_address_to_symbol
921#error kallsyms_address_to_symbol not exported
922#endif],
923ac_cv_linux_exports_kallsyms_address=yes,
924ac_cv_linux_exports_kallsyms_address=no)])
925AC_MSG_RESULT($ac_cv_linux_exports_kallsyms_address)
926CPPFLAGS="$save_CPPFLAGS"])
927
928AC_DEFUN(LINUX_COMPLETION_H_EXISTS, [
929AC_MSG_CHECKING(for linux/completion.h existance)
930save_CPPFLAGS="$CPPFLAGS"
931CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
932AC_CACHE_VAL(ac_cv_linux_completion_h_exists,
933[
934AC_TRY_COMPILE(
935[#include <linux/completion.h>
936#include <linux/version.h>],
937[struct completion _c;
938#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,8)
939lose
940#endif
941],
942ac_cv_linux_completion_h_exists=yes,
943ac_cv_linux_completion_h_exists=no)])
944AC_MSG_RESULT($ac_cv_linux_completion_h_exists)
945CPPFLAGS="$save_CPPFLAGS"])
946
947AC_DEFUN(LINUX_FS_STRUCT_INODE_HAS_I_MMAP_SHARED, [
948AC_MSG_CHECKING(for i_mmap_shared in struct inode)
949save_CPPFLAGS="$CPPFLAGS"
950CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
951AC_CACHE_VAL(ac_cv_linux_fs_struct_inode_has_i_mmap_shared,
952[
953AC_TRY_COMPILE(
954[#include <linux/fs.h>],
955[struct inode _inode;
956printf("%d\n", _inode.i_mmap_shared);],
957ac_cv_linux_fs_struct_inode_has_i_mmap_shared=yes,
958ac_cv_linux_fs_struct_inode_has_i_mmap_shared=no)])
959AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_mmap_shared)
960CPPFLAGS="$save_CPPFLAGS"])
961
962AC_DEFUN(LINUX_FS_STRUCT_INODE_HAS_I_DIRTY_DATA_BUFFERS, [
963AC_MSG_CHECKING(for i_dirty_data_buffers in struct inode)
964save_CPPFLAGS="$CPPFLAGS"
965CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
966AC_CACHE_VAL(ac_cv_linux_fs_struct_inode_has_i_dirty_data_buffers,
967[
968AC_TRY_COMPILE(
969[#include <linux/fs.h>],
970[struct inode _inode;
971printf("%d\n", _inode.i_dirty_data_buffers);],
972ac_cv_linux_fs_struct_inode_has_i_dirty_data_buffers=yes,
973ac_cv_linux_fs_struct_inode_has_i_dirty_data_buffers=no)])
974AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_dirty_data_buffers)
975CPPFLAGS="$save_CPPFLAGS"])
976
977AC_DEFUN(LINUX_FS_STRUCT_INODE_HAS_I_MAPPING_OVERLOAD, [
978AC_MSG_CHECKING(for i_mapping_overload in struct inode)
979save_CPPFLAGS="$CPPFLAGS"
980CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
981AC_CACHE_VAL(ac_cv_linux_fs_struct_inode_has_i_mapping_overload,
982[
983AC_TRY_COMPILE(
984[#include <linux/fs.h>],
985[struct inode _inode;
986printf("%d\n", _inode.i_mapping_overload);],
987ac_cv_linux_fs_struct_inode_has_i_mapping_overload=yes,
988ac_cv_linux_fs_struct_inode_has_i_mapping_overload=no)])
989AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_mapping_overload)
990CPPFLAGS="$save_CPPFLAGS"])
991
992AC_DEFUN(LINUX_FS_STRUCT_INODE_HAS_I_CDEV, [
993AC_MSG_CHECKING(for i_cdev in struct inode)
994save_CPPFLAGS="$CPPFLAGS"
995CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
996AC_CACHE_VAL(ac_cv_linux_fs_struct_inode_has_i_cdev,
997[
998AC_TRY_COMPILE(
999[#include <linux/fs.h>],
1000[struct inode _inode;
1001printf("%d\n", _inode.i_cdev);],
1002ac_cv_linux_fs_struct_inode_has_i_cdev=yes,
1003ac_cv_linux_fs_struct_inode_has_i_cdev=no)])
1004AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_cdev)
1005CPPFLAGS="$save_CPPFLAGS"])
1006
1007AC_DEFUN(LINUX_FS_STRUCT_INODE_HAS_I_DEVICES, [
1008AC_MSG_CHECKING(for i_devices in struct inode)
1009save_CPPFLAGS="$CPPFLAGS"
1010CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
1011AC_CACHE_VAL(ac_cv_linux_fs_struct_inode_has_i_cdev,
1012[
1013AC_TRY_COMPILE(
1014[#include <linux/fs.h>],
1015[struct inode _inode;
1016printf("%d\n", _inode.i_devices);],
1017ac_cv_linux_fs_struct_inode_has_i_devices=yes,
1018ac_cv_linux_fs_struct_inode_has_i_devices=no)])
1019AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_devices)
1020CPPFLAGS="$save_CPPFLAGS"])
1021
1022
1023AC_DEFUN(LINUX_INODE_SETATTR_RETURN_TYPE,[
1024AC_MSG_CHECKING(for inode_setattr return type)
1025save_CPPFLAGS="$CPPFLAGS"
1026CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
1027AC_CACHE_VAL(ac_cv_linux_func_inode_setattr_returns_int,
1028[
1029AC_TRY_COMPILE(
1030[#include <linux/fs.h>],
1031[struct inode _inode;
1032struct iattr _iattr;
1033int i;
1034i = inode_setattr(&_inode, &_iattr);],
1035ac_cv_linux_func_inode_setattr_returns_int=yes,
1036ac_cv_linux_func_inode_setattr_returns_int=no)])
1037AC_MSG_RESULT($ac_cv_linux_func_inode_setattr_returns_int)
1038CPPFLAGS="$save_CPPFLAGS"])
1039
1040AC_DEFUN(LINUX_NEED_RHCONFIG,[
1041RHCONFIG_SP=""
1042RHCONFIG_MP=""
1043if test "x$enable_redhat_buildsys" = "xyes"; then
1044  AC_MSG_WARN(Configured to build from a Red Hat SPEC file)
1045else
1046  AC_MSG_CHECKING(for redhat kernel configuration)
1047  if test -f "${LINUX_KERNEL_PATH}/include/linux/rhconfig.h"; then
1048    ac_linux_rhconfig=yes
1049    RHCONFIG_SP="-D__BOOT_KERNEL_UP=1 -D__BOOT_KERNEL_SMP=0"
1050    RHCONFIG_MP="-D__BOOT_KERNEL_UP=0 -D__BOOT_KERNEL_SMP=1"
1051    AC_MSG_RESULT($ac_linux_rhconfig)
1052    if test ! -f "/boot/kernel.h"; then
1053        AC_MSG_WARN([/boot/kernel.h does not exist. build may fail])
1054    fi
1055  else
1056    ac_linux_rhconfig=no
1057    AC_MSG_RESULT($ac_linux_rhconfig)
1058  fi
1059fi
1060AC_SUBST(RHCONFIG_SP)
1061AC_SUBST(RHCONFIG_MP)
1062])
1063
1064AC_DEFUN(LINUX_WHICH_MODULES,[
1065if test "x$enable_redhat_buildsys" = "xyes"; then
1066  MPS=Default
1067else
1068  save_CPPFLAGS="$CPPFLAGS"
1069  CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $RHCONFIG_SP $CPPFLAGS"
1070  AC_MSG_CHECKING(if kernel uses MODVERSIONS)
1071  AC_CACHE_VAL(ac_cv_linux_config_modversions,[
1072  AC_TRY_COMPILE(
1073[#include <linux/config.h>
1074],
1075[#ifndef CONFIG_MODVERSIONS
1076lose;
1077#endif
1078],
1079  ac_cv_linux_config_modversions=yes,
1080  ac_cv_linux_config_modversions=no)])
1081  AC_MSG_RESULT($ac_cv_linux_config_modversions)
1082  AC_MSG_CHECKING(which kernel modules to build)
1083  if test "x$ac_linux_rhconfig" = "xyes" -o "x$ac_cv_linux_config_modversions" = "xno"; then
1084      MPS="MP SP"
1085  else
1086  AC_CACHE_VAL(ac_cv_linux_config_smp, [
1087  AC_TRY_COMPILE(
1088[#include <linux/config.h>
1089],
1090[#ifndef CONFIG_SMP
1091lose;
1092#endif
1093],
1094  ac_cv_linux_config_smp=yes,
1095  ac_cv_linux_config_smp=no)])
1096  dnl AC_MSG_RESULT($ac_cv_linux_config_smp)
1097      if test "x$ac_cv_linux_config_smp" = "xyes"; then
1098          MPS=MP
1099      else
1100          MPS=SP
1101      fi
1102  fi
1103  CPPFLAGS=$save_CPPFLAGS
1104  AC_MSG_RESULT($MPS)
1105fi
1106AC_SUBST(MPS)
1107])
1108
1109
1110AC_DEFUN(SOLARIS_UFSVFS_HAS_DQRWLOCK, [
1111AC_MSG_CHECKING(for vfs_dqrwlock in struct ufsvfs)
1112AC_CACHE_VAL(ac_cv_solaris_ufsvfs_has_dqrwlock,
1113[
1114AC_TRY_COMPILE(
1115[#define _KERNEL
1116#include <sys/fs/ufs_inode.h>],
1117[struct ufsvfs _ufsvfs;
1118(void) _ufsvfs.vfs_dqrwlock;],
1119ac_cv_solaris_ufsvfs_has_dqrwlock=yes,
1120ac_cv_solaris_ufsvfs_has_dqrwlock=no)])
1121AC_MSG_RESULT($ac_cv_solaris_ufsvfs_has_dqrwlock)
1122if test "$ac_cv_solaris_ufsvfs_has_dqrwlock" = "yes"; then
1123  AC_DEFINE(HAVE_VFS_DQRWLOCK, 1, [define if struct ufsvfs has vfs_dqrwlock])
1124fi
1125])
1126
1127
1128AC_DEFUN(SOLARIS_PROC_HAS_P_COREFILE, [
1129AC_MSG_CHECKING(for p_corefile in struct proc)
1130AC_CACHE_VAL(ac_cv_solaris_proc_has_p_corefile,
1131[
1132AC_TRY_COMPILE(
1133[#define _KERNEL
1134#include <sys/proc.h>],
1135[struct proc _proc;
1136(void) _proc.p_corefile;],
1137ac_cv_solaris_proc_has_p_corefile=yes,
1138ac_cv_solaris_proc_has_p_corefile=no)])
1139AC_MSG_RESULT($ac_cv_solaris_proc_has_p_corefile)
1140if test "$ac_cv_solaris_proc_has_p_corefile" = "yes"; then
1141  AC_DEFINE(HAVE_P_COREFILE, 1, [define if struct proc has p_corefile])
1142fi
1143])
1144
1145
1146# Do all the work for Automake.  This macro actually does too much --
1147# some checks are only needed if your package does certain things.
1148# But this isn't really a big deal.
1149
1150# serial 1
1151
1152dnl Usage:
1153dnl AM_INIT_AUTOMAKE(package,version, [no-define])
1154
1155AC_DEFUN(AM_INIT_AUTOMAKE,
1156[AC_REQUIRE([AC_PROG_INSTALL])
1157PACKAGE=[$1]
1158AC_SUBST(PACKAGE)
1159VERSION=[$2]
1160AC_SUBST(VERSION)
1161dnl test to see if srcdir already configured
1162if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
1163  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
1164fi
1165ifelse([$3],,
1166AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
1167AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
1168AC_REQUIRE([AM_SANITY_CHECK])
1169AC_REQUIRE([AC_ARG_PROGRAM])
1170dnl FIXME This is truly gross.
1171missing_dir=`cd $ac_aux_dir && pwd`
1172AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
1173AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
1174AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
1175AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
1176AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
1177AC_REQUIRE([AC_PROG_MAKE_SET])])
1178
1179#
1180# Check to make sure that the build environment is sane.
1181#
1182
1183AC_DEFUN(AM_SANITY_CHECK,
1184[AC_MSG_CHECKING([whether build environment is sane])
1185# Just in case
1186sleep 1
1187echo timestamp > conftestfile
1188# Do `set' in a subshell so we don't clobber the current shell's
1189# arguments.  Must try -L first in case configure is actually a
1190# symlink; some systems play weird games with the mod time of symlinks
1191# (eg FreeBSD returns the mod time of the symlink's containing
1192# directory).
1193if (
1194   set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
1195   if test "[$]*" = "X"; then
1196      # -L didn't work.
1197      set X `ls -t $srcdir/configure conftestfile`
1198   fi
1199   if test "[$]*" != "X $srcdir/configure conftestfile" \
1200      && test "[$]*" != "X conftestfile $srcdir/configure"; then
1201
1202      # If neither matched, then we have a broken ls.  This can happen
1203      # if, for instance, CONFIG_SHELL is bash and it inherits a
1204      # broken ls alias from the environment.  This has actually
1205      # happened.  Such a system could not be considered "sane".
1206      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
1207alias in your environment])
1208   fi
1209
1210   test "[$]2" = conftestfile
1211   )
1212then
1213   # Ok.
1214   :
1215else
1216   AC_MSG_ERROR([newly created file is older than distributed files!
1217Check your system clock])
1218fi
1219rm -f conftest*
1220AC_MSG_RESULT(yes)])
1221
1222dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
1223dnl The program must properly implement --version.
1224AC_DEFUN(AM_MISSING_PROG,
1225[AC_MSG_CHECKING(for working $2)
1226# Run test in a subshell; some versions of sh will print an error if
1227# an executable is not found, even if stderr is redirected.
1228# Redirect stdin to placate older versions of autoconf.  Sigh.
1229if ($2 --version) < /dev/null > /dev/null 2>&1; then
1230   $1=$2
1231   AC_MSG_RESULT(found)
1232else
1233   $1="$3/missing $2"
1234   AC_MSG_RESULT(missing)
1235fi
1236AC_SUBST($1)])
1237
Note: See TracBrowser for help on using the repository browser.