*** empty log message ***
[midnight-commander.git] / acinclude.m4
blob455a41371c70405be26c97956003c3fc6bf4da48
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 termnet  to true or false depending on whether it is required.
43 dnl        If yes, defines USE_TERMNET.
44 dnl     Sets vfs_flags to "pretty" list of vfs implementations we include.
45 dnl     Sets shell variable use_vfs to yes (default, --with-vfs) or
46 dnl        "no" (--without-vfs).
47 dnl     Calls AC_SUBST(mcserv), which is either empty or "mcserv".
49 dnl Private define
50 AC_DEFUN([MC_WITH_VFS],[
51   dnl FIXME: network checks should probably be in their own macro.
52   AC_CHECK_LIB(nsl, t_accept)
53   AC_CHECK_LIB(socket, socket)
55   have_socket=no
56   AC_CHECK_FUNCS(socket, have_socket=yes)
57   if test $have_socket = no; then
58     # socket is not in the default libraries.  See if it's in some other.
59     for lib in bsd socket inet; do
60       AC_CHECK_LIB([$lib], [socket], [
61           LIBS="$LIBS -l$lib"
62           have_socket=yes
63           AC_DEFINE(HAVE_SOCKET)
64           break])
65     done
66   fi
68   have_gethostbyname=no
69   AC_CHECK_FUNC(gethostbyname, have_gethostbyname=yes)
70   if test $have_gethostbyname = no; then
71     # gethostbyname is not in the default libraries.  See if it's in some other.
72     for lib in bsd socket inet; do
73       AC_CHECK_LIB([$lib], [gethostbyname],
74                    [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break])
75     done
76   fi
78   vfs_flags="tarfs"
79   use_net_code=false
80   if test $have_socket = yes; then
81       AC_STRUCT_LINGER
82       AC_CHECK_FUNCS(pmap_set, , [
83          AC_CHECK_LIB(rpc, pmap_set, [
84            LIBS="-lrpc $LIBS"
85           AC_DEFINE(HAVE_PMAP_SET)
86           ])])
87       AC_CHECK_FUNCS(pmap_getport pmap_getmaps rresvport)
88       dnl add for source routing support setsockopt
89       AC_CHECK_HEADERS(rpc/pmap_clnt.h, , , [
90 #include <sys/types.h>
91 #include <sys/socket.h>
92 #include <netinet/in.h>
93 #include <rpc/rpc.h>
94 #include <rpc/pmap_prot.h>
95                                             ])
96       dnl
97       dnl mcfs support
98       dnl
99       AC_ARG_WITH(mcfs,
100           [--with-mcfs             Support mc-specific networking file system],[
101           if test "x$withval" != "xno"; then
102             AC_DEFINE(WITH_MCFS, 1, [Define to enable mc-specific networking file system])
103             vfs_flags="$vfs_flags, mcfs"
104           fi
105       ])
106       vfs_flags="$vfs_flags, ftpfs, fish"
107       use_net_code=true
108   fi
110   dnl
111   dnl Samba support
112   dnl
113   smbfs=""
114   SAMBAFILES=""
115   AC_ARG_WITH(samba,
116           [--with-samba            Support smb virtual file system],[
117           if test "x$withval" != "xno"; then
118                   AC_DEFINE(WITH_SMBFS, 1, [Define to enable VFS over SMB])
119                   vfs_flags="$vfs_flags, smbfs"
120                   smbfs="smbfs.o"
121                   SAMBAFILES="\$(SAMBAFILES)"
122           fi
123   ])
124   AC_SUBST(smbfs)
125   AC_SUBST(SAMBAFILES)
127   if test "x$smbfs" != x ; then
128   #################################################
129   # set Samba configuration directory location
130   configdir="/etc"
131   AC_ARG_WITH(configdir,
132   [  --with-configdir=DIR     Where the Samba configuration files are (/etc)],
133   [ case "$withval" in
134     yes|no)
135     #
136     # Just in case anybody does it
137     #
138         AC_MSG_WARN([--with-configdir called without argument - will use default])
139     ;;
140     * )
141         configdir="$withval"
142     ;;
143   esac]
144   )
145   AC_SUBST(configdir)
147   AC_ARG_WITH(codepagedir,
148     [  --with-codepagedir=DIR   Where the Samba codepage files are],
149     [ case "$withval" in
150       yes|no)
151       #
152       # Just in case anybody does it
153       #
154         AC_MSG_WARN([--with-codepagedir called without argument - will use default])
155       ;;
156     esac]
157   )
158   fi
160   dnl
161   dnl The termnet support
162   dnl
163   termnet=false
164   AC_ARG_WITH(termnet,
165           [--with-termnet             If you want a termified net support],[
166           if test x$withval = xyes; then
167                   AC_DEFINE(USE_TERMNET, 1,
168                             [Define to enable `term' firewall support])
169                   termnet=true          
170           fi
171   ])
173   TERMNET=""
174   AC_DEFINE(USE_VFS, 1, [Define to enable VFS support])
175   if $use_net_code; then
176      AC_DEFINE(USE_NETCODE, 1, [Define to use networked VFS])
177   fi
178   mcserv=
179   if test $have_socket = yes; then
180      mcserv="mcserv"
181      if $termnet; then
182         TERMNET="-ltermnet"
183      fi
184   fi
186   AC_SUBST(TERMNET)
187   AC_SUBST(mcserv)
189 dnl FIXME:
190 dnl MC_VFS_LIBS=
196 AC_DEFUN([MC_VFS_CHECKS],[
197         use_vfs=yes
198         AC_ARG_WITH(vfs,
199                 [--with-vfs                Compile with the VFS code],
200                 use_vfs=$withval
201         )
202         case $use_vfs in
203                 yes)    MC_WITH_VFS;;
204                 no)     use_vfs=no;;
205                 *)      use_vfs=no;;
206                         dnl Should we issue a warning?
207         esac
213 dnl Check for struct linger
215 AC_DEFUN([AC_STRUCT_LINGER], [
216 av_struct_linger=no
217 AC_MSG_CHECKING([struct linger is available])
218 AC_TRY_RUN([
219 #include <sys/types.h>
220 #include <sys/socket.h>
222 struct linger li;
224 int main ()
226     li.l_onoff = 1;
227     li.l_linger = 120;
228     return 0;
231 AC_DEFINE(HAVE_STRUCT_LINGER, 1,
232           [Define if `struct linger' is available])
233 av_struct_linger=yes
235 av_struct_linger=no
237 av_struct_linger=no
239 AC_MSG_RESULT([$av_struct_linger])
244 dnl Filesystem information detection
246 dnl To get information about the disk, mount points, etc.
249 AC_DEFUN([AC_GET_FS_INFO], [
250     AC_CHECK_HEADERS(fcntl.h sys/dustat.h sys/param.h sys/statfs.h sys/fstyp.h)
251     AC_CHECK_HEADERS(mnttab.h mntent.h utime.h sys/statvfs.h sys/vfs.h)
252     AC_CHECK_HEADERS(sys/filsys.h sys/fs_types.h)
253     AC_CHECK_HEADERS(sys/mount.h, , , [
254 #include <sys/param.h>
255 #include <sys/stat.h>
256                                       ])
257     AC_CHECK_FUNCS(getmntinfo)
259     dnl This configure.in code has been stolen from GNU fileutils-3.12.  Its
260     dnl job is to detect a method to get list of mounted filesystems.
262     AC_MSG_CHECKING([for d_ino member in directory struct])
263     AC_CACHE_VAL(fu_cv_sys_d_ino_in_dirent,
264     [AC_TRY_LINK([
265 #include <sys/types.h>
266 #ifdef HAVE_DIRENT_H
267 # include <dirent.h>
268 #else /* not HAVE_DIRENT_H */
269 # define dirent direct
270 # ifdef HAVE_SYS_NDIR_H
271 #  include <sys/ndir.h>
272 # endif /* HAVE_SYS_NDIR_H */
273 # ifdef HAVE_SYS_DIR_H
274 #  include <sys/dir.h>
275 # endif /* HAVE_SYS_DIR_H */
276 # ifdef HAVE_NDIR_H
277 #  include <ndir.h>
278 # endif /* HAVE_NDIR_H */
279 #endif /* HAVE_DIRENT_H */
280     ],
281       [struct dirent dp; dp.d_ino = 0;],
282         fu_cv_sys_d_ino_in_dirent=yes,
283         fu_cv_sys_d_ino_in_dirent=no)])
284     AC_MSG_RESULT([$fu_cv_sys_d_ino_in_dirent])
285     if test $fu_cv_sys_d_ino_in_dirent = yes; then
286       AC_DEFINE(D_INO_IN_DIRENT, 1,
287                 [Define if `d_ino' is member of `struct directory'])
288     fi
290     # Determine how to get the list of mounted filesystems.
291     list_mounted_fs=
293     # If the getmntent function is available but not in the standard library,
294     # make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX).
295     AC_FUNC_GETMNTENT
297     if test $ac_cv_func_getmntent = yes; then
299       # This system has the getmntent function.
300       # Determine whether it's the one-argument variant or the two-argument one.
302       if test -z "$list_mounted_fs"; then
303         # SVR4
304         AC_MSG_CHECKING([for two-argument getmntent function])
305         AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
306         [AC_EGREP_HEADER(getmntent, sys/mnttab.h,
307           fu_cv_sys_mounted_getmntent2=yes,
308           fu_cv_sys_mounted_getmntent2=no)])
309         AC_MSG_RESULT([$fu_cv_sys_mounted_getmntent2])
310         if test $fu_cv_sys_mounted_getmntent2 = yes; then
311           list_mounted_fs=found
312           AC_DEFINE(MOUNTED_GETMNTENT2, 1,
313                     [Define if function `getmntent' takes 2 arguments])
314         fi
315       fi
317       if test -z "$list_mounted_fs"; then
318         # 4.3BSD, SunOS, HP-UX, Dynix, Irix
319         AC_MSG_CHECKING([for one-argument getmntent function])
320         AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
321                      [test $ac_cv_header_mntent_h = yes \
322                        && fu_cv_sys_mounted_getmntent1=yes \
323                        || fu_cv_sys_mounted_getmntent1=no])
324         AC_MSG_RESULT([$fu_cv_sys_mounted_getmntent1])
325         if test $fu_cv_sys_mounted_getmntent1 = yes; then
326           list_mounted_fs=found
327           AC_DEFINE(MOUNTED_GETMNTENT1, 1,
328                     [Define if function `getmntent' takes 1 argument])
329         fi
330       fi
332     fi
334     if test -z "$list_mounted_fs"; then
335       # DEC Alpha running OSF/1.
336       AC_MSG_CHECKING([for getfsstat function])
337       AC_CACHE_VAL(fu_cv_sys_mounted_getsstat,
338       [AC_TRY_LINK([
339 #include <sys/types.h>
340 #include <sys/mount.h>
341 #include <sys/fs_types.h>],
342       [struct statfs *stats;
343       numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); ],
344         fu_cv_sys_mounted_getsstat=yes,
345         fu_cv_sys_mounted_getsstat=no)])
346       AC_MSG_RESULT([$fu_cv_sys_mounted_getsstat])
347       if test $fu_cv_sys_mounted_getsstat = yes; then
348         list_mounted_fs=found
349         AC_DEFINE(MOUNTED_GETFSSTAT, 1,
350                   [Define if function `getfsstat' can be used])
351       fi
352     fi
354     if test -z "$list_mounted_fs"; then
355       # AIX.
356       AC_MSG_CHECKING([for mntctl function and struct vmount])
357       AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
358       [AC_TRY_CPP([#include <fshelp.h>],
359         fu_cv_sys_mounted_vmount=yes,
360         fu_cv_sys_mounted_vmount=no)])
361       AC_MSG_RESULT([$fu_cv_sys_mounted_vmount])
362       if test $fu_cv_sys_mounted_vmount = yes; then
363         list_mounted_fs=found
364         AC_DEFINE(MOUNTED_VMOUNT, 1,
365                   [Define if function `mntctl' and `struct vmount' can be used])
366       fi
367     fi
369     if test -z "$list_mounted_fs"; then
370       # SVR3
371       AC_MSG_CHECKING([for existence of three headers])
372       AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
373         [AC_TRY_CPP([
374 #include <sys/statfs.h>
375 #include <sys/fstyp.h>
376 #include <mnttab.h>],
377                     fu_cv_sys_mounted_fread_fstyp=yes,
378                     fu_cv_sys_mounted_fread_fstyp=no)])
379       AC_MSG_RESULT([$fu_cv_sys_mounted_fread_fstyp])
380       if test $fu_cv_sys_mounted_fread_fstyp = yes; then
381         list_mounted_fs=found
382         AC_DEFINE(MOUNTED_FREAD_FSTYP, 1,
383                   [Define if sys/statfs.h, sys/fstyp.h and mnttab.h
384 can be used together])
385       fi
386     fi
388     if test -z "$list_mounted_fs"; then
389       # 4.4BSD and DEC OSF/1.
390       AC_MSG_CHECKING([for getmntinfo function])
391       AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
392         [
393           ok=
394           if test $ac_cv_func_getmntinfo = yes; then
395             AC_EGREP_HEADER(f_type;, sys/mount.h,
396                             ok=yes)
397           fi
398           test -n "$ok" \
399               && fu_cv_sys_mounted_getmntinfo=yes \
400               || fu_cv_sys_mounted_getmntinfo=no
401         ])
402       AC_MSG_RESULT([$fu_cv_sys_mounted_getmntinfo])
403       if test $fu_cv_sys_mounted_getmntinfo = yes; then
404         list_mounted_fs=found
405         AC_DEFINE(MOUNTED_GETMNTINFO, 1,
406                   [Define if `getmntinfo' function can be used])
407         AC_MSG_CHECKING([if struct statfs has f_fstypename])
408         AC_CACHE_VAL(fu_cv_sys_mounted_f_fstypename,
409           [AC_EGREP_HEADER([f_fstypename],
410                            [sys/mount.h],
411                            [fu_cv_sys_mounted_f_fstypename=yes],
412                            [fu_cv_sys_mounted_f_fstypename=no])
413           ])
414         AC_MSG_RESULT([$fu_cv_sys_mounted_f_fstypename])
415         if test $fu_cv_sys_mounted_f_fstypename = yes; then
416           AC_DEFINE(HAVE_F_FSTYPENAME, 1,
417                     [Define if `f_fstypename' is member of `struct statfs'])
418         fi
419       fi
420     fi
422     if test -z "$list_mounted_fs"; then
423       # Ultrix
424       AC_MSG_CHECKING([for getmnt function])
425       AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
426         [AC_TRY_CPP([
427 #include <sys/fs_types.h>
428 #include <sys/mount.h>],
429                     fu_cv_sys_mounted_getmnt=yes,
430                     fu_cv_sys_mounted_getmnt=no)])
431       AC_MSG_RESULT([$fu_cv_sys_mounted_getmnt])
432       if test $fu_cv_sys_mounted_getmnt = yes; then
433         list_mounted_fs=found
434         AC_DEFINE(MOUNTED_GETMNT, 1,
435                   [Define if `getmnt' function can be used])
436       fi
437     fi
439     if test -z "$list_mounted_fs"; then
440       # SVR2
441     AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
442       AC_CACHE_VAL(fu_cv_sys_mounted_fread,
443         [AC_TRY_CPP([#include <mnttab.h>],
444                     fu_cv_sys_mounted_fread=yes,
445                     fu_cv_sys_mounted_fread=no)])
446       AC_MSG_RESULT([$fu_cv_sys_mounted_fread])
447       if test $fu_cv_sys_mounted_fread = yes; then
448         list_mounted_fs=found
449         AC_DEFINE(MOUNTED_FREAD, 1,
450                  [Define if it's possible to resort to fread on /etc/mnttab])
451       fi
452     fi
454     if test -z "$list_mounted_fs"; then
455       AC_MSG_WARN([could not determine how to read list of mounted fs])
456     else
457       AC_DEFINE(HAVE_INFOMOUNT_LIST, 1,
458                 [Define if the list of mounted filesystems can be determined])
459     fi
461 dnl This configure.in code has been stolen from GNU fileutils-3.12.  Its
462 dnl job is to detect a method to get file system information.
464     AC_MSG_NOTICE([checking how to get filesystem space usage])
465     space=no
467     # Here we'll compromise a little (and perform only the link test)
468     # since it seems there are no variants of the statvfs function.
469     if test $space = no; then
470       # SVR4
471       AC_CHECK_FUNCS(statvfs)
472       if test $ac_cv_func_statvfs = yes; then
473         space=yes
474         AC_DEFINE(STAT_STATVFS, 1,
475                   [Define if function `statfs' can be used])
476       fi
477     fi
479     if test $space = no; then
480       # DEC Alpha running OSF/1
481       AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
482       AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
483       [AC_TRY_RUN([
484 #include <sys/param.h>
485 #include <sys/types.h>
486 #include <sys/mount.h>
487       main ()
488       {
489         struct statfs fsd;
490         fsd.f_fsize = 0;
491         exit (statfs (".", &fsd, sizeof (struct statfs)));
492       }],
493       fu_cv_sys_stat_statfs3_osf1=yes,
494       fu_cv_sys_stat_statfs3_osf1=no,
495       fu_cv_sys_stat_statfs3_osf1=no)])
496       AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
497       if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
498         space=yes
499         AC_DEFINE(STAT_STATFS3_OSF1, 1,
500                   [Define if function `statfs' takes 3 arguments])
501       fi
502     fi
504     if test $space = no; then
505     # AIX
506       AC_MSG_CHECKING([for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)])
507       AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
508       [AC_TRY_RUN([
509 #ifdef HAVE_SYS_PARAM_H
510 #include <sys/param.h>
511 #endif
512 #ifdef HAVE_SYS_MOUNT_H
513 #include <sys/mount.h>
514 #endif
515 #ifdef HAVE_SYS_VFS_H
516 #include <sys/vfs.h>
517 #endif
518       main ()
519       {
520       struct statfs fsd;
521       fsd.f_bsize = 0;
522       exit (statfs (".", &fsd));
523       }],
524       fu_cv_sys_stat_statfs2_bsize=yes,
525       fu_cv_sys_stat_statfs2_bsize=no,
526       fu_cv_sys_stat_statfs2_bsize=no)])
527       AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_bsize])
528       if test $fu_cv_sys_stat_statfs2_bsize = yes; then
529         space=yes
530         AC_DEFINE(STAT_STATFS2_BSIZE, 1,
531                   [Define if function `statfs' takes two arguments and
532 `bsize' is member of `struct statfs'])
533       fi
534     fi
536     if test $space = no; then
537     # SVR3
538       AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
539       AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
540       [AC_TRY_RUN([#include <sys/types.h>
541 #include <sys/statfs.h>
542       main ()
543       {
544       struct statfs fsd;
545       exit (statfs (".", &fsd, sizeof fsd, 0));
546       }],
547         fu_cv_sys_stat_statfs4=yes,
548         fu_cv_sys_stat_statfs4=no,
549         fu_cv_sys_stat_statfs4=no)])
550       AC_MSG_RESULT([$fu_cv_sys_stat_statfs4])
551       if test $fu_cv_sys_stat_statfs4 = yes; then
552         space=yes
553         AC_DEFINE(STAT_STATFS4, 1,
554                   [Define if function `statfs' takes 4 arguments])
555       fi
556     fi
558     if test $space = no; then
559     # 4.4BSD and NetBSD
560       AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
561     member (4.4BSD and NetBSD)])
562       AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
563       [AC_TRY_RUN([#include <sys/types.h>
564 #ifdef HAVE_SYS_PARAM_H
565 #include <sys/param.h>
566 #endif
567 #ifdef HAVE_SYS_MOUNT_H
568 #include <sys/mount.h>
569 #endif
570       main ()
571       {
572       struct statfs fsd;
573       fsd.f_fsize = 0;
574       exit (statfs (".", &fsd));
575       }],
576       fu_cv_sys_stat_statfs2_fsize=yes,
577       fu_cv_sys_stat_statfs2_fsize=no,
578       fu_cv_sys_stat_statfs2_fsize=no)])
579       AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_fsize])
580       if test $fu_cv_sys_stat_statfs2_fsize = yes; then
581         space=yes
582         AC_DEFINE(STAT_STATFS2_FSIZE, 1,
583                   [Define if function `statfs' takes two arguments and
584 `fsize' is member of `struct statfs'])
585       fi
586     fi
588     if test $space = no; then
589       # Ultrix
590       AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
591       AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
592       [AC_TRY_RUN([
593 #include <sys/types.h>
594 #ifdef HAVE_SYS_PARAM_H
595 #include <sys/param.h>
596 #endif
597 #ifdef HAVE_SYS_MOUNT_H
598 #include <sys/mount.h>
599 #endif
600 #ifdef HAVE_SYS_FS_TYPES_H
601 #include <sys/fs_types.h>
602 #endif
603       main ()
604       {
605       struct fs_data fsd;
606       /* Ultrix's statfs returns 1 for success,
607          0 for not mounted, -1 for failure.  */
608       exit (statfs (".", &fsd) != 1);
609       }],
610       fu_cv_sys_stat_fs_data=yes,
611       fu_cv_sys_stat_fs_data=no,
612       fu_cv_sys_stat_fs_data=no)])
613       AC_MSG_RESULT([$fu_cv_sys_stat_fs_data])
614       if test $fu_cv_sys_stat_fs_data = yes; then
615         space=yes
616         AC_DEFINE(STAT_STATFS2_FS_DATA, 1,
617                   [Define if function `statfs' takes two arguments
618 and uses `struct fs_data'])
619       fi
620     fi
622     dnl Not supported
623     dnl if test $space = no; then
624     dnl # SVR2
625     dnl AC_TRY_CPP([#include <sys/filsys.h>],
626     dnl   AC_DEFINE(STAT_READ_FILSYS) space=yes)
627     dnl fi
630 dnl AC_TRY_WARNINGS(INCLUDES, FUNCTION-BODY,
631 dnl             ACTION-IF-NO-WARNINGS [, ACTION-IF-WARNINGS-OR-ERROR])
632 AC_DEFUN([AC_TRY_WARNINGS],
633 [cat > conftest.$ac_ext <<EOF
634 dnl This sometimes fails to find confdefs.h, for some reason.
635 dnl [#]line __oline__ "[$]0"
636 [#]line __oline__ "configure"
637 #include "confdefs.h"
638 [$1]
639 int main() { return 0; }
640 int t() {
641 [$2]
642 ; return 0; }
644 ac_compile_warn='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 2>&1'
645 if { if eval $ac_compile_warn; then :; else echo arning; fi; } |
646         grep arning 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
647   ifelse([$4], , :, [rm -rf conftest*
648   $4])
649 ifelse([$3], , , [else
650   rm -rf conftest*
651   $3
652 ])dnl
654 rm -f conftest*]
657 AC_DEFUN([AC_USE_TERMINFO], [
658         AC_DEFINE(SLANG_TERMINFO, 1, [Define to use S-Lang with terminfo])
659         AC_MSG_NOTICE([using SLang screen manager/terminfo])
660         slang_term=" with terminfo"
663 AC_DEFUN([AC_USE_TERMCAP], [
664         AC_MSG_NOTICE([using S-Lang screen manager/termcap])
665         AC_DEFINE(USE_TERMCAP, 1, [Define to use termcap library])
666         dnl Check with $LIBS at the end so that it works with ELF libs.
667         AC_CHECK_LIB(termcap, tgoto, [LIBS="$LIBS -ltermcap"], , [$LIBS])
668         slang_term=" with termcap"
670         
671 AC_DEFUN([AC_WITH_SLANG], [
672         AC_DEFINE(HAVE_SLANG, 1,
673                   [Define to use S-Lang library for screen management])
674         screen_type="slang"
675         if $slang_use_system_installed_lib
676         then
677             AC_DEFINE(HAVE_SYSTEM_SLANG, 1,
678                       [Define to use S-Lang library installed on the system])
679             MCLIBS="-lslang $MCLIBS"
680             screen_manager="SLang (system-installed library)"
681             AC_MSG_NOTICE([using system installed S-Lang library])
682             ac_save_LIBS="$LIBS"
683             LIBS="$LIBS -lslang"
684             AC_TRY_LINK(
685             [ 
686             #ifdef HAVE_SLANG_SLANG_H
687             #include <slang/slang.h>
688             #else
689             #include <slang.h>
690             #endif], [
691             SLtt_get_terminfo();
692             SLtt_tgetflag("");], 
693             [LIBS="$ac_save_LIBS"; AC_USE_TERMINFO], 
694             [LIBS="$ac_save_LIBS"; AC_USE_TERMCAP])
695         else
696             screen_manager="SLang"
697         fi
698         if $slang_check_lib
699         then
700             use_terminfo=false
701             for dir in  /usr/lib /usr/share/lib /usr/local/lib /lib \
702                         /usr/local/share /usr/share
703             do
704                 if test -d $dir/terminfo; then
705                 use_terminfo=true; 
706                 break
707                 fi
708             done
709             if $use_terminfo; then
710                 AC_USE_TERMINFO
711             else
712                 AC_USE_TERMCAP
713             fi
714         fi]
717 AC_DEFUN([AC_WITH_EDIT], [
718         AC_DEFINE(USE_INTERNAL_EDIT, 1,
719                   [Define to enable internal editor])
720         LIBEDIT_A="libedit.a"
721         MCEDIT="mcedit"
722         LEDIT="-ledit"
723         EDIT_msg="yes"
724         AC_MSG_NOTICE([using internal editor])
727 AC_DEFUN([AC_EXT2_UNDEL], [
728   MC_UNDELFS_CHECKS
729   if test "$ext2fs_undel" = yes; then
730      AC_MSG_NOTICE([using ext2fs file recovery code])
731      vfs_flags="${vfs_flags}, undelfs"
732      undelfs_o="undelfs.o"
733      MCLIBS="$MCLIBS $EXT2FS_UNDEL_LIBS"
734   else
735      AC_MSG_NOTICE([not using ext2fs file recovery code])
736   fi