home *** CD-ROM | disk | FTP | other *** search
/ PC-Online 1996 May / PCOnline_05_1996.bin / linux / source / a / bin / fileutil.12 / fileutil / fileutils-3.12 / configure.in < prev    next >
Encoding:
Text File  |  1994-11-01  |  11.1 KB  |  434 lines

  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_INIT(src/ls.c)
  3. AC_CONFIG_HEADER(config.h)
  4. AC_PROG_MAKE_SET
  5.  
  6. AC_SUBST(PROGS)dnl
  7. AC_PATH_PROG(LN, ln, ln)dnl
  8. AC_PATH_PROG(MV, mv, mv)dnl
  9. AC_PATH_PROG(RM, rm, rm)dnl
  10. AC_SUBST(LIBPROGS)dnl
  11. AC_PROG_CC
  12. AC_PROG_CPP
  13. AC_PROG_GCC_TRADITIONAL
  14. AC_PROG_INSTALL
  15. AC_PROG_RANLIB
  16. AC_PROG_YACC
  17. AC_AIX
  18. AC_MINIX
  19. AC_ISC_POSIX
  20. AC_HEADER_MAJOR
  21.  
  22. AC_HEADER_DIRENT
  23. AC_FUNC_CLOSEDIR_VOID
  24.  
  25. AC_TYPE_GETGROUPS
  26. AC_TYPE_MODE_T
  27. AC_TYPE_OFF_T
  28. AC_TYPE_SIGNAL
  29. AC_TYPE_SIZE_T
  30. AC_TYPE_UID_T
  31. AC_CHECK_TYPE(ino_t, unsigned long)
  32.  
  33. AC_C_CONST
  34. AC_HEADER_STDC
  35. AC_STRUCT_TM
  36. AC_STRUCT_ST_BLOCKS
  37. AC_HEADER_TIME
  38. AC_HEADER_STAT
  39.  
  40. AC_CHECK_HEADERS(string.h fcntl.h limits.h sys/time.h errno.h unistd.h \
  41.     sys/param.h sys/statfs.h sys/fstyp.h mnttab.h mntent.h utime.h \
  42.     sys/statvfs.h sys/vfs.h sys/mount.h sys/filsys.h sys/fs_types.h)
  43. AC_REPLACE_FUNCS(euidaccess fnmatch mkdir mktime rename rmdir stpcpy \
  44.     strdup strstr)
  45. AC_CHECK_FUNCS(bcopy endgrent fchdir ftime ftruncate getcwd getgroups \
  46.     getmntinfo gettimeofday isascii memcpy mkfifo strerror)
  47.  
  48. AC_FUNC_VPRINTF
  49. AC_FUNC_ALLOCA
  50. AC_FUNC_UTIME_NULL
  51.  
  52. AC_MSG_CHECKING([for d_ino member in directory struct])
  53. AC_CACHE_VAL(fu_cv_sys_d_ino_in_dirent,
  54. [AC_TRY_LINK([
  55. #include <sys/types.h>
  56. #ifdef HAVE_DIRENT_H
  57. # include <dirent.h>
  58. #else /* not HAVE_DIRENT_H */
  59. # define dirent direct
  60. # ifdef HAVE_SYS_NDIR_H
  61. #  include <sys/ndir.h>
  62. # endif /* HAVE_SYS_NDIR_H */
  63. # ifdef HAVE_SYS_DIR_H
  64. #  include <sys/dir.h>
  65. # endif /* HAVE_SYS_DIR_H */
  66. # ifdef HAVE_NDIR_H
  67. #  include <ndir.h>
  68. # endif /* HAVE_NDIR_H */
  69. #endif /* HAVE_DIRENT_H */
  70. ],
  71.   [struct dirent dp; dp.d_ino = 0;],
  72.     fu_cv_sys_d_ino_in_dirent=yes,
  73.     fu_cv_sys_d_ino_in_dirent=no)])
  74. AC_MSG_RESULT($fu_cv_sys_d_ino_in_dirent)
  75. if test $fu_cv_sys_d_ino_in_dirent = yes; then
  76.   AC_DEFINE(D_INO_IN_DIRENT)
  77. fi
  78.  
  79. # Determine how to get the list of mounted filesystems.
  80. list_mounted_fs=
  81.  
  82. # If the getmntent function is available but not in the standard library,
  83. # make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX).
  84. AC_FUNC_GETMNTENT
  85.  
  86. if test $ac_cv_func_getmntent = yes; then
  87.  
  88.   # This system has the getmntent function.
  89.   # Determine whether it's the one-argument variant or the two-argument one.
  90.  
  91.   if test -z "$list_mounted_fs"; then
  92.     # 4.3BSD, SunOS, HP-UX, Dynix, Irix
  93.     AC_MSG_CHECKING([for one-argument getmntent function])
  94.     AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
  95.          [test $ac_cv_header_mntent_h = yes \
  96.            && fu_cv_sys_mounted_getmntent1=yes \
  97.            || fu_cv_sys_mounted_getmntent1=no])
  98.     AC_MSG_RESULT($fu_cv_sys_mounted_getmntent1)
  99.     if test $fu_cv_sys_mounted_getmntent1 = yes; then
  100.       list_mounted_fs=found
  101.       AC_DEFINE(MOUNTED_GETMNTENT1)
  102.     fi
  103.   fi
  104.  
  105.   if test -z "$list_mounted_fs"; then
  106.     # SVR4
  107.     AC_MSG_CHECKING([for two-argument getmntent function])
  108.     AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
  109.     [AC_EGREP_HEADER(getmntent, sys/mnttab.h,
  110.       fu_cv_sys_mounted_getmntent2=yes,
  111.       fu_cv_sys_mounted_getmntent2=no)])
  112.     AC_MSG_RESULT($fu_cv_sys_mounted_getmntent2)
  113.     if test $fu_cv_sys_mounted_getmntent2 = yes; then
  114.       list_mounted_fs=found
  115.       AC_DEFINE(MOUNTED_GETMNTENT2)
  116.     fi
  117.   fi
  118.  
  119.   if test -z "$list_mounted_fs"; then
  120.     AC_MSG_ERROR([could not determine how to read list of mounted filesystems])
  121.   fi
  122.  
  123. fi
  124.  
  125. if test -z "$list_mounted_fs"; then
  126.   # DEC Alpha running OSF/1.
  127.   AC_MSG_CHECKING([for getfsstat function])
  128.   AC_CACHE_VAL(fu_cv_sys_mounted_getsstat,
  129.   [AC_TRY_LINK([
  130. #include <sys/types.h>
  131. #include <sys/mount.h>
  132. #include <sys/fs_types.h>],
  133.   [struct statfs *stats;
  134.   numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); ],
  135.     fu_cv_sys_mounted_getsstat=yes,
  136.     fu_cv_sys_mounted_getsstat=no)])
  137.   AC_MSG_RESULT($fu_cv_sys_mounted_getsstat)
  138.   if test $fu_cv_sys_mounted_getsstat = yes; then
  139.     list_mounted_fs=found
  140.     AC_DEFINE(MOUNTED_GETFSSTAT)
  141.   fi
  142. fi
  143.  
  144. if test -z "$list_mounted_fs"; then
  145.   # AIX.
  146.   AC_MSG_CHECKING([for mntctl function and struct vmount])
  147.   AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
  148.   [AC_TRY_CPP([#include <fshelp.h>],
  149.     fu_cv_sys_mounted_vmount=yes,
  150.     fu_cv_sys_mounted_vmount=no)])
  151.   AC_MSG_RESULT($fu_cv_sys_mounted_vmount)
  152.   if test $fu_cv_sys_mounted_vmount = yes; then
  153.     list_mounted_fs=found
  154.     AC_DEFINE(MOUNTED_VMOUNT)
  155.   fi
  156. fi
  157.  
  158. if test -z "$list_mounted_fs"; then
  159.   # SVR3
  160.   AC_MSG_CHECKING([for FIXME existence of three headers])
  161.   AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
  162.     [AC_TRY_CPP([
  163. #include <sys/statfs.h>
  164. #include <sys/fstyp.h>
  165. #include <mnttab.h>],
  166.         fu_cv_sys_mounted_fread_fstyp=yes,
  167.         fu_cv_sys_mounted_fread_fstyp=no)])
  168.   AC_MSG_RESULT($fu_cv_sys_mounted_fread_fstyp)
  169.   if test $fu_cv_sys_mounted_fread_fstyp = yes; then
  170.     list_mounted_fs=found
  171.     AC_DEFINE(MOUNTED_FREAD_FSTYP)
  172.   fi
  173. fi
  174.  
  175. if test -z "$list_mounted_fs"; then
  176.   # 4.4BSD and DEC OSF/1.
  177.   AC_MSG_CHECKING([for getmntinfo function])
  178.   AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
  179.     [
  180.       ok=
  181.       if test $ac_cv_func_getmntinfo = yes; then
  182.     AC_EGREP_HEADER(f_type;, sys/mount.h,
  183.             ok=yes)
  184.       fi
  185.       test -n "$ok" \
  186.       && fu_cv_sys_mounted_getmntinfo=yes \
  187.       || fu_cv_sys_mounted_getmntinfo=no
  188.     ])
  189.   AC_MSG_RESULT($fu_cv_sys_mounted_getmntinfo)
  190.   if test $fu_cv_sys_mounted_getmntinfo = yes; then
  191.     list_mounted_fs=found
  192.     AC_DEFINE(MOUNTED_GETMNTINFO)
  193.   fi
  194. fi
  195.  
  196. # FIXME: add a test for netbsd-1.1 here
  197.  
  198. if test -z "$list_mounted_fs"; then
  199.   # Ultrix
  200.   AC_MSG_CHECKING([for getmnt function])
  201.   AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
  202.     [AC_TRY_CPP([
  203. #include <sys/fs_types.h>
  204. #include <sys/mount.h>],
  205.         fu_cv_sys_mounted_getmnt=yes,
  206.         fu_cv_sys_mounted_getmnt=no)])
  207.   AC_MSG_RESULT($fu_cv_sys_mounted_getmnt)
  208.   if test $fu_cv_sys_mounted_getmnt = yes; then
  209.     list_mounted_fs=found
  210.     AC_DEFINE(MOUNTED_GETMNT)
  211.   fi
  212. fi
  213.  
  214. if test -z "$list_mounted_fs"; then
  215.   # SVR2
  216.   AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
  217.   AC_CACHE_VAL(fu_cv_sys_mounted_fread,
  218.     [AC_TRY_CPP([#include <mnttab.h>],
  219.         fu_cv_sys_mounted_fread=yes,
  220.         fu_cv_sys_mounted_fread=no)])
  221.   AC_MSG_RESULT($fu_cv_sys_mounted_fread)
  222.   if test $fu_cv_sys_mounted_fread = yes; then
  223.     list_mounted_fs=found
  224.     AC_DEFINE(MOUNTED_FREAD)
  225.   fi
  226. fi
  227.  
  228. if test -z "$list_mounted_fs"; then
  229.   AC_MSG_ERROR([could not determine how to read list of mounted filesystems])
  230.   # FIXME -- no need to abort building the whole package
  231.   # Can't build mountlist.c or anything that needs its functions
  232. fi
  233.  
  234. AC_CHECKING(how to get filesystem space usage)
  235. space=no
  236.  
  237. # Here we'll compromise a little (and perform only the link test)
  238. # since it seems there are no variants of the statvfs function.
  239. if test $space = no; then
  240.   # SVR4
  241.   AC_CHECK_FUNCS(statvfs)
  242.   if test $ac_cv_func_statvfs = yes; then
  243.     space=yes
  244.     AC_DEFINE(STAT_STATVFS)
  245.   fi
  246. fi
  247.  
  248. if test $space = no; then
  249.   # DEC Alpha running OSF/1
  250.   AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
  251.   AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
  252.   [AC_TRY_RUN([
  253. #include <sys/param.h>
  254. #include <sys/types.h>
  255. #include <sys/mount.h>
  256.   main ()
  257.   {
  258.     struct statfs fsd;
  259.     fsd.f_fsize = 0;
  260.     exit (statfs (".", &fsd, sizeof (struct statfs)));
  261.   }],
  262.   fu_cv_sys_stat_statfs3_osf1=yes,
  263.   fu_cv_sys_stat_statfs3_osf1=no,
  264.   fu_cv_sys_stat_statfs3_osf1=no)])
  265.   AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
  266.   if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
  267.     space=yes
  268.     AC_DEFINE(STAT_STATFS3_OSF1)
  269.   fi
  270. fi
  271.  
  272. if test $space = no; then
  273. # AIX
  274.   AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
  275. member (AIX, 4.3BSD)])
  276.   AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
  277.   [AC_TRY_RUN([
  278. #ifdef HAVE_SYS_PARAM_H
  279. #include <sys/param.h>
  280. #endif
  281. #ifdef HAVE_SYS_MOUNT_H
  282. #include <sys/mount.h>
  283. #endif
  284. #ifdef HAVE_SYS_VFS_H
  285. #include <sys/vfs.h>
  286. #endif
  287.   main ()
  288.   {
  289.   struct statfs fsd;
  290.   fsd.f_bsize = 0;
  291.   exit (statfs (".", &fsd));
  292.   }],
  293.   fu_cv_sys_stat_statfs2_bsize=yes,
  294.   fu_cv_sys_stat_statfs2_bsize=no,
  295.   fu_cv_sys_stat_statfs2_bsize=no)])
  296.   AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
  297.   if test $fu_cv_sys_stat_statfs2_bsize = yes; then
  298.     space=yes
  299.     AC_DEFINE(STAT_STATFS2_BSIZE)
  300.   fi
  301. fi
  302.  
  303. if test $space = no; then
  304. # SVR3
  305.   AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
  306.   AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
  307.   [AC_TRY_RUN([#include <sys/types.h>
  308. #include <sys/statfs.h>
  309.   main ()
  310.   {
  311.   struct statfs fsd;
  312.   exit (statfs (".", &fsd, sizeof fsd, 0));
  313.   }],
  314.     fu_cv_sys_stat_statfs4=yes,
  315.     fu_cv_sys_stat_statfs4=no,
  316.     fu_cv_sys_stat_statfs4=no)])
  317.   AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
  318.   if test $fu_cv_sys_stat_statfs4 = yes; then
  319.     space=yes
  320.     AC_DEFINE(STAT_STATFS4)
  321.   fi
  322. fi
  323.  
  324. if test $space = no; then
  325. # 4.4BSD and NetBSD
  326.   AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
  327. member (4.4BSD and NetBSD)])
  328.   AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
  329.   [AC_TRY_RUN([#include <sys/types.h>
  330. #ifdef HAVE_SYS_PARAM_H
  331. #include <sys/param.h>
  332. #endif
  333. #ifdef HAVE_SYS_MOUNT_H
  334. #include <sys/mount.h>
  335. #endif
  336.   main ()
  337.   {
  338.   struct statfs fsd;
  339.   fsd.f_fsize = 0;
  340.   exit (statfs (".", &fsd));
  341.   }],
  342.   fu_cv_sys_stat_statfs2_fsize=yes,
  343.   fu_cv_sys_stat_statfs2_fsize=no,
  344.   fu_cv_sys_stat_statfs2_fsize=no)])
  345.   AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
  346.   if test $fu_cv_sys_stat_statfs2_fsize = yes; then
  347.     space=yes
  348.     AC_DEFINE(STAT_STATFS2_FSIZE)
  349.   fi
  350. fi
  351.  
  352. if test $space = no; then
  353.   # Ultrix
  354.   AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
  355.   AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
  356.   [AC_TRY_RUN([#include <sys/types.h>
  357. #ifdef HAVE_SYS_PARAM_H
  358. #include <sys/param.h>
  359. #endif
  360. #ifdef HAVE_SYS_MOUNT_H
  361. #include <sys/mount.h>
  362. #endif
  363. #ifdef HAVE_SYS_FS_TYPES_H
  364. #include <sys/fs_types.h>
  365. #endif
  366.   main ()
  367.   {
  368.   struct fs_data fsd;
  369.   /* Ultrix's statfs returns 1 for success,
  370.      0 for not mounted, -1 for failure.  */
  371.   exit (statfs (".", &fsd) != 1);
  372.   }],
  373.   fu_cv_sys_stat_fs_data=yes,
  374.   fu_cv_sys_stat_fs_data=no,
  375.   fu_cv_sys_stat_fs_data=no)])
  376.   AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
  377.   if test $fu_cv_sys_stat_fs_data = yes; then
  378.     space=yes
  379.     AC_DEFINE(STAT_STATFS2_FS_DATA)
  380.   fi
  381. fi
  382.  
  383. if test $space = no; then
  384. # SVR2
  385. AC_TRY_CPP([#include <sys/filsys.h>],
  386.   AC_DEFINE(STAT_READ_FILSYS) space=yes)
  387. fi
  388.  
  389. if test -n "$list_mounted_fs" && test $space != no; then
  390.   PROGS="$PROGS df" LIBOBJS="$LIBOBJS fsusage.o mountlist.o"
  391. fi
  392.  
  393. AC_CHECK_FUNCS(ftruncate, , [ftruncate_missing=yes])
  394.  
  395. if test "$ftruncate_missing" = yes; then
  396.   AC_MSG_CHECKING([fcntl emulation of ftruncate])
  397.   AC_CACHE_VAL(fu_cv_sys_ftruncate_emulation,
  398.   [AC_TRY_LINK([
  399. #include <sys/types.h>
  400. #include <fcntl.h>], [
  401. #if !defined(F_CHSIZE) && !defined(F_FREESP)
  402. chsize();
  403. #endif
  404. ],
  405.     fu_cv_sys_ftruncate_emulation=yes,
  406.     fu_cv_sys_ftruncate_emulation=no)])
  407.   AC_MSG_RESULT($fu_cv_sys_ftruncate_emulation)
  408.   if test $fu_cv_sys_ftruncate_emulation = yes; then
  409.     LIBOBJS="$LIBOBJS ftruncate.o"
  410.   fi
  411. fi
  412.  
  413. case "$LIBOBJS" in
  414. *rename.o*)
  415.   LIBPROGS="$LIBPROGS mvdir"
  416.   ;;
  417. esac
  418.  
  419. # If we don't yet have getgroups, see if it's in -lbsd.
  420. # This is reported to be necessary on an ITOS 3000WS running SEIUX 3.1.
  421. AC_CHECK_FUNC(getgroups, , AC_CHECK_LIB(bsd, getgroups))
  422.  
  423. # Check for libypsec.a on Dolphin M88K machines.
  424. AC_CHECK_LIB(ypsec, main)
  425.  
  426. # m88k running dgux 5.4 needs this
  427. AC_CHECK_LIB(ldgc, main)
  428.  
  429. AC_CHECKING(for AFS)
  430. test -d /afs && AC_DEFINE(AFS)
  431.  
  432. AC_OUTPUT(Makefile doc/Makefile lib/Makefile man/Makefile src/Makefile,
  433. [echo > stamp-h])dnl
  434.