Am-Utils Cross Reference
am-utils/acinclude.m4

source navigation ]
diff markup ]
identifier search ]
freetext search ]
file search ]
 
Version: 6.0.1 ] [ 6.0.2 ] [ 6.0.3 ] [ 6.0.4 ] [ 6.0.5 ] [ 6.0.6 ] [ 6.0.7 ] [ 6.0.8 ] [ 6.0.9 ] [ 6.0.10 ] [ 6.1 ] [ 6.1.1 ]

  1 dnl aclocal.m4 file for am-utils-6.x
  2 dnl Contains definitions for specialized GNU-autoconf macros.
  3 dnl Author: Erez Zadok <ezk@cs.columbia.edu>
  4 dnl
  5 dnl DO NOT EDIT DIRECTLY!  Generated automatically by maintainers from
  6 dnl m4/GNUmakefile!
  7 dnl
  8 dnl ######################################################################
  9 dnl UNCOMMENT THE NEXT FEW LINES FOR DEBUGGING CONFIGURE
 10 dnl define([AC_CACHE_LOAD], )dnl
 11 dnl define([AC_CACHE_SAVE], )dnl
 12 dnl ======================================================================
 13 
 14 
 15 
 16 dnl ######################################################################
 17 dnl check if compiler can handle "void *"
 18 AC_DEFUN([AMU_C_VOID_P],
 19 [
 20 AC_CACHE_CHECK(if compiler can handle void *,
 21 ac_cv_c_void_p,
 22 [
 23 # try to compile a program which uses void *
 24 AC_TRY_COMPILE(
 25 [ ],
 26 [
 27 void *vp;
 28 ], ac_cv_c_void_p=yes, ac_cv_c_void_p=no)
 29 ])
 30 if test "$ac_cv_c_void_p" = yes
 31 then
 32   AC_DEFINE(voidp, void *)
 33 else
 34   AC_DEFINE(voidp, char *)
 35 fi
 36 ])
 37 dnl ======================================================================
 38 
 39 
 40 dnl ######################################################################
 41 dnl New versions of the cache functions which also dynamically evaluate the
 42 dnl cache-id field, so that it may contain shell variables to expand
 43 dnl dynamically for the creation of $ac_cv_* variables on the fly.
 44 dnl In addition, this function allows you to call COMMANDS which generate
 45 dnl output on the command line, because it prints its own AC_MSG_CHECKING
 46 dnl after COMMANDS are run.
 47 dnl
 48 dnl ======================================================================
 49 dnl AMU_CACHE_CHECK_DYNAMIC(MESSAGE, CACHE-ID, COMMANDS)
 50 define(AMU_CACHE_CHECK_DYNAMIC,
 51 [
 52 ac_tmp=`echo $2`
 53 if eval "test \"`echo '$''{'$ac_tmp'+set}'`\" = set"; then
 54   AC_MSG_CHECKING([$1])
 55   echo $ECHO_N "(cached) $ECHO_C" 1>&AS_MESSAGE_FD([])
 56 dnl XXX: for older autoconf versions
 57 dnl  echo $ac_n "(cached) $ac_c" 1>&AS_MESSAGE_FD([])
 58 else
 59   $3
 60   AC_MSG_CHECKING([$1])
 61 fi
 62 ac_tmp_val=`eval eval "echo '$''{'$ac_tmp'}'"`
 63 AC_MSG_RESULT($ac_tmp_val)
 64 ])
 65 dnl ======================================================================
 66 
 67 
 68 dnl ######################################################################
 69 dnl check if an automounter filesystem exists (it almost always does).
 70 dnl Usage: AC_CHECK_AMU_FS(<fs>, <msg>, [<depfs>])
 71 dnl Print the message in <msg>, and declare HAVE_AMU_FS_<fs> true.
 72 dnl If <depfs> is defined, then define this filesystem as tru only of the
 73 dnl filesystem for <depfs> is true.
 74 AC_DEFUN([AMU_CHECK_AMU_FS],
 75 [
 76 # store variable name of fs
 77 ac_upcase_am_fs_name=`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
 78 ac_safe=HAVE_AMU_FS_$ac_upcase_am_fs_name
 79 # check for cache and set it if needed
 80 AMU_CACHE_CHECK_DYNAMIC(for $2 filesystem ($1),
 81 ac_cv_am_fs_$1,
 82 [
 83 # true by default
 84 eval "ac_cv_am_fs_$1=yes"
 85 # if <depfs> exists but is defined to "no", set this filesystem to no.
 86 if test -n "$3"
 87 then
 88   # flse by default if arg 3 was supplied
 89   eval "ac_cv_am_fs_$1=no"
 90   if test "`eval echo '$''{ac_cv_fs_'$3'}'`" = yes
 91   then
 92     eval "ac_cv_am_fs_$1=yes"
 93   fi
 94   # some filesystems do not have a mnttab entry, but exist based on headers
 95   if test "`eval echo '$''{ac_cv_fs_header_'$3'}'`" = yes
 96   then
 97     eval "ac_cv_am_fs_$1=yes"
 98   fi
 99 fi
100 ])
101 # check if need to define variable
102 if test "`eval echo '$''{ac_cv_am_fs_'$1'}'`" = yes
103 then
104   AC_DEFINE_UNQUOTED($ac_safe)
105 fi
106 ])
107 dnl ======================================================================
108 
109 
110 dnl ######################################################################
111 dnl check the autofs flavor
112 AC_DEFUN([AMU_CHECK_AUTOFS_STYLE],
113 [
114 AC_CACHE_CHECK(autofs style,
115 ac_cv_autofs_style,
116 [
117 # select the correct style to mount(2) a filesystem
118 case "${host_os}" in
119        solaris1* | solaris2.[[0-4]] )
120                ac_cv_autofs_style=default ;;
121        solaris2.5* )
122                ac_cv_autofs_style=solaris_v1 ;;
123        # Solaris 8+ uses the AutoFS V3/V4 protocols, but they are very similar
124        # to V2, so use one style for all.
125        solaris* )
126                ac_cv_autofs_style=solaris_v2_v3 ;;
127        irix6* )
128                ac_cv_autofs_style=solaris_v1 ;;
129        linux* )
130                ac_cv_autofs_style=linux ;;
131        * )
132                ac_cv_autofs_style=default ;;
133 esac
134 ])
135 # always make a link and include the file name, otherwise on systems where
136 # autofs support has not been ported yet check_fs_{headers, mntent}.m4 add
137 # ops_autofs.o to AMD_FS_OBJS, but there's no way to build it.
138 am_utils_link_files=${am_utils_link_files}amd/ops_autofs.c:conf/autofs/autofs_${ac_cv_autofs_style}.c" "amu_autofs_prot.h:conf/autofs/autofs_${ac_cv_autofs_style}.h" "
139 
140 # set headers in a macro for Makefile.am files to use (for dependencies)
141 AMU_AUTOFS_PROT_HEADER='${top_builddir}/'amu_autofs_prot.h
142 AC_SUBST(AMU_AUTOFS_PROT_HEADER)
143 ])
144 dnl ======================================================================
145 
146 
147 dnl ######################################################################
148 dnl check style of fixmount check_mount() function
149 AC_DEFUN([AMU_CHECK_CHECKMOUNT_STYLE],
150 [
151 AC_CACHE_CHECK(style of fixmount check_mount(),
152 ac_cv_style_checkmount,
153 [
154 # select the correct style for unmounting filesystems
155 case "${host_os_name}" in
156         svr4* | sysv4* | solaris2* | sunos5* )
157                         ac_cv_style_checkmount=svr4 ;;
158         bsd44* | bsdi* | freebsd* | netbsd* | openbsd* | darwin* | macosx* | rhapsody* )
159                         ac_cv_style_checkmount=bsd44 ;;
160         aix* )
161                         ac_cv_style_checkmount=aix ;;
162         osf* )
163                         ac_cv_style_checkmount=osf ;;
164         ultrix* )
165                         ac_cv_style_checkmount=ultrix ;;
166         * )
167                         ac_cv_style_checkmount=default ;;
168 esac
169 ])
170 am_utils_checkmount_style_file="check_mount.c"
171 am_utils_link_files=${am_utils_link_files}fixmount/${am_utils_checkmount_style_file}:conf/checkmount/checkmount_${ac_cv_style_checkmount}.c" "
172 
173 ])
174 dnl ======================================================================
175 
176 
177 dnl ######################################################################
178 dnl check for external definition for a function (not external variables)
179 dnl Usage AMU_CHECK_EXTERN(extern)
180 dnl Checks for external definition for "extern" that is delimited on the
181 dnl left and the right by a character that is not a valid symbol character.
182 dnl
183 dnl Note that $pattern below is very carefully crafted to match any system
184 dnl external definition, with __P posix prototypes, with or without an extern
185 dnl word, etc.  Think twice before changing this.
186 AC_DEFUN([AMU_CHECK_EXTERN],
187 [
188 # store variable name for external definition
189 ac_upcase_extern_name=`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
190 ac_safe=HAVE_EXTERN_$ac_upcase_extern_name
191 # check for cached value and set it if needed
192 AMU_CACHE_CHECK_DYNAMIC(external function definition for $1,
193 ac_cv_extern_$1,
194 [
195 # the old pattern assumed that the complete external definition is on one
196 # line but on some systems it is split over several lines, so only match
197 # beginning of the extern definition including the opening parenthesis.
198 #pattern="(extern)?.*[^a-zA-Z0-9_]$1[^a-zA-Z0-9_]?.*\(.*\).*;"
199 pattern="(extern)?.*[[^a-zA-Z0-9_]]$1[[^a-zA-Z0-9_]]?.*\("
200 AC_EGREP_CPP(${pattern},
201 [
202 #ifdef HAVE_SYS_TYPES_H
203 # include <sys/types.h>
204 #endif /* HAVE_SYS_TYPES_H */
205 #ifdef HAVE_SYS_WAIT_H
206 # include <sys/wait.h>
207 #endif /* HAVE_SYS_WAIT_H */
208 #if TIME_WITH_SYS_TIME
209 # include <sys/time.h>
210 # include <time.h>
211 #else /* not TIME_WITH_SYS_TIME */
212 # if HAVE_SYS_TIME_H
213 #  include <sys/time.h>
214 # else /* not HAVE_SYS_TIME_H */
215 #  include <time.h>
216 # endif /* not HAVE_SYS_TIME_H */
217 #endif /* not TIME_WITH_SYS_TIME */
218 
219 #if defined(_AIX) && defined(HAVE_SYS_VMOUNT_H)
220 # include <sys/vmount.h>
221 #endif /* defined(_AIX) && defined(HAVE_SYS_VMOUNT_H) */
222 
223 #ifdef HAVE_STDIO_H
224 # include <stdio.h>
225 #endif /* HAVE_STDIO_H */
226 #ifdef HAVE_STDLIB_H
227 # include <stdlib.h>
228 #endif /* HAVE_STDLIB_H */
229 #if HAVE_UNISTD_H
230 # include <unistd.h>
231 #endif /* HAVE_UNISTD_H */
232 #if HAVE_STRING_H
233 # include <string.h>
234 #endif /* HAVE_STRING_H */
235 #ifdef HAVE_STRINGS_H
236 # include <strings.h>
237 #endif /* HAVE_STRINGS_H */
238 #ifdef HAVE_NETDB_H
239 # include <netdb.h>
240 #endif /* HAVE_NETDB_H */
241 #ifdef HAVE_CLUSTER_H
242 # include <cluster.h>
243 #endif /* HAVE_CLUSTER_H */
244 #ifdef HAVE_RPC_RPC_H
245 /*
246  * Turn on PORTMAP, so that additional header files would get included
247  * and the important definition for UDPMSGSIZE is included too.
248  */
249 # ifndef PORTMAP
250 #  define PORTMAP
251 # endif /* not PORTMAP */
252 # include <rpc/rpc.h>
253 # ifndef XDRPROC_T_TYPE
254 typedef bool_t (*xdrproc_t) __P ((XDR *, __ptr_t, ...));
255 # endif /* not XDRPROC_T_TYPE */
256 #endif /* HAVE_RPC_RPC_H */
257 
258 #if defined(HAVE_TCPD_H) && defined(HAVE_LIBWRAP)
259 # include <tcpd.h>
260 #endif /* defined(HAVE_TCPD_H) && defined(HAVE_LIBWRAP) */
261 
262 ], eval "ac_cv_extern_$1=yes", eval "ac_cv_extern_$1=no")
263 ])
264 # check if need to define variable
265 if test "`eval echo '$''{ac_cv_extern_'$1'}'`" = yes
266 then
267   AC_DEFINE_UNQUOTED($ac_safe)
268 fi
269 ])
270 dnl ======================================================================
271 
272 dnl ######################################################################
273 dnl run AMU_CHECK_EXTERN on each argument given
274 dnl Usage: AMU_CHECK_EXTERNS(arg arg arg ...)
275 AC_DEFUN([AMU_CHECK_EXTERNS],
276 [
277 for ac_tmp_arg in $1
278 do
279 AMU_CHECK_EXTERN($ac_tmp_arg)
280 done
281 ])
282 dnl ======================================================================
283 
284 
285 dnl ######################################################################
286 dnl check for external definition for an LDAP function (not external variables)
287 dnl Usage AMU_CHECK_EXTERN_LDAP(extern)
288 dnl Checks for external definition for "extern" that is delimited on the
289 dnl left and the right by a character that is not a valid symbol character.
290 dnl
291 dnl Note that $pattern below is very carefully crafted to match any system
292 dnl external definition, with __P posix prototypes, with or without an extern
293 dnl word, etc.  Think twice before changing this.
294 AC_DEFUN([AMU_CHECK_EXTERN_LDAP],
295 [
296 # store variable name for external definition
297 ac_upcase_extern_name=`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
298 ac_safe=HAVE_EXTERN_$ac_upcase_extern_name
299 # check for cached value and set it if needed
300 AMU_CACHE_CHECK_DYNAMIC(external function definition for $1,
301 ac_cv_extern_$1,
302 [
303 # the old pattern assumed that the complete external definition is on one
304 # line but on some systems it is split over several lines, so only match
305 # beginning of the extern definition including the opening parenthesis.
306 #pattern="(extern)?.*[^a-zA-Z0-9_]$1[^a-zA-Z0-9_]?.*\(.*\).*;"
307 dnl This expression is a bit different than check_extern.m4 because of the
308 dnl way that openldap wrote their externs in <ldap.h>.
309 pattern="(extern)?.*([[^a-zA-Z0-9_]])?$1[[^a-zA-Z0-9_]]?.*\("
310 AC_EGREP_CPP(${pattern},
311 [
312 #ifdef HAVE_SYS_TYPES_H
313 # include <sys/types.h>
314 #endif /* HAVE_SYS_TYPES_H */
315 #ifdef HAVE_SYS_WAIT_H
316 # include <sys/wait.h>
317 #endif /* HAVE_SYS_WAIT_H */
318 #if TIME_WITH_SYS_TIME
319 # include <sys/time.h>
320 # include <time.h>
321 #else /* not TIME_WITH_SYS_TIME */
322 # if HAVE_SYS_TIME_H
323 #  include <sys/time.h>
324 # else /* not HAVE_SYS_TIME_H */
325 #  include <time.h>
326 # endif /* not HAVE_SYS_TIME_H */
327 #endif /* not TIME_WITH_SYS_TIME */
328 
329 #ifdef HAVE_STDIO_H
330 # include <stdio.h>
331 #endif /* HAVE_STDIO_H */
332 #ifdef HAVE_STDLIB_H
333 # include <stdlib.h>
334 #endif /* HAVE_STDLIB_H */
335 #if HAVE_UNISTD_H
336 # include <unistd.h>
337 #endif /* HAVE_UNISTD_H */
338 #if HAVE_STRING_H
339 # include <string.h>
340 #endif /* HAVE_STRING_H */
341 #ifdef HAVE_STRINGS_H
342 # include <strings.h>
343 #endif /* HAVE_STRINGS_H */
344 #ifdef HAVE_NETDB_H
345 # include <netdb.h>
346 #endif /* HAVE_NETDB_H */
347 #ifdef HAVE_CLUSTER_H
348 # include <cluster.h>
349 #endif /* HAVE_CLUSTER_H */
350 #ifdef HAVE_RPC_RPC_H
351 /*
352  * Turn on PORTMAP, so that additional header files would get included
353  * and the important definition for UDPMSGSIZE is included too.
354  */
355 # ifndef PORTMAP
356 #  define PORTMAP
357 # endif /* not PORTMAP */
358 # include <rpc/rpc.h>
359 # ifndef XDRPROC_T_TYPE
360 typedef bool_t (*xdrproc_t) __P ((XDR *, __ptr_t, ...));
361 # endif /* not XDRPROC_T_TYPE */
362 #endif /* HAVE_RPC_RPC_H */
363 
364 #if defined(HAVE_TCPD_H) && defined(HAVE_LIBWRAP)
365 # include <tcpd.h>
366 #endif /* defined(HAVE_TCPD_H) && defined(HAVE_LIBWRAP) */
367 
368 #ifdef HAVE_LDAP_H
369 # include <ldap.h>
370 #endif /* HAVE_LDAP_H */
371 #ifdef HAVE_LBER_H
372 # include <lber.h>
373 #endif /* HAVE_LBER_H */
374 
375 ], eval "ac_cv_extern_$1=yes", eval "ac_cv_extern_$1=no")
376 ])
377 # check if need to define variable
378 if test "`eval echo '$''{ac_cv_extern_'$1'}'`" = yes
379 then
380   AC_DEFINE_UNQUOTED($ac_safe)
381 fi
382 ])
383 dnl ======================================================================
384 
385 
386 dnl ######################################################################
387 dnl Find if type 'fhandle' exists
388 AC_DEFUN([AMU_CHECK_FHANDLE],
389 [
390 AC_CACHE_CHECK(if plain fhandle type exists,
391 ac_cv_have_fhandle,
392 [
393 # try to compile a program which may have a definition for the type
394 # set to a default value
395 ac_cv_have_fhandle=no
396 # look for "struct nfs_fh"
397 if test "$ac_cv_have_fhandle" = no
398 then
399 AC_TRY_COMPILE_NFS(
400 [ fhandle a;
401 ], ac_cv_have_fhandle=yes, ac_cv_have_fhandle=no)
402 fi
403 
404 ])
405 if test "$ac_cv_have_fhandle" != no
406 then
407   AC_DEFINE(HAVE_FHANDLE)
408 fi
409 ])
410 dnl ======================================================================
411 
412 
413 dnl ######################################################################
414 dnl FIXED VERSION OF AUTOCONF 2.59 AC_CHECK_MEMBER.  g/cc will fail to check
415 dnl a member if the .member is itself a data structure, because you cannot
416 dnl compare, in C, a data structure against NULL; you can compare a native
417 dnl data type (int, char) or a pointer.  Solution: do what I did in my
418 dnl original member checking macro: try to take the address of the member.
419 dnl You can always take the address of anything.
420 dnl -Erez Zadok, Feb 19, 2005.
421 dnl
422 
423 # AC_CHECK_MEMBER2(AGGREGATE.MEMBER,
424 #                 [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
425 #                 [INCLUDES])
426 # ---------------------------------------------------------
427 # AGGREGATE.MEMBER is for instance `struct passwd.pw_gecos', shell
428 # variables are not a valid argument.
429 AC_DEFUN([AC_CHECK_MEMBER2],
430 [AS_LITERAL_IF([$1], [],
431                [AC_FATAL([$0: requires literal arguments])])dnl
432 m4_bmatch([$1], [\.], ,
433          [m4_fatal([$0: Did not see any dot in `$1'])])dnl
434 AS_VAR_PUSHDEF([ac_Member], [ac_cv_member_$1])dnl
435 dnl Extract the aggregate name, and the member name
436 AC_CACHE_CHECK([for $1], ac_Member,
437 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])],
438 [dnl AGGREGATE ac_aggr;
439 static m4_bpatsubst([$1], [\..*]) ac_aggr;
440 dnl ac_aggr.MEMBER;
441 if (&(ac_aggr.m4_bpatsubst([$1], [^[^.]*\.])))
442 return 0;])],
443                 [AS_VAR_SET(ac_Member, yes)],
444 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])],
445 [dnl AGGREGATE ac_aggr;
446 static m4_bpatsubst([$1], [\..*]) ac_aggr;
447 dnl sizeof ac_aggr.MEMBER;
448 if (sizeof ac_aggr.m4_bpatsubst([$1], [^[^.]*\.]))
449 return 0;])],
450                 [AS_VAR_SET(ac_Member, yes)],
451                 [AS_VAR_SET(ac_Member, no)])])])
452 AS_IF([test AS_VAR_GET(ac_Member) = yes], [$2], [$3])dnl
453 AS_VAR_POPDEF([ac_Member])dnl
454 ])# AC_CHECK_MEMBER
455 
456 
457 # AC_CHECK_MEMBERS2([AGGREGATE.MEMBER, ...],
458 #                  [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]
459 #                  [INCLUDES])
460 # ---------------------------------------------------------
461 # The first argument is an m4 list.
462 AC_DEFUN([AC_CHECK_MEMBERS2],
463 [m4_foreach([AC_Member], [$1],
464   [AC_CHECK_MEMBER2(AC_Member,
465          [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]AC_Member), 1,
466                             [Define to 1 if `]m4_bpatsubst(AC_Member,
467                                                      [^[^.]*\.])[' is
468                              member of `]m4_bpatsubst(AC_Member, [\..*])['.])
469 $2],
470                  [$3],
471                  [$4])])])
472 
473 
474 
475 dnl ######################################################################
476 dnl find if structure $1 has field field $2
477 AC_DEFUN([AMU_CHECK_FIELD],
478 [
479 AC_CHECK_MEMBERS2($1, , ,[
480 AMU_MOUNT_HEADERS(
481 [
482 /* now set the typedef */
483 #ifdef HAVE_STRUCT_MNTENT
484 typedef struct mntent mntent_t;
485 #else /* not HAVE_STRUCT_MNTENT */
486 # ifdef HAVE_STRUCT_MNTTAB
487 typedef struct mnttab mntent_t;
488 # endif /*  HAVE_STRUCT_MNTTAB */
489 #endif /* not HAVE_STRUCT_MNTENT */
490 
491 /*
492  * for various filesystem specific mount arguments
493  */
494 
495 #ifdef HAVE_SYS_FS_PC_FS_H
496 # include <sys/fs/pc_fs.h>
497 #endif /* HAVE_SYS_FS_PC_FS_H */
498 #ifdef HAVE_MSDOSFS_MSDOSFSMOUNT_H
499 # include <msdosfs/msdosfsmount.h>
500 #endif /* HAVE_MSDOSFS_MSDOSFSMOUNT_H */
501 #ifdef HAVE_FS_MSDOSFS_MSDOSFSMOUNT_H
502 # include <fs/msdosfs/msdosfsmount.h>
503 #endif /* HAVE_FS_MSDOSFS_MSDOSFSMOUNT_H */
504 
505 #ifdef HAVE_SYS_FS_EFS_CLNT_H
506 # include <sys/fs/efs_clnt.h>
507 #endif /* HAVE_SYS_FS_EFS_CLNT_H */
508 #ifdef HAVE_SYS_FS_XFS_CLNT_H
509 # include <sys/fs/xfs_clnt.h>
510 #endif /* HAVE_SYS_FS_XFS_CLNT_H */
511 #ifdef HAVE_SYS_FS_UFS_MOUNT_H
512 # include <sys/fs/ufs_mount.h>
513 #endif /* HAVE_SYS_FS_UFS_MOUNT_H */
514 #ifdef HAVE_SYS_FS_AUTOFS_H
515 # include <sys/fs/autofs.h>
516 #endif /* HAVE_SYS_FS_AUTOFS_H */
517 #ifdef HAVE_RPCSVC_AUTOFS_PROT_H
518 # include <rpcsvc/autofs_prot.h>
519 #else  /* not HAVE_RPCSVC_AUTOFS_PROT_H */
520 # ifdef HAVE_SYS_FS_AUTOFS_PROT_H
521 #  include <sys/fs/autofs_prot.h>
522 # endif /* HAVE_SYS_FS_AUTOFS_PROT_H */
523 #endif /* not HAVE_RPCSVC_AUTOFS_PROT_H */
524 #ifdef HAVE_HSFS_HSFS_H
525 # include <hsfs/hsfs.h>
526 #endif /* HAVE_HSFS_HSFS_H */
527 
528 #ifdef HAVE_IFADDRS_H
529 # include <ifaddrs.h>
530 #endif /* HAVE_IFADDRS_H */
531 
532 ])
533 ])
534 ])
535 dnl ======================================================================
536 
537 
538 dnl ######################################################################
539 dnl check if a filesystem exists (if any of its header files exist).
540 dnl Usage: AC_CHECK_FS_HEADERS(<headers>..., <fs>, [<fssymbol>])
541 dnl Check if any of the headers <headers> exist.  If any exist, then
542 dnl define HAVE_FS_<fs>.  If <fssymbol> exits, then define
543 dnl HAVE_FS_<fssymbol> instead...
544 AC_DEFUN([AMU_CHECK_FS_HEADERS],
545 [
546 # find what name to give to the fs
547 if test -n "$3"
548 then
549   ac_fs_name=$3
550 else
551   ac_fs_name=$2
552 fi
553 # store variable name of fs
554 ac_upcase_fs_name=`echo $2 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
555 ac_fs_headers_safe=HAVE_FS_$ac_upcase_fs_name
556 # check for cache and set it if needed
557 AMU_CACHE_CHECK_DYNAMIC(for $ac_fs_name filesystem in <$1>,
558 ac_cv_fs_header_$ac_fs_name,
559 [
560 # define to "no" by default
561 eval "ac_cv_fs_header_$ac_fs_name=no"
562 # and look to see if it was found
563 AC_CHECK_HEADERS($1,
564 [ eval "ac_cv_fs_header_$ac_fs_name=yes"
565   break
566 ])])
567 # check if need to define variable
568 if test "`eval echo '$''{ac_cv_fs_header_'$ac_fs_name'}'`" = yes
569 then
570   AC_DEFINE_UNQUOTED($ac_fs_headers_safe)
571 # append ops_<fs>.o object to AMD_FS_OBJS for automatic compilation
572 # if first time we add something to this list, then also tell autoconf
573 # to replace instances of it in Makefiles.
574   if test -z "$AMD_FS_OBJS"
575   then
576     AMD_FS_OBJS="ops_${ac_fs_name}.o"
577     AC_SUBST(AMD_FS_OBJS)
578   else
579     # since this object file could have already been added before
580     # we need to ensure we do not add it twice.
581     case "${AMD_FS_OBJS}" in
582       *ops_${ac_fs_name}.o* ) ;;
583       * )
584         AMD_FS_OBJS="$AMD_FS_OBJS ops_${ac_fs_name}.o"
585       ;;
586     esac
587   fi
588 fi
589 ])
590 dnl ======================================================================
591 
592 
593 dnl ######################################################################
594 dnl check if a filesystem type exists (if its header files exist)
595 dnl Usage: AC_CHECK_FS_MNTENT(<filesystem>, [<fssymbol>])
596 dnl
597 dnl Check in some headers for MNTTYPE_<filesystem> macro.  If that exist,
598 dnl then define HAVE_FS_<filesystem>.  If <fssymbol> exits, then define
599 dnl HAVE_FS_<fssymbol> instead...
600 AC_DEFUN([AMU_CHECK_FS_MNTENT],
601 [
602 # find what name to give to the fs
603 if test -n "$2"
604 then
605   ac_fs_name=$2
606   ac_fs_as_name=" (from: $1)"
607 else
608   ac_fs_name=$1
609   ac_fs_as_name=""
610 fi
611 # store variable name of filesystem
612 ac_upcase_fs_name=`echo $ac_fs_name | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
613 ac_safe=HAVE_FS_$ac_upcase_fs_name
614 # check for cache and set it if needed
615 AMU_CACHE_CHECK_DYNAMIC(for $ac_fs_name$ac_fs_as_name mntent definition,
616 ac_cv_fs_$ac_fs_name,
617 [
618 # assume not found
619 eval "ac_cv_fs_$ac_fs_name=no"
620 for ac_fs_tmp in $1
621 do
622   ac_upcase_fs_symbol=`echo $ac_fs_tmp | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
623 
624   # first look for MNTTYPE_*
625   AC_EGREP_CPP(yes,
626   AMU_MOUNT_HEADERS(
627   [
628 #ifdef MNTTYPE_$ac_upcase_fs_symbol
629     yes
630 #endif /* MNTTYPE_$ac_upcase_fs_symbol */
631   ]), [eval "ac_cv_fs_$ac_fs_name=yes"], [eval "ac_cv_fs_$ac_fs_name=no"] )
632   # check if need to terminate "for" loop
633   if test "`eval echo '$''{ac_cv_fs_'$ac_fs_name'}'`" != no
634   then
635     break
636   fi
637 
638   # now try to look for MOUNT_ macro
639   AC_EGREP_CPP(yes,
640   AMU_MOUNT_HEADERS(
641   [
642 #ifdef MOUNT_$ac_upcase_fs_symbol
643     yes
644 #endif /* MOUNT_$ac_upcase_fs_symbol */
645   ]), [eval "ac_cv_fs_$ac_fs_name=yes"], [eval "ac_cv_fs_$ac_fs_name=no"] )
646   # check if need to terminate "for" loop
647   if test "`eval echo '$''{ac_cv_fs_'$ac_fs_name'}'`" != no
648   then
649     break
650   fi
651 
652   # now try to look for MNT_ macro
653   AC_EGREP_CPP(yes,
654   AMU_MOUNT_HEADERS(
655   [
656 #ifdef MNT_$ac_upcase_fs_symbol
657     yes
658 #endif /* MNT_$ac_upcase_fs_symbol */
659   ]), [eval "ac_cv_fs_$ac_fs_name=yes"], [eval "ac_cv_fs_$ac_fs_name=no"] )
660   # check if need to terminate "for" loop
661   if test "`eval echo '$''{ac_cv_fs_'$ac_fs_name'}'`" != no
662   then
663     break
664   fi
665 
666   # now try to look for GT_ macro (ultrix)
667   AC_EGREP_CPP(yes,
668   AMU_MOUNT_HEADERS(
669   [
670 #ifdef GT_$ac_upcase_fs_symbol
671     yes
672 #endif /* GT_$ac_upcase_fs_symbol */
673   ]), [eval "ac_cv_fs_$ac_fs_name=yes"], [eval "ac_cv_fs_$ac_fs_name=no"] )
674   # check if need to terminate "for" loop
675   if test "`eval echo '$''{ac_cv_fs_'$ac_fs_name'}'`" != no
676   then
677     break
678   fi
679 
680   # look for a loadable filesystem module (linux)
681   if test -f /lib/modules/$host_os_version/fs/$ac_fs_tmp.ko
682   then
683     eval "ac_cv_fs_$ac_fs_name=yes"
684     break
685   fi
686   if test -f /lib/modules/$host_os_version/fs/$ac_fs_tmp.o
687   then
688     eval "ac_cv_fs_$ac_fs_name=yes"
689     break
690   fi
691 
692   # look for a loadable filesystem module (linux 2.4+)
693   if test -f /lib/modules/$host_os_version/kernel/fs/$ac_fs_tmp/$ac_fs_tmp.ko
694   then
695     eval "ac_cv_fs_$ac_fs_name=yes"
696     break
697   fi
698   if test -f /lib/modules/$host_os_version/kernel/fs/$ac_fs_tmp/$ac_fs_tmp.o
699   then
700     eval "ac_cv_fs_$ac_fs_name=yes"
701     break
702   fi
703 
704   # look for a loadable filesystem module (linux redhat-5.1)
705   if test -f /lib/modules/preferred/fs/$ac_fs_tmp.ko
706   then
707     eval "ac_cv_fs_$ac_fs_name=yes"
708     break
709   fi
710   if test -f /lib/modules/preferred/fs/$ac_fs_tmp.o
711   then
712     eval "ac_cv_fs_$ac_fs_name=yes"
713     break
714   fi
715 
716   # in addition look for statically compiled filesystem (linux)
717   if egrep "[[^a-zA-Z0-9_]]$ac_fs_tmp$" /proc/filesystems >/dev/null 2>&1
718   then
719     eval "ac_cv_fs_$ac_fs_name=yes"
720     break
721   fi
722 
723   if test "$ac_fs_tmp" = "nfs3" -a "$ac_cv_header_linux_nfs_mount_h" = "yes"
724   then
725     # hack hack hack
726     # in 6.1, which has fallback to v2/udp, we might want
727     # to always use version 4.
728     # in 6.0 we do not have much choice
729     #
730     let nfs_mount_version="`grep NFS_MOUNT_VERSION /usr/include/linux/nfs_mount.h | awk '{print $''3;}'`"
731     if test $nfs_mount_version -ge 4
732     then
733       eval "ac_cv_fs_$ac_fs_name=yes"
734       break
735     fi
736   fi
737 
738   # run a test program for bsdi3
739   AC_TRY_RUN(
740   [
741 #include <sys/param.h>
742 #include <sys/mount.h>
743 main()
744 {
745   int i;
746   struct vfsconf vf;
747   i = getvfsbyname("$ac_fs_tmp", &vf);
748   if (i < 0)
749     exit(1);
750   else
751     exit(0);
752 }
753   ], [eval "ac_cv_fs_$ac_fs_name=yes"
754       break
755      ]
756   )
757 
758 done
759 ])
760 # check if need to define variable
761 if test "`eval echo '$''{ac_cv_fs_'$ac_fs_name'}'`" = yes
762 then
763   AC_DEFINE_UNQUOTED($ac_safe)
764 # append ops_<fs>.o object to AMD_FS_OBJS for automatic compilation
765 # if first time we add something to this list, then also tell autoconf
766 # to replace instances of it in Makefiles.
767   if test -z "$AMD_FS_OBJS"
768   then
769     AMD_FS_OBJS="ops_${ac_fs_name}.o"
770     AC_SUBST(AMD_FS_OBJS)
771   else
772     # since this object file could have already been added before
773     # we need to ensure we do not add it twice.
774     case "${AMD_FS_OBJS}" in
775       *ops_${ac_fs_name}.o* ) ;;
776       * )
777         AMD_FS_OBJS="$AMD_FS_OBJS ops_${ac_fs_name}.o"
778       ;;
779     esac
780   fi
781 fi
782 ])
783 dnl ======================================================================
784 
785 
786 dnl ######################################################################
787 dnl Do we have a GNUish getopt
788 AC_DEFUN([AMU_CHECK_GNU_GETOPT],
789 [
790 AC_CACHE_CHECK([for GNU getopt], ac_cv_sys_gnu_getopt, [
791 AC_TRY_RUN([
792 #include <stdio.h>
793 #include <unistd.h>
794 int main()
795 {
796    int argc = 3;
797    char *argv[] = { "actest", "arg", "-x", NULL };
798    int c;
799    FILE* rf;
800    int isGNU = 0;
801 
802    rf = fopen("conftestresult", "w");
803    if (rf == NULL) exit(1);
804 
805    while ( (c = getopt(argc, argv, "x")) != -1 ) {
806        switch ( c ) {
807           case 'x':
808              isGNU=1;
809              break;
810           default:
811              exit(1);
812        }
813    }
814    fprintf(rf, isGNU ? "yes" : "no");
815    exit(0);
816 }
817 ],[
818 ac_cv_sys_gnu_getopt="`cat conftestresult`"
819 ],[
820 ac_cv_sys_gnu_getopt="fail"
821 ])
822 ])
823 if test "$ac_cv_sys_gnu_getopt" = "yes"
824 then
825     AC_DEFINE(HAVE_GNU_GETOPT)
826 fi
827 ])
828 
829 
830 dnl ######################################################################
831 dnl Define mount type to hide amd mounts from df(1)
832 dnl
833 dnl This has to be determined individually per OS.  Depending on whatever
834 dnl mount options are defined in the system header files such as
835 dnl MNTTYPE_IGNORE or MNTTYPE_AUTO, or others does not work: some OSs define
836 dnl some of these then use other stuff; some do not define them at all in
837 dnl the headers, but still use it; and more.  After a long attempt to get
838 dnl this automatically configured, I came to the conclusion that the semi-
839 dnl automatic per-host-os determination here is the best.
840 dnl
841 AC_DEFUN([AMU_CHECK_HIDE_MOUNT_TYPE],
842 [
843 AC_CACHE_CHECK(for mount type to hide from df,
844 ac_cv_hide_mount_type,
845 [
846 case "${host_os}" in
847         irix* | hpux* )
848                 ac_cv_hide_mount_type="ignore"
849                 ;;
850         sunos4* )
851                 ac_cv_hide_mount_type="auto"
852                 ;;
853         * )
854                 ac_cv_hide_mount_type="nfs"
855                 ;;
856 esac
857 ])
858 AC_DEFINE_UNQUOTED(HIDE_MOUNT_TYPE, "$ac_cv_hide_mount_type")
859 ])
860 dnl ======================================================================
861 
862 
863 dnl a bug-fixed version of autoconf 2.12.
864 dnl first try to link library without $5, and only of that failed,
865 dnl try with $5 if specified.
866 dnl it adds $5 to $LIBS if it was needed -Erez.
867 dnl AC_CHECK_LIB2(LIBRARY, FUNCTION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
868 dnl              [, OTHER-LIBRARIES]]])
869 AC_DEFUN([AMU_CHECK_LIB2],
870 [AC_MSG_CHECKING([for $2 in -l$1])
871 dnl Use a cache variable name containing both the library and function name,
872 dnl because the test really is for library $1 defining function $2, not
873 dnl just for library $1.  Separate tests with the same $1 and different $2s
874 dnl may have different results.
875 ac_lib_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'`
876 AC_CACHE_VAL(ac_cv_lib_$ac_lib_var,
877 [ac_save_LIBS="$LIBS"
878 
879 # first try with base library, without auxiliary library
880 LIBS="-l$1 $LIBS"
881 AC_TRY_LINK(dnl
882 ifelse([$2], [main], , dnl Avoid conflicting decl of main.
883 [/* Override any gcc2 internal prototype to avoid an error.  */
884 ]
885 [/* We use char because int might match the return type of a gcc2
886     builtin and then its argument prototype would still apply.  */
887 char $2();
888 ]),
889             [$2()],
890             eval "ac_cv_lib_$ac_lib_var=\"$1\"",
891             eval "ac_cv_lib_$ac_lib_var=no")
892 
893 # if OK, set to no auxiliary library, else try auxiliary library
894 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = no"; then
895  LIBS="-l$1 $5 $LIBS"
896  AC_TRY_LINK(dnl
897  ifelse([$2], [main], , dnl Avoid conflicting decl of main.
898  [/* Override any gcc2 internal prototype to avoid an error.  */
899  ]
900  [/* We use char because int might match the return type of a gcc2
901      builtin and then its argument prototype would still apply.  */
902  char $2();
903  ]),
904             [$2()],
905             eval "ac_cv_lib_$ac_lib_var=\"$1 $5\"",
906             eval "ac_cv_lib_$ac_lib_var=no")
907 fi
908 
909 LIBS="$ac_save_LIBS"
910 ])dnl
911 ac_tmp="`eval echo '$''{ac_cv_lib_'$ac_lib_var'}'`"
912 if test "${ac_tmp}" != no; then
913   AC_MSG_RESULT(-l$ac_tmp)
914   ifelse([$3], ,
915 [
916   ac_tr_lib=HAVE_LIB`echo $1 | sed -e 's/[[^a-zA-Z0-9_]]/_/g' \
917     -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
918 
919   AC_DEFINE_UNQUOTED($ac_tr_lib)
920   LIBS="-l$ac_tmp $LIBS"
921 ], [$3])
922 else
923   AC_MSG_RESULT(no)
924 ifelse([$4], , , [$4
925 ])dnl
926 fi
927 
928 ])
929 
930 
931 dnl ######################################################################
932 dnl check if libwrap (if exists), requires the caller to define the variables
933 dnl deny_severity and allow_severity.
934 AC_DEFUN([AMU_CHECK_LIBWRAP_SEVERITY],
935 [
936 AC_CACHE_CHECK([if libwrap wants caller to define allow_severity and deny_severity], ac_cv_need_libwrap_severity_vars, [
937 # save, then reset $LIBS back to original value
938 SAVEDLIBS="$LIBS"
939 LIBS="$LIBS -lwrap"
940 # run program one without defining our own severity variables
941 AC_TRY_RUN(
942 [
943 int main()
944 {
945    exit(0);
946 }
947 ],[ac_tmp_val1="yes"],[ac_tmp_val1="no"])
948 # run program two with defining our own severity variables
949 AC_TRY_RUN(
950 [
951 int deny_severity, allow_severity;
952 int main()
953 {
954    exit(0);
955 }
956 ],[ac_tmp_val2="yes"],[ac_tmp_val2="no"])
957 # restore original value of $LIBS
958 LIBS="$SAVEDLIBS"
959 # now decide what to do
960 if test "$ac_tmp_val1" = "no" && test "$ac_tmp_val2" = "yes"
961 then
962         ac_cv_need_libwrap_severity_vars="yes"
963 else
964         ac_cv_need_libwrap_severity_vars="no"
965 fi
966 ])
967 if test "$ac_cv_need_libwrap_severity_vars" = "yes"
968 then
969         AC_DEFINE(NEED_LIBWRAP_SEVERITY_VARIABLES)
970 fi
971 ])
972 
973 
974 dnl ######################################################################
975 dnl check if a map exists (if some library function exists).
976 dnl Usage: AC_CHECK_MAP_FUNCS(<functions>..., <map>, [<mapsymbol>])
977 dnl Check if any of the functions <functions> exist.  If any exist, then
978 dnl define HAVE_MAP_<map>.  If <mapsymbol> exits, then defined
979 dnl HAVE_MAP_<mapsymbol> instead...
980 AC_DEFUN([AMU_CHECK_MAP_FUNCS],
981 [
982 # find what name to give to the map
983 if test -n "$3"
984 then
985   ac_map_name=$3
986 else
987   ac_map_name=$2
988 fi
989 # store variable name of map
990 ac_upcase_map_name=`echo $ac_map_name | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
991 ac_safe=HAVE_MAP_$ac_upcase_map_name
992 # check for cache and set it if needed
993 AMU_CACHE_CHECK_DYNAMIC(for $ac_map_name maps,
994 ac_cv_map_$ac_map_name,
995 [
996 # define to "no" by default
997 eval "ac_cv_map_$ac_map_name=no"
998 # and look to see if it was found
999 AC_CHECK_FUNCS($1,
1000 [
1001   eval "ac_cv_map_$ac_map_name=yes"
1002   break
1003 ])])
1004 # check if need to define variable
1005 if test "`eval echo '$''{ac_cv_map_'$ac_map_name'}'`" = yes
1006 then
1007   AC_DEFINE_UNQUOTED($ac_safe)
1008 # append info_<map>.o object to AMD_INFO_OBJS for automatic compilation
1009 # if first time we add something to this list, then also tell autoconf
1010 # to replace instances of it in Makefiles.
1011   if test -z "$AMD_INFO_OBJS"
1012   then
1013     AMD_INFO_OBJS="info_${ac_map_name}.o"
1014     AC_SUBST(AMD_INFO_OBJS)
1015   else
1016     AMD_INFO_OBJS="$AMD_INFO_OBJS info_${ac_map_name}.o"
1017   fi
1018 fi
1019 ])
1020 dnl ======================================================================
1021 
1022 
1023 dnl ######################################################################
1024 dnl Find CDFS-specific mount(2) options (hex numbers)
1025 dnl Usage: AMU_CHECK_MNT2_CDFS_OPT(<fs>)
1026 dnl Check if there is an entry for MS_<fs> or M_<fs> in sys/mntent.h or
1027 dnl mntent.h, then define MNT2_CDFS_OPT_<fs> to the hex number.
1028 AC_DEFUN([AMU_CHECK_MNT2_CDFS_OPT],
1029 [
1030 # what name to give to the fs
1031 ac_fs_name=$1
1032 # store variable name of fs
1033 ac_upcase_fs_name=`echo $ac_fs_name | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
1034 ac_safe=MNT2_CDFS_OPT_$ac_upcase_fs_name
1035 # check for cache and set it if needed
1036 AMU_CACHE_CHECK_DYNAMIC(for CDFS-specific mount(2) option $ac_fs_name,
1037 ac_cv_mnt2_cdfs_opt_$ac_fs_name,
1038 [
1039 # undefine by default
1040 eval "ac_cv_mnt2_cdfs_opt_$ac_fs_name=notfound"
1041 value=notfound
1042 
1043 # first, try MS_* (most systems).  Must be the first test!
1044 if test "$value" = notfound
1045 then
1046 AMU_EXPAND_CPP_HEX(
1047 AMU_MOUNT_HEADERS
1048 , MS_$ac_upcase_fs_name)
1049 fi
1050 
1051 # if failed, try MNT_* (bsd44 systems)
1052 if test "$value" = notfound
1053 then
1054 AMU_EXPAND_CPP_HEX(
1055 AMU_MOUNT_HEADERS
1056 , MNT_$ac_upcase_fs_name)
1057 fi
1058 
1059 # if failed, try MS_*  as an integer (linux systems)
1060 if test "$value" = notfound
1061 then
1062 AMU_EXPAND_CPP_INT(
1063 AMU_MOUNT_HEADERS
1064 , MS_$ac_upcase_fs_name)
1065 fi
1066 
1067 # If failed try M_* (must be last test since svr4 systems define M_DATA etc.
1068 # in <sys/stream.h>
1069 # This test was off for now, because of the conflicts with other systems.
1070 # but I turned it back on by faking the inclusion of <sys/stream.h> already.
1071 if test "$value" = notfound
1072 then
1073 AMU_EXPAND_CPP_HEX(
1074 #ifndef _sys_stream_h
1075 # define _sys_stream_h
1076 #endif /* not _sys_stream_h */
1077 #ifndef _SYS_STREAM_H
1078 # define _SYS_STREAM_H
1079 #endif  /* not _SYS_STREAM_H */
1080 AMU_MOUNT_HEADERS
1081 , M_$ac_upcase_fs_name)
1082 fi
1083 
1084 # if failed, try ISOFSMNT_* as a hex (bsdi4 systems)
1085 if test "$value" = notfound
1086 then
1087 AMU_EXPAND_CPP_HEX(
1088 AMU_MOUNT_HEADERS
1089 , ISOFSMNT_$ac_upcase_fs_name)
1090 fi
1091 
1092 # set cache variable to value
1093 eval "ac_cv_mnt2_cdfs_opt_$ac_fs_name=$value"
1094 ])
1095 # outside cache check, if ok, define macro
1096 ac_tmp=`eval echo '$''{ac_cv_mnt2_cdfs_opt_'$ac_fs_name'}'`
1097 if test "${ac_tmp}" != notfound
1098 then
1099   AC_DEFINE_UNQUOTED($ac_safe, $ac_tmp)
1100 fi
1101 ])
1102 dnl ======================================================================
1103 
1104 dnl ######################################################################
1105 dnl run AMU_CHECK_MNT2_CDFS_OPT on each argument given
1106 dnl Usage: AMU_CHECK_MNT2_CDFS_OPTS(arg arg arg ...)
1107 AC_DEFUN([AMU_CHECK_MNT2_CDFS_OPTS],
1108 [
1109 for ac_tmp_arg in $1
1110 do
1111 AMU_CHECK_MNT2_CDFS_OPT($ac_tmp_arg)
1112 done
1113 ])
1114 dnl ======================================================================
1115 
1116 
1117 dnl ######################################################################
1118 dnl Find generic mount(2) options (hex numbers)
1119 dnl Usage: AMU_CHECK_MNT2_GEN_OPT(<fs>)
1120 dnl Check if there is an entry for MS_<fs>, MNT_<fs>, or M_<fs>
1121 dnl (in that order) in mntent.h, sys/mntent.h, or mount.h...
1122 dnl then define MNT2_GEN_OPT_<fs> to the hex number.
1123 AC_DEFUN([AMU_CHECK_MNT2_GEN_OPT],
1124 [
1125 # what name to give to the fs
1126 ac_fs_name=$1
1127 # store variable name of fs
1128 ac_upcase_fs_name=`echo $ac_fs_name | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
1129 ac_safe=MNT2_GEN_OPT_$ac_upcase_fs_name
1130 # check for cache and set it if needed
1131 AMU_CACHE_CHECK_DYNAMIC(for generic mount(2) option $ac_fs_name,
1132 ac_cv_mnt2_gen_opt_$ac_fs_name,
1133 [
1134 # undefine by default
1135 eval "ac_cv_mnt2_gen_opt_$ac_fs_name=notfound"
1136 value=notfound
1137 
1138 # first, try MS_* (most systems).  Must be the first test!
1139 if test "$value" = notfound
1140 then
1141 AMU_EXPAND_CPP_HEX(
1142 AMU_MOUNT_HEADERS
1143 , MS_$ac_upcase_fs_name)
1144 fi
1145 
1146 # if failed, try MNT_* (bsd44 systems)
1147 if test "$value" = notfound
1148 then
1149 AMU_EXPAND_CPP_HEX(
1150 AMU_MOUNT_HEADERS
1151 , MNT_$ac_upcase_fs_name)
1152 fi
1153 
1154 # if failed, try MS_*  as an integer (linux systems)
1155 if test "$value" = notfound
1156 then
1157 AMU_EXPAND_CPP_INT(
1158 AMU_MOUNT_HEADERS
1159 , MS_$ac_upcase_fs_name)
1160 fi
1161 
1162 # If failed try M_* (must be last test since svr4 systems define M_DATA etc.
1163 # in <sys/stream.h>
1164 # This test was off for now, because of the conflicts with other systems.
1165 # but I turned it back on by faking the inclusion of <sys/stream.h> already.
1166 if test "$value" = notfound
1167 then
1168 AMU_EXPAND_CPP_HEX(
1169 #ifndef _sys_stream_h
1170 # define _sys_stream_h
1171 #endif /* not _sys_stream_h */
1172 #ifndef _SYS_STREAM_H
1173 # define _SYS_STREAM_H
1174 #endif  /* not _SYS_STREAM_H */
1175 AMU_MOUNT_HEADERS
1176 , M_$ac_upcase_fs_name)
1177 fi
1178 
1179 # set cache variable to value
1180 eval "ac_cv_mnt2_gen_opt_$ac_fs_name=$value"
1181 ])
1182 # outside cache check, if ok, define macro
1183 ac_tmp=`eval echo '$''{ac_cv_mnt2_gen_opt_'$ac_fs_name'}'`
1184 if test "${ac_tmp}" != notfound
1185 then
1186   AC_DEFINE_UNQUOTED($ac_safe, $ac_tmp)
1187 fi
1188 ])
1189 dnl ======================================================================
1190 
1191 dnl ######################################################################
1192 dnl run AMU_CHECK_MNT2_GEN_OPT on each argument given
1193 dnl Usage: AMU_CHECK_MNT2_GEN_OPTS(arg arg arg ...)
1194 AC_DEFUN([AMU_CHECK_MNT2_GEN_OPTS],
1195 [
1196 for ac_tmp_arg in $1
1197 do
1198 AMU_CHECK_MNT2_GEN_OPT($ac_tmp_arg)
1199 done
1200 ])
1201 dnl ======================================================================
1202 
1203 
1204 dnl ######################################################################
1205 dnl Find NFS-specific mount(2) options (hex numbers)
1206 dnl Usage: AMU_CHECK_MNT2_NFS_OPT(<fs>)
1207 dnl Check if there is an entry for NFSMNT_<fs> in sys/mntent.h or
1208 dnl mntent.h, then define MNT2_NFS_OPT_<fs> to the hex number.
1209 AC_DEFUN([AMU_CHECK_MNT2_NFS_OPT],
1210 [
1211 # what name to give to the fs
1212 ac_fs_name=$1
1213 # store variable name of fs
1214 ac_upcase_fs_name=`echo $ac_fs_name | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
1215 ac_safe=MNT2_NFS_OPT_$ac_upcase_fs_name
1216 # check for cache and set it if needed
1217 AMU_CACHE_CHECK_DYNAMIC(for NFS-specific mount(2) option $ac_fs_name,
1218 ac_cv_mnt2_nfs_opt_$ac_fs_name,
1219 [
1220 # undefine by default
1221 eval "ac_cv_mnt2_nfs_opt_$ac_fs_name=notfound"
1222 value=notfound
1223 
1224 # first try NFSMNT_* (most systems)
1225 if test "$value" = notfound
1226 then
1227 AMU_EXPAND_CPP_HEX(
1228 AMU_MOUNT_HEADERS
1229 , NFSMNT_$ac_upcase_fs_name)
1230 fi
1231 
1232 # next try NFS_MOUNT_* (linux)
1233 if test "$value" = notfound
1234 then
1235 AMU_EXPAND_CPP_HEX(
1236 AMU_MOUNT_HEADERS
1237 , NFS_MOUNT_$ac_upcase_fs_name)
1238 fi
1239 
1240 # set cache variable to value
1241 eval "ac_cv_mnt2_nfs_opt_$ac_fs_name=$value"
1242 ])
1243 # outside cache check, if ok, define macro
1244 ac_tmp=`eval echo '$''{ac_cv_mnt2_nfs_opt_'$ac_fs_name'}'`
1245 if test "${ac_tmp}" != notfound
1246 then
1247   AC_DEFINE_UNQUOTED($ac_safe, $ac_tmp)
1248 fi
1249 ])
1250 dnl ======================================================================
1251 
1252 dnl ######################################################################
1253 dnl run AMU_CHECK_MNT2_NFS_OPT on each argument given
1254 dnl Usage: AMU_CHECK_MNT2_NFS_OPTS(arg arg arg ...)
1255 AC_DEFUN([AMU_CHECK_MNT2_NFS_OPTS],
1256 [
1257 for ac_tmp_arg in $1
1258 do
1259 AMU_CHECK_MNT2_NFS_OPT($ac_tmp_arg)
1260 done
1261 ])
1262 dnl ======================================================================
1263 
1264 
1265 dnl ######################################################################
1266 dnl Find name of mount table file, and define it as MNTTAB_FILE_NAME
1267 dnl
1268 dnl Solaris defines MNTTAB as /etc/mnttab, the file where /sbin/mount
1269 dnl stores its cache of mounted filesystems.  But under SunOS, the same
1270 dnl macro MNTTAB, is defined as the _source_ of filesystems to mount, and
1271 dnl is set to /etc/fstab.  That is why I have to first check out
1272 dnl if MOUNTED exists, and if not, check for the MNTTAB macro.
1273 dnl
1274 AC_DEFUN([AMU_CHECK_MNTTAB_FILE_NAME],
1275 [
1276 AC_CACHE_CHECK(for name of mount table file name,
1277 ac_cv_mnttab_file_name,
1278 [
1279 # expand cpp value for MNTTAB
1280 AMU_EXPAND_CPP_STRING(
1281 AMU_MOUNT_HEADERS(
1282 [
1283 /* see M4 comment at the top of the definition of this macro */
1284 #ifdef MOUNTED
1285 # define _MNTTAB_FILE_NAME MOUNTED
1286 # else /* not MOUNTED */
1287 # ifdef MNTTAB
1288 #  define _MNTTAB_FILE_NAME MNTTAB
1289 # endif /* MNTTAB */
1290 #endif /* not MOUNTED */
1291 ]),
1292 _MNTTAB_FILE_NAME,
1293 [ ac_cv_mnttab_file_name=$value
1294 ],
1295 [
1296 ac_cv_mnttab_file_name=notfound
1297 # check explicitly for /etc/mnttab
1298 if test "$ac_cv_mnttab_file_name" = notfound
1299 then
1300   if test -f /etc/mnttab
1301   then
1302     ac_cv_mnttab_file_name="/etc/mnttab"
1303   fi
1304 fi
1305 # check explicitly for /etc/mtab
1306 if test "$ac_cv_mnttab_file_name" = notfound
1307 then
1308   if test -f /etc/mtab
1309   then
1310     ac_cv_mnttab_file_name="/etc/mtab"
1311   fi
1312 fi
1313 ])
1314 ])
1315 # test value and create macro as needed
1316 if test "$ac_cv_mnttab_file_name" != notfound
1317 then
1318   AC_DEFINE_UNQUOTED(MNTTAB_FILE_NAME, "$ac_cv_mnttab_file_name")
1319 fi
1320 ])
1321 dnl ======================================================================
1322 
1323 
1324 dnl ######################################################################
1325 dnl check if the mount table is kept in a file or in the kernel.
1326 AC_DEFUN([AMU_CHECK_MNTTAB_LOCATION],
1327 [
1328 AMU_CACHE_CHECK_DYNAMIC(where mount table is kept,
1329 ac_cv_mnttab_location,
1330 [
1331 # assume location is on file
1332 ac_cv_mnttab_location=file
1333 AC_CHECK_FUNCS(mntctl getmntinfo getmountent,
1334 ac_cv_mnttab_location=kernel)
1335 # Solaris 8 Beta Refresh and up use the mntfs pseudo filesystem to store the
1336 # mount table in kernel (cf. mnttab(4): the MS_NOMNTTAB option in
1337 # <sys/mount.h> inhibits that a mount shows up there and thus can be used to
1338 # check for the in-kernel mount table
1339 if test "$ac_cv_mnt2_gen_opt_nomnttab" != notfound
1340 then
1341   ac_cv_mnttab_location=kernel
1342 fi
1343 ])
1344 if test "$ac_cv_mnttab_location" = file
1345 then
1346  AC_DEFINE(MOUNT_TABLE_ON_FILE)
1347 fi
1348 ])
1349 dnl ======================================================================
1350 
1351 
1352 dnl ######################################################################
1353 dnl check the string type of the name of a filesystem mount table entry
1354 dnl option.
1355 dnl Usage: AMU_CHECK_MNTTAB_OPT(<fs>)
1356 dnl Check if there is an entry for MNTOPT_<fs> in sys/mntent.h or mntent.h
1357 dnl define MNTTAB_OPT_<fs> to the string name (e.g., "ro").
1358 AC_DEFUN([AMU_CHECK_MNTTAB_OPT],
1359 [
1360 # what name to give to the fs
1361 ac_fs_name=$1
1362 # store variable name of fs
1363 ac_upcase_fs_name=`echo $ac_fs_name | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
1364 ac_safe=MNTTAB_OPT_$ac_upcase_fs_name
1365 # check for cache and set it if needed
1366 AMU_CACHE_CHECK_DYNAMIC(for mount table option $ac_fs_name,
1367 ac_cv_mnttab_opt_$ac_fs_name,
1368 [
1369 # undefine by default
1370 eval "ac_cv_mnttab_opt_$ac_fs_name=notfound"
1371 # and look to see if it was found
1372 AMU_EXPAND_CPP_STRING(
1373 AMU_MOUNT_HEADERS
1374 , MNTOPT_$ac_upcase_fs_name)
1375 # set cache variable to value
1376 if test "${value}" != notfound
1377 then
1378   eval "ac_cv_mnttab_opt_$ac_fs_name=\\\"$value\\\""
1379 else
1380   eval "ac_cv_mnttab_opt_$ac_fs_name=$value"
1381 fi
1382 dnl DO NOT CHECK FOR MNT_* b/c bsd44 systems don't use /etc/mnttab,
1383 ])
1384 # outside cache check, if ok, define macro
1385 ac_tmp=`eval echo '$''{ac_cv_mnttab_opt_'$ac_fs_name'}'`
1386 if test "${ac_tmp}" != notfound
1387 then
1388   AC_DEFINE_UNQUOTED($ac_safe, $ac_tmp)
1389 fi
1390 ])
1391 dnl ======================================================================
1392 
1393 dnl ######################################################################
1394 dnl run AMU_CHECK_MNTTAB_OPT on each argument given
1395 dnl Usage: AMU_CHECK_MNTTAB_OPTS(arg arg arg ...)
1396 AC_DEFUN([AMU_CHECK_MNTTAB_OPTS],
1397 [
1398 for ac_tmp_arg in $1
1399 do
1400 AMU_CHECK_MNTTAB_OPT($ac_tmp_arg)
1401 done
1402 ])
1403 dnl ======================================================================
1404 
1405 
1406 dnl ######################################################################
1407 dnl check style of accessing the mount table file
1408 AC_DEFUN([AMU_CHECK_MNTTAB_STYLE],
1409 [
1410 AC_CACHE_CHECK(mount table style,
1411 ac_cv_style_mnttab,
1412 [
1413 # select the correct style for mount table manipulation functions
1414 case "${host_os_name}" in
1415         aix* )
1416                         ac_cv_style_mnttab=aix ;;
1417         bsd* | bsdi* | freebsd* | netbsd* | openbsd* | darwin* | macosx* | rhapsody* )
1418                         ac_cv_style_mnttab=bsd ;;
1419         isc3* )
1420                         ac_cv_style_mnttab=isc3 ;;
1421         mach3* )
1422                         ac_cv_style_mnttab=mach3 ;;
1423         osf* )
1424                         ac_cv_style_mnttab=osf ;;
1425         svr4* | sysv4* | solaris2* | sunos5* | aoi* )
1426                         ac_cv_style_mnttab=svr4 ;;
1427         ultrix* )
1428                         ac_cv_style_mnttab=ultrix ;;
1429         linux*)
1430                         ac_cv_style_mnttab=linux ;;
1431         * )
1432                         ac_cv_style_mnttab=file ;;
1433 esac
1434 ])
1435 am_utils_link_files=${am_utils_link_files}libamu/mtabutil.c:conf/mtab/mtab_${ac_cv_style_mnttab}.c" "
1436 
1437 # append mtab utilities object to LIBOBJS for automatic compilation
1438 AC_LIBOBJ(mtabutil)
1439 ])
1440 dnl ======================================================================
1441 
1442 
1443 dnl ######################################################################
1444 dnl check the string type of the name of a filesystem mount table entry.
1445 dnl Usage: AC_CHECK_MNTTAB_TYPE(<fs>, [fssymbol])
1446 dnl Check if there is an entry for MNTTYPE_<fs> in sys/mntent.h and mntent.h
1447 dnl define MNTTAB_TYPE_<fs> to the string name (e.g., "nfs").  If <fssymbol>
1448 dnl exist, then define MNTTAB_TYPE_<fssymbol> instead.  If <fssymbol> is
1449 dnl defined, then <fs> can be a list of fs strings to look for.
1450 dnl If no symbols have been defined, but the filesystem has been found
1451 dnl earlier, then set the mount-table type to "<fs>" anyway...
1452 AC_DEFUN([AMU_CHECK_MNTTAB_TYPE],
1453 [
1454 # find what name to give to the fs
1455 if test -n "$2"
1456 then
1457   ac_fs_name=$2
1458 else
1459   ac_fs_name=$1
1460 fi
1461 # store variable name of fs
1462 ac_upcase_fs_name=`echo $ac_fs_name | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
1463 ac_safe=MNTTAB_TYPE_$ac_upcase_fs_name
1464 # check for cache and set it if needed
1465 AMU_CACHE_CHECK_DYNAMIC(for mnttab name for $ac_fs_name filesystem,
1466 ac_cv_mnttab_type_$ac_fs_name,
1467 [
1468 # undefine by default
1469 eval "ac_cv_mnttab_type_$ac_fs_name=notfound"
1470 # and look to see if it was found
1471 for ac_fs_tmp in $1
1472 do
1473   if test "$ac_fs_tmp" = "nfs3" -a "$ac_cv_fs_nfs3" = "yes" -a "$ac_cv_header_linux_nfs_h" = "yes"
1474   then
1475     eval "ac_cv_mnttab_type_$ac_fs_name=\\\"$ac_cv_mnttab_type_nfs\\\""
1476     break
1477   fi
1478 
1479   ac_upcase_fs_symbol=`echo $ac_fs_tmp | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' | tr -d '.'`
1480 
1481   # first look for MNTTYPE_*
1482   AC_EGREP_CPP(yes,
1483   AMU_MOUNT_HEADERS(
1484   [
1485 #ifdef MNTTYPE_$ac_upcase_fs_symbol
1486     yes
1487 #endif /* MNTTYPE_$ac_upcase_fs_symbol */
1488   ]),
1489   [ eval "ac_cv_mnttab_type_$ac_fs_name=\\\"$ac_fs_tmp\\\""
1490   ])
1491   # check if need to terminate "for" loop
1492   if test "`eval echo '$''{ac_cv_mnttab_type_'$ac_fs_name'}'`" != notfound
1493   then
1494     break
1495   fi
1496 
1497   # look for a loadable filesystem module (linux)
1498   if test -f /lib/modules/$host_os_version/fs/$ac_fs_tmp.ko
1499   then
1500     eval "ac_cv_mnttab_type_$ac_fs_name=\\\"$ac_fs_tmp\\\""
1501     break
1502   fi
1503   if test -f /lib/modules/$host_os_version/fs/$ac_fs_tmp.o
1504   then
1505     eval "ac_cv_mnttab_type_$ac_fs_name=\\\"$ac_fs_tmp\\\""
1506     break
1507   fi
1508 
1509   # look for a loadable filesystem module (linux 2.4+)
1510   if test -f /lib/modules/$host_os_version/kernel/fs/$ac_fs_tmp/$ac_fs_tmp.ko
1511   then
1512     eval "ac_cv_mnttab_type_$ac_fs_name=\\\"$ac_fs_tmp\\\""
1513     break
1514   fi
1515   if test -f /lib/modules/$host_os_version/kernel/fs/$ac_fs_tmp/$ac_fs_tmp.o
1516   then
1517     eval "ac_cv_mnttab_type_$ac_fs_name=\\\"$ac_fs_tmp\\\""
1518     break
1519   fi
1520 
1521   # look for a loadable filesystem module (linux redhat-5.1)
1522