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([ext2fs/ext2_fs.h linux/ext2_fs.h], [ext2_fs_h=yes; break])
11 if test x$ext2_fs_h = xyes; then
12 AC_CHECK_HEADERS([ext2fs/ext2fs.h], [ext2fs_ext2fs_h=yes], ,
15 #ifdef HAVE_EXT2FS_EXT2_FS_H
16 #include <ext2fs/ext2_fs.h>
19 #include <linux/ext2_fs.h>
22 if test x$ext2fs_ext2fs_h = xyes; then
23 AC_DEFINE(USE_EXT2FSLIB, 1,
24 [Define to enable undelete support on ext2])
26 EXT2FS_UNDEL_LIBS="-lext2fs -lcom_err"
27 AC_CHECK_TYPE(ext2_ino_t, ,
28 [AC_DEFINE(ext2_ino_t, ino_t,
29 [Define to ino_t if undefined.])],
35 #ifdef HAVE_EXT2FS_EXT2_FS_H
36 #include <ext2fs/ext2_fs.h>
39 #include <linux/ext2_fs.h>
41 #include <ext2fs/ext2fs.h>
50 dnl Check for tools used in extfs scripts.
51 AC_DEFUN([MC_EXTFS_CHECKS], [
52 AC_PATH_PROG([ZIP], [zip], [/usr/bin/zip])
53 AC_PATH_PROG([UNZIP], [unzip], [/usr/bin/unzip])
54 AC_CACHE_CHECK([for zipinfo code in unzip], [mc_cv_have_zipinfo],
55 [mc_cv_have_zipinfo=no
56 if $UNZIP -Z </dev/null >/dev/null 2>&1; then
57 mc_cv_have_zipinfo=yes
59 if test "x$mc_cv_have_zipinfo" = xyes; then
64 AC_SUBST([HAVE_ZIPINFO])
65 AC_PATH_PROG([PERL], [perl], [/usr/bin/perl])
70 dnl MC_MCSERVER_CHECKS
71 dnl Check how mcserver should check passwords.
72 dnl Possible methods are PAM, pwdauth and crypt.
73 dnl The later works with both /etc/shadow and /etc/passwd.
74 dnl If PAM is found, other methods are not checked.
76 AC_DEFUN([MC_MCSERVER_CHECKS], [
78 dnl Check if PAM can be used for mcserv
79 AC_CHECK_LIB(dl, dlopen, [LIB_DL="-ldl"])
80 AC_CHECK_LIB(pam, pam_start, [
81 AC_DEFINE(HAVE_PAM, 1,
82 [Define if PAM (Pluggable Authentication Modules) is available])
83 MCSERVLIBS="-lpam $LIB_DL"
84 mcserv_pam=yes], [], [$LIB_DL])
86 dnl Check for crypt() - needed for both /etc/shadow and /etc/passwd.
87 if test -z "$mcserv_pam"; then
89 dnl Check for pwdauth() - used on SunOS.
90 AC_CHECK_FUNCS([pwdauth])
93 AC_CHECK_HEADERS([crypt.h], [crypt_header=yes])
94 if test -n "$crypt_header"; then
97 AC_SEARCH_LIBS(crypt, [crypt crypt_i], [mcserv_auth=crypt])
100 if test -n "$mcserv_auth"; then
101 AC_DEFINE(HAVE_CRYPT, 1,
102 [Define to use crypt function in mcserv])
104 dnl Check for shadow passwords
105 AC_CHECK_HEADERS([shadow.h shadow/shadow.h],
106 [shadow_header=yes; break])
107 if test -n "$shadow_header"; then
110 AC_SEARCH_LIBS(getspnam, [shadow], [mcserv_auth=shadow])
113 if test -n "$mcserv_auth"; then
114 AC_DEFINE(HAVE_SHADOW, 1,
115 [Define to use shadow passwords for mcserv])
128 dnl Check for various functions needed by libvfs.
129 dnl This has various effects:
130 dnl Sets MC_VFS_LIBS to libraries required
131 dnl Sets vfs_flags to "pretty" list of vfs implementations we include.
132 dnl Sets shell variable use_vfs to yes (default, --with-vfs) or
133 dnl "no" (--without-vfs).
136 AC_DEFUN([MC_WITH_VFS],[
139 vfs_flags="cpiofs, extfs, tarfs"
142 AC_ARG_ENABLE([netcode],
143 [ --enable-netcode Support for networking [[yes]]])
145 if test "x$enable_netcode" != xno; then
146 dnl FIXME: network checks should probably be in their own macro.
147 AC_SEARCH_LIBS(socket, [xnet bsd socket inet], [have_socket=yes])
148 if test x$have_socket = xyes; then
149 AC_SEARCH_LIBS(gethostbyname, [bsd socket inet netinet])
150 AC_CHECK_MEMBERS([struct linger.l_linger], , , [
151 #include <sys/types.h>
152 #include <sys/socket.h>
154 AC_CHECK_FUNCS(pmap_set, , [
155 AC_CHECK_LIB(rpc, pmap_set, [
157 AC_DEFINE(HAVE_PMAP_SET)
159 AC_CHECK_FUNCS(pmap_getport pmap_getmaps rresvport)
160 dnl add for source routing support setsockopt
161 AC_CHECK_HEADERS(rpc/pmap_clnt.h, , , [
162 #include <sys/types.h>
163 #include <sys/socket.h>
164 #include <netinet/in.h>
166 #include <rpc/pmap_prot.h>
172 [ --with-mcfs Support mc-specific networking file system [[no]]],
173 [if test "x$withval" != "xno"; then
174 AC_DEFINE(WITH_MCFS, 1, [Define to enable mc-specific networking file system])
175 vfs_flags="$vfs_flags, mcfs"
180 vfs_flags="$vfs_flags, ftpfs, fish"
190 [ --with-samba Support smb virtual file system [[no]]],
191 [if test "x$withval" != "xno"; then
192 AC_DEFINE(WITH_SMBFS, 1, [Define to enable VFS over SMB])
193 vfs_flags="$vfs_flags, smbfs"
198 if test -n "$use_smbfs"; then
199 #################################################
200 # set Samba configuration directory location
202 AC_ARG_WITH(configdir,
203 [ --with-configdir=DIR Where the Samba configuration files are [[/etc]]],
207 # Just in case anybody does it
209 AC_MSG_WARN([--with-configdir called without argument - will use default])
218 AC_ARG_WITH(codepagedir,
219 [ --with-codepagedir=DIR Where the Samba codepage files are],
223 # Just in case anybody does it
225 AC_MSG_WARN([--with-codepagedir called without argument - will use default])
232 dnl Ext2fs undelete support
234 AC_ARG_WITH(ext2undel,
235 [ --with-ext2undel Compile with ext2 undelete code [[yes if found]]],
236 [if test x$withval != xno; then
237 if test x$withval != xyes; then
238 LDFLAGS="$LDFLAGS -L$withval/lib"
239 CPPFLAGS="$CPPFLAGS -I$withval/include"
244 AC_CHECK_LIB(ext2fs, ext2fs_close, [AC_EXT2_UNDEL], , [-lcom_err])
247 AC_DEFINE(USE_VFS, 1, [Define to enable VFS support])
248 if $use_net_code; then
249 AC_DEFINE(USE_NETCODE, 1, [Define to use networked VFS])
255 AC_DEFUN([MC_VFS_CHECKS],[
258 [ --with-vfs Compile with the VFS code [[yes]]],
265 dnl Should we issue a warning?
272 dnl Filesystem information detection
274 dnl To get information about the disk, mount points, etc.
277 AC_DEFUN([AC_GET_FS_INFO], [
278 AC_CHECK_HEADERS([fcntl.h utime.h])
280 gl_LIST_MOUNTED_FILE_SYSTEMS([
281 AC_DEFINE(HAVE_INFOMOUNT_LIST, 1,
282 [Define if the list of mounted filesystems can be determined])],
283 [AC_MSG_WARN([could not determine how to read list of mounted fs])])
291 dnl Try using termcap database and link with libtermcap if possible.
293 AC_DEFUN([MC_USE_TERMCAP], [
294 screen_msg="$screen_msg with termcap database"
295 AC_MSG_NOTICE([using S-Lang screen library with termcap])
296 AC_DEFINE(USE_TERMCAP, 1, [Define to use termcap database])
297 AC_CHECK_LIB(termcap, tgoto, [MCLIBS="$MCLIBS -ltermcap"], , [$LIBS])
302 dnl Check if the installed S-Lang library uses termcap
304 AC_DEFUN([MC_SLANG_TERMCAP], [
305 AC_CACHE_CHECK([if S-Lang uses termcap], [mc_cv_slang_termcap], [
309 #ifdef HAVE_SLANG_SLANG_H
310 #include <slang/slang.h>
315 [SLtt_get_terminfo(); SLtt_tgetflag("");],
316 [mc_cv_slang_termcap=no],
317 [mc_cv_slang_termcap=yes])
321 if test x$mc_cv_slang_termcap = xyes; then
327 dnl Common code for MC_WITH_SLANG and MC_WITH_MCSLANG
329 AC_DEFUN([_MC_WITH_XSLANG], [
331 AC_DEFINE(HAVE_SLANG, 1,
332 [Define to use S-Lang library for screen management])
337 dnl Check if the system S-Lang library can be used.
338 dnl If not, and $1 is "strict", exit, otherwise fall back to mcslang.
340 AC_DEFUN([MC_WITH_SLANG], [
345 AC_CHECK_HEADERS([slang.h slang/slang.h],
346 [slang_h_found=yes; break])
347 if test -z "$slang_h_found"; then
351 dnl Check if termcap is needed.
352 dnl This check must be done before anything is linked against S-Lang.
353 if test x$with_screen = xslang; then
357 dnl Check the library
358 if test x$with_screen = xslang; then
359 AC_CHECK_LIB([slang], [SLang_init_tty], [MCLIBS="$MCLIBS -lslang"],
360 [with_screen=mcslang], ["$MCLIBS"])
363 dnl Unless external S-Lang was requested, reject S-Lang with UTF-8 hacks
364 if test x$with_screen = xslang; then
366 m4_if([$1], strict, ,
367 [AC_CHECK_LIB([slang], [SLsmg_write_nwchars],
368 [AC_MSG_WARN([Rejecting S-Lang with UTF-8 support, \
369 it's not fully supported yet])
370 with_screen=mcslang])])
373 if test x$with_screen = xslang; then
374 AC_DEFINE(HAVE_SYSTEM_SLANG, 1,
375 [Define to use S-Lang library installed on the system])
377 screen_msg="S-Lang library (installed on the system)"
380 [if test $with_screen != slang; then
381 AC_MSG_ERROR([S-Lang library not found])
392 dnl Use the included S-Lang library.
394 AC_DEFUN([MC_WITH_MCSLANG], [
396 screen_msg="Included S-Lang library (mcslang)"
398 dnl Type checks from S-Lang sources
399 AC_CHECK_SIZEOF(short, 2)
400 AC_CHECK_SIZEOF(int, 4)
401 AC_CHECK_SIZEOF(long, 4)
402 AC_CHECK_SIZEOF(float, 4)
403 AC_CHECK_SIZEOF(double, 8)
405 AC_CHECK_SIZEOF(off_t)
406 AC_CHECK_TYPES(long long)
407 AC_CHECK_SIZEOF(long long)
408 AC_CHECK_FUNCS(atexit on_exit)
410 # Search for terminfo database.
412 if test x"$with_termcap" != xyes; then
413 if test x"$with_termcap" = xno; then
416 if test -n "$TERMINFO" && test -r "$TERMINFO/v/vt100"; then
419 for dir in "/usr/share/terminfo" "/usr/lib/terminfo" \
420 "/usr/share/lib/terminfo" "/etc/terminfo" \
421 "/usr/local/lib/terminfo" "$HOME/.terminfo"; do
422 if test -r "$dir/v/vt100"; then
428 # If there is no terminfo, use termcap
429 if test -z "$use_terminfo"; then
438 dnl Use the ncurses library. It can only be requested explicitly,
439 dnl so just fail if anything goes wrong.
441 dnl If ncurses exports the ESCDELAY variable it should be set to 0
442 dnl or you'll have to press Esc three times to dismiss a dialog box.
444 AC_DEFUN([MC_WITH_NCURSES], [
445 dnl has_colors() is specific to ncurses, it's not in the old curses
448 AC_SEARCH_LIBS([has_colors], [ncurses curses], [MCLIBS="$MCLIBS $LIBS"],
449 [AC_MSG_ERROR([Cannot find ncurses library])])
453 AC_CHECK_HEADERS([ncurses/curses.h ncurses.h curses.h],
454 [ncurses_h_found=yes; break])
456 if test -z "$ncurses_h_found"; then
457 AC_MSG_ERROR([Cannot find ncurses header file])
461 screen_msg="ncurses library"
462 AC_DEFINE(USE_NCURSES, 1,
463 [Define to use ncurses for screen management])
465 AC_CACHE_CHECK([for ESCDELAY variable],
466 [mc_cv_ncurses_escdelay],
471 [mc_cv_ncurses_escdelay=yes],
472 [mc_cv_ncurses_escdelay=no])
474 if test "$mc_cv_ncurses_escdelay" = yes; then
475 AC_DEFINE(HAVE_ESCDELAY, 1,
476 [Define if ncurses has ESCDELAY variable])
479 AC_CHECK_FUNCS(resizeterm)
485 dnl Check for ext2fs recovery code
487 AC_DEFUN([AC_EXT2_UNDEL], [
489 if test "$ext2fs_undel" = yes; then
490 AC_MSG_NOTICE([using ext2fs file recovery code])
491 vfs_flags="${vfs_flags}, undelfs"
493 MCLIBS="$MCLIBS $EXT2FS_UNDEL_LIBS"
495 AC_MSG_NOTICE([not using ext2fs file recovery code])
500 dnl Check whether the g_module_* family of functions works
501 dnl on this system. We need to know that at the compile time to
502 dnl decide whether to link with X11.
504 AC_DEFUN([AC_G_MODULE_SUPPORTED], [
505 AC_CACHE_CHECK([if gmodule functionality is supported], mc_cv_g_module_supported, [
506 ac_save_CFLAGS="$CFLAGS"
508 CFLAGS="$CFLAGS $GMODULE_CFLAGS"
509 LIBS="$GMODULE_LIBS $LIBS"
515 int ret = (g_module_supported () == TRUE) ? 0 : 1;
519 [mc_cv_g_module_supported=yes],
520 [mc_cv_g_module_supported=no],
521 [mc_cv_g_module_supported=no]
523 CFLAGS="$ac_save_CFLAGS"
527 if test "$mc_cv_g_module_supported" = yes; then
528 AC_DEFINE(HAVE_GMODULE, 1,
529 [Define if gmodule functionality is supported])