acinclude.m4 24 KB

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