home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 9 / FreshFishVol9-CD2.bin / bbs / gnu / fileutils-3.12-src.lha / fileutils-3.12 / configure.in < prev    next >
Encoding:
Text File  |  1994-11-12  |  11.2 KB  |  436 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. # Amiga hack - short circuit this test since it matches and prevents
  273. # us from finding the 4.4 BSD case below that we really want.
  274. if false; then
  275. # AIX
  276.   AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
  277. member (AIX, 4.3BSD)])
  278.   AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
  279.   [AC_TRY_RUN([
  280. #ifdef HAVE_SYS_PARAM_H
  281. #include <sys/param.h>
  282. #endif
  283. #ifdef HAVE_SYS_MOUNT_H
  284. #include <sys/mount.h>
  285. #endif
  286. #ifdef HAVE_SYS_VFS_H
  287. #include <sys/vfs.h>
  288. #endif
  289.   main ()
  290.   {
  291.   struct statfs fsd;
  292.   fsd.f_bsize = 0;
  293.   exit (statfs (".", &fsd));
  294.   }],
  295.   fu_cv_sys_stat_statfs2_bsize=yes,
  296.   fu_cv_sys_stat_statfs2_bsize=no,
  297.   fu_cv_sys_stat_statfs2_bsize=no)])
  298.   AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
  299.   if test $fu_cv_sys_stat_statfs2_bsize = yes; then
  300.     space=yes
  301.     AC_DEFINE(STAT_STATFS2_BSIZE)
  302.   fi
  303. fi
  304.  
  305. if test $space = no; then
  306. # SVR3
  307.   AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
  308.   AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
  309.   [AC_TRY_RUN([#include <sys/types.h>
  310. #include <sys/statfs.h>
  311.   main ()
  312.   {
  313.   struct statfs fsd;
  314.   exit (statfs (".", &fsd, sizeof fsd, 0));
  315.   }],
  316.     fu_cv_sys_stat_statfs4=yes,
  317.     fu_cv_sys_stat_statfs4=no,
  318.     fu_cv_sys_stat_statfs4=no)])
  319.   AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
  320.   if test $fu_cv_sys_stat_statfs4 = yes; then
  321.     space=yes
  322.     AC_DEFINE(STAT_STATFS4)
  323.   fi
  324. fi
  325.  
  326. if test $space = no; then
  327. # 4.4BSD and NetBSD
  328.   AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
  329. member (4.4BSD and NetBSD)])
  330.   AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
  331.   [AC_TRY_RUN([#include <sys/types.h>
  332. #ifdef HAVE_SYS_PARAM_H
  333. #include <sys/param.h>
  334. #endif
  335. #ifdef HAVE_SYS_MOUNT_H
  336. #include <sys/mount.h>
  337. #endif
  338.   main ()
  339.   {
  340.   struct statfs fsd;
  341.   fsd.f_fsize = 0;
  342.   exit (statfs (".", &fsd));
  343.   }],
  344.   fu_cv_sys_stat_statfs2_fsize=yes,
  345.   fu_cv_sys_stat_statfs2_fsize=no,
  346.   fu_cv_sys_stat_statfs2_fsize=no)])
  347.   AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
  348.   if test $fu_cv_sys_stat_statfs2_fsize = yes; then
  349.     space=yes
  350.     AC_DEFINE(STAT_STATFS2_FSIZE)
  351.   fi
  352. fi
  353.  
  354. if test $space = no; then
  355.   # Ultrix
  356.   AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
  357.   AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
  358.   [AC_TRY_RUN([#include <sys/types.h>
  359. #ifdef HAVE_SYS_PARAM_H
  360. #include <sys/param.h>
  361. #endif
  362. #ifdef HAVE_SYS_MOUNT_H
  363. #include <sys/mount.h>
  364. #endif
  365. #ifdef HAVE_SYS_FS_TYPES_H
  366. #include <sys/fs_types.h>
  367. #endif
  368.   main ()
  369.   {
  370.   struct fs_data fsd;
  371.   /* Ultrix's statfs returns 1 for success,
  372.      0 for not mounted, -1 for failure.  */
  373.   exit (statfs (".", &fsd) != 1);
  374.   }],
  375.   fu_cv_sys_stat_fs_data=yes,
  376.   fu_cv_sys_stat_fs_data=no,
  377.   fu_cv_sys_stat_fs_data=no)])
  378.   AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
  379.   if test $fu_cv_sys_stat_fs_data = yes; then
  380.     space=yes
  381.     AC_DEFINE(STAT_STATFS2_FS_DATA)
  382.   fi
  383. fi
  384.  
  385. if test $space = no; then
  386. # SVR2
  387. AC_TRY_CPP([#include <sys/filsys.h>],
  388.   AC_DEFINE(STAT_READ_FILSYS) space=yes)
  389. fi
  390.  
  391. if test -n "$list_mounted_fs" && test $space != no; then
  392.   PROGS="$PROGS df" LIBOBJS="$LIBOBJS fsusage.o mountlist.o"
  393. fi
  394.  
  395. AC_CHECK_FUNCS(ftruncate, , [ftruncate_missing=yes])
  396.  
  397. if test "$ftruncate_missing" = yes; then
  398.   AC_MSG_CHECKING([fcntl emulation of ftruncate])
  399.   AC_CACHE_VAL(fu_cv_sys_ftruncate_emulation,
  400.   [AC_TRY_LINK([
  401. #include <sys/types.h>
  402. #include <fcntl.h>], [
  403. #if !defined(F_CHSIZE) && !defined(F_FREESP)
  404. chsize();
  405. #endif
  406. ],
  407.     fu_cv_sys_ftruncate_emulation=yes,
  408.     fu_cv_sys_ftruncate_emulation=no)])
  409.   AC_MSG_RESULT($fu_cv_sys_ftruncate_emulation)
  410.   if test $fu_cv_sys_ftruncate_emulation = yes; then
  411.     LIBOBJS="$LIBOBJS ftruncate.o"
  412.   fi
  413. fi
  414.  
  415. case "$LIBOBJS" in
  416. *rename.o*)
  417.   LIBPROGS="$LIBPROGS mvdir"
  418.   ;;
  419. esac
  420.  
  421. # If we don't yet have getgroups, see if it's in -lbsd.
  422. # This is reported to be necessary on an ITOS 3000WS running SEIUX 3.1.
  423. AC_CHECK_FUNC(getgroups, , AC_CHECK_LIB(bsd, getgroups))
  424.  
  425. # Check for libypsec.a on Dolphin M88K machines.
  426. AC_CHECK_LIB(ypsec, main)
  427.  
  428. # m88k running dgux 5.4 needs this
  429. AC_CHECK_LIB(ldgc, main)
  430.  
  431. AC_CHECKING(for AFS)
  432. test -d /gnu/afs && AC_DEFINE(AFS)
  433.  
  434. AC_OUTPUT(Makefile doc/Makefile lib/Makefile man/Makefile src/Makefile,
  435. [echo > stamp-h])dnl
  436.