acinclude.m4 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801
  1. dnl MC_UNDELFS_CHECKS
  2. dnl Check for ext2fs undel support.
  3. dnl Set shell variable ext2fs_undel to "yes" if we have it,
  4. dnl "no" otherwise. May define USE_EXT2FSLIB for cpp.
  5. dnl Will set EXT2FS_UNDEL_LIBS to required libraries.
  6. AC_DEFUN([MC_UNDELFS_CHECKS], [
  7. ext2fs_undel=no
  8. EXT2FS_UNDEL_LIBS=
  9. AC_CHECK_HEADERS(linux/ext2_fs.h)
  10. if test x$ac_cv_header_linux_ext2_fs_h = xyes
  11. then
  12. AC_CHECK_HEADERS(ext2fs/ext2fs.h, , , [#include <stdio.h>
  13. #include <linux/ext2_fs.h>])
  14. if test x$ac_cv_header_ext2fs_ext2fs_h = xyes
  15. then
  16. AC_DEFINE(USE_EXT2FSLIB, 1,
  17. [Define to enable undelete support on ext2])
  18. ext2fs_undel=yes
  19. EXT2FS_UNDEL_LIBS="-lext2fs -lcom_err"
  20. AC_CHECK_TYPE(ext2_ino_t, ,
  21. [AC_DEFINE(ext2_ino_t, ino_t,
  22. [Define to ino_t if undefined.])],
  23. [#include <errno.h>
  24. #include <stdio.h>
  25. #include <fcntl.h>
  26. #include <stdlib.h>
  27. /* asm/types.h defines its own umode_t :-( */
  28. #undef umode_t
  29. #include <linux/ext2_fs.h>
  30. #include <ext2fs/ext2fs.h>])
  31. fi
  32. fi
  33. ])
  34. dnl MC_VFS_CHECKS
  35. dnl Check for various functions needed by libvfs.
  36. dnl This has various effects:
  37. dnl Sets MC_VFS_LIBS to libraries required
  38. dnl Sets termnet to true or false depending on whether it is required.
  39. dnl If yes, defines USE_TERMNET.
  40. dnl Sets vfs_flags to "pretty" list of vfs implementations we include.
  41. dnl Sets shell variable use_vfs to yes (default, --with-vfs) or
  42. dnl "no" (--without-vfs).
  43. dnl Calls AC_SUBST(mcserv), which is either empty or "mcserv".
  44. dnl Private define
  45. AC_DEFUN([MC_WITH_VFS],[
  46. dnl FIXME: network checks should probably be in their own macro.
  47. AC_CHECK_LIB(nsl, t_accept)
  48. AC_CHECK_LIB(socket, socket)
  49. have_socket=no
  50. AC_CHECK_FUNCS(socket, have_socket=yes)
  51. if test $have_socket = no; then
  52. # socket is not in the default libraries. See if it's in some other.
  53. for lib in bsd socket inet; do
  54. AC_CHECK_LIB([$lib], [socket], [
  55. LIBS="$LIBS -l$lib"
  56. have_socket=yes
  57. AC_DEFINE(HAVE_SOCKET)
  58. break])
  59. done
  60. fi
  61. have_gethostbyname=no
  62. AC_CHECK_FUNC(gethostbyname, have_gethostbyname=yes)
  63. if test $have_gethostbyname = no; then
  64. # gethostbyname is not in the default libraries. See if it's in some other.
  65. for lib in bsd socket inet; do
  66. AC_CHECK_LIB([$lib], [gethostbyname],
  67. [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break])
  68. done
  69. fi
  70. vfs_flags="tarfs"
  71. use_net_code=false
  72. if test $have_socket = yes; then
  73. AC_STRUCT_LINGER
  74. AC_CHECK_FUNCS(pmap_set, , [
  75. AC_CHECK_LIB(rpc, pmap_set, [
  76. LIBS="-lrpc $LIBS"
  77. AC_DEFINE(HAVE_PMAP_SET)
  78. ])])
  79. AC_CHECK_FUNCS(pmap_getport pmap_getmaps rresvport)
  80. dnl add for source routing support setsockopt
  81. AC_CHECK_HEADERS(rpc/pmap_clnt.h, , , [
  82. #include <sys/types.h>
  83. #include <sys/socket.h>
  84. #include <netinet/in.h>
  85. #include <rpc/rpc.h>
  86. #include <rpc/pmap_prot.h>
  87. ])
  88. dnl
  89. dnl mcfs support
  90. dnl
  91. mcfs="mcfs"
  92. AC_ARG_WITH(mcfs,
  93. [--with-mcfs Support mc's private file system],[
  94. if test "x$withval" = "xno"; then
  95. mcfs=""
  96. fi
  97. ])
  98. if test "x$mcfs" != "x"; then
  99. AC_DEFINE(WITH_MCFS, 1, [Define to enable mc's private file system])
  100. vfs_flags="$vfs_flags, mcfs"
  101. fi
  102. vfs_flags="$vfs_flags, ftpfs, fish"
  103. use_net_code=true
  104. fi
  105. dnl
  106. dnl Samba support
  107. dnl
  108. smbfs=""
  109. SAMBAFILES=""
  110. AC_ARG_WITH(samba,
  111. [--with-samba Support smb virtual file system],[
  112. if test "x$withval" != "xno"; then
  113. AC_DEFINE(WITH_SMBFS, 1, [Define to enable VFS over SMB])
  114. vfs_flags="$vfs_flags, smbfs"
  115. smbfs="smbfs.o"
  116. SAMBAFILES="\$(SAMBAFILES)"
  117. fi
  118. ])
  119. AC_SUBST(smbfs)
  120. AC_SUBST(SAMBAFILES)
  121. if test "x$smbfs" != x ; then
  122. #################################################
  123. # set Samba configuration directory location
  124. configdir="/etc"
  125. AC_ARG_WITH(configdir,
  126. [ --with-configdir=DIR Where the Samba configuration files are (/etc)],
  127. [ case "$withval" in
  128. yes|no)
  129. #
  130. # Just in case anybody does it
  131. #
  132. AC_MSG_WARN([--with-configdir called without argument - will use default])
  133. ;;
  134. * )
  135. configdir="$withval"
  136. ;;
  137. esac]
  138. )
  139. AC_SUBST(configdir)
  140. AC_ARG_WITH(codepagedir,
  141. [ --with-codepagedir=DIR Where the Samba codepage files are],
  142. [ case "$withval" in
  143. yes|no)
  144. #
  145. # Just in case anybody does it
  146. #
  147. AC_MSG_WARN([--with-codepagedir called without argument - will use default])
  148. ;;
  149. esac]
  150. )
  151. fi
  152. dnl
  153. dnl The termnet support
  154. dnl
  155. termnet=false
  156. AC_ARG_WITH(termnet,
  157. [--with-termnet If you want a termified net support],[
  158. if test x$withval = xyes; then
  159. AC_DEFINE(USE_TERMNET, 1,
  160. [Define to enable `term' firewall support])
  161. termnet=true
  162. fi
  163. ])
  164. TERMNET=""
  165. AC_DEFINE(USE_VFS, 1, [Define to enable VFS support])
  166. if $use_net_code; then
  167. AC_DEFINE(USE_NETCODE, 1, [Define to use networked VFS])
  168. fi
  169. mcserv=
  170. if test $have_socket = yes; then
  171. mcserv="mcserv"
  172. if $termnet; then
  173. TERMNET="-ltermnet"
  174. fi
  175. fi
  176. AC_SUBST(TERMNET)
  177. AC_SUBST(mcserv)
  178. dnl FIXME:
  179. dnl MC_VFS_LIBS=
  180. ])
  181. AC_DEFUN([MC_VFS_CHECKS],[
  182. use_vfs=yes
  183. AC_ARG_WITH(vfs,
  184. [--with-vfs Compile with the VFS code],
  185. use_vfs=$withval
  186. )
  187. case $use_vfs in
  188. yes) MC_WITH_VFS;;
  189. no) use_vfs=no;;
  190. *) use_vfs=no;;
  191. dnl Should we issue a warning?
  192. esac
  193. ])
  194. dnl
  195. dnl Check for struct linger
  196. dnl
  197. AC_DEFUN([AC_STRUCT_LINGER], [
  198. av_struct_linger=no
  199. AC_MSG_CHECKING([struct linger is available])
  200. AC_TRY_RUN([
  201. #include <sys/types.h>
  202. #include <sys/socket.h>
  203. struct linger li;
  204. int main ()
  205. {
  206. li.l_onoff = 1;
  207. li.l_linger = 120;
  208. return 0;
  209. }
  210. ],[
  211. AC_DEFINE(HAVE_STRUCT_LINGER, 1,
  212. [Define if `struct linger' is available])
  213. av_struct_linger=yes
  214. ],[
  215. av_struct_linger=no
  216. ],[
  217. av_struct_linger=no
  218. ])
  219. AC_MSG_RESULT([$av_struct_linger])
  220. ])
  221. dnl
  222. dnl Check for size of d_name dirent member
  223. dnl
  224. AC_DEFUN([AC_SHORT_D_NAME_LEN], [
  225. AC_MSG_CHECKING([filename fits on dirent.d_name])
  226. AC_CACHE_VAL(ac_cv_dnamesize, [
  227. OCFLAGS="$CFLAGS"
  228. CFLAGS="$CFLAGS -I$srcdir"
  229. AC_TRY_RUN([
  230. #include <src/fs.h>
  231. int main ()
  232. {
  233. struct dirent ddd;
  234. if (sizeof (ddd.d_name) < 12)
  235. return 0;
  236. else
  237. return 1;
  238. }
  239. ],[
  240. ac_cv_dnamesize="no"
  241. ], [
  242. ac_cv_dnamesize="yes"
  243. ], [
  244. # Cannot find out, so assume no
  245. ac_cv_dnamesize="no"
  246. ])
  247. CFLAGS="$OCFLAGS"
  248. ])
  249. if test x$ac_cv_dnamesize = xno; then
  250. AC_DEFINE(NEED_EXTRA_DIRENT_BUFFER, 1,
  251. [Define if using `struct dirent' can overwrite stack])
  252. fi
  253. AC_MSG_RESULT([$ac_cv_dnamesize])
  254. ])
  255. dnl
  256. dnl Filesystem information detection
  257. dnl
  258. dnl To get information about the disk, mount points, etc.
  259. dnl
  260. AC_DEFUN([AC_GET_FS_INFO], [
  261. AC_CHECK_HEADERS(fcntl.h sys/dustat.h sys/param.h sys/statfs.h sys/fstyp.h)
  262. AC_CHECK_HEADERS(mnttab.h mntent.h utime.h sys/statvfs.h sys/vfs.h)
  263. AC_CHECK_HEADERS(sys/filsys.h sys/fs_types.h)
  264. AC_CHECK_HEADERS(sys/mount.h, , , [
  265. #include <sys/param.h>
  266. #include <sys/stat.h>
  267. ])
  268. AC_CHECK_FUNCS(getmntinfo)
  269. dnl This configure.in code has been stolen from GNU fileutils-3.12. Its
  270. dnl job is to detect a method to get list of mounted filesystems.
  271. AC_MSG_CHECKING([for d_ino member in directory struct])
  272. AC_CACHE_VAL(fu_cv_sys_d_ino_in_dirent,
  273. [AC_TRY_LINK([
  274. #include <sys/types.h>
  275. #ifdef HAVE_DIRENT_H
  276. # include <dirent.h>
  277. #else /* not HAVE_DIRENT_H */
  278. # define dirent direct
  279. # ifdef HAVE_SYS_NDIR_H
  280. # include <sys/ndir.h>
  281. # endif /* HAVE_SYS_NDIR_H */
  282. # ifdef HAVE_SYS_DIR_H
  283. # include <sys/dir.h>
  284. # endif /* HAVE_SYS_DIR_H */
  285. # ifdef HAVE_NDIR_H
  286. # include <ndir.h>
  287. # endif /* HAVE_NDIR_H */
  288. #endif /* HAVE_DIRENT_H */
  289. ],
  290. [struct dirent dp; dp.d_ino = 0;],
  291. fu_cv_sys_d_ino_in_dirent=yes,
  292. fu_cv_sys_d_ino_in_dirent=no)])
  293. AC_MSG_RESULT([$fu_cv_sys_d_ino_in_dirent])
  294. if test $fu_cv_sys_d_ino_in_dirent = yes; then
  295. AC_DEFINE(D_INO_IN_DIRENT, 1,
  296. [Define if `d_ino' is member of `struct directory'])
  297. fi
  298. # Determine how to get the list of mounted filesystems.
  299. list_mounted_fs=
  300. # If the getmntent function is available but not in the standard library,
  301. # make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX).
  302. AC_FUNC_GETMNTENT
  303. if test $ac_cv_func_getmntent = yes; then
  304. # This system has the getmntent function.
  305. # Determine whether it's the one-argument variant or the two-argument one.
  306. if test -z "$list_mounted_fs"; then
  307. # SVR4
  308. AC_MSG_CHECKING([for two-argument getmntent function])
  309. AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
  310. [AC_EGREP_HEADER(getmntent, sys/mnttab.h,
  311. fu_cv_sys_mounted_getmntent2=yes,
  312. fu_cv_sys_mounted_getmntent2=no)])
  313. AC_MSG_RESULT([$fu_cv_sys_mounted_getmntent2])
  314. if test $fu_cv_sys_mounted_getmntent2 = yes; then
  315. list_mounted_fs=found
  316. AC_DEFINE(MOUNTED_GETMNTENT2, 1,
  317. [Define if function `getmntent' takes 2 arguments])
  318. fi
  319. fi
  320. if test -z "$list_mounted_fs"; then
  321. # 4.3BSD, SunOS, HP-UX, Dynix, Irix
  322. AC_MSG_CHECKING([for one-argument getmntent function])
  323. AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
  324. [test $ac_cv_header_mntent_h = yes \
  325. && fu_cv_sys_mounted_getmntent1=yes \
  326. || fu_cv_sys_mounted_getmntent1=no])
  327. AC_MSG_RESULT([$fu_cv_sys_mounted_getmntent1])
  328. if test $fu_cv_sys_mounted_getmntent1 = yes; then
  329. list_mounted_fs=found
  330. AC_DEFINE(MOUNTED_GETMNTENT1, 1,
  331. [Define if function `getmntent' takes 1 argument])
  332. fi
  333. fi
  334. fi
  335. if test -z "$list_mounted_fs"; then
  336. # DEC Alpha running OSF/1.
  337. AC_MSG_CHECKING([for getfsstat function])
  338. AC_CACHE_VAL(fu_cv_sys_mounted_getsstat,
  339. [AC_TRY_LINK([
  340. #include <sys/types.h>
  341. #include <sys/mount.h>
  342. #include <sys/fs_types.h>],
  343. [struct statfs *stats;
  344. numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); ],
  345. fu_cv_sys_mounted_getsstat=yes,
  346. fu_cv_sys_mounted_getsstat=no)])
  347. AC_MSG_RESULT([$fu_cv_sys_mounted_getsstat])
  348. if test $fu_cv_sys_mounted_getsstat = yes; then
  349. list_mounted_fs=found
  350. AC_DEFINE(MOUNTED_GETFSSTAT, 1,
  351. [Define if function `getfsstat' can be used])
  352. fi
  353. fi
  354. if test -z "$list_mounted_fs"; then
  355. # AIX.
  356. AC_MSG_CHECKING([for mntctl function and struct vmount])
  357. AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
  358. [AC_TRY_CPP([#include <fshelp.h>],
  359. fu_cv_sys_mounted_vmount=yes,
  360. fu_cv_sys_mounted_vmount=no)])
  361. AC_MSG_RESULT([$fu_cv_sys_mounted_vmount])
  362. if test $fu_cv_sys_mounted_vmount = yes; then
  363. list_mounted_fs=found
  364. AC_DEFINE(MOUNTED_VMOUNT, 1,
  365. [Define if function `mntctl' and `struct vmount' can be used])
  366. fi
  367. fi
  368. if test -z "$list_mounted_fs"; then
  369. # SVR3
  370. AC_MSG_CHECKING([for existence of three headers])
  371. AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
  372. [AC_TRY_CPP([
  373. #include <sys/statfs.h>
  374. #include <sys/fstyp.h>
  375. #include <mnttab.h>],
  376. fu_cv_sys_mounted_fread_fstyp=yes,
  377. fu_cv_sys_mounted_fread_fstyp=no)])
  378. AC_MSG_RESULT([$fu_cv_sys_mounted_fread_fstyp])
  379. if test $fu_cv_sys_mounted_fread_fstyp = yes; then
  380. list_mounted_fs=found
  381. AC_DEFINE(MOUNTED_FREAD_FSTYP, 1,
  382. [Define if sys/statfs.h, sys/fstyp.h and mnttab.h
  383. can be used together])
  384. fi
  385. fi
  386. if test -z "$list_mounted_fs"; then
  387. # 4.4BSD and DEC OSF/1.
  388. AC_MSG_CHECKING([for getmntinfo function])
  389. AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
  390. [
  391. ok=
  392. if test $ac_cv_func_getmntinfo = yes; then
  393. AC_EGREP_HEADER(f_type;, sys/mount.h,
  394. ok=yes)
  395. fi
  396. test -n "$ok" \
  397. && fu_cv_sys_mounted_getmntinfo=yes \
  398. || fu_cv_sys_mounted_getmntinfo=no
  399. ])
  400. AC_MSG_RESULT([$fu_cv_sys_mounted_getmntinfo])
  401. if test $fu_cv_sys_mounted_getmntinfo = yes; then
  402. list_mounted_fs=found
  403. AC_DEFINE(MOUNTED_GETMNTINFO, 1,
  404. [Define if `getmntinfo' function can be used])
  405. AC_MSG_CHECKING([if struct statfs has f_fstypename])
  406. AC_CACHE_VAL(fu_cv_sys_mounted_f_fstypename,
  407. [AC_EGREP_HEADER([f_fstypename],
  408. [sys/mount.h],
  409. [fu_cv_sys_mounted_f_fstypename=yes],
  410. [fu_cv_sys_mounted_f_fstypename=no])
  411. ])
  412. AC_MSG_RESULT([$fu_cv_sys_mounted_f_fstypename])
  413. if test $fu_cv_sys_mounted_f_fstypename = yes; then
  414. AC_DEFINE(HAVE_F_FSTYPENAME, 1,
  415. [Define if `f_fstypename' is member of `struct statfs'])
  416. fi
  417. fi
  418. fi
  419. if test -z "$list_mounted_fs"; then
  420. # Ultrix
  421. AC_MSG_CHECKING([for getmnt function])
  422. AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
  423. [AC_TRY_CPP([
  424. #include <sys/fs_types.h>
  425. #include <sys/mount.h>],
  426. fu_cv_sys_mounted_getmnt=yes,
  427. fu_cv_sys_mounted_getmnt=no)])
  428. AC_MSG_RESULT([$fu_cv_sys_mounted_getmnt])
  429. if test $fu_cv_sys_mounted_getmnt = yes; then
  430. list_mounted_fs=found
  431. AC_DEFINE(MOUNTED_GETMNT, 1,
  432. [Define if `getmnt' function can be used])
  433. fi
  434. fi
  435. if test -z "$list_mounted_fs"; then
  436. # SVR2
  437. AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
  438. AC_CACHE_VAL(fu_cv_sys_mounted_fread,
  439. [AC_TRY_CPP([#include <mnttab.h>],
  440. fu_cv_sys_mounted_fread=yes,
  441. fu_cv_sys_mounted_fread=no)])
  442. AC_MSG_RESULT([$fu_cv_sys_mounted_fread])
  443. if test $fu_cv_sys_mounted_fread = yes; then
  444. list_mounted_fs=found
  445. AC_DEFINE(MOUNTED_FREAD, 1,
  446. [Define if it's possible to resort to fread on /etc/mnttab])
  447. fi
  448. fi
  449. if test -z "$list_mounted_fs"; then
  450. AC_MSG_WARN([could not determine how to read list of mounted fs])
  451. else
  452. AC_DEFINE(HAVE_INFOMOUNT_LIST, 1,
  453. [Define if the list of mounted filesystems can be determined])
  454. fi
  455. dnl This configure.in code has been stolen from GNU fileutils-3.12. Its
  456. dnl job is to detect a method to get file system information.
  457. AC_MSG_NOTICE([checking how to get filesystem space usage])
  458. space=no
  459. # Here we'll compromise a little (and perform only the link test)
  460. # since it seems there are no variants of the statvfs function.
  461. if test $space = no; then
  462. # SVR4
  463. AC_CHECK_FUNCS(statvfs)
  464. if test $ac_cv_func_statvfs = yes; then
  465. space=yes
  466. AC_DEFINE(STAT_STATVFS, 1,
  467. [Define if function `statfs' can be used])
  468. fi
  469. fi
  470. if test $space = no; then
  471. # DEC Alpha running OSF/1
  472. AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
  473. AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
  474. [AC_TRY_RUN([
  475. #include <sys/param.h>
  476. #include <sys/types.h>
  477. #include <sys/mount.h>
  478. main ()
  479. {
  480. struct statfs fsd;
  481. fsd.f_fsize = 0;
  482. exit (statfs (".", &fsd, sizeof (struct statfs)));
  483. }],
  484. fu_cv_sys_stat_statfs3_osf1=yes,
  485. fu_cv_sys_stat_statfs3_osf1=no,
  486. fu_cv_sys_stat_statfs3_osf1=no)])
  487. AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
  488. if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
  489. space=yes
  490. AC_DEFINE(STAT_STATFS3_OSF1, 1,
  491. [Define if function `statfs' takes 3 arguments])
  492. fi
  493. fi
  494. if test $space = no; then
  495. # AIX
  496. AC_MSG_CHECKING([for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)])
  497. AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
  498. [AC_TRY_RUN([
  499. #ifdef HAVE_SYS_PARAM_H
  500. #include <sys/param.h>
  501. #endif
  502. #ifdef HAVE_SYS_MOUNT_H
  503. #include <sys/mount.h>
  504. #endif
  505. #ifdef HAVE_SYS_VFS_H
  506. #include <sys/vfs.h>
  507. #endif
  508. main ()
  509. {
  510. struct statfs fsd;
  511. fsd.f_bsize = 0;
  512. exit (statfs (".", &fsd));
  513. }],
  514. fu_cv_sys_stat_statfs2_bsize=yes,
  515. fu_cv_sys_stat_statfs2_bsize=no,
  516. fu_cv_sys_stat_statfs2_bsize=no)])
  517. AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_bsize])
  518. if test $fu_cv_sys_stat_statfs2_bsize = yes; then
  519. space=yes
  520. AC_DEFINE(STAT_STATFS2_BSIZE, 1,
  521. [Define if function `statfs' takes two arguments and
  522. `bsize' is member of `struct statfs'])
  523. fi
  524. fi
  525. if test $space = no; then
  526. # SVR3
  527. AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
  528. AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
  529. [AC_TRY_RUN([#include <sys/types.h>
  530. #include <sys/statfs.h>
  531. main ()
  532. {
  533. struct statfs fsd;
  534. exit (statfs (".", &fsd, sizeof fsd, 0));
  535. }],
  536. fu_cv_sys_stat_statfs4=yes,
  537. fu_cv_sys_stat_statfs4=no,
  538. fu_cv_sys_stat_statfs4=no)])
  539. AC_MSG_RESULT([$fu_cv_sys_stat_statfs4])
  540. if test $fu_cv_sys_stat_statfs4 = yes; then
  541. space=yes
  542. AC_DEFINE(STAT_STATFS4, 1,
  543. [Define if function `statfs' takes 4 arguments])
  544. fi
  545. fi
  546. if test $space = no; then
  547. # 4.4BSD and NetBSD
  548. AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
  549. member (4.4BSD and NetBSD)])
  550. AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
  551. [AC_TRY_RUN([#include <sys/types.h>
  552. #ifdef HAVE_SYS_PARAM_H
  553. #include <sys/param.h>
  554. #endif
  555. #ifdef HAVE_SYS_MOUNT_H
  556. #include <sys/mount.h>
  557. #endif
  558. main ()
  559. {
  560. struct statfs fsd;
  561. fsd.f_fsize = 0;
  562. exit (statfs (".", &fsd));
  563. }],
  564. fu_cv_sys_stat_statfs2_fsize=yes,
  565. fu_cv_sys_stat_statfs2_fsize=no,
  566. fu_cv_sys_stat_statfs2_fsize=no)])
  567. AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_fsize])
  568. if test $fu_cv_sys_stat_statfs2_fsize = yes; then
  569. space=yes
  570. AC_DEFINE(STAT_STATFS2_FSIZE, 1,
  571. [Define if function `statfs' takes two arguments and
  572. `fsize' is member of `struct statfs'])
  573. fi
  574. fi
  575. if test $space = no; then
  576. # Ultrix
  577. AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
  578. AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
  579. [AC_TRY_RUN([
  580. #include <sys/types.h>
  581. #ifdef HAVE_SYS_PARAM_H
  582. #include <sys/param.h>
  583. #endif
  584. #ifdef HAVE_SYS_MOUNT_H
  585. #include <sys/mount.h>
  586. #endif
  587. #ifdef HAVE_SYS_FS_TYPES_H
  588. #include <sys/fs_types.h>
  589. #endif
  590. main ()
  591. {
  592. struct fs_data fsd;
  593. /* Ultrix's statfs returns 1 for success,
  594. 0 for not mounted, -1 for failure. */
  595. exit (statfs (".", &fsd) != 1);
  596. }],
  597. fu_cv_sys_stat_fs_data=yes,
  598. fu_cv_sys_stat_fs_data=no,
  599. fu_cv_sys_stat_fs_data=no)])
  600. AC_MSG_RESULT([$fu_cv_sys_stat_fs_data])
  601. if test $fu_cv_sys_stat_fs_data = yes; then
  602. space=yes
  603. AC_DEFINE(STAT_STATFS2_FS_DATA, 1,
  604. [Define if function `statfs' takes two arguments
  605. and uses `struct fs_data'])
  606. fi
  607. fi
  608. dnl Not supported
  609. dnl if test $space = no; then
  610. dnl # SVR2
  611. dnl AC_TRY_CPP([#include <sys/filsys.h>],
  612. dnl AC_DEFINE(STAT_READ_FILSYS) space=yes)
  613. dnl fi
  614. ])
  615. dnl AC_TRY_WARNINGS(INCLUDES, FUNCTION-BODY,
  616. dnl ACTION-IF-NO-WARNINGS [, ACTION-IF-WARNINGS-OR-ERROR])
  617. AC_DEFUN([AC_TRY_WARNINGS],
  618. [cat > conftest.$ac_ext <<EOF
  619. dnl This sometimes fails to find confdefs.h, for some reason.
  620. dnl [#]line __oline__ "[$]0"
  621. [#]line __oline__ "configure"
  622. #include "confdefs.h"
  623. [$1]
  624. int main() { return 0; }
  625. int t() {
  626. [$2]
  627. ; return 0; }
  628. EOF
  629. ac_compile_warn='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 2>&1'
  630. if { if eval $ac_compile_warn; then :; else echo arning; fi; } |
  631. grep arning 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
  632. ifelse([$4], , :, [rm -rf conftest*
  633. $4])
  634. ifelse([$3], , , [else
  635. rm -rf conftest*
  636. $3
  637. ])dnl
  638. fi
  639. rm -f conftest*]
  640. )
  641. AC_DEFUN([AC_USE_TERMINFO], [
  642. AC_DEFINE(SLANG_TERMINFO, 1, [Define to use S-Lang with terminfo])
  643. AC_MSG_NOTICE([using SLang screen manager/terminfo])
  644. slang_term=" with terminfo"
  645. ])
  646. AC_DEFUN([AC_USE_TERMCAP], [
  647. AC_MSG_NOTICE([using S-Lang screen manager/termcap])
  648. AC_DEFINE(USE_TERMCAP, 1, [Define to use termcap library])
  649. dnl Check with $LIBS at the end so that it works with ELF libs.
  650. AC_CHECK_LIB(termcap, tgoto, [LIBS="$LIBS -ltermcap"], , [$LIBS])
  651. slang_term=" with termcap"
  652. ])
  653. AC_DEFUN([AC_WITH_SLANG], [
  654. AC_DEFINE(HAVE_SLANG, 1,
  655. [Define to use S-Lang library for screen management])
  656. search_ncurses=false
  657. screen_type="slang"
  658. if $slang_use_system_installed_lib
  659. then
  660. AC_DEFINE(HAVE_SYSTEM_SLANG, 1,
  661. [Define to use S-Lang library installed on the system])
  662. MCLIBS="-lslang $MCLIBS"
  663. screen_manager="SLang (system-installed library)"
  664. AC_MSG_NOTICE([using system installed S-Lang library])
  665. ac_save_LIBS="$LIBS"
  666. LIBS="$LIBS -lslang"
  667. AC_TRY_LINK(
  668. [
  669. #ifdef HAVE_SLANG_SLANG_H
  670. #include <slang/slang.h>
  671. #else
  672. #include <slang.h>
  673. #endif], [
  674. SLtt_get_terminfo();
  675. SLtt_tgetflag("");],
  676. [LIBS="$ac_save_LIBS"; AC_USE_TERMINFO],
  677. [LIBS="$ac_save_LIBS"; AC_USE_TERMCAP])
  678. else
  679. screen_manager="SLang"
  680. fi
  681. if $slang_check_lib
  682. then
  683. use_terminfo=false
  684. for dir in /usr/lib /usr/share/lib /usr/local/lib /lib \
  685. /usr/local/share /usr/share
  686. do
  687. if test -d $dir/terminfo; then
  688. use_terminfo=true;
  689. break
  690. fi
  691. done
  692. if $use_terminfo; then
  693. AC_USE_TERMINFO
  694. else
  695. AC_USE_TERMCAP
  696. fi
  697. fi]
  698. )
  699. AC_DEFUN([AC_WITH_EDIT], [
  700. AC_DEFINE(USE_INTERNAL_EDIT, 1,
  701. [Define to enable internal editor])
  702. LIBEDIT_A="libedit.a"
  703. MCEDIT="mcedit"
  704. LEDIT="-ledit"
  705. EDIT_msg="yes"
  706. AC_MSG_NOTICE([using internal editor])
  707. ])
  708. AC_DEFUN([AC_EXT2_UNDEL], [
  709. MC_UNDELFS_CHECKS
  710. if test "$ext2fs_undel" = yes; then
  711. AC_MSG_NOTICE([using ext2fs file recovery code])
  712. vfs_flags="${vfs_flags}, undelfs"
  713. undelfs_o="undelfs.o"
  714. LIBS="$LIBS $EXT2FS_UNDEL_LIBS"
  715. else
  716. AC_MSG_NOTICE([not using ext2fs file recovery code])
  717. fi
  718. ])
  719. dnl
  720. dnl Parameters: directory filename LIBS_append CPPFLAGS_append nicename
  721. dnl
  722. AC_DEFUN([AC_NCURSES], [
  723. if $search_ncurses
  724. then
  725. if test -f $1/$2
  726. then
  727. AC_MSG_NOTICE([found ncurses header $1/$2])
  728. MCLIBS="$MCLIBS $3"
  729. CPPFLAGS="$CPPFLAGS $4"
  730. search_ncurses=false
  731. screen_type="ncurses"
  732. screen_manager="$5"
  733. AC_DEFINE(USE_NCURSES, 1,
  734. [Define to use ncurses for screen management])
  735. fi
  736. fi
  737. ])