2 dnl Check for size of d_name dirent member
4 AC_DEFUN([AC_SHORT_D_NAME_LEN], [
5 AC_MSG_CHECKING([filename fits on dirent.d_name])
6 AC_CACHE_VAL(ac_cv_dnamesize, [
8 CFLAGS="$CFLAGS -I$srcdir"
16 if (sizeof (ddd.d_name) < 12)
27 # Cannot find out, so assume no
32 if test x$ac_cv_dnamesize = xno; then
33 AC_DEFINE(NEED_EXTRA_DIRENT_BUFFER)
35 AC_MSG_RESULT([$ac_cv_dnamesize])
39 dnl Filesystem information detection
41 dnl To get information about the disk, mount points, etc.
44 AC_DEFUN([AC_GET_FS_INFO], [
45 AC_CHECK_HEADERS(fcntl.h sys/dustat.h sys/param.h sys/statfs.h sys/fstyp.h)
46 AC_CHECK_HEADERS(mnttab.h mntent.h utime.h sys/statvfs.h sys/vfs.h)
47 AC_CHECK_HEADERS(sys/mount.h sys/filsys.h sys/fs_types.h)
48 AC_CHECK_FUNCS(getmntinfo)
50 dnl This configure.in code has been stolen from GNU fileutils-3.12. Its
51 dnl job is to detect a method to get list of mounted filesystems.
53 AC_MSG_CHECKING([for d_ino member in directory struct])
54 AC_CACHE_VAL(fu_cv_sys_d_ino_in_dirent,
56 #include <sys/types.h>
59 #else /* not HAVE_DIRENT_H */
60 # define dirent direct
61 # ifdef HAVE_SYS_NDIR_H
62 # include <sys/ndir.h>
63 # endif /* HAVE_SYS_NDIR_H */
64 # ifdef HAVE_SYS_DIR_H
66 # endif /* HAVE_SYS_DIR_H */
69 # endif /* HAVE_NDIR_H */
70 #endif /* HAVE_DIRENT_H */
72 [struct dirent dp; dp.d_ino = 0;],
73 fu_cv_sys_d_ino_in_dirent=yes,
74 fu_cv_sys_d_ino_in_dirent=no)])
75 AC_MSG_RESULT([$fu_cv_sys_d_ino_in_dirent])
76 if test $fu_cv_sys_d_ino_in_dirent = yes; then
77 AC_DEFINE(D_INO_IN_DIRENT)
80 # Determine how to get the list of mounted filesystems.
83 # If the getmntent function is available but not in the standard library,
84 # make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX).
87 if test $ac_cv_func_getmntent = yes; then
89 # This system has the getmntent function.
90 # Determine whether it's the one-argument variant or the two-argument one.
92 if test -z "$list_mounted_fs"; then
94 AC_MSG_CHECKING([for two-argument getmntent function])
95 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
96 [AC_EGREP_HEADER(getmntent, sys/mnttab.h,
97 fu_cv_sys_mounted_getmntent2=yes,
98 fu_cv_sys_mounted_getmntent2=no)])
99 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntent2])
100 if test $fu_cv_sys_mounted_getmntent2 = yes; then
101 list_mounted_fs=found
102 AC_DEFINE(MOUNTED_GETMNTENT2)
106 if test -z "$list_mounted_fs"; then
107 # 4.3BSD, SunOS, HP-UX, Dynix, Irix
108 AC_MSG_CHECKING([for one-argument getmntent function])
109 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
110 [test $ac_cv_header_mntent_h = yes \
111 && fu_cv_sys_mounted_getmntent1=yes \
112 || fu_cv_sys_mounted_getmntent1=no])
113 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntent1])
114 if test $fu_cv_sys_mounted_getmntent1 = yes; then
115 list_mounted_fs=found
116 AC_DEFINE(MOUNTED_GETMNTENT1)
122 if test -z "$list_mounted_fs"; then
123 # DEC Alpha running OSF/1.
124 AC_MSG_CHECKING([for getfsstat function])
125 AC_CACHE_VAL(fu_cv_sys_mounted_getsstat,
127 #include <sys/types.h>
128 #include <sys/mount.h>
129 #include <sys/fs_types.h>],
130 [struct statfs *stats;
131 numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); ],
132 fu_cv_sys_mounted_getsstat=yes,
133 fu_cv_sys_mounted_getsstat=no)])
134 AC_MSG_RESULT([$fu_cv_sys_mounted_getsstat])
135 if test $fu_cv_sys_mounted_getsstat = yes; then
136 list_mounted_fs=found
137 AC_DEFINE(MOUNTED_GETFSSTAT)
141 if test -z "$list_mounted_fs"; then
143 AC_MSG_CHECKING([for mntctl function and struct vmount])
144 AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
145 [AC_TRY_CPP([#include <fshelp.h>],
146 fu_cv_sys_mounted_vmount=yes,
147 fu_cv_sys_mounted_vmount=no)])
148 AC_MSG_RESULT([$fu_cv_sys_mounted_vmount])
149 if test $fu_cv_sys_mounted_vmount = yes; then
150 list_mounted_fs=found
151 AC_DEFINE(MOUNTED_VMOUNT)
155 if test -z "$list_mounted_fs"; then
157 AC_MSG_CHECKING([for existence of three headers])
158 AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
160 #include <sys/statfs.h>
161 #include <sys/fstyp.h>
162 #include <mnttab.h>],
163 fu_cv_sys_mounted_fread_fstyp=yes,
164 fu_cv_sys_mounted_fread_fstyp=no)])
165 AC_MSG_RESULT([$fu_cv_sys_mounted_fread_fstyp])
166 if test $fu_cv_sys_mounted_fread_fstyp = yes; then
167 list_mounted_fs=found
168 AC_DEFINE(MOUNTED_FREAD_FSTYP)
172 if test -z "$list_mounted_fs"; then
173 # 4.4BSD and DEC OSF/1.
174 AC_MSG_CHECKING([for getmntinfo function])
175 AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
178 if test $ac_cv_func_getmntinfo = yes; then
179 AC_EGREP_HEADER(f_type;, sys/mount.h,
183 && fu_cv_sys_mounted_getmntinfo=yes \
184 || fu_cv_sys_mounted_getmntinfo=no
186 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntinfo])
187 if test $fu_cv_sys_mounted_getmntinfo = yes; then
188 list_mounted_fs=found
189 AC_DEFINE(MOUNTED_GETMNTINFO)
190 AC_MSG_CHECKING([if struct statfs has f_fstypename])
191 AC_CACHE_VAL(fu_cv_sys_mounted_f_fstypename,
192 [AC_EGREP_HEADER([f_fstypename],
194 [fu_cv_sys_mounted_f_fstypename=yes],
195 [fu_cv_sys_mounted_f_fstypename=no])
197 AC_MSG_RESULT([$fu_cv_sys_mounted_f_fstypename])
198 if test $fu_cv_sys_mounted_f_fstypename = yes; then
199 AC_DEFINE(HAVE_F_FSTYPENAME)
204 if test -z "$list_mounted_fs"; then
206 AC_MSG_CHECKING([for getmnt function])
207 AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
209 #include <sys/fs_types.h>
210 #include <sys/mount.h>],
211 fu_cv_sys_mounted_getmnt=yes,
212 fu_cv_sys_mounted_getmnt=no)])
213 AC_MSG_RESULT([$fu_cv_sys_mounted_getmnt])
214 if test $fu_cv_sys_mounted_getmnt = yes; then
215 list_mounted_fs=found
216 AC_DEFINE(MOUNTED_GETMNT)
220 if test -z "$list_mounted_fs"; then
222 AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
223 AC_CACHE_VAL(fu_cv_sys_mounted_fread,
224 [AC_TRY_CPP([#include <mnttab.h>],
225 fu_cv_sys_mounted_fread=yes,
226 fu_cv_sys_mounted_fread=no)])
227 AC_MSG_RESULT([$fu_cv_sys_mounted_fread])
228 if test $fu_cv_sys_mounted_fread = yes; then
229 list_mounted_fs=found
230 AC_DEFINE(MOUNTED_FREAD)
234 if test -z "$list_mounted_fs"; then
235 AC_MSG_WARN([could not determine how to read list of mounted fs])
237 AC_DEFINE(HAVE_INFOMOUNT_LIST, 1,
238 [Can determine list of mounted filesystems])
241 dnl This configure.in code has been stolen from GNU fileutils-3.12. Its
242 dnl job is to detect a method to get file system information.
244 AC_CHECKING([how to get filesystem space usage])
247 # Here we'll compromise a little (and perform only the link test)
248 # since it seems there are no variants of the statvfs function.
249 if test $space = no; then
251 AC_CHECK_FUNCS(statvfs)
252 if test $ac_cv_func_statvfs = yes; then
254 AC_DEFINE(STAT_STATVFS)
258 if test $space = no; then
259 # DEC Alpha running OSF/1
260 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
261 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
263 #include <sys/param.h>
264 #include <sys/types.h>
265 #include <sys/mount.h>
270 exit (statfs (".", &fsd, sizeof (struct statfs)));
272 fu_cv_sys_stat_statfs3_osf1=yes,
273 fu_cv_sys_stat_statfs3_osf1=no,
274 fu_cv_sys_stat_statfs3_osf1=no)])
275 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
276 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
278 AC_DEFINE(STAT_STATFS3_OSF1)
282 if test $space = no; then
284 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)])
285 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
287 #ifdef HAVE_SYS_PARAM_H
288 #include <sys/param.h>
290 #ifdef HAVE_SYS_MOUNT_H
291 #include <sys/mount.h>
293 #ifdef HAVE_SYS_VFS_H
300 exit (statfs (".", &fsd));
302 fu_cv_sys_stat_statfs2_bsize=yes,
303 fu_cv_sys_stat_statfs2_bsize=no,
304 fu_cv_sys_stat_statfs2_bsize=no)])
305 AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_bsize])
306 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
308 AC_DEFINE(STAT_STATFS2_BSIZE)
312 if test $space = no; then
314 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
315 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
316 [AC_TRY_RUN([#include <sys/types.h>
317 #include <sys/statfs.h>
321 exit (statfs (".", &fsd, sizeof fsd, 0));
323 fu_cv_sys_stat_statfs4=yes,
324 fu_cv_sys_stat_statfs4=no,
325 fu_cv_sys_stat_statfs4=no)])
326 AC_MSG_RESULT([$fu_cv_sys_stat_statfs4])
327 if test $fu_cv_sys_stat_statfs4 = yes; then
329 AC_DEFINE(STAT_STATFS4)
333 if test $space = no; then
335 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
336 member (4.4BSD and NetBSD)])
337 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
338 [AC_TRY_RUN([#include <sys/types.h>
339 #ifdef HAVE_SYS_PARAM_H
340 #include <sys/param.h>
342 #ifdef HAVE_SYS_MOUNT_H
343 #include <sys/mount.h>
349 exit (statfs (".", &fsd));
351 fu_cv_sys_stat_statfs2_fsize=yes,
352 fu_cv_sys_stat_statfs2_fsize=no,
353 fu_cv_sys_stat_statfs2_fsize=no)])
354 AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_fsize])
355 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
357 AC_DEFINE(STAT_STATFS2_FSIZE)
361 if test $space = no; then
363 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
364 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
366 #include <sys/types.h>
367 #ifdef HAVE_SYS_PARAM_H
368 #include <sys/param.h>
370 #ifdef HAVE_SYS_MOUNT_H
371 #include <sys/mount.h>
373 #ifdef HAVE_SYS_FS_TYPES_H
374 #include <sys/fs_types.h>
379 /* Ultrix's statfs returns 1 for success,
380 0 for not mounted, -1 for failure. */
381 exit (statfs (".", &fsd) != 1);
383 fu_cv_sys_stat_fs_data=yes,
384 fu_cv_sys_stat_fs_data=no,
385 fu_cv_sys_stat_fs_data=no)])
386 AC_MSG_RESULT([$fu_cv_sys_stat_fs_data])
387 if test $fu_cv_sys_stat_fs_data = yes; then
389 AC_DEFINE(STAT_STATFS2_FS_DATA)
394 dnl if test $space = no; then
396 dnl AC_TRY_CPP([#include <sys/filsys.h>],
397 dnl AC_DEFINE(STAT_READ_FILSYS) space=yes)
401 dnl AC_TRY_WARNINGS(INCLUDES, FUNCTION-BODY,
402 dnl ACTION-IF-NO-WARNINGS [, ACTION-IF-WARNINGS-OR-ERROR])
403 AC_DEFUN([AC_TRY_WARNINGS],
404 [cat > conftest.$ac_ext <<EOF
405 dnl This sometimes fails to find confdefs.h, for some reason.
406 dnl [#]line __oline__ "[$]0"
407 [#]line __oline__ "configure"
408 #include "confdefs.h"
410 int main() { return 0; }
415 ac_compile_warn='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 2>&1'
416 if { if eval $ac_compile_warn; then :; else echo arning; fi; } | grep arning 1>&AC_FD_CC 2>&AC_FD_CC; then
417 ifelse([$4], , :, [rm -rf conftest*
419 ifelse([$3], , , [else
427 AC_DEFUN([AC_USE_SUNOS_CURSES], [
429 screen_manager="SunOS 4.x /usr/5include curses"
430 AC_MSG_RESULT([Using SunOS 4.x /usr/5include curses])
431 AC_DEFINE(USE_SUNOS_CURSES)
432 AC_DEFINE(NO_COLOR_CURSES)
433 AC_DEFINE(USE_SYSV_CURSES)
434 CPPFLAGS="$CPPFLAGS -I/usr/5include"
435 XCURSES="xcurses.o /usr/5lib/libcurses.a /usr/5lib/libtermcap.a"
436 AC_MSG_RESULT([Please note that some screen refreshs may fail])
437 AC_MSG_WARN([Reconsider using Slang])
440 AC_DEFUN([AC_USE_OSF1_CURSES], [
441 AC_MSG_RESULT([Using OSF1 curses])
443 screen_manager="OSF1 curses"
444 AC_DEFINE(NO_COLOR_CURSES)
445 AC_DEFINE(USE_SYSV_CURSES)
447 LIBS="$LIBS -lcurses"
450 AC_DEFUN([AC_USE_SYSV_CURSES], [
451 AC_MSG_RESULT([Using SysV curses])
452 AC_DEFINE(USE_SYSV_CURSES)
455 screen_manager="SysV/curses"
456 LIBS="$LIBS -lcurses"
459 AC_DEFUN([AC_USE_TERMINFO], [
460 AC_DEFINE(SLANG_TERMINFO)
461 AC_MSG_RESULT([Using SLang screen manager/terminfo])
462 slang_term=" with terminfo"
465 AC_DEFUN([AC_USE_TERMCAP], [
466 AC_MSG_RESULT([Using SLang screen manager/termcap])
467 AC_DEFINE(USE_TERMCAP)
468 dnl Check with $LIBS at the end so that it works with ELF libs.
469 AC_CHECK_LIB(termcap, tgoto, LIBS="$LIBS -ltermcap", , $LIBS)
470 slang_term=" with termcap"
473 AC_DEFUN([AC_WITH_SLANG], [
474 AC_DEFINE(HAVE_SLANG)
476 if $slang_use_system_installed_lib
478 AC_DEFINE(HAVE_SYSTEM_SLANG)
480 screen_manager="SLang (system-installed library)"
481 AC_MSG_RESULT([Using system installed SLang library])
487 #ifdef SLANG_H_INSIDE_SLANG_DIR
488 #include <slang/slang.h>
497 [LIBS="$ac_save_LIBS"; AC_USE_TERMINFO],
498 [LIBS="$ac_save_LIBS"; AC_USE_TERMCAP])
500 MCCPPFLAGS="$MCCPPFLAGS -I\$(slangdir)"
501 LIBSLANG="libmcslang.a"
502 screen_manager="SLang"
504 CPPFLAGS="$CPPFLAGS -I../slang"
505 fastdepslang=fastdepslang
509 /*) ln -sf $srcdir/slang/slang-mc.h slang/slang.h;;
510 *) ln -sf ../$srcdir/slang/slang-mc.h slang/slang.h;;
516 for dir in /usr/lib /usr/share/lib /usr/local/lib /lib \
517 /usr/local/share /usr/share
519 if test -d $dir/terminfo; then
524 if $use_terminfo; then
532 AC_DEFUN([AC_WITH_EDIT], [
533 AC_DEFINE(USE_INTERNAL_EDIT)
534 LIBEDIT_A="libedit.a"
538 AC_MSG_RESULT([will call internal editor])
541 AC_DEFUN([AC_EXT2_UNDEL], [
543 if test "$ext2fs_undel" = yes; then
544 AC_MSG_RESULT([With ext2fs file recovery code])
545 vfs_flags="${vfs_flags}, undelfs"
546 undelfs_o="undelfs.o"
547 LIBS="$LIBS $EXT2FS_UNDEL_LIBS"
549 AC_MSG_WARN([No ext2fs file recovery code])
554 dnl Parameters: directory filename LIBS_append CPPFLAGS_append nicename
556 AC_DEFUN([AC_NCURSES], [
561 AC_MSG_RESULT([Found ncurses on $1/$2])
563 CPPFLAGS="$CPPFLAGS $4"
566 AC_DEFINE(USE_NCURSES)