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.
7 AC_DEFUN([MC_UNDELFS_CHECKS], [
10 AC_CHECK_HEADERS(linux/ext2_fs.h)
11 if test x$ac_cv_header_linux_ext2_fs_h = xyes
13 AC_CHECK_HEADERS(ext2fs/ext2fs.h, , , [#include <stdio.h>
14 #include <linux/ext2_fs.h>])
15 if test x$ac_cv_header_ext2fs_ext2fs_h = xyes
17 AC_DEFINE(USE_EXT2FSLIB, 1,
18 [Define to enable undelete support on ext2])
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.])],
28 /* asm/types.h defines its own umode_t :-( */
30 #include <linux/ext2_fs.h>
31 #include <ext2fs/ext2fs.h>])
39 dnl Check for various functions needed by libvfs.
40 dnl This has various effects:
41 dnl Sets MC_VFS_LIBS to libraries required
42 dnl Sets vfs_flags to "pretty" list of vfs implementations we include.
43 dnl Sets shell variable use_vfs to yes (default, --with-vfs) or
44 dnl "no" (--without-vfs).
45 dnl Calls AC_SUBST(mcserv), which is either empty or "mcserv".
48 AC_DEFUN([MC_WITH_VFS],[
49 dnl FIXME: network checks should probably be in their own macro.
50 AC_CHECK_LIB(nsl, t_accept)
51 AC_CHECK_LIB(socket, socket)
54 AC_CHECK_FUNCS(socket, have_socket=yes)
55 if test $have_socket = no; then
56 # socket is not in the default libraries. See if it's in some other.
57 for lib in bsd socket inet; do
58 AC_CHECK_LIB([$lib], [socket], [
61 AC_DEFINE(HAVE_SOCKET)
67 AC_CHECK_FUNC(gethostbyname, have_gethostbyname=yes)
68 if test $have_gethostbyname = no; then
69 # gethostbyname is not in the default libraries. See if it's in some other.
70 for lib in bsd socket inet; do
71 AC_CHECK_LIB([$lib], [gethostbyname],
72 [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break])
78 if test $have_socket = yes; then
80 AC_CHECK_FUNCS(pmap_set, , [
81 AC_CHECK_LIB(rpc, pmap_set, [
83 AC_DEFINE(HAVE_PMAP_SET)
85 AC_CHECK_FUNCS(pmap_getport pmap_getmaps rresvport)
86 dnl add for source routing support setsockopt
87 AC_CHECK_HEADERS(rpc/pmap_clnt.h, , , [
88 #include <sys/types.h>
89 #include <sys/socket.h>
90 #include <netinet/in.h>
92 #include <rpc/pmap_prot.h>
98 [ --with-mcfs Support mc-specific networking file system [[no]]],
99 [if test "x$withval" != "xno"; then
100 AC_DEFINE(WITH_MCFS, 1, [Define to enable mc-specific networking file system])
101 vfs_flags="$vfs_flags, mcfs"
105 vfs_flags="$vfs_flags, ftpfs, fish"
114 [ --with-samba Support smb virtual file system [[no]]],
115 [if test "x$withval" != "xno"; then
116 AC_DEFINE(WITH_SMBFS, 1, [Define to enable VFS over SMB])
117 vfs_flags="$vfs_flags, smbfs"
122 if test -n "$use_smbfs"; then
123 #################################################
124 # set Samba configuration directory location
126 AC_ARG_WITH(configdir,
127 [ --with-configdir=DIR Where the Samba configuration files are [[/etc]]],
131 # Just in case anybody does it
133 AC_MSG_WARN([--with-configdir called without argument - will use default])
142 AC_ARG_WITH(codepagedir,
143 [ --with-codepagedir=DIR Where the Samba codepage files are],
147 # Just in case anybody does it
149 AC_MSG_WARN([--with-codepagedir called without argument - will use default])
155 AC_DEFINE(USE_VFS, 1, [Define to enable VFS support])
156 if $use_net_code; then
157 AC_DEFINE(USE_NETCODE, 1, [Define to use networked VFS])
160 if test $have_socket = yes; then
173 AC_DEFUN([MC_VFS_CHECKS],[
176 [ --with-vfs Compile with the VFS code [[yes]]],
183 dnl Should we issue a warning?
190 dnl Check for struct linger
192 AC_DEFUN([AC_STRUCT_LINGER], [
194 AC_MSG_CHECKING([struct linger is available])
196 #include <sys/types.h>
197 #include <sys/socket.h>
208 AC_DEFINE(HAVE_STRUCT_LINGER, 1,
209 [Define if `struct linger' is available])
216 AC_MSG_RESULT([$av_struct_linger])
221 dnl Filesystem information detection
223 dnl To get information about the disk, mount points, etc.
226 AC_DEFUN([AC_GET_FS_INFO], [
227 AC_CHECK_HEADERS(fcntl.h sys/dustat.h sys/param.h sys/statfs.h sys/fstyp.h)
228 AC_CHECK_HEADERS(mnttab.h mntent.h utime.h sys/statvfs.h sys/vfs.h)
229 AC_CHECK_HEADERS(sys/filsys.h sys/fs_types.h)
230 AC_CHECK_HEADERS(sys/mount.h, , , [
231 #include <sys/param.h>
232 #include <sys/stat.h>
234 AC_CHECK_FUNCS(getmntinfo)
236 dnl This configure.in code has been stolen from GNU fileutils-3.12. Its
237 dnl job is to detect a method to get list of mounted filesystems.
239 AC_MSG_CHECKING([for d_ino member in directory struct])
240 AC_CACHE_VAL(fu_cv_sys_d_ino_in_dirent,
242 #include <sys/types.h>
245 #else /* not HAVE_DIRENT_H */
246 # define dirent direct
247 # ifdef HAVE_SYS_NDIR_H
248 # include <sys/ndir.h>
249 # endif /* HAVE_SYS_NDIR_H */
250 # ifdef HAVE_SYS_DIR_H
251 # include <sys/dir.h>
252 # endif /* HAVE_SYS_DIR_H */
255 # endif /* HAVE_NDIR_H */
256 #endif /* HAVE_DIRENT_H */
258 [struct dirent dp; dp.d_ino = 0;],
259 fu_cv_sys_d_ino_in_dirent=yes,
260 fu_cv_sys_d_ino_in_dirent=no)])
261 AC_MSG_RESULT([$fu_cv_sys_d_ino_in_dirent])
262 if test $fu_cv_sys_d_ino_in_dirent = yes; then
263 AC_DEFINE(D_INO_IN_DIRENT, 1,
264 [Define if `d_ino' is member of `struct directory'])
267 # Determine how to get the list of mounted filesystems.
270 # If the getmntent function is available but not in the standard library,
271 # make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX).
274 if test $ac_cv_func_getmntent = yes; then
276 # This system has the getmntent function.
277 # Determine whether it's the one-argument variant or the two-argument one.
279 if test -z "$list_mounted_fs"; then
281 AC_MSG_CHECKING([for two-argument getmntent function])
282 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
283 [AC_EGREP_HEADER(getmntent, sys/mnttab.h,
284 fu_cv_sys_mounted_getmntent2=yes,
285 fu_cv_sys_mounted_getmntent2=no)])
286 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntent2])
287 if test $fu_cv_sys_mounted_getmntent2 = yes; then
288 list_mounted_fs=found
289 AC_DEFINE(MOUNTED_GETMNTENT2, 1,
290 [Define if function `getmntent' takes 2 arguments])
294 if test -z "$list_mounted_fs"; then
295 # 4.3BSD, SunOS, HP-UX, Dynix, Irix
296 AC_MSG_CHECKING([for one-argument getmntent function])
297 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
298 [test $ac_cv_header_mntent_h = yes \
299 && fu_cv_sys_mounted_getmntent1=yes \
300 || fu_cv_sys_mounted_getmntent1=no])
301 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntent1])
302 if test $fu_cv_sys_mounted_getmntent1 = yes; then
303 list_mounted_fs=found
304 AC_DEFINE(MOUNTED_GETMNTENT1, 1,
305 [Define if function `getmntent' takes 1 argument])
311 if test -z "$list_mounted_fs"; then
312 # DEC Alpha running OSF/1.
313 AC_MSG_CHECKING([for getfsstat function])
314 AC_CACHE_VAL(fu_cv_sys_mounted_getsstat,
316 #include <sys/types.h>
317 #include <sys/mount.h>
318 #include <sys/fs_types.h>],
319 [struct statfs *stats;
320 numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); ],
321 fu_cv_sys_mounted_getsstat=yes,
322 fu_cv_sys_mounted_getsstat=no)])
323 AC_MSG_RESULT([$fu_cv_sys_mounted_getsstat])
324 if test $fu_cv_sys_mounted_getsstat = yes; then
325 list_mounted_fs=found
326 AC_DEFINE(MOUNTED_GETFSSTAT, 1,
327 [Define if function `getfsstat' can be used])
331 if test -z "$list_mounted_fs"; then
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])
346 if test -z "$list_mounted_fs"; then
348 AC_MSG_CHECKING([for existence of three headers])
349 AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
351 #include <sys/statfs.h>
352 #include <sys/fstyp.h>
353 #include <mnttab.h>],
354 fu_cv_sys_mounted_fread_fstyp=yes,
355 fu_cv_sys_mounted_fread_fstyp=no)])
356 AC_MSG_RESULT([$fu_cv_sys_mounted_fread_fstyp])
357 if test $fu_cv_sys_mounted_fread_fstyp = yes; then
358 list_mounted_fs=found
359 AC_DEFINE(MOUNTED_FREAD_FSTYP, 1,
360 [Define if sys/statfs.h, sys/fstyp.h and mnttab.h
361 can be used together])
365 if test -z "$list_mounted_fs"; then
366 # 4.4BSD and DEC OSF/1.
367 AC_MSG_CHECKING([for getmntinfo function])
368 AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
371 if test $ac_cv_func_getmntinfo = yes; then
372 AC_EGREP_HEADER(f_type;, sys/mount.h,
376 && fu_cv_sys_mounted_getmntinfo=yes \
377 || fu_cv_sys_mounted_getmntinfo=no
379 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntinfo])
380 if test $fu_cv_sys_mounted_getmntinfo = yes; then
381 list_mounted_fs=found
382 AC_DEFINE(MOUNTED_GETMNTINFO, 1,
383 [Define if `getmntinfo' function can be used])
384 AC_MSG_CHECKING([if struct statfs has f_fstypename])
385 AC_CACHE_VAL(fu_cv_sys_mounted_f_fstypename,
386 [AC_EGREP_HEADER([f_fstypename],
388 [fu_cv_sys_mounted_f_fstypename=yes],
389 [fu_cv_sys_mounted_f_fstypename=no])
391 AC_MSG_RESULT([$fu_cv_sys_mounted_f_fstypename])
392 if test $fu_cv_sys_mounted_f_fstypename = yes; then
393 AC_DEFINE(HAVE_F_FSTYPENAME, 1,
394 [Define if `f_fstypename' is member of `struct statfs'])
399 if test -z "$list_mounted_fs"; then
401 AC_MSG_CHECKING([for getmnt function])
402 AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
404 #include <sys/fs_types.h>
405 #include <sys/mount.h>],
406 fu_cv_sys_mounted_getmnt=yes,
407 fu_cv_sys_mounted_getmnt=no)])
408 AC_MSG_RESULT([$fu_cv_sys_mounted_getmnt])
409 if test $fu_cv_sys_mounted_getmnt = yes; then
410 list_mounted_fs=found
411 AC_DEFINE(MOUNTED_GETMNT, 1,
412 [Define if `getmnt' function can be used])
416 if test -z "$list_mounted_fs"; then
418 AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
419 AC_CACHE_VAL(fu_cv_sys_mounted_fread,
420 [AC_TRY_CPP([#include <mnttab.h>],
421 fu_cv_sys_mounted_fread=yes,
422 fu_cv_sys_mounted_fread=no)])
423 AC_MSG_RESULT([$fu_cv_sys_mounted_fread])
424 if test $fu_cv_sys_mounted_fread = yes; then
425 list_mounted_fs=found
426 AC_DEFINE(MOUNTED_FREAD, 1,
427 [Define if it's possible to resort to fread on /etc/mnttab])
431 if test -z "$list_mounted_fs"; then
432 AC_MSG_WARN([could not determine how to read list of mounted fs])
434 AC_DEFINE(HAVE_INFOMOUNT_LIST, 1,
435 [Define if the list of mounted filesystems can be determined])
438 dnl This configure.in code has been stolen from GNU fileutils-3.12. Its
439 dnl job is to detect a method to get file system information.
441 AC_MSG_NOTICE([checking how to get filesystem space usage])
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
448 AC_CHECK_FUNCS(statvfs)
449 if test $ac_cv_func_statvfs = yes; then
451 AC_DEFINE(STAT_STATVFS, 1,
452 [Define if function `statfs' can be used])
456 if test $space = no; then
457 # DEC Alpha running OSF/1
458 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
459 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
461 #include <sys/param.h>
462 #include <sys/types.h>
463 #include <sys/mount.h>
468 exit (statfs (".", &fsd, sizeof (struct statfs)));
470 fu_cv_sys_stat_statfs3_osf1=yes,
471 fu_cv_sys_stat_statfs3_osf1=no,
472 fu_cv_sys_stat_statfs3_osf1=no)])
473 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
474 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
476 AC_DEFINE(STAT_STATFS3_OSF1, 1,
477 [Define if function `statfs' takes 3 arguments])
481 if test $space = no; then
483 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)])
484 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
486 #ifdef HAVE_SYS_PARAM_H
487 #include <sys/param.h>
489 #ifdef HAVE_SYS_MOUNT_H
490 #include <sys/mount.h>
492 #ifdef HAVE_SYS_VFS_H
499 exit (statfs (".", &fsd));
501 fu_cv_sys_stat_statfs2_bsize=yes,
502 fu_cv_sys_stat_statfs2_bsize=no,
503 fu_cv_sys_stat_statfs2_bsize=no)])
504 AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_bsize])
505 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
507 AC_DEFINE(STAT_STATFS2_BSIZE, 1,
508 [Define if function `statfs' takes two arguments and
509 `bsize' is member of `struct statfs'])
513 if test $space = no; then
515 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
516 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
517 [AC_TRY_RUN([#include <sys/types.h>
518 #include <sys/statfs.h>
522 exit (statfs (".", &fsd, sizeof fsd, 0));
524 fu_cv_sys_stat_statfs4=yes,
525 fu_cv_sys_stat_statfs4=no,
526 fu_cv_sys_stat_statfs4=no)])
527 AC_MSG_RESULT([$fu_cv_sys_stat_statfs4])
528 if test $fu_cv_sys_stat_statfs4 = yes; then
530 AC_DEFINE(STAT_STATFS4, 1,
531 [Define if function `statfs' takes 4 arguments])
535 if test $space = no; then
537 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
538 member (4.4BSD and NetBSD)])
539 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
540 [AC_TRY_RUN([#include <sys/types.h>
541 #ifdef HAVE_SYS_PARAM_H
542 #include <sys/param.h>
544 #ifdef HAVE_SYS_MOUNT_H
545 #include <sys/mount.h>
551 exit (statfs (".", &fsd));
553 fu_cv_sys_stat_statfs2_fsize=yes,
554 fu_cv_sys_stat_statfs2_fsize=no,
555 fu_cv_sys_stat_statfs2_fsize=no)])
556 AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_fsize])
557 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
559 AC_DEFINE(STAT_STATFS2_FSIZE, 1,
560 [Define if function `statfs' takes two arguments and
561 `fsize' is member of `struct statfs'])
565 if test $space = no; then
567 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
568 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
570 #include <sys/types.h>
571 #ifdef HAVE_SYS_PARAM_H
572 #include <sys/param.h>
574 #ifdef HAVE_SYS_MOUNT_H
575 #include <sys/mount.h>
577 #ifdef HAVE_SYS_FS_TYPES_H
578 #include <sys/fs_types.h>
583 /* Ultrix's statfs returns 1 for success,
584 0 for not mounted, -1 for failure. */
585 exit (statfs (".", &fsd) != 1);
587 fu_cv_sys_stat_fs_data=yes,
588 fu_cv_sys_stat_fs_data=no,
589 fu_cv_sys_stat_fs_data=no)])
590 AC_MSG_RESULT([$fu_cv_sys_stat_fs_data])
591 if test $fu_cv_sys_stat_fs_data = yes; then
593 AC_DEFINE(STAT_STATFS2_FS_DATA, 1,
594 [Define if function `statfs' takes two arguments
595 and uses `struct fs_data'])
600 dnl if test $space = no; then
602 dnl AC_TRY_CPP([#include <sys/filsys.h>],
603 dnl AC_DEFINE(STAT_READ_FILSYS) space=yes)
609 dnl Try using termcap database and link with libtermcap if possible.
611 AC_DEFUN([MC_USE_TERMCAP], [
612 screen_msg="$screen_msg with termcap database"
613 AC_MSG_NOTICE([using S-Lang screen manager with termcap])
614 AC_DEFINE(USE_TERMCAP, 1, [Define to use termcap database])
615 AC_CHECK_LIB(termcap, tgoto, [MCLIBS="$MCLIBS -ltermcap"], , [$LIBS])
620 dnl Common code for MC_WITH_SLANG and MC_WITH_MCSLANG
622 dnl We check for the existance of setupterm on curses library
623 dnl this is required to load certain definitions on some termcaps
624 dnl editions (AIX and OSF/1 I seem to remember).
625 dnl Note that we avoid using setupterm
627 AC_DEFUN([_MC_WITH_XSLANG], [
629 AC_DEFINE(HAVE_SLANG, 1,
630 [Define to use S-Lang library for screen management])
636 AC_CHECK_LIB(curses,setupterm,
640 [return (key_end == parm_insert_line);],
641 [MCLIBS="$MCLIBS -lcurses"
642 AC_DEFINE(USE_SETUPTERM, 1,
643 [Define to use function `setupterm'
644 from `curses' library in S-Lang])])
652 dnl Check if the system S-Lang library can be used.
653 dnl If not, and $1 is "strict", exit, otherwise fall back to mcslang.
655 AC_DEFUN([MC_WITH_SLANG], [
657 AC_CHECK_LIB([slang], [SLang_init_tty], [MCLIBS="$MCLIBS -lslang"],
658 [with_screen=mcslang])
661 if test x$with_screen = xslang; then
663 AC_CHECK_HEADERS([slang.h slang/slang.h],
664 [slang_h_found=yes; break])
666 if test -z "$slang_h_found"; then
671 dnl Check if the installed S-Lang library uses termcap
672 if test x$with_screen = xslang; then
674 screen_msg="S-Lang library (installed on the system)"
675 AC_DEFINE(HAVE_SYSTEM_SLANG, 1,
676 [Define to use S-Lang library installed on the system])
680 #ifdef HAVE_SLANG_SLANG_H
681 #include <slang/slang.h>
685 [SLtt_get_terminfo();
687 [LIBS="$ac_save_LIBS"],
688 [LIBS="$ac_save_LIBS"; MC_USE_TERMCAP])
692 [if test $with_screen != slang; then
693 AC_MSG_ERROR([S-Lang library not found])
702 dnl Use the included S-Lang library.
704 AC_DEFUN([MC_WITH_MCSLANG], [
706 screen_msg="Included S-Lang library (mcslang)"
712 dnl Use the ncurses library. It can only be requested explicitly,
713 dnl so just fail if anything goes wrong.
715 dnl If ncurses exports the ESCDELAY variable it should be set to 0
716 dnl or you'll have to press Esc three times to dismiss a dialog box.
718 AC_DEFUN([MC_WITH_NCURSES], [
719 dnl has_colors() is specific to ncurses, it's not in the old curses
720 AC_CHECK_LIB([ncurses], [has_colors], [MCLIBS="$MCLIBS -lncurses"],
721 [AC_MSG_ERROR([Could not find ncurses library])])
725 AC_CHECK_HEADERS([ncurses/curses.h ncurses.h curses.h],
726 [ncurses_h_found=yes; break])
728 if test -z "$ncurses_h_found"; then
729 AC_MSG_ERROR([Could not find ncurses header file])
733 screen_msg="ncurses library"
734 AC_DEFINE(USE_NCURSES, 1,
735 [Define to use ncurses for screen management])
738 LIBS="$LIBS -lncurses"
739 AC_CACHE_CHECK([for ESCDELAY variable],
740 [mc_cv_ncurses_escdelay],
741 [AC_TRY_COMPILE([], [
748 [mc_cv_ncurses_escdelay=yes],
749 [mc_cv_ncurses_escdelay=no])
751 if test "$mc_cv_ncurses_escdelay" = yes; then
752 AC_DEFINE(HAVE_ESCDELAY, 1,
753 [Define if ncurses has ESCDELAY variable])
756 AC_CHECK_FUNCS(resizeterm)
762 dnl Check for ext2fs recovery code
764 AC_DEFUN([AC_EXT2_UNDEL], [
766 if test "$ext2fs_undel" = yes; then
767 AC_MSG_NOTICE([using ext2fs file recovery code])
768 vfs_flags="${vfs_flags}, undelfs"
770 MCLIBS="$MCLIBS $EXT2FS_UNDEL_LIBS"
772 AC_MSG_NOTICE([not using ext2fs file recovery code])
776 dnl The next line is for compatibility with gettext 0.10.x
777 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])