*** empty log message ***
[midnight-commander.git] / acinclude.m4
blobb394dfeb291c62917f4508f54ccc63212ff55430
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       vfs_flags="$vfs_flags, mcfs, ftpfs, fish"
97       use_net_code=true
98   fi
100   dnl
101   dnl Samba support
102   dnl
103   smbfs=""
104   SAMBAFILES=""
105   AC_ARG_WITH(samba,
106           [--with-samba            Support smb virtual file system],[
107           if test "x$withval" != "xno"; then
108                   AC_DEFINE(WITH_SMBFS, 1, [Define to enable VFS over SMB])
109                   vfs_flags="$vfs_flags, smbfs"
110                   smbfs="smbfs.o"
111                   SAMBAFILES="\$(SAMBAFILES)"
112           fi
113   ])
114   AC_SUBST(smbfs)
115   AC_SUBST(SAMBAFILES)
117   if test "x$smbfs" != x ; then
118   #################################################
119   # set Samba configuration directory location
120   configdir="/etc"
121   AC_ARG_WITH(configdir,
122   [  --with-configdir=DIR     Where the Samba configuration files are (/etc)],
123   [ case "$withval" in
124     yes|no)
125     #
126     # Just in case anybody does it
127     #
128         AC_MSG_WARN([--with-configdir called without argument - will use default])
129     ;;
130     * )
131         configdir="$withval"
132     ;;
133   esac]
134   )
135   AC_SUBST(configdir)
137   AC_ARG_WITH(codepagedir,
138     [  --with-codepagedir=DIR   Where the Samba codepage files are],
139     [ case "$withval" in
140       yes|no)
141       #
142       # Just in case anybody does it
143       #
144         AC_MSG_WARN([--with-codepagedir called without argument - will use default])
145       ;;
146     esac]
147   )
148   fi
150   dnl
151   dnl The termnet support
152   dnl
153   termnet=false
154   AC_ARG_WITH(termnet,
155           [--with-termnet             If you want a termified net support],[
156           if test x$withval = xyes; then
157                   AC_DEFINE(USE_TERMNET, 1,
158                             [Define to enable `term' firewall support])
159                   termnet=true          
160           fi
161   ])
163   TERMNET=""
164   AC_DEFINE(USE_VFS, 1, [Define to enable VFS support])
165   if $use_net_code; then
166      AC_DEFINE(USE_NETCODE, 1, [Define to use networked VFS])
167   fi
168   mcserv=
169   if test $have_socket = yes; then
170      mcserv="mcserv"
171      if $termnet; then
172         TERMNET="-ltermnet"
173      fi
174   fi
176   AC_SUBST(TERMNET)
177   AC_SUBST(mcserv)
179 dnl FIXME:
180 dnl MC_VFS_LIBS=
186 AC_DEFUN([MC_VFS_CHECKS],[
187         use_vfs=yes
188         AC_ARG_WITH(vfs,
189                 [--with-vfs                Compile with the VFS code],
190                 use_vfs=$withval
191         )
192         case $use_vfs in
193                 yes)    MC_WITH_VFS;;
194                 no)     use_vfs=no;;
195                 *)      use_vfs=no;;
196                         dnl Should we issue a warning?
197         esac
203 dnl Check for struct linger
205 AC_DEFUN([AC_STRUCT_LINGER], [
206 av_struct_linger=no
207 AC_MSG_CHECKING([struct linger is available])
208 AC_TRY_RUN([
209 #include <sys/types.h>
210 #include <sys/socket.h>
212 struct linger li;
214 int main ()
216     li.l_onoff = 1;
217     li.l_linger = 120;
218     return 0;
221 AC_DEFINE(HAVE_STRUCT_LINGER, 1,
222           [Define if `struct linger' is available])
223 av_struct_linger=yes
225 av_struct_linger=no
227 av_struct_linger=no
229 AC_MSG_RESULT([$av_struct_linger])
235 dnl Check for size of d_name dirent member
237 AC_DEFUN([AC_SHORT_D_NAME_LEN], [
238 AC_MSG_CHECKING([filename fits on dirent.d_name])
239 AC_CACHE_VAL(ac_cv_dnamesize, [
240 OCFLAGS="$CFLAGS"
241 CFLAGS="$CFLAGS -I$srcdir"
242 AC_TRY_RUN([
243 #include <src/fs.h>
245 int main ()
247    struct dirent ddd;
249    if (sizeof (ddd.d_name) < 12)
250         return 0;
251    else
252         return 1; 
256     ac_cv_dnamesize="no"
257 ], [
258     ac_cv_dnamesize="yes"
259 ], [
260 # Cannot find out, so assume no
261     ac_cv_dnamesize="no"
263 CFLAGS="$OCFLAGS"
265 if test x$ac_cv_dnamesize = xno; then
266     AC_DEFINE(NEED_EXTRA_DIRENT_BUFFER, 1,
267               [Define if using `struct dirent' can overwrite stack])
269 AC_MSG_RESULT([$ac_cv_dnamesize])
273 dnl Filesystem information detection
275 dnl To get information about the disk, mount points, etc.
278 AC_DEFUN([AC_GET_FS_INFO], [
279     AC_CHECK_HEADERS(fcntl.h sys/dustat.h sys/param.h sys/statfs.h sys/fstyp.h)
280     AC_CHECK_HEADERS(mnttab.h mntent.h utime.h sys/statvfs.h sys/vfs.h)
281     AC_CHECK_HEADERS(sys/filsys.h sys/fs_types.h)
282     AC_CHECK_HEADERS(sys/mount.h, , , [
283 #include <sys/param.h>
284 #include <sys/stat.h>
285                                       ])
286     AC_CHECK_FUNCS(getmntinfo)
288     dnl This configure.in code has been stolen from GNU fileutils-3.12.  Its
289     dnl job is to detect a method to get list of mounted filesystems.
291     AC_MSG_CHECKING([for d_ino member in directory struct])
292     AC_CACHE_VAL(fu_cv_sys_d_ino_in_dirent,
293     [AC_TRY_LINK([
294 #include <sys/types.h>
295 #ifdef HAVE_DIRENT_H
296 # include <dirent.h>
297 #else /* not HAVE_DIRENT_H */
298 # define dirent direct
299 # ifdef HAVE_SYS_NDIR_H
300 #  include <sys/ndir.h>
301 # endif /* HAVE_SYS_NDIR_H */
302 # ifdef HAVE_SYS_DIR_H
303 #  include <sys/dir.h>
304 # endif /* HAVE_SYS_DIR_H */
305 # ifdef HAVE_NDIR_H
306 #  include <ndir.h>
307 # endif /* HAVE_NDIR_H */
308 #endif /* HAVE_DIRENT_H */
309     ],
310       [struct dirent dp; dp.d_ino = 0;],
311         fu_cv_sys_d_ino_in_dirent=yes,
312         fu_cv_sys_d_ino_in_dirent=no)])
313     AC_MSG_RESULT([$fu_cv_sys_d_ino_in_dirent])
314     if test $fu_cv_sys_d_ino_in_dirent = yes; then
315       AC_DEFINE(D_INO_IN_DIRENT, 1,
316                 [Define if `d_ino' is member of `struct directory'])
317     fi
319     # Determine how to get the list of mounted filesystems.
320     list_mounted_fs=
322     # If the getmntent function is available but not in the standard library,
323     # make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX).
324     AC_FUNC_GETMNTENT
326     if test $ac_cv_func_getmntent = yes; then
328       # This system has the getmntent function.
329       # Determine whether it's the one-argument variant or the two-argument one.
331       if test -z "$list_mounted_fs"; then
332         # SVR4
333         AC_MSG_CHECKING([for two-argument getmntent function])
334         AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
335         [AC_EGREP_HEADER(getmntent, sys/mnttab.h,
336           fu_cv_sys_mounted_getmntent2=yes,
337           fu_cv_sys_mounted_getmntent2=no)])
338         AC_MSG_RESULT([$fu_cv_sys_mounted_getmntent2])
339         if test $fu_cv_sys_mounted_getmntent2 = yes; then
340           list_mounted_fs=found
341           AC_DEFINE(MOUNTED_GETMNTENT2, 1,
342                     [Define if function `getmntent' takes 2 arguments])
343         fi
344       fi
346       if test -z "$list_mounted_fs"; then
347         # 4.3BSD, SunOS, HP-UX, Dynix, Irix
348         AC_MSG_CHECKING([for one-argument getmntent function])
349         AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
350                      [test $ac_cv_header_mntent_h = yes \
351                        && fu_cv_sys_mounted_getmntent1=yes \
352                        || fu_cv_sys_mounted_getmntent1=no])
353         AC_MSG_RESULT([$fu_cv_sys_mounted_getmntent1])
354         if test $fu_cv_sys_mounted_getmntent1 = yes; then
355           list_mounted_fs=found
356           AC_DEFINE(MOUNTED_GETMNTENT1, 1,
357                     [Define if function `getmntent' takes 1 argument])
358         fi
359       fi
361     fi
363     if test -z "$list_mounted_fs"; then
364       # DEC Alpha running OSF/1.
365       AC_MSG_CHECKING([for getfsstat function])
366       AC_CACHE_VAL(fu_cv_sys_mounted_getsstat,
367       [AC_TRY_LINK([
368 #include <sys/types.h>
369 #include <sys/mount.h>
370 #include <sys/fs_types.h>],
371       [struct statfs *stats;
372       numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); ],
373         fu_cv_sys_mounted_getsstat=yes,
374         fu_cv_sys_mounted_getsstat=no)])
375       AC_MSG_RESULT([$fu_cv_sys_mounted_getsstat])
376       if test $fu_cv_sys_mounted_getsstat = yes; then
377         list_mounted_fs=found
378         AC_DEFINE(MOUNTED_GETFSSTAT, 1,
379                   [Define if function `getfsstat' can be used])
380       fi
381     fi
383     if test -z "$list_mounted_fs"; then
384       # AIX.
385       AC_MSG_CHECKING([for mntctl function and struct vmount])
386       AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
387       [AC_TRY_CPP([#include <fshelp.h>],
388         fu_cv_sys_mounted_vmount=yes,
389         fu_cv_sys_mounted_vmount=no)])
390       AC_MSG_RESULT([$fu_cv_sys_mounted_vmount])
391       if test $fu_cv_sys_mounted_vmount = yes; then
392         list_mounted_fs=found
393         AC_DEFINE(MOUNTED_VMOUNT, 1,
394                   [Define if function `mntctl' and `struct vmount' can be used])
395       fi
396     fi
398     if test -z "$list_mounted_fs"; then
399       # SVR3
400       AC_MSG_CHECKING([for existence of three headers])
401       AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
402         [AC_TRY_CPP([
403 #include <sys/statfs.h>
404 #include <sys/fstyp.h>
405 #include <mnttab.h>],
406                     fu_cv_sys_mounted_fread_fstyp=yes,
407                     fu_cv_sys_mounted_fread_fstyp=no)])
408       AC_MSG_RESULT([$fu_cv_sys_mounted_fread_fstyp])
409       if test $fu_cv_sys_mounted_fread_fstyp = yes; then
410         list_mounted_fs=found
411         AC_DEFINE(MOUNTED_FREAD_FSTYP, 1,
412                   [Define if sys/statfs.h, sys/fstyp.h and mnttab.h
413 can be used together])
414       fi
415     fi
417     if test -z "$list_mounted_fs"; then
418       # 4.4BSD and DEC OSF/1.
419       AC_MSG_CHECKING([for getmntinfo function])
420       AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
421         [
422           ok=
423           if test $ac_cv_func_getmntinfo = yes; then
424             AC_EGREP_HEADER(f_type;, sys/mount.h,
425                             ok=yes)
426           fi
427           test -n "$ok" \
428               && fu_cv_sys_mounted_getmntinfo=yes \
429               || fu_cv_sys_mounted_getmntinfo=no
430         ])
431       AC_MSG_RESULT([$fu_cv_sys_mounted_getmntinfo])
432       if test $fu_cv_sys_mounted_getmntinfo = yes; then
433         list_mounted_fs=found
434         AC_DEFINE(MOUNTED_GETMNTINFO, 1,
435                   [Define if `getmntinfo' function can be used])
436         AC_MSG_CHECKING([if struct statfs has f_fstypename])
437         AC_CACHE_VAL(fu_cv_sys_mounted_f_fstypename,
438           [AC_EGREP_HEADER([f_fstypename],
439                            [sys/mount.h],
440                            [fu_cv_sys_mounted_f_fstypename=yes],
441                            [fu_cv_sys_mounted_f_fstypename=no])
442           ])
443         AC_MSG_RESULT([$fu_cv_sys_mounted_f_fstypename])
444         if test $fu_cv_sys_mounted_f_fstypename = yes; then
445           AC_DEFINE(HAVE_F_FSTYPENAME, 1,
446                     [Define if `f_fstypename' is member of `struct statfs'])
447         fi
448       fi
449     fi
451     if test -z "$list_mounted_fs"; then
452       # Ultrix
453       AC_MSG_CHECKING([for getmnt function])
454       AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
455         [AC_TRY_CPP([
456 #include <sys/fs_types.h>
457 #include <sys/mount.h>],
458                     fu_cv_sys_mounted_getmnt=yes,
459                     fu_cv_sys_mounted_getmnt=no)])
460       AC_MSG_RESULT([$fu_cv_sys_mounted_getmnt])
461       if test $fu_cv_sys_mounted_getmnt = yes; then
462         list_mounted_fs=found
463         AC_DEFINE(MOUNTED_GETMNT, 1,
464                   [Define if `getmnt' function can be used])
465       fi
466     fi
468     if test -z "$list_mounted_fs"; then
469       # SVR2
470     AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
471       AC_CACHE_VAL(fu_cv_sys_mounted_fread,
472         [AC_TRY_CPP([#include <mnttab.h>],
473                     fu_cv_sys_mounted_fread=yes,
474                     fu_cv_sys_mounted_fread=no)])
475       AC_MSG_RESULT([$fu_cv_sys_mounted_fread])
476       if test $fu_cv_sys_mounted_fread = yes; then
477         list_mounted_fs=found
478         AC_DEFINE(MOUNTED_FREAD, 1,
479                  [Define if it's possible to resort to fread on /etc/mnttab])
480       fi
481     fi
483     if test -z "$list_mounted_fs"; then
484       AC_MSG_WARN([could not determine how to read list of mounted fs])
485     else
486       AC_DEFINE(HAVE_INFOMOUNT_LIST, 1,
487                 [Define if the list of mounted filesystems can be determined])
488     fi
490 dnl This configure.in code has been stolen from GNU fileutils-3.12.  Its
491 dnl job is to detect a method to get file system information.
493     AC_MSG_NOTICE([checking how to get filesystem space usage])
494     space=no
496     # Here we'll compromise a little (and perform only the link test)
497     # since it seems there are no variants of the statvfs function.
498     if test $space = no; then
499       # SVR4
500       AC_CHECK_FUNCS(statvfs)
501       if test $ac_cv_func_statvfs = yes; then
502         space=yes
503         AC_DEFINE(STAT_STATVFS, 1,
504                   [Define if function `statfs' can be used])
505       fi
506     fi
508     if test $space = no; then
509       # DEC Alpha running OSF/1
510       AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
511       AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
512       [AC_TRY_RUN([
513 #include <sys/param.h>
514 #include <sys/types.h>
515 #include <sys/mount.h>
516       main ()
517       {
518         struct statfs fsd;
519         fsd.f_fsize = 0;
520         exit (statfs (".", &fsd, sizeof (struct statfs)));
521       }],
522       fu_cv_sys_stat_statfs3_osf1=yes,
523       fu_cv_sys_stat_statfs3_osf1=no,
524       fu_cv_sys_stat_statfs3_osf1=no)])
525       AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
526       if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
527         space=yes
528         AC_DEFINE(STAT_STATFS3_OSF1, 1,
529                   [Define if function `statfs' takes 3 arguments])
530       fi
531     fi
533     if test $space = no; then
534     # AIX
535       AC_MSG_CHECKING([for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)])
536       AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
537       [AC_TRY_RUN([
538 #ifdef HAVE_SYS_PARAM_H
539 #include <sys/param.h>
540 #endif
541 #ifdef HAVE_SYS_MOUNT_H
542 #include <sys/mount.h>
543 #endif
544 #ifdef HAVE_SYS_VFS_H
545 #include <sys/vfs.h>
546 #endif
547       main ()
548       {
549       struct statfs fsd;
550       fsd.f_bsize = 0;
551       exit (statfs (".", &fsd));
552       }],
553       fu_cv_sys_stat_statfs2_bsize=yes,
554       fu_cv_sys_stat_statfs2_bsize=no,
555       fu_cv_sys_stat_statfs2_bsize=no)])
556       AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_bsize])
557       if test $fu_cv_sys_stat_statfs2_bsize = yes; then
558         space=yes
559         AC_DEFINE(STAT_STATFS2_BSIZE, 1,
560                   [Define if function `statfs' takes two arguments and
561 `bsize' is member of `struct statfs'])
562       fi
563     fi
565     if test $space = no; then
566     # SVR3
567       AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
568       AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
569       [AC_TRY_RUN([#include <sys/types.h>
570 #include <sys/statfs.h>
571       main ()
572       {
573       struct statfs fsd;
574       exit (statfs (".", &fsd, sizeof fsd, 0));
575       }],
576         fu_cv_sys_stat_statfs4=yes,
577         fu_cv_sys_stat_statfs4=no,
578         fu_cv_sys_stat_statfs4=no)])
579       AC_MSG_RESULT([$fu_cv_sys_stat_statfs4])
580       if test $fu_cv_sys_stat_statfs4 = yes; then
581         space=yes
582         AC_DEFINE(STAT_STATFS4, 1,
583                   [Define if function `statfs' takes 4 arguments])
584       fi
585     fi
587     if test $space = no; then
588     # 4.4BSD and NetBSD
589       AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
590     member (4.4BSD and NetBSD)])
591       AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
592       [AC_TRY_RUN([#include <sys/types.h>
593 #ifdef HAVE_SYS_PARAM_H
594 #include <sys/param.h>
595 #endif
596 #ifdef HAVE_SYS_MOUNT_H
597 #include <sys/mount.h>
598 #endif
599       main ()
600       {
601       struct statfs fsd;
602       fsd.f_fsize = 0;
603       exit (statfs (".", &fsd));
604       }],
605       fu_cv_sys_stat_statfs2_fsize=yes,
606       fu_cv_sys_stat_statfs2_fsize=no,
607       fu_cv_sys_stat_statfs2_fsize=no)])
608       AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_fsize])
609       if test $fu_cv_sys_stat_statfs2_fsize = yes; then
610         space=yes
611         AC_DEFINE(STAT_STATFS2_FSIZE, 1,
612                   [Define if function `statfs' takes two arguments and
613 `fsize' is member of `struct statfs'])
614       fi
615     fi
617     if test $space = no; then
618       # Ultrix
619       AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
620       AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
621       [AC_TRY_RUN([
622 #include <sys/types.h>
623 #ifdef HAVE_SYS_PARAM_H
624 #include <sys/param.h>
625 #endif
626 #ifdef HAVE_SYS_MOUNT_H
627 #include <sys/mount.h>
628 #endif
629 #ifdef HAVE_SYS_FS_TYPES_H
630 #include <sys/fs_types.h>
631 #endif
632       main ()
633       {
634       struct fs_data fsd;
635       /* Ultrix's statfs returns 1 for success,
636          0 for not mounted, -1 for failure.  */
637       exit (statfs (".", &fsd) != 1);
638       }],
639       fu_cv_sys_stat_fs_data=yes,
640       fu_cv_sys_stat_fs_data=no,
641       fu_cv_sys_stat_fs_data=no)])
642       AC_MSG_RESULT([$fu_cv_sys_stat_fs_data])
643       if test $fu_cv_sys_stat_fs_data = yes; then
644         space=yes
645         AC_DEFINE(STAT_STATFS2_FS_DATA, 1,
646                   [Define if function `statfs' takes two arguments
647 and uses `struct fs_data'])
648       fi
649     fi
651     dnl Not supported
652     dnl if test $space = no; then
653     dnl # SVR2
654     dnl AC_TRY_CPP([#include <sys/filsys.h>],
655     dnl   AC_DEFINE(STAT_READ_FILSYS) space=yes)
656     dnl fi
659 dnl AC_TRY_WARNINGS(INCLUDES, FUNCTION-BODY,
660 dnl             ACTION-IF-NO-WARNINGS [, ACTION-IF-WARNINGS-OR-ERROR])
661 AC_DEFUN([AC_TRY_WARNINGS],
662 [cat > conftest.$ac_ext <<EOF
663 dnl This sometimes fails to find confdefs.h, for some reason.
664 dnl [#]line __oline__ "[$]0"
665 [#]line __oline__ "configure"
666 #include "confdefs.h"
667 [$1]
668 int main() { return 0; }
669 int t() {
670 [$2]
671 ; return 0; }
673 ac_compile_warn='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 2>&1'
674 if { if eval $ac_compile_warn; then :; else echo arning; fi; } |
675         grep arning 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
676   ifelse([$4], , :, [rm -rf conftest*
677   $4])
678 ifelse([$3], , , [else
679   rm -rf conftest*
680   $3
681 ])dnl
683 rm -f conftest*]
686 AC_DEFUN([AC_USE_TERMINFO], [
687         AC_DEFINE(SLANG_TERMINFO, 1, [Define to use S-Lang with terminfo])
688         AC_MSG_NOTICE([using SLang screen manager/terminfo])
689         slang_term=" with terminfo"
692 AC_DEFUN([AC_USE_TERMCAP], [
693         AC_MSG_NOTICE([using S-Lang screen manager/termcap])
694         AC_DEFINE(USE_TERMCAP, 1, [Define to use termcap library])
695         dnl Check with $LIBS at the end so that it works with ELF libs.
696         AC_CHECK_LIB(termcap, tgoto, [LIBS="$LIBS -ltermcap"], , [$LIBS])
697         slang_term=" with termcap"
699         
700 AC_DEFUN([AC_WITH_SLANG], [
701         AC_DEFINE(HAVE_SLANG, 1,
702                   [Define to use S-Lang library for screen management])
703         search_ncurses=false
704         screen_type="slang"
705         if $slang_use_system_installed_lib
706         then
707             AC_DEFINE(HAVE_SYSTEM_SLANG, 1,
708                       [Define to use S-Lang library installed on the system])
709             MCLIBS="-lslang $MCLIBS"
710             screen_manager="SLang (system-installed library)"
711             AC_MSG_NOTICE([using system installed S-Lang library])
712             ac_save_LIBS="$LIBS"
713             LIBS="$LIBS -lslang"
714             AC_TRY_LINK(
715             [ 
716             #ifdef HAVE_SLANG_SLANG_H
717             #include <slang/slang.h>
718             #else
719             #include <slang.h>
720             #endif], [
721             SLtt_get_terminfo();
722             SLtt_tgetflag("");], 
723             [LIBS="$ac_save_LIBS"; AC_USE_TERMINFO], 
724             [LIBS="$ac_save_LIBS"; AC_USE_TERMCAP])
725         else
726             screen_manager="SLang"
727         fi
728         if $slang_check_lib
729         then
730             use_terminfo=false
731             for dir in  /usr/lib /usr/share/lib /usr/local/lib /lib \
732                         /usr/local/share /usr/share
733             do
734                 if test -d $dir/terminfo; then
735                 use_terminfo=true; 
736                 break
737                 fi
738             done
739             if $use_terminfo; then
740                 AC_USE_TERMINFO
741             else
742                 AC_USE_TERMCAP
743             fi
744         fi]
747 AC_DEFUN([AC_WITH_EDIT], [
748         AC_DEFINE(USE_INTERNAL_EDIT, 1,
749                   [Define to enable internal editor])
750         LIBEDIT_A="libedit.a"
751         MCEDIT="mcedit"
752         LEDIT="-ledit"
753         EDIT_msg="yes"
754         AC_MSG_NOTICE([using internal editor])
757 AC_DEFUN([AC_EXT2_UNDEL], [
758   MC_UNDELFS_CHECKS
759   if test "$ext2fs_undel" = yes; then
760      AC_MSG_NOTICE([using ext2fs file recovery code])
761      vfs_flags="${vfs_flags}, undelfs"
762      undelfs_o="undelfs.o"
763      LIBS="$LIBS $EXT2FS_UNDEL_LIBS"
764   else
765      AC_MSG_NOTICE([not using ext2fs file recovery code])
766   fi
770 dnl Parameters: directory filename LIBS_append CPPFLAGS_append nicename
772 AC_DEFUN([AC_NCURSES], [
773     if $search_ncurses
774     then
775         if test -f $1/$2
776         then
777             AC_MSG_NOTICE([found ncurses header $1/$2])
778             MCLIBS="$MCLIBS $3"
779             CPPFLAGS="$CPPFLAGS $4"
780             search_ncurses=false
781             screen_type="ncurses"
782             screen_manager="$5"
783             AC_DEFINE(USE_NCURSES, 1,
784                       [Define to use ncurses for screen management])
785         fi
786     fi