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)
120 if test -z "$list_mounted_fs"; then
121 AC_MSG_WARN([could not determine how to read list of mounted fs])
122 CPPFLAGS="$CPPFLAGS -DNO_INFOMOUNT"
127 if test -z "$list_mounted_fs"; then
128 # DEC Alpha running OSF/1.
129 AC_MSG_CHECKING([for getfsstat function])
130 AC_CACHE_VAL(fu_cv_sys_mounted_getsstat,
132 #include <sys/types.h>
133 #include <sys/mount.h>
134 #include <sys/fs_types.h>],
135 [struct statfs *stats;
136 numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); ],
137 fu_cv_sys_mounted_getsstat=yes,
138 fu_cv_sys_mounted_getsstat=no)])
139 AC_MSG_RESULT([$fu_cv_sys_mounted_getsstat])
140 if test $fu_cv_sys_mounted_getsstat = yes; then
141 list_mounted_fs=found
142 AC_DEFINE(MOUNTED_GETFSSTAT)
146 if test -z "$list_mounted_fs"; then
148 AC_MSG_CHECKING([for mntctl function and struct vmount])
149 AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
150 [AC_TRY_CPP([#include <fshelp.h>],
151 fu_cv_sys_mounted_vmount=yes,
152 fu_cv_sys_mounted_vmount=no)])
153 AC_MSG_RESULT([$fu_cv_sys_mounted_vmount])
154 if test $fu_cv_sys_mounted_vmount = yes; then
155 list_mounted_fs=found
156 AC_DEFINE(MOUNTED_VMOUNT)
160 if test -z "$list_mounted_fs"; then
162 AC_MSG_CHECKING([for existence of three headers])
163 AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
165 #include <sys/statfs.h>
166 #include <sys/fstyp.h>
167 #include <mnttab.h>],
168 fu_cv_sys_mounted_fread_fstyp=yes,
169 fu_cv_sys_mounted_fread_fstyp=no)])
170 AC_MSG_RESULT([$fu_cv_sys_mounted_fread_fstyp])
171 if test $fu_cv_sys_mounted_fread_fstyp = yes; then
172 list_mounted_fs=found
173 AC_DEFINE(MOUNTED_FREAD_FSTYP)
177 if test -z "$list_mounted_fs"; then
178 # 4.4BSD and DEC OSF/1.
179 AC_MSG_CHECKING([for getmntinfo function])
180 AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
183 if test $ac_cv_func_getmntinfo = yes; then
184 AC_EGREP_HEADER(f_type;, sys/mount.h,
188 && fu_cv_sys_mounted_getmntinfo=yes \
189 || fu_cv_sys_mounted_getmntinfo=no
191 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntinfo])
192 if test $fu_cv_sys_mounted_getmntinfo = yes; then
193 list_mounted_fs=found
194 AC_DEFINE(MOUNTED_GETMNTINFO)
195 AC_MSG_CHECKING([if struct statfs has f_fstypename])
196 AC_CACHE_VAL(fu_cv_sys_mounted_f_fstypename,
198 AC_EGREP_HEADER(f_type;, sys/mount.h, ok=yes, ok=)
200 && fu_cv_sys_mounted_f_fstypename=yes \
201 || fu_cv_sys_mounted_f_fstypename=no
203 AC_MSG_RESULT([$fu_cv_sys_mounted_f_fstypename])
204 if test $fu_cv_sys_mounted_f_fstypename = yes; then
205 AC_DEFINE(HAVE_F_FSTYPENAME)
210 if test -z "$list_mounted_fs"; then
212 AC_MSG_CHECKING([for getmnt function])
213 AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
215 #include <sys/fs_types.h>
216 #include <sys/mount.h>],
217 fu_cv_sys_mounted_getmnt=yes,
218 fu_cv_sys_mounted_getmnt=no)])
219 AC_MSG_RESULT([$fu_cv_sys_mounted_getmnt])
220 if test $fu_cv_sys_mounted_getmnt = yes; then
221 list_mounted_fs=found
222 AC_DEFINE(MOUNTED_GETMNT)
226 if test -z "$list_mounted_fs"; then
228 AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
229 AC_CACHE_VAL(fu_cv_sys_mounted_fread,
230 [AC_TRY_CPP([#include <mnttab.h>],
231 fu_cv_sys_mounted_fread=yes,
232 fu_cv_sys_mounted_fread=no)])
233 AC_MSG_RESULT([$fu_cv_sys_mounted_fread])
234 if test $fu_cv_sys_mounted_fread = yes; then
235 list_mounted_fs=found
236 AC_DEFINE(MOUNTED_FREAD)
240 if test -z "$list_mounted_fs"; then
241 AC_MSG_WARN([could not determine how to read list of mounted fs])
242 CPPFLAGS="$CPPFLAGS -DNO_INFOMOUNT"
243 # FIXME -- no need to abort building the whole package
244 # Can't build mountlist.c or anything that needs its functions
247 dnl This configure.in code has been stolen from GNU fileutils-3.12. Its
248 dnl job is to detect a method to get file system information.
250 AC_CHECKING([how to get filesystem space usage])
253 # Here we'll compromise a little (and perform only the link test)
254 # since it seems there are no variants of the statvfs function.
255 if test $space = no; then
257 AC_CHECK_FUNCS(statvfs)
258 if test $ac_cv_func_statvfs = yes; then
260 AC_DEFINE(STAT_STATVFS)
264 if test $space = no; then
265 # DEC Alpha running OSF/1
266 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
267 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
269 #include <sys/param.h>
270 #include <sys/types.h>
271 #include <sys/mount.h>
276 exit (statfs (".", &fsd, sizeof (struct statfs)));
278 fu_cv_sys_stat_statfs3_osf1=yes,
279 fu_cv_sys_stat_statfs3_osf1=no,
280 fu_cv_sys_stat_statfs3_osf1=no)])
281 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
282 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
284 AC_DEFINE(STAT_STATFS3_OSF1)
288 if test $space = no; then
290 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)])
291 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
293 #ifdef HAVE_SYS_PARAM_H
294 #include <sys/param.h>
296 #ifdef HAVE_SYS_MOUNT_H
297 #include <sys/mount.h>
299 #ifdef HAVE_SYS_VFS_H
306 exit (statfs (".", &fsd));
308 fu_cv_sys_stat_statfs2_bsize=yes,
309 fu_cv_sys_stat_statfs2_bsize=no,
310 fu_cv_sys_stat_statfs2_bsize=no)])
311 AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_bsize])
312 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
314 AC_DEFINE(STAT_STATFS2_BSIZE)
318 if test $space = no; then
320 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
321 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
322 [AC_TRY_RUN([#include <sys/types.h>
323 #include <sys/statfs.h>
327 exit (statfs (".", &fsd, sizeof fsd, 0));
329 fu_cv_sys_stat_statfs4=yes,
330 fu_cv_sys_stat_statfs4=no,
331 fu_cv_sys_stat_statfs4=no)])
332 AC_MSG_RESULT([$fu_cv_sys_stat_statfs4])
333 if test $fu_cv_sys_stat_statfs4 = yes; then
335 AC_DEFINE(STAT_STATFS4)
339 if test $space = no; then
341 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
342 member (4.4BSD and NetBSD)])
343 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
344 [AC_TRY_RUN([#include <sys/types.h>
345 #ifdef HAVE_SYS_PARAM_H
346 #include <sys/param.h>
348 #ifdef HAVE_SYS_MOUNT_H
349 #include <sys/mount.h>
355 exit (statfs (".", &fsd));
357 fu_cv_sys_stat_statfs2_fsize=yes,
358 fu_cv_sys_stat_statfs2_fsize=no,
359 fu_cv_sys_stat_statfs2_fsize=no)])
360 AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_fsize])
361 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
363 AC_DEFINE(STAT_STATFS2_FSIZE)
367 if test $space = no; then
369 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
370 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
372 #include <sys/types.h>
373 #ifdef HAVE_SYS_PARAM_H
374 #include <sys/param.h>
376 #ifdef HAVE_SYS_MOUNT_H
377 #include <sys/mount.h>
379 #ifdef HAVE_SYS_FS_TYPES_H
380 #include <sys/fs_types.h>
385 /* Ultrix's statfs returns 1 for success,
386 0 for not mounted, -1 for failure. */
387 exit (statfs (".", &fsd) != 1);
389 fu_cv_sys_stat_fs_data=yes,
390 fu_cv_sys_stat_fs_data=no,
391 fu_cv_sys_stat_fs_data=no)])
392 AC_MSG_RESULT([$fu_cv_sys_stat_fs_data])
393 if test $fu_cv_sys_stat_fs_data = yes; then
395 AC_DEFINE(STAT_STATFS2_FS_DATA)
400 dnl if test $space = no; then
402 dnl AC_TRY_CPP([#include <sys/filsys.h>],
403 dnl AC_DEFINE(STAT_READ_FILSYS) space=yes)
407 dnl AC_TRY_WARNINGS(INCLUDES, FUNCTION-BODY,
408 dnl ACTION-IF-NO-WARNINGS [, ACTION-IF-WARNINGS-OR-ERROR])
409 AC_DEFUN([AC_TRY_WARNINGS],
410 [cat > conftest.$ac_ext <<EOF
411 dnl This sometimes fails to find confdefs.h, for some reason.
412 dnl [#]line __oline__ "[$]0"
413 [#]line __oline__ "configure"
414 #include "confdefs.h"
416 int main() { return 0; }
421 ac_compile_warn='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 2>&1'
422 if { if eval $ac_compile_warn; then :; else echo arning; fi; } | grep arning 1>&AC_FD_CC 2>&AC_FD_CC; then
423 ifelse([$4], , :, [rm -rf conftest*
425 ifelse([$3], , , [else
433 dnl Find if make is GNU make.
434 AC_DEFUN([AC_PROG_GNU_MAKE],
435 [AC_MSG_CHECKING([whether we are using GNU make])
436 set dummy ${MAKE-make}; ac_make=[$]2
437 AC_CACHE_VAL(ac_cv_prog_gnu_make,
438 [cat > conftestmake <<\EOF
442 if ${MAKE-make} --version -f conftestmake 2>/dev/null | grep GNU >/dev/null 2>&1; then
443 ac_cv_prog_gnu_make=yes
445 ac_cv_prog_gnu_make=no
447 rm -f conftestmake])dnl
448 if test $ac_cv_prog_gnu_make = yes; then
450 GNU_MAKE="GNU_MAKE=yes"
455 AC_SUBST([GNU_MAKE])dnl
458 AC_DEFUN([AC_USE_SUNOS_CURSES], [
460 screen_manager="SunOS 4.x /usr/5include curses"
461 AC_MSG_RESULT([Using SunOS 4.x /usr/5include curses])
462 AC_DEFINE(USE_SUNOS_CURSES)
463 AC_DEFINE(NO_COLOR_CURSES)
464 AC_DEFINE(USE_SYSV_CURSES)
465 CPPFLAGS="$CPPFLAGS -I/usr/5include"
466 XCURSES="xcurses.o /usr/5lib/libcurses.a /usr/5lib/libtermcap.a"
467 AC_MSG_RESULT([Please note that some screen refreshs may fail])
468 AC_MSG_WARN([Reconsider using Slang])
471 AC_DEFUN([AC_USE_OSF1_CURSES], [
472 AC_MSG_RESULT([Using OSF1 curses])
474 screen_manager="OSF1 curses"
475 AC_DEFINE(NO_COLOR_CURSES)
476 AC_DEFINE(USE_SYSV_CURSES)
478 LIBS="$LIBS -lcurses"
481 AC_DEFUN([AC_USE_SYSV_CURSES], [
482 AC_MSG_RESULT([Using SysV curses])
483 AC_DEFINE(USE_SYSV_CURSES)
486 screen_manager="SysV/curses"
487 LIBS="$LIBS -lcurses"
490 AC_DEFUN([AC_USE_TERMINFO], [
491 AC_DEFINE(SLANG_TERMINFO)
492 AC_MSG_RESULT([Using SLang screen manager/terminfo])
493 slang_term=" with terminfo"
496 AC_DEFUN([AC_USE_TERMCAP], [
497 AC_MSG_RESULT([Using SLang screen manager/termcap])
498 AC_DEFINE(USE_TERMCAP)
499 dnl Check with $LIBS at the end so that it works with ELF libs.
500 AC_CHECK_LIB(termcap, tgoto, LIBS="$LIBS -ltermcap", , $LIBS)
501 slang_term=" with termcap"
504 AC_DEFUN([AC_WITH_SLANG], [
505 AC_DEFINE(HAVE_SLANG)
507 if $slang_use_system_installed_lib
509 AC_DEFINE(HAVE_SYSTEM_SLANG)
511 screen_manager="SLang (system-installed library)"
512 AC_MSG_RESULT([Using system installed SLang library])
518 #ifdef SLANG_H_INSIDE_SLANG_DIR
519 #include <slang/slang.h>
528 [LIBS="$ac_save_LIBS"; AC_USE_TERMINFO],
529 [LIBS="$ac_save_LIBS"; AC_USE_TERMCAP])
531 MCCPPFLAGS="$MCCPPFLAGS -I\$(slangdir)"
532 LIBSLANG="libmcslang.a"
533 screen_manager="SLang"
535 CPPFLAGS="$CPPFLAGS -I../slang"
536 fastdepslang=fastdepslang
540 /*) ln -sf $srcdir/slang/slang-mc.h slang/slang.h;;
541 *) ln -sf ../$srcdir/slang/slang-mc.h slang/slang.h;;
547 for dir in /usr/lib /usr/share/lib /usr/local/lib /lib \
548 /usr/local/share /usr/share
550 if test -d $dir/terminfo; then
555 if $use_terminfo; then
563 AC_DEFUN([AC_WITH_EDIT], [
564 AC_DEFINE(USE_INTERNAL_EDIT)
565 LIBEDIT_A="libedit.a"
569 AC_MSG_RESULT([will call internal editor])
572 AC_DEFUN([AC_EXT2_UNDEL], [
574 if test "$ext2fs_undel" = yes; then
575 AC_MSG_RESULT([With ext2fs file recovery code])
576 vfs_flags="${vfs_flags}, undelfs"
577 undelfs_o="undelfs.o"
578 LIBS="$LIBS $EXT2FS_UNDEL_LIBS"
580 AC_MSG_WARN([No ext2fs file recovery code])
585 dnl Parameters: directory filename LIBS_append CPPFLAGS_append nicename
587 AC_DEFUN([AC_NCURSES], [
592 AC_MSG_RESULT([Found ncurses on $1/$2])
594 CPPFLAGS="$CPPFLAGS $4"
597 AC_DEFINE(USE_NCURSES)