some little trimming and a string untranslated left...
[midnight-commander.git] / acinclude.m4
blob32e14bd8252b9b17272b1b1cef3ba4eb735675cc
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.
7 AC_DEFUN([MC_UNDELFS_CHECKS], [
8   ext2fs_undel=no
9   EXT2FS_UNDEL_LIBS=
10   AC_CHECK_HEADERS(linux/ext2_fs.h)
11   if test x$ac_cv_header_linux_ext2_fs_h = xyes
12   then
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
16     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                     [#include <errno.h>
25 #include <stdio.h>
26 #include <fcntl.h>
27 #include <stdlib.h>
28 /* asm/types.h defines its own umode_t :-( */
29 #undef umode_t
30 #include <linux/ext2_fs.h>
31 #include <ext2fs/ext2fs.h>])
32     fi
33   fi
38 dnl MC_VFS_CHECKS
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".
47 dnl Private define
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)
53   have_socket=no
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], [
59           LIBS="$LIBS -l$lib"
60           have_socket=yes
61           AC_DEFINE(HAVE_SOCKET)
62           break])
63     done
64   fi
66   have_gethostbyname=no
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])
73     done
74   fi
76   vfs_flags="tarfs"
77   use_net_code=false
78   if test $have_socket = yes; then
79       AC_STRUCT_LINGER
80       AC_CHECK_FUNCS(pmap_set, , [
81          AC_CHECK_LIB(rpc, pmap_set, [
82            LIBS="-lrpc $LIBS"
83           AC_DEFINE(HAVE_PMAP_SET)
84           ])])
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>
91 #include <rpc/rpc.h>
92 #include <rpc/pmap_prot.h>
93                                             ])
94       dnl
95       dnl mcfs support
96       dnl
97       AC_ARG_WITH(mcfs,
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"
102             use_mcfs=yes
103         fi]
104       )
105       vfs_flags="$vfs_flags, ftpfs, fish"
106       use_net_code=true
107   fi
109   dnl
110   dnl Samba support
111   dnl
112   use_smbfs=
113   AC_ARG_WITH(samba,
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"
118                   use_smbfs=yes
119           fi
120   ])
122   if test -n "$use_smbfs"; then
123   #################################################
124   # set Samba configuration directory location
125   configdir="/etc"
126   AC_ARG_WITH(configdir,
127   [  --with-configdir=DIR     Where the Samba configuration files are [[/etc]]],
128   [ case "$withval" in
129     yes|no)
130     #
131     # Just in case anybody does it
132     #
133         AC_MSG_WARN([--with-configdir called without argument - will use default])
134     ;;
135     * )
136         configdir="$withval"
137     ;;
138   esac]
139   )
140   AC_SUBST(configdir)
142   AC_ARG_WITH(codepagedir,
143     [  --with-codepagedir=DIR   Where the Samba codepage files are],
144     [ case "$withval" in
145       yes|no)
146       #
147       # Just in case anybody does it
148       #
149         AC_MSG_WARN([--with-codepagedir called without argument - will use default])
150       ;;
151     esac]
152   )
153   fi
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])
158   fi
159   mcserv=
160   if test $have_socket = yes; then
161      mcserv="mcserv"
162   fi
164   AC_SUBST(mcserv)
166 dnl FIXME:
167 dnl MC_VFS_LIBS=
173 AC_DEFUN([MC_VFS_CHECKS],[
174         use_vfs=yes
175         AC_ARG_WITH(vfs,
176                 [  --with-vfs               Compile with the VFS code [[yes]]],
177                 use_vfs=$withval
178         )
179         case $use_vfs in
180                 yes)    MC_WITH_VFS;;
181                 no)     use_vfs=no;;
182                 *)      use_vfs=no;;
183                         dnl Should we issue a warning?
184         esac
190 dnl Check for struct linger
192 AC_DEFUN([AC_STRUCT_LINGER], [
193 av_struct_linger=no
194 AC_MSG_CHECKING([struct linger is available])
195 AC_TRY_RUN([
196 #include <sys/types.h>
197 #include <sys/socket.h>
199 struct linger li;
201 int main ()
203     li.l_onoff = 1;
204     li.l_linger = 120;
205     return 0;
208 AC_DEFINE(HAVE_STRUCT_LINGER, 1,
209           [Define if `struct linger' is available])
210 av_struct_linger=yes
212 av_struct_linger=no
214 av_struct_linger=no
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>
233                                       ])
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,
241     [AC_TRY_LINK([
242 #include <sys/types.h>
243 #ifdef HAVE_DIRENT_H
244 # include <dirent.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 */
253 # ifdef HAVE_NDIR_H
254 #  include <ndir.h>
255 # endif /* HAVE_NDIR_H */
256 #endif /* HAVE_DIRENT_H */
257     ],
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'])
265     fi
267     # Determine how to get the list of mounted filesystems.
268     list_mounted_fs=
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).
272     AC_FUNC_GETMNTENT
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
280         # SVR4
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])
291         fi
292       fi
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])
306         fi
307       fi
309     fi
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,
315       [AC_TRY_LINK([
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])
328       fi
329     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
346     if test -z "$list_mounted_fs"; then
347       # SVR3
348       AC_MSG_CHECKING([for existence of three headers])
349       AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
350         [AC_TRY_CPP([
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])
362       fi
363     fi
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,
369         [
370           ok=
371           if test $ac_cv_func_getmntinfo = yes; then
372             AC_EGREP_HEADER(f_type;, sys/mount.h,
373                             ok=yes)
374           fi
375           test -n "$ok" \
376               && fu_cv_sys_mounted_getmntinfo=yes \
377               || fu_cv_sys_mounted_getmntinfo=no
378         ])
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],
387                            [sys/mount.h],
388                            [fu_cv_sys_mounted_f_fstypename=yes],
389                            [fu_cv_sys_mounted_f_fstypename=no])
390           ])
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'])
395         fi
396       fi
397     fi
399     if test -z "$list_mounted_fs"; then
400       # Ultrix
401       AC_MSG_CHECKING([for getmnt function])
402       AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
403         [AC_TRY_CPP([
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])
413       fi
414     fi
416     if test -z "$list_mounted_fs"; then
417       # SVR2
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])
428       fi
429     fi
431     if test -z "$list_mounted_fs"; then
432       AC_MSG_WARN([could not determine how to read list of mounted fs])
433     else
434       AC_DEFINE(HAVE_INFOMOUNT_LIST, 1,
435                 [Define if the list of mounted filesystems can be determined])
436     fi
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])
442     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
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,
460       [AC_TRY_RUN([
461 #include <sys/param.h>
462 #include <sys/types.h>
463 #include <sys/mount.h>
464       main ()
465       {
466         struct statfs fsd;
467         fsd.f_fsize = 0;
468         exit (statfs (".", &fsd, sizeof (struct statfs)));
469       }],
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
475         space=yes
476         AC_DEFINE(STAT_STATFS3_OSF1, 1,
477                   [Define if function `statfs' takes 3 arguments])
478       fi
479     fi
481     if test $space = no; then
482     # AIX
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,
485       [AC_TRY_RUN([
486 #ifdef HAVE_SYS_PARAM_H
487 #include <sys/param.h>
488 #endif
489 #ifdef HAVE_SYS_MOUNT_H
490 #include <sys/mount.h>
491 #endif
492 #ifdef HAVE_SYS_VFS_H
493 #include <sys/vfs.h>
494 #endif
495       main ()
496       {
497       struct statfs fsd;
498       fsd.f_bsize = 0;
499       exit (statfs (".", &fsd));
500       }],
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
506         space=yes
507         AC_DEFINE(STAT_STATFS2_BSIZE, 1,
508                   [Define if function `statfs' takes two arguments and
509 `bsize' is member of `struct statfs'])
510       fi
511     fi
513     if test $space = no; then
514     # SVR3
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>
519       main ()
520       {
521       struct statfs fsd;
522       exit (statfs (".", &fsd, sizeof fsd, 0));
523       }],
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
529         space=yes
530         AC_DEFINE(STAT_STATFS4, 1,
531                   [Define if function `statfs' takes 4 arguments])
532       fi
533     fi
535     if test $space = no; then
536     # 4.4BSD and NetBSD
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>
543 #endif
544 #ifdef HAVE_SYS_MOUNT_H
545 #include <sys/mount.h>
546 #endif
547       main ()
548       {
549       struct statfs fsd;
550       fsd.f_fsize = 0;
551       exit (statfs (".", &fsd));
552       }],
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
558         space=yes
559         AC_DEFINE(STAT_STATFS2_FSIZE, 1,
560                   [Define if function `statfs' takes two arguments and
561 `fsize' is member of `struct statfs'])
562       fi
563     fi
565     if test $space = no; then
566       # Ultrix
567       AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
568       AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
569       [AC_TRY_RUN([
570 #include <sys/types.h>
571 #ifdef HAVE_SYS_PARAM_H
572 #include <sys/param.h>
573 #endif
574 #ifdef HAVE_SYS_MOUNT_H
575 #include <sys/mount.h>
576 #endif
577 #ifdef HAVE_SYS_FS_TYPES_H
578 #include <sys/fs_types.h>
579 #endif
580       main ()
581       {
582       struct fs_data fsd;
583       /* Ultrix's statfs returns 1 for success,
584          0 for not mounted, -1 for failure.  */
585       exit (statfs (".", &fsd) != 1);
586       }],
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
592         space=yes
593         AC_DEFINE(STAT_STATFS2_FS_DATA, 1,
594                   [Define if function `statfs' takes two arguments
595 and uses `struct fs_data'])
596       fi
597     fi
599     dnl Not supported
600     dnl if test $space = no; then
601     dnl # SVR2
602     dnl AC_TRY_CPP([#include <sys/filsys.h>],
603     dnl   AC_DEFINE(STAT_READ_FILSYS) space=yes)
604     dnl fi
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], [
628     screen_type=slang
629     AC_DEFINE(HAVE_SLANG, 1,
630               [Define to use S-Lang library for screen management])
632     case $host_os in
633     linux*)
634         ;;
635     *)
636         AC_CHECK_LIB(curses,setupterm,
637                      [AC_TRY_COMPILE([
638 #include <curses.h>
639 #include <term.h>],
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])])
645         ])
646         ;;
647     esac
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], [
656     with_screen=slang
657     AC_CHECK_LIB([slang], [SLang_init_tty], [MCLIBS="$MCLIBS -lslang"],
658                  [with_screen=mcslang])
660     dnl Check the header
661     if test x$with_screen = xslang; then
662         slang_h_found=
663         AC_CHECK_HEADERS([slang.h slang/slang.h],
664                          [slang_h_found=yes; break])
666         if test -z "$slang_h_found"; then
667             with_screen=mcslang
668         fi
669     fi
671     dnl Check if the installed S-Lang library uses termcap
672     if test x$with_screen = xslang; then
673         screen_type=slang
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])
677         ac_save_LIBS="$LIBS"
678         LIBS="$LIBS -lslang"
679         AC_TRY_LINK([ 
680         #ifdef HAVE_SLANG_SLANG_H
681         #include <slang/slang.h>
682         #else
683         #include <slang.h>
684         #endif],
685         [SLtt_get_terminfo();
686         SLtt_tgetflag("");], 
687         [LIBS="$ac_save_LIBS"],
688         [LIBS="$ac_save_LIBS"; MC_USE_TERMCAP])
689         _MC_WITH_XSLANG
690     else
691         m4_if([$1], strict,
692             [if test $with_screen != slang; then
693                 AC_MSG_ERROR([S-Lang library not found])
694             fi],
695             [MC_WITH_MCSLANG]
696         )
697     fi
702 dnl Use the included S-Lang library.
704 AC_DEFUN([MC_WITH_MCSLANG], [
705     screen_type=slang
706     screen_msg="Included S-Lang library (mcslang)"
707     _MC_WITH_XSLANG
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])])
723     dnl Check the header
724     ncurses_h_found=
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])
730     fi
732     screen_type=ncurses
733     screen_msg="ncurses library"
734     AC_DEFINE(USE_NCURSES, 1,
735               [Define to use ncurses for screen management])
737     save_LIBS="$LIBS"
738     LIBS="$LIBS -lncurses"
739     AC_CACHE_CHECK([for ESCDELAY variable],
740                    [mc_cv_ncurses_escdelay],
741                    [AC_TRY_COMPILE([], [
742                         extern int ESCDELAY;
743                         int main ()
744                         {
745                           ESCDELAY = 0;
746                         }
747                         ],
748                         [mc_cv_ncurses_escdelay=yes],
749                         [mc_cv_ncurses_escdelay=no])
750     ])
751     if test "$mc_cv_ncurses_escdelay" = yes; then
752         AC_DEFINE(HAVE_ESCDELAY, 1,
753                   [Define if ncurses has ESCDELAY variable])
754     fi
756     AC_CHECK_FUNCS(resizeterm)
757     LIBS="$save_LIBS"
762 dnl Check for ext2fs recovery code
764 AC_DEFUN([AC_EXT2_UNDEL], [
765   MC_UNDELFS_CHECKS
766   if test "$ext2fs_undel" = yes; then
767      AC_MSG_NOTICE([using ext2fs file recovery code])
768      vfs_flags="${vfs_flags}, undelfs"
769      use_undelfs=yes
770      MCLIBS="$MCLIBS $EXT2FS_UNDEL_LIBS"
771   else
772      AC_MSG_NOTICE([not using ext2fs file recovery code])
773   fi
776 dnl The next line is for compatibility with gettext 0.10.x
777 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])