acinclude.m4 21 KB

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