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