acinclude.m4 24 KB

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