acinclude.m4 24 KB

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