acinclude.m4 24 KB

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