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/filsys.h sys/fs_types.h)
48 AC_CHECK_HEADERS(sys/mount.h, , , [
49 #include <sys/param.h>
52 AC_CHECK_FUNCS(getmntinfo)
54 dnl This configure.in code has been stolen from GNU fileutils-3.12. Its
55 dnl job is to detect a method to get list of mounted filesystems.
57 AC_MSG_CHECKING([for d_ino member in directory struct])
58 AC_CACHE_VAL(fu_cv_sys_d_ino_in_dirent,
60 #include <sys/types.h>
63 #else /* not HAVE_DIRENT_H */
64 # define dirent direct
65 # ifdef HAVE_SYS_NDIR_H
66 # include <sys/ndir.h>
67 # endif /* HAVE_SYS_NDIR_H */
68 # ifdef HAVE_SYS_DIR_H
70 # endif /* HAVE_SYS_DIR_H */
73 # endif /* HAVE_NDIR_H */
74 #endif /* HAVE_DIRENT_H */
76 [struct dirent dp; dp.d_ino = 0;],
77 fu_cv_sys_d_ino_in_dirent=yes,
78 fu_cv_sys_d_ino_in_dirent=no)])
79 AC_MSG_RESULT([$fu_cv_sys_d_ino_in_dirent])
80 if test $fu_cv_sys_d_ino_in_dirent = yes; then
81 AC_DEFINE(D_INO_IN_DIRENT)
84 # Determine how to get the list of mounted filesystems.
87 # If the getmntent function is available but not in the standard library,
88 # make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX).
91 if test $ac_cv_func_getmntent = yes; then
93 # This system has the getmntent function.
94 # Determine whether it's the one-argument variant or the two-argument one.
96 if test -z "$list_mounted_fs"; then
98 AC_MSG_CHECKING([for two-argument getmntent function])
99 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
100 [AC_EGREP_HEADER(getmntent, sys/mnttab.h,
101 fu_cv_sys_mounted_getmntent2=yes,
102 fu_cv_sys_mounted_getmntent2=no)])
103 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntent2])
104 if test $fu_cv_sys_mounted_getmntent2 = yes; then
105 list_mounted_fs=found
106 AC_DEFINE(MOUNTED_GETMNTENT2)
110 if test -z "$list_mounted_fs"; then
111 # 4.3BSD, SunOS, HP-UX, Dynix, Irix
112 AC_MSG_CHECKING([for one-argument getmntent function])
113 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
114 [test $ac_cv_header_mntent_h = yes \
115 && fu_cv_sys_mounted_getmntent1=yes \
116 || fu_cv_sys_mounted_getmntent1=no])
117 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntent1])
118 if test $fu_cv_sys_mounted_getmntent1 = yes; then
119 list_mounted_fs=found
120 AC_DEFINE(MOUNTED_GETMNTENT1)
126 if test -z "$list_mounted_fs"; then
127 # DEC Alpha running OSF/1.
128 AC_MSG_CHECKING([for getfsstat function])
129 AC_CACHE_VAL(fu_cv_sys_mounted_getsstat,
131 #include <sys/types.h>
132 #include <sys/mount.h>
133 #include <sys/fs_types.h>],
134 [struct statfs *stats;
135 numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); ],
136 fu_cv_sys_mounted_getsstat=yes,
137 fu_cv_sys_mounted_getsstat=no)])
138 AC_MSG_RESULT([$fu_cv_sys_mounted_getsstat])
139 if test $fu_cv_sys_mounted_getsstat = yes; then
140 list_mounted_fs=found
141 AC_DEFINE(MOUNTED_GETFSSTAT)
145 if test -z "$list_mounted_fs"; then
147 AC_MSG_CHECKING([for mntctl function and struct vmount])
148 AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
149 [AC_TRY_CPP([#include <fshelp.h>],
150 fu_cv_sys_mounted_vmount=yes,
151 fu_cv_sys_mounted_vmount=no)])
152 AC_MSG_RESULT([$fu_cv_sys_mounted_vmount])
153 if test $fu_cv_sys_mounted_vmount = yes; then
154 list_mounted_fs=found
155 AC_DEFINE(MOUNTED_VMOUNT)
159 if test -z "$list_mounted_fs"; then
161 AC_MSG_CHECKING([for existence of three headers])
162 AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
164 #include <sys/statfs.h>
165 #include <sys/fstyp.h>
166 #include <mnttab.h>],
167 fu_cv_sys_mounted_fread_fstyp=yes,
168 fu_cv_sys_mounted_fread_fstyp=no)])
169 AC_MSG_RESULT([$fu_cv_sys_mounted_fread_fstyp])
170 if test $fu_cv_sys_mounted_fread_fstyp = yes; then
171 list_mounted_fs=found
172 AC_DEFINE(MOUNTED_FREAD_FSTYP)
176 if test -z "$list_mounted_fs"; then
177 # 4.4BSD and DEC OSF/1.
178 AC_MSG_CHECKING([for getmntinfo function])
179 AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
182 if test $ac_cv_func_getmntinfo = yes; then
183 AC_EGREP_HEADER(f_type;, sys/mount.h,
187 && fu_cv_sys_mounted_getmntinfo=yes \
188 || fu_cv_sys_mounted_getmntinfo=no
190 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntinfo])
191 if test $fu_cv_sys_mounted_getmntinfo = yes; then
192 list_mounted_fs=found
193 AC_DEFINE(MOUNTED_GETMNTINFO)
194 AC_MSG_CHECKING([if struct statfs has f_fstypename])
195 AC_CACHE_VAL(fu_cv_sys_mounted_f_fstypename,
196 [AC_EGREP_HEADER([f_fstypename],
198 [fu_cv_sys_mounted_f_fstypename=yes],
199 [fu_cv_sys_mounted_f_fstypename=no])
201 AC_MSG_RESULT([$fu_cv_sys_mounted_f_fstypename])
202 if test $fu_cv_sys_mounted_f_fstypename = yes; then
203 AC_DEFINE(HAVE_F_FSTYPENAME)
208 if test -z "$list_mounted_fs"; then
210 AC_MSG_CHECKING([for getmnt function])
211 AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
213 #include <sys/fs_types.h>
214 #include <sys/mount.h>],
215 fu_cv_sys_mounted_getmnt=yes,
216 fu_cv_sys_mounted_getmnt=no)])
217 AC_MSG_RESULT([$fu_cv_sys_mounted_getmnt])
218 if test $fu_cv_sys_mounted_getmnt = yes; then
219 list_mounted_fs=found
220 AC_DEFINE(MOUNTED_GETMNT)
224 if test -z "$list_mounted_fs"; then
226 AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
227 AC_CACHE_VAL(fu_cv_sys_mounted_fread,
228 [AC_TRY_CPP([#include <mnttab.h>],
229 fu_cv_sys_mounted_fread=yes,
230 fu_cv_sys_mounted_fread=no)])
231 AC_MSG_RESULT([$fu_cv_sys_mounted_fread])
232 if test $fu_cv_sys_mounted_fread = yes; then
233 list_mounted_fs=found
234 AC_DEFINE(MOUNTED_FREAD)
238 if test -z "$list_mounted_fs"; then
239 AC_MSG_WARN([could not determine how to read list of mounted fs])
241 AC_DEFINE(HAVE_INFOMOUNT_LIST, 1,
242 [Can determine list of mounted filesystems])
245 dnl This configure.in code has been stolen from GNU fileutils-3.12. Its
246 dnl job is to detect a method to get file system information.
248 AC_CHECKING([how to get filesystem space usage])
251 # Here we'll compromise a little (and perform only the link test)
252 # since it seems there are no variants of the statvfs function.
253 if test $space = no; then
255 AC_CHECK_FUNCS(statvfs)
256 if test $ac_cv_func_statvfs = yes; then
258 AC_DEFINE(STAT_STATVFS)
262 if test $space = no; then
263 # DEC Alpha running OSF/1
264 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
265 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
267 #include <sys/param.h>
268 #include <sys/types.h>
269 #include <sys/mount.h>
274 exit (statfs (".", &fsd, sizeof (struct statfs)));
276 fu_cv_sys_stat_statfs3_osf1=yes,
277 fu_cv_sys_stat_statfs3_osf1=no,
278 fu_cv_sys_stat_statfs3_osf1=no)])
279 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
280 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
282 AC_DEFINE(STAT_STATFS3_OSF1)
286 if test $space = no; then
288 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)])
289 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
291 #ifdef HAVE_SYS_PARAM_H
292 #include <sys/param.h>
294 #ifdef HAVE_SYS_MOUNT_H
295 #include <sys/mount.h>
297 #ifdef HAVE_SYS_VFS_H
304 exit (statfs (".", &fsd));
306 fu_cv_sys_stat_statfs2_bsize=yes,
307 fu_cv_sys_stat_statfs2_bsize=no,
308 fu_cv_sys_stat_statfs2_bsize=no)])
309 AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_bsize])
310 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
312 AC_DEFINE(STAT_STATFS2_BSIZE)
316 if test $space = no; then
318 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
319 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
320 [AC_TRY_RUN([#include <sys/types.h>
321 #include <sys/statfs.h>
325 exit (statfs (".", &fsd, sizeof fsd, 0));
327 fu_cv_sys_stat_statfs4=yes,
328 fu_cv_sys_stat_statfs4=no,
329 fu_cv_sys_stat_statfs4=no)])
330 AC_MSG_RESULT([$fu_cv_sys_stat_statfs4])
331 if test $fu_cv_sys_stat_statfs4 = yes; then
333 AC_DEFINE(STAT_STATFS4)
337 if test $space = no; then
339 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
340 member (4.4BSD and NetBSD)])
341 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
342 [AC_TRY_RUN([#include <sys/types.h>
343 #ifdef HAVE_SYS_PARAM_H
344 #include <sys/param.h>
346 #ifdef HAVE_SYS_MOUNT_H
347 #include <sys/mount.h>
353 exit (statfs (".", &fsd));
355 fu_cv_sys_stat_statfs2_fsize=yes,
356 fu_cv_sys_stat_statfs2_fsize=no,
357 fu_cv_sys_stat_statfs2_fsize=no)])
358 AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_fsize])
359 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
361 AC_DEFINE(STAT_STATFS2_FSIZE)
365 if test $space = no; then
367 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
368 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
370 #include <sys/types.h>
371 #ifdef HAVE_SYS_PARAM_H
372 #include <sys/param.h>
374 #ifdef HAVE_SYS_MOUNT_H
375 #include <sys/mount.h>
377 #ifdef HAVE_SYS_FS_TYPES_H
378 #include <sys/fs_types.h>
383 /* Ultrix's statfs returns 1 for success,
384 0 for not mounted, -1 for failure. */
385 exit (statfs (".", &fsd) != 1);
387 fu_cv_sys_stat_fs_data=yes,
388 fu_cv_sys_stat_fs_data=no,
389 fu_cv_sys_stat_fs_data=no)])
390 AC_MSG_RESULT([$fu_cv_sys_stat_fs_data])
391 if test $fu_cv_sys_stat_fs_data = yes; then
393 AC_DEFINE(STAT_STATFS2_FS_DATA)
398 dnl if test $space = no; then
400 dnl AC_TRY_CPP([#include <sys/filsys.h>],
401 dnl AC_DEFINE(STAT_READ_FILSYS) space=yes)
405 dnl AC_TRY_WARNINGS(INCLUDES, FUNCTION-BODY,
406 dnl ACTION-IF-NO-WARNINGS [, ACTION-IF-WARNINGS-OR-ERROR])
407 AC_DEFUN([AC_TRY_WARNINGS],
408 [cat > conftest.$ac_ext <<EOF
409 dnl This sometimes fails to find confdefs.h, for some reason.
410 dnl [#]line __oline__ "[$]0"
411 [#]line __oline__ "configure"
412 #include "confdefs.h"
414 int main() { return 0; }
419 ac_compile_warn='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 2>&1'
420 if { if eval $ac_compile_warn; then :; else echo arning; fi; } | grep arning 1>&AC_FD_CC 2>&AC_FD_CC; then
421 ifelse([$4], , :, [rm -rf conftest*
423 ifelse([$3], , , [else
431 AC_DEFUN([AC_USE_SUNOS_CURSES], [
433 screen_manager="SunOS 4.x /usr/5include curses"
434 AC_MSG_RESULT([Using SunOS 4.x /usr/5include curses])
435 AC_DEFINE(USE_SUNOS_CURSES)
436 AC_DEFINE(NO_COLOR_CURSES)
437 AC_DEFINE(USE_SYSV_CURSES)
438 CPPFLAGS="$CPPFLAGS -I/usr/5include"
439 XCURSES="xcurses.o /usr/5lib/libcurses.a /usr/5lib/libtermcap.a"
440 AC_MSG_RESULT([Please note that some screen refreshs may fail])
441 AC_MSG_WARN([Reconsider using Slang])
444 AC_DEFUN([AC_USE_OSF1_CURSES], [
445 AC_MSG_RESULT([Using OSF1 curses])
447 screen_manager="OSF1 curses"
448 AC_DEFINE(NO_COLOR_CURSES)
449 AC_DEFINE(USE_SYSV_CURSES)
451 LIBS="$LIBS -lcurses"
454 AC_DEFUN([AC_USE_SYSV_CURSES], [
455 AC_MSG_RESULT([Using SysV curses])
456 AC_DEFINE(USE_SYSV_CURSES)
459 screen_manager="SysV/curses"
460 LIBS="$LIBS -lcurses"
463 AC_DEFUN([AC_USE_TERMINFO], [
464 AC_DEFINE(SLANG_TERMINFO)
465 AC_MSG_RESULT([Using SLang screen manager/terminfo])
466 slang_term=" with terminfo"
469 AC_DEFUN([AC_USE_TERMCAP], [
470 AC_MSG_RESULT([Using SLang screen manager/termcap])
471 AC_DEFINE(USE_TERMCAP)
472 dnl Check with $LIBS at the end so that it works with ELF libs.
473 AC_CHECK_LIB(termcap, tgoto, LIBS="$LIBS -ltermcap", , $LIBS)
474 slang_term=" with termcap"
477 AC_DEFUN([AC_WITH_SLANG], [
478 AC_DEFINE(HAVE_SLANG)
480 if $slang_use_system_installed_lib
482 AC_DEFINE(HAVE_SYSTEM_SLANG)
484 screen_manager="SLang (system-installed library)"
485 AC_MSG_RESULT([Using system installed SLang library])
491 #ifdef SLANG_H_INSIDE_SLANG_DIR
492 #include <slang/slang.h>
501 [LIBS="$ac_save_LIBS"; AC_USE_TERMINFO],
502 [LIBS="$ac_save_LIBS"; AC_USE_TERMCAP])
504 MCCPPFLAGS="$MCCPPFLAGS -I\$(slangdir)"
505 LIBSLANG="libmcslang.a"
506 screen_manager="SLang"
508 CPPFLAGS="$CPPFLAGS -I../slang"
509 fastdepslang=fastdepslang
513 /*) ln -sf $srcdir/slang/slang-mc.h slang/slang.h;;
514 *) ln -sf ../$srcdir/slang/slang-mc.h slang/slang.h;;
520 for dir in /usr/lib /usr/share/lib /usr/local/lib /lib \
521 /usr/local/share /usr/share
523 if test -d $dir/terminfo; then
528 if $use_terminfo; then
536 AC_DEFUN([AC_WITH_EDIT], [
537 AC_DEFINE(USE_INTERNAL_EDIT)
538 LIBEDIT_A="libedit.a"
542 AC_MSG_RESULT([will call internal editor])
545 AC_DEFUN([AC_EXT2_UNDEL], [
547 if test "$ext2fs_undel" = yes; then
548 AC_MSG_RESULT([With ext2fs file recovery code])
549 vfs_flags="${vfs_flags}, undelfs"
550 undelfs_o="undelfs.o"
551 LIBS="$LIBS $EXT2FS_UNDEL_LIBS"
553 AC_MSG_WARN([No ext2fs file recovery code])
558 dnl Parameters: directory filename LIBS_append CPPFLAGS_append nicename
560 AC_DEFUN([AC_NCURSES], [
565 AC_MSG_RESULT([Found ncurses on $1/$2])
567 CPPFLAGS="$CPPFLAGS $4"
570 AC_DEFINE(USE_NCURSES)