acinclude.m4 26 KB

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