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