update
[midnight-commander.git] / mc-aclocal.m4
blobf55851b0843ce2e3deeeeca2baead95d3067af62
1 dnl
2 dnl XView & SlingShot library checking
3 dnl (c) 1995 Jakub Jelinek
4 dnl
6 dnl Set xview_includes, xview_libraries, and no_xview (initially yes).
7 dnl Also sets xview_no_private_headers to yes if there are no xview_private
8 dnl headers in the system.
9 AC_DEFUN(AC_PATH_XVIEW,
11 no_xview=yes
12 AC_ARG_WITH(xview, [--with-xview              Use the XView toolkit],no_xview=)
14 AC_ARG_WITH(xview-includes, [--with-xview-includes=path  Specifies XView includes directory],
16 if test x$withval = xyes; then
17     AC_MSG_WARN(Usage is: --with-xview-includes=path)
18     xview_includes=NONE
19     no_xview=
20 else
21     xview_includes=$withval
25 xview_includes=NONE
26 ])dnl
27 AC_ARG_WITH(xview-libraries, [--with-xview-libraries=path  Specifies XView libraries directory],
29 if test x$withval = xyes; then
30     AC_MSG_WARN(Usage is: --with-xview-libraries=path)
31     xview_libraries=NONE
32     no_xview=
33 else
34     xview_libraries=$withval
38 xview_libraries=NONE
39 ])dnl
41 if test "$no_xview" != yes; then
42     if test "$no_x" = yes; then
43         no_xview=yes
44     fi
46 if test "$no_xview" != yes; then
47 AC_MSG_CHECKING(for XView)
48 if test x$xview_libraries = xNONE; then 
49     if test x$xview_includes = xNONE; then
50 AC_CACHE_VAL(ac_cv_path_xview,
52     no_xview=yes
53 AC_PATH_XVIEW_XMKMF
54     if test "x$no_xview" = xyes; then
55 AC_PATH_XVIEW_DIRECT
56     fi
57     if test "x$no_xview" = xyes; then
58         ac_cv_path_xview="no_xview=yes"
59     else
60         ac_cv_path_xview="no_xview= ac_xview_includes=$ac_xview_includes ac_xview_libraries=$ac_xview_libraries ac_xview_no_private_headers=$ac_xview_no_private_headers"
61     fi
62 ])dnl
63         eval "$ac_cv_path_xview"
64     fi
67 if test "x$no_xview" = xyes; then
68     AC_MSG_RESULT(no)
69 else
70     if test "x$xview_includes" = x || test "x$xview_includes" = xNONE; then
71         xview_includes=$ac_xview_includes
72     fi
73     if test "x$xview_libraries" = x || test "x$xview_libraries" = xNONE; then
74         xview_libraries=$ac_xview_libraries
75     fi
76     xview_no_private_headers=$ac_xview_no_private_headers
77     ac_cv_path_xview="no_xview= ac_xview_includes=$xview_includes ac_xview_libraries=$xview_libraries ac_xview_no_private_headers=$ac_xview_no_private_headers" 
78     if test "x$xview_libraries" != x; then
79         ac_msg_xview="libraries $xview_libraries"
80     else
81         ac_msg_xview=""
82     fi
83     if test "x$xview_includes" != x; then
84         if test "x$ac_msg_xview" != x; then
85             ac_msg_xview="$ac_msg_xview, "
86         fi
87         ac_msg_xview="${ac_msg_xview}headers $xview_includes"
88     fi
89     if test "x$xview_no_private_headers" = xyes; then
90         if test "x$ac_msg_xview" != x; then
91             ac_msg_xview="$ac_msg_xview, "
92         fi
93         ac_msg_xview="${ac_msg_xview}without xview_private headers"
94     fi  
95     AC_MSG_RESULT([$ac_msg_xview])
100 dnl Internal subroutine of AC_PATH_XVIEW
101 dnl Set ac_xview_includes, ac_xview_libraries, and no_xview (initially yes).
102 AC_DEFUN(AC_PATH_XVIEW_XMKMF,
103 [rm -fr conftestdir
104 if mkdir conftestdir; then
105   cd conftestdir
106   # Make sure to not put "make" in the Imakefile rules, since we grep it out.
107   cat > Imakefile <<'EOF'
108 #include <XView.tmpl>
109 acfindxv:
110         @echo 'ac_im_library_dest="${LIBRARY_DEST}"; ac_im_header_dest="${HEADER_DEST}"'
112   if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
113     no_xview=
114     # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
115     eval `make acfindxv 2>/dev/null | grep -v make`
116     # Screen out bogus values from the imake configuration.
117     if test -f "$ac_im_header_dest/xview/xview.h"; then
118         ac_xview_includes="$ac_im_header_dest"
119     else
120         no_xview=yes
121     fi
122     if test -d "$ac_im_library_dest"; then
123         ac_xview_libraries="$ac_im_library_dest"
124     else
125         no_xview=yes
126     fi
127   fi
128   if test "x$no_xview" != xyes; then
129     if test -f "$ac_xview_includes/xview_private/draw_impl.h"; then
130         ac_xview_no_private_headers=
131     else
132         ac_xview_no_private_headers=yes
133     fi
134   fi
135   cd ..
136   rm -fr conftestdir
140 dnl Internal subroutine of AC_PATH_XVIEW
141 dnl Set ac_xview_includes, ac_xview_libraries, and no_xview (initially yes).
142 AC_DEFUN(AC_PATH_XVIEW_DIRECT,
143 [test -z "$xview_direct_test_library" && xview_direct_test_library=xview
144 test -z "$xview_direct_test_function" && xview_direct_test_function=xv_unique_key
145 test -z "$xview_direct_test_include" && xview_direct_test_include=xview/xview.h
146 AC_TRY_CPP([#include <$xview_direct_test_include>],
147 [no_xview= ac_xview_includes=],
148 [  for ac_dir in               \
149     $OPENWINHOME/include    \
150     /usr/openwin/include      \
151     /usr/openwin/share/include \
152                               \
153     /usr/X11R6/include        \
154     /usr/X11R5/include        \
155     /usr/X11R4/include        \
156                               \
157     /usr/include/X11R6        \
158     /usr/include/X11R5        \
159     /usr/include/X11R4        \
160                               \
161     /usr/local/X11R6/include  \
162     /usr/local/X11R5/include  \
163     /usr/local/X11R4/include  \
164                               \
165     /usr/local/include/X11R6  \
166     /usr/local/include/X11R5  \
167     /usr/local/include/X11R4  \
168                               \
169     /usr/X11/include          \
170     /usr/include/X11          \
171     /usr/local/X11/include    \
172     /usr/local/include/X11    \
173                               \
174     /usr/X386/include         \
175     /usr/x386/include         \
176     /usr/XFree86/include/X11  \
177                               \
178     /usr/include              \
179     /usr/local/include        \
180     /usr/unsupported/include  \
181     /usr/athena/include       \
182     /usr/local/x11r5/include  \
183     /usr/lpp/Xamples/include  \
184     ; \
185   do
186     if test -r "$ac_dir/$xview_direct_test_include"; then
187       no_xview= ac_xview_includes=$ac_dir
188       break
189     fi
190   done])
192 if test "x$no_xview" != xyes; then
193     if test "x$ac_xview_includes" != x; then
194         if test -f "$ac_xview_includes/xview_private/draw_impl.h"; then
195             ac_xview_no_private_headers=
196         else
197             ac_xview_no_private_headers=yes
198         fi
199     else
200 AC_TRY_CPP([#include <xview_private/draw_impl.h>],
201 [ac_xview_no_private_headers=],[ac_xview_no_private_headers=yes])
202     fi
205 # Check for the libraries.
206 # See if we find them without any special options.
207 # Don't add to $LIBS permanently.
208 ac_save_LIBS="$LIBS"
209 ac_save_LDFLAGS="$LDFLAGS"
210 LDFLAGS="$LDFLAGS $X_LIBS"
211 LIBS="-l$xview_direct_test_library -lolgx $X_EXTRA_LIBS -lX11 $X_PRE_LIBS $LIBS"
212 AC_TRY_LINK([#include <$xview_direct_test_include>
213 ], [${xview_direct_test_function}()],
214 [LIBS="$ac_save_LIBS" LDFLAGS="$ac_save_LDFLAGS" no_xview= ac_xview_libraries=],
215 [LIBS="$ac_save_LIBS" LDFLAGS="$ac_save_LDFLAGS"
216 # First see if replacing the include by lib works.
217 for ac_dir in `echo "$ac_xview_includes" | sed s/include/lib/` \
218     $OPENWINHOME/lib    \
219     $OPENWINHOME/share/lib \
220     /usr/openwin/lib      \
221     /usr/openwin/share/lib \
222                           \
223     /usr/X11R6/lib        \
224     /usr/X11R5/lib        \
225     /usr/X11R4/lib        \
226                           \
227     /usr/lib/X11R6        \
228     /usr/lib/X11R5        \
229     /usr/lib/X11R4        \
230                           \
231     /usr/local/X11R6/lib  \
232     /usr/local/X11R5/lib  \
233     /usr/local/X11R4/lib  \
234                           \
235     /usr/local/lib/X11R6  \
236     /usr/local/lib/X11R5  \
237     /usr/local/lib/X11R4  \
238                           \
239     /usr/X11/lib          \
240     /usr/lib/X11          \
241     /usr/local/X11/lib    \
242     /usr/local/lib/X11    \
243                           \
244     /usr/X386/lib         \
245     /usr/x386/lib         \
246     /usr/XFree86/lib/X11  \
247                           \
248     /usr/lib              \
249     /usr/local/lib        \
250     /usr/unsupported/lib  \
251     /usr/athena/lib       \
252     /usr/local/x11r5/lib  \
253     /usr/lpp/Xamples/lib  \
254     ; \
256   for ac_extension in a so sl; do
257     if test -r $ac_dir/lib${xview_direct_test_library}.$ac_extension; then
258       no_xview= ac_xview_libraries=$ac_dir
259       break 2
260     fi
261   done
262 done])])
264 dnl Substitute XVIEW_LIBS and XVIEW_CFLAGS and 
265 dnl HAVE_XVIEW, which is either yes or no.
266 dnl Both contain X_LIBS resp. X_CFLAGS inside
267 dnl Also substitutes HAVE_XVIEW_PRIVATE_HEADERS
268 dnl if there are xview_private headers in the system
269 AC_DEFUN(AC_PATH_XVIEW_XTRA,
270 [AC_REQUIRE([AC_PATH_XVIEW])dnl
271 if test "$no_xview" = yes; then 
272   # Not all programs may use this symbol, but it does not hurt to define it.
273   XVIEW_CFLAGS="$X_CFGLAGS $XVIEW_CFLAGS -DXVIEW_MISSING"
274 else
275   if test -n "$xview_includes"; then
276     XVIEW_CFLAGS="$X_CFLAGS $XVIEW_CFGLAGS"
277     if test "$xview_includes" != "$x_includes"; then
278       XVIEW_CPPFLAGS="-I$xview_includes"
279     fi
280   fi
282   # It would be nice to have a more robust check for the -R ld option than
283   # just checking for Solaris.
284   # It would also be nice to do this for all -L options, not just this one.
285   if test -n "$xview_libraries"; then
286     if test "$xview_libraries" = "$x_libraries"; then
287       XVIEW_LIBS="$X_LIBS $XVIEW_LIBS"
288     else
289       XVIEW_LIBS="$X_LIBS $XVIEW_LIBS -L$xview_libraries"
290       if test "`(uname) 2>/dev/null`" = SunOS &&
291         uname -r | grep '^5' >/dev/null; then
292         XVIEW_LIBS="$XVIEW_LIBS -R$xview_libraries"
293       fi
294     fi
295   fi
297 if test "x$no_xview" = xyes; then
298   HAVE_XVIEW=no
299 else
300   HAVE_XVIEW=yes
302 if test "x$xview_no_private_headers" = xyes; then
303   HAVE_XVIEW_PRIVATE_HEADERS=no
304 else
305   HAVE_XVIEW_PRIVATE_HEADERS=yes
307 AC_SUBST(XVIEW_CFLAGS)dnl
308 AC_SUBST(XVIEW_CPPFLAGS)dnl
309 AC_SUBST(XVIEW_LIBS)dnl
310 AC_SUBST(HAVE_XVIEW)dnl
311 AC_SUBST(HAVE_XVIEW_PRIVATE_HEADERS)dnl
312 ])dnl
314 dnl Internal subroutine of AC_PATH_SLINGSHOT
315 AC_DEFUN(AC_PATH_SLINGSHOT_DIRECT,
317 AC_TRY_CPP([#include <sspkg/rectobj.h>],[no_ss= ac_ss_includes=],
318 [  for ac_dir in               \
319     $OPENWINHOME/include    \
320     /usr/openwin/include      \
321     /usr/openwin/share/include \
322                               \
323     /usr/X11R6/include        \
324     /usr/X11R5/include        \
325     /usr/X11R4/include        \
326                               \
327     /usr/include/X11R6        \
328     /usr/include/X11R5        \
329     /usr/include/X11R4        \
330                               \
331     /usr/local/X11R6/include  \
332     /usr/local/X11R5/include  \
333     /usr/local/X11R4/include  \
334                               \
335     /usr/local/include/X11R6  \
336     /usr/local/include/X11R5  \
337     /usr/local/include/X11R4  \
338                               \
339     /usr/X11/include          \
340     /usr/include/X11          \
341     /usr/local/X11/include    \
342     /usr/local/include/X11    \
343                               \
344     /usr/X386/include         \
345     /usr/x386/include         \
346     /usr/XFree86/include/X11  \
347                               \
348     /usr/include              \
349     /usr/local/include        \
350     /usr/unsupported/include  \
351     /usr/athena/include       \
352     /usr/local/x11r5/include  \
353     /usr/lpp/Xamples/include  \
354     ; \
355   do
356     if test -r "$ac_dir/sspkg/rectobj.h"; then
357       no_ss= ac_ss_includes=$ac_dir
358       break
359     fi
360   done])
362 # Check for the libraries.
363 # See if we find them without any special options.
364 # Don't add to $LIBS permanently.
365 ac_save_LIBS="$LIBS"
366 ac_save_LDFLAGS="$LDFLAGS"
367 LDFLAGS="$LDFLAGS $XVIEW_LIBS"
368 LIBS="-lsspkg -lm -lxview -lolgx $X_EXTRA_LIBS -lX11 $X_PRE_LIBS $LIBS"
369 AC_TRY_LINK([#include <sspkg/rectobj.h>
370 ], [rectobj_get_selected_list()],
371 [LIBS="$ac_save_LIBS" LDFLAGS="$ac_save_LDFLAGS" no_ss= ac_ss_libraries=],
372 [LIBS="$ac_save_LIBS" LDFLAGS="$ac_save_LDFLAGS"
373 # First see if replacing the include by lib works.
374 for ac_dir in `echo "$ac_ss_includes" | sed s/include/lib/` \
375     $OPENWINHOME/lib    \
376     $OPENWINHOME/share/lib \
377     /usr/openwin/lib      \
378     /usr/openwin/share/lib \
379                           \
380     /usr/X11R6/lib        \
381     /usr/X11R5/lib        \
382     /usr/X11R4/lib        \
383                           \
384     /usr/lib/X11R6        \
385     /usr/lib/X11R5        \
386     /usr/lib/X11R4        \
387                           \
388     /usr/local/X11R6/lib  \
389     /usr/local/X11R5/lib  \
390     /usr/local/X11R4/lib  \
391                           \
392     /usr/local/lib/X11R6  \
393     /usr/local/lib/X11R5  \
394     /usr/local/lib/X11R4  \
395                           \
396     /usr/X11/lib          \
397     /usr/lib/X11          \
398     /usr/local/X11/lib    \
399     /usr/local/lib/X11    \
400                           \
401     /usr/X386/lib         \
402     /usr/x386/lib         \
403     /usr/XFree86/lib/X11  \
404                           \
405     /usr/lib              \
406     /usr/local/lib        \
407     /usr/unsupported/lib  \
408     /usr/athena/lib       \
409     /usr/local/x11r5/lib  \
410     /usr/lpp/Xamples/lib  \
411     ; \
413   for ac_extension in a so sl; do
414     if test -r $ac_dir/libsspkg.$ac_extension; then
415       no_ss= ac_ss_libraries=$ac_dir
416       break 2
417     fi
418   done
419 done])])
421 dnl Set ss_includes, ss_libraries, and no_ss (initially yes).
422 AC_DEFUN(AC_PATH_SLINGSHOT,
423 [AC_REQUIRE([AC_PATH_XVIEW_XTRA])dnl
424 AC_MSG_CHECKING(for SlingShot)
425 AC_ARG_WITH(ss, [--with-ss         Use the SlingShot extension])
427 AC_ARG_WITH(ss-includes, [--with-ss-includes=path  Specifies SlingShot includes directory],
429 if test x$withval = xyes; then
430     AC_MSG_WARN(Usage is: --with-ss-includes=path)
431     ss_includes=NONE
432 else
433     ss_includes=$withval
437 ss_includes=NONE
438 ])dnl
439 AC_ARG_WITH(ss-libraries, [--with-ss-libraries=path  Specifies SlingShot libraries directory],
441 if test x$withval = xyes; then
442     AC_MSG_WARN(Usage is: --with-ss-libraries=path)
443     ss_libraries=NONE
444 else
445     ss_libraries=$withval
449 ss_libraries=NONE
450 ])dnl
452 if test "x$with_ss" = xno; then
453     no_ss=yes
454 else
455     if test "x$ss_includes" != xNONE && test "x$ss_libraries" != xNONE; then
456         no_ss=
457     else
458 AC_CACHE_VAL(ac_cv_path_ss,
460     no_ss=yes
461 AC_PATH_SLINGSHOT_DIRECT
462     if test "x$no_ss" = xyes; then
463         ac_cv_path_ss="ac_noss=yes"
464     else
465         ac_cv_path_ss="ac_ss_includes=$ac_ss_includes ac_ss_libraries=$ac_ss_libraries"
466     fi
467 ])dnl
468         eval "$ac_cv_path_ss"
469     fi
472 if test "x$no_ss" = xyes; then
473     AC_MSG_RESULT(no)
474 else
475     if test "x$ss_includes" = x || test "x$ss_includes" = xNONE; then
476         ss_includes=$ac_ss_includes
477     fi
478     if test "x$ss_libraries" = x || test "x$ss_libraries" = xNONE; then
479         ss_libraries=$ac_ss_libraries
480     fi
481     ac_cv_path_ss="no_ss= ac_ss_includes=$ss_includes ac_ss_libraries=$ss_libraries" 
482     if test "x$ss_libraries" = x; then
483         if test "x$ss_includes" = x; then
484             AC_MSG_RESULT(yes)
485         else
486             AC_MSG_RESULT([headers $ss_includes])
487         fi
488     else
489         if test "x$ss_includes" = x; then
490             AC_MSG_RESULT([libraries $ss_libraries])
491         else
492             AC_MSG_RESULT([libraries $ss_libraries, headers $ss_includes])
493         fi
494     fi
498 dnl Substitute SLINGSHOT_LIBS and SLINGSHOT_CFLAGS and 
499 dnl HAVE_SLINGSHOT, which is either yes or no.
500 dnl Both contain XVIEW_LIBS resp. XVIEW_CFLAGS inside
501 AC_DEFUN(AC_PATH_SLINGSHOT_XTRA,
502 [AC_REQUIRE([AC_PATH_SLINGSHOT])dnl
503 if test "$no_ss" = yes; then 
504   # Not all programs may use this symbol, but it does not hurt to define it.
505   SLINGSHOT_CFLAGS="$XVIEW_CFGLAGS $SLINGSHOT_CFLAGS -DSLINGSHOT_MISSING"
506 else
507   if test -n "$ss_includes"; then
508     SLINGSHOT_CFLAGS="$XVIEW_CFLAGS $SLINGSHOT_CFGLAGS -I$ss_includes"
509   fi
511   # It would be nice to have a more robust check for the -R ld option than
512   # just checking for Solaris.
513   # It would also be nice to do this for all -L options, not just this one.
514   if test -n "$ss_libraries"; then
515     SLINGSHOT_LIBS="$XVIEW_LIBS $SLINGSHOT_LIBS -L$ss_libraries"
516     if test "`(uname) 2>/dev/null`" = SunOS &&
517       uname -r | grep '^5' >/dev/null; then
518       SLINGSHOT_LIBS="$SLINGSHOT_LIBS -R$ss_libraries"
519     fi
520   fi
522 if test "x$no_ss" = xyes; then
523   HAVE_SLINGSHOT=no
524 else
525   HAVE_SLINGSHOT=yes
527 AC_SUBST(SLINGSHOT_CFLAGS)dnl
528 AC_SUBST(SLINGSHOT_LIBS)dnl
529 AC_SUBST(HAVE_SLINGSHOT)dnl
530 ])dnl
533 dnl XView library checking end
537 dnl Check for size of d_name dirent member
539 AC_DEFUN(AC_SHORT_D_NAME_LEN, [
540 AC_MSG_CHECKING(filename fits on dirent.d_name)
541 AC_CACHE_VAL(ac_cv_dnamesize, [
542 OCFLAGS="$CFLAGS"
543 CFLAGS="$CFLAGS -I$srcdir"
544 AC_TRY_RUN([
545 #include <src/fs.h>
547 main ()
549    struct dirent ddd;
551    if (sizeof (ddd.d_name) < 12)
552         exit (0);
553    else
554         exit (1); 
558     ac_cv_dnamesize="no"
559 ], [
560     ac_cv_dnamesize="yes"
561 ], [
562 # Cannot find out, so assume no
563     ac_cv_dnamesize="no"
565 CFLAGS="$OCFLAGS"
567 if test x$ac_cv_dnamesize = xno; then
568     AC_DEFINE(NEED_EXTRA_DIRENT_BUFFER)
570 AC_MSG_RESULT($ac_cv_dnamesize)
574 dnl Filesystem information detection
576 dnl To get information about the disk, mount points, etc.
579 AC_DEFUN(AC_GET_FS_INFO, [
580     AC_CHECK_HEADERS(fcntl.h sys/dustat.h sys/param.h sys/statfs.h sys/fstyp.h)
581     AC_CHECK_HEADERS(mnttab.h mntent.h utime.h sys/statvfs.h sys/vfs.h)
582     AC_CHECK_HEADERS(sys/mount.h sys/filsys.h sys/fs_types.h)
583     AC_CHECK_FUNCS(getmntinfo)
585     dnl This configure.in code has been stolen from GNU fileutils-3.12.  Its
586     dnl job is to detect a method to get list of mounted filesystems.
588     AC_MSG_CHECKING([for d_ino member in directory struct])
589     AC_CACHE_VAL(fu_cv_sys_d_ino_in_dirent,
590     [AC_TRY_LINK([
591 #include <sys/types.h>
592 #ifdef HAVE_DIRENT_H
593 # include <dirent.h>
594 #else /* not HAVE_DIRENT_H */
595 # define dirent direct
596 # ifdef HAVE_SYS_NDIR_H
597 #  include <sys/ndir.h>
598 # endif /* HAVE_SYS_NDIR_H */
599 # ifdef HAVE_SYS_DIR_H
600 #  include <sys/dir.h>
601 # endif /* HAVE_SYS_DIR_H */
602 # ifdef HAVE_NDIR_H
603 #  include <ndir.h>
604 # endif /* HAVE_NDIR_H */
605 #endif /* HAVE_DIRENT_H */
606     ],
607       [struct dirent dp; dp.d_ino = 0;],
608         fu_cv_sys_d_ino_in_dirent=yes,
609         fu_cv_sys_d_ino_in_dirent=no)])
610     AC_MSG_RESULT($fu_cv_sys_d_ino_in_dirent)
611     if test $fu_cv_sys_d_ino_in_dirent = yes; then
612       AC_DEFINE(D_INO_IN_DIRENT)
613     fi
615     # Determine how to get the list of mounted filesystems.
616     list_mounted_fs=
618     # If the getmntent function is available but not in the standard library,
619     # make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX).
620     AC_FUNC_GETMNTENT
622     if test $ac_cv_func_getmntent = yes; then
624       # This system has the getmntent function.
625       # Determine whether it's the one-argument variant or the two-argument one.
627       if test -z "$list_mounted_fs"; then
628         # SVR4
629         AC_MSG_CHECKING([for two-argument getmntent function])
630         AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
631         [AC_EGREP_HEADER(getmntent, sys/mnttab.h,
632           fu_cv_sys_mounted_getmntent2=yes,
633           fu_cv_sys_mounted_getmntent2=no)])
634         AC_MSG_RESULT($fu_cv_sys_mounted_getmntent2)
635         if test $fu_cv_sys_mounted_getmntent2 = yes; then
636           list_mounted_fs=found
637           AC_DEFINE(MOUNTED_GETMNTENT2)
638         fi
639       fi
641       if test -z "$list_mounted_fs"; then
642         # 4.3BSD, SunOS, HP-UX, Dynix, Irix
643         AC_MSG_CHECKING([for one-argument getmntent function])
644         AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
645                      [test $ac_cv_header_mntent_h = yes \
646                        && fu_cv_sys_mounted_getmntent1=yes \
647                        || fu_cv_sys_mounted_getmntent1=no])
648         AC_MSG_RESULT($fu_cv_sys_mounted_getmntent1)
649         if test $fu_cv_sys_mounted_getmntent1 = yes; then
650           list_mounted_fs=found
651           AC_DEFINE(MOUNTED_GETMNTENT1)
652         fi
653       fi
655       if test -z "$list_mounted_fs"; then
656         AC_WARN([could not determine how to read list of mounted fs])
657         CPPFLAGS="$CPPFLAGS -DNO_INFOMOUNT"
658       fi
660     fi
662     if test -z "$list_mounted_fs"; then
663       # DEC Alpha running OSF/1.
664       AC_MSG_CHECKING([for getfsstat function])
665       AC_CACHE_VAL(fu_cv_sys_mounted_getsstat,
666       [AC_TRY_LINK([
667 #include <sys/types.h>
668 #include <sys/mount.h>
669 #include <sys/fs_types.h>],
670       [struct statfs *stats;
671       numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); ],
672         fu_cv_sys_mounted_getsstat=yes,
673         fu_cv_sys_mounted_getsstat=no)])
674       AC_MSG_RESULT($fu_cv_sys_mounted_getsstat)
675       if test $fu_cv_sys_mounted_getsstat = yes; then
676         list_mounted_fs=found
677         AC_DEFINE(MOUNTED_GETFSSTAT)
678       fi
679     fi
681     if test -z "$list_mounted_fs"; then
682       # AIX.
683       AC_MSG_CHECKING([for mntctl function and struct vmount])
684       AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
685       [AC_TRY_CPP([#include <fshelp.h>],
686         fu_cv_sys_mounted_vmount=yes,
687         fu_cv_sys_mounted_vmount=no)])
688       AC_MSG_RESULT($fu_cv_sys_mounted_vmount)
689       if test $fu_cv_sys_mounted_vmount = yes; then
690         list_mounted_fs=found
691         AC_DEFINE(MOUNTED_VMOUNT)
692       fi
693     fi
695     if test -z "$list_mounted_fs"; then
696       # SVR3
697       AC_MSG_CHECKING([for existence of three headers])
698       AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
699         [AC_TRY_CPP([
700 #include <sys/statfs.h>
701 #include <sys/fstyp.h>
702 #include <mnttab.h>],
703                     fu_cv_sys_mounted_fread_fstyp=yes,
704                     fu_cv_sys_mounted_fread_fstyp=no)])
705       AC_MSG_RESULT($fu_cv_sys_mounted_fread_fstyp)
706       if test $fu_cv_sys_mounted_fread_fstyp = yes; then
707         list_mounted_fs=found
708         AC_DEFINE(MOUNTED_FREAD_FSTYP)
709       fi
710     fi
712     if test -z "$list_mounted_fs"; then
713       # 4.4BSD and DEC OSF/1.
714       AC_MSG_CHECKING([for getmntinfo function])
715       AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
716         [
717           ok=
718           if test $ac_cv_func_getmntinfo = yes; then
719             AC_EGREP_HEADER(f_type;, sys/mount.h,
720                             ok=yes)
721           fi
722           test -n "$ok" \
723               && fu_cv_sys_mounted_getmntinfo=yes \
724               || fu_cv_sys_mounted_getmntinfo=no
725         ])
726       AC_MSG_RESULT($fu_cv_sys_mounted_getmntinfo)
727       if test $fu_cv_sys_mounted_getmntinfo = yes; then
728         list_mounted_fs=found
729         AC_DEFINE(MOUNTED_GETMNTINFO)
730       fi
731     fi
733     # FIXME: add a test for netbsd-1.1 here
735     if test -z "$list_mounted_fs"; then
736       # Ultrix
737       AC_MSG_CHECKING([for getmnt function])
738       AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
739         [AC_TRY_CPP([
740 #include <sys/fs_types.h>
741 #include <sys/mount.h>],
742                     fu_cv_sys_mounted_getmnt=yes,
743                     fu_cv_sys_mounted_getmnt=no)])
744       AC_MSG_RESULT($fu_cv_sys_mounted_getmnt)
745       if test $fu_cv_sys_mounted_getmnt = yes; then
746         list_mounted_fs=found
747         AC_DEFINE(MOUNTED_GETMNT)
748       fi
749     fi
751     if test -z "$list_mounted_fs"; then
752       # SVR2
753     AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
754       AC_CACHE_VAL(fu_cv_sys_mounted_fread,
755         [AC_TRY_CPP([#include <mnttab.h>],
756                     fu_cv_sys_mounted_fread=yes,
757                     fu_cv_sys_mounted_fread=no)])
758       AC_MSG_RESULT($fu_cv_sys_mounted_fread)
759       if test $fu_cv_sys_mounted_fread = yes; then
760         list_mounted_fs=found
761         AC_DEFINE(MOUNTED_FREAD)
762       fi
763     fi
765     if test -z "$list_mounted_fs"; then
766       AC_MSG_WARN([could not determine how to read list of mounted fs])
767       CPPFLAGS="$CPPFLAGS -DNO_INFOMOUNT"
768       # FIXME -- no need to abort building the whole package
769       # Can't build mountlist.c or anything that needs its functions
770     fi
772 dnl This configure.in code has been stolen from GNU fileutils-3.12.  Its
773 dnl job is to detect a method to get file system information.
775     AC_CHECKING(how to get filesystem space usage)
776     space=no
778     # Here we'll compromise a little (and perform only the link test)
779     # since it seems there are no variants of the statvfs function.
780     if test $space = no; then
781       # SVR4
782       AC_CHECK_FUNCS(statvfs)
783       if test $ac_cv_func_statvfs = yes; then
784         space=yes
785         AC_DEFINE(STAT_STATVFS)
786       fi
787     fi
789     if test $space = no; then
790       # DEC Alpha running OSF/1
791       AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
792       AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
793       [AC_TRY_RUN([
794 #include <sys/param.h>
795 #include <sys/types.h>
796 #include <sys/mount.h>
797       main ()
798       {
799         struct statfs fsd;
800         fsd.f_fsize = 0;
801         exit (statfs (".", &fsd, sizeof (struct statfs)));
802       }],
803       fu_cv_sys_stat_statfs3_osf1=yes,
804       fu_cv_sys_stat_statfs3_osf1=no,
805       fu_cv_sys_stat_statfs3_osf1=no)])
806       AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
807       if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
808         space=yes
809         AC_DEFINE(STAT_STATFS3_OSF1)
810       fi
811     fi
813     if test $space = no; then
814     # AIX
815       AC_MSG_CHECKING([for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)])
816       AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
817       [AC_TRY_RUN([
818 #ifdef HAVE_SYS_PARAM_H
819 #include <sys/param.h>
820 #endif
821 #ifdef HAVE_SYS_MOUNT_H
822 #include <sys/mount.h>
823 #endif
824 #ifdef HAVE_SYS_VFS_H
825 #include <sys/vfs.h>
826 #endif
827       main ()
828       {
829       struct statfs fsd;
830       fsd.f_bsize = 0;
831       exit (statfs (".", &fsd));
832       }],
833       fu_cv_sys_stat_statfs2_bsize=yes,
834       fu_cv_sys_stat_statfs2_bsize=no,
835       fu_cv_sys_stat_statfs2_bsize=no)])
836       AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
837       if test $fu_cv_sys_stat_statfs2_bsize = yes; then
838         space=yes
839         AC_DEFINE(STAT_STATFS2_BSIZE)
840       fi
841     fi
843     if test $space = no; then
844     # SVR3
845       AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
846       AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
847       [AC_TRY_RUN([#include <sys/types.h>
848 #include <sys/statfs.h>
849       main ()
850       {
851       struct statfs fsd;
852       exit (statfs (".", &fsd, sizeof fsd, 0));
853       }],
854         fu_cv_sys_stat_statfs4=yes,
855         fu_cv_sys_stat_statfs4=no,
856         fu_cv_sys_stat_statfs4=no)])
857       AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
858       if test $fu_cv_sys_stat_statfs4 = yes; then
859         space=yes
860         AC_DEFINE(STAT_STATFS4)
861       fi
862     fi
864     if test $space = no; then
865     # 4.4BSD and NetBSD
866       AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
867     member (4.4BSD and NetBSD)])
868       AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
869       [AC_TRY_RUN([#include <sys/types.h>
870 #ifdef HAVE_SYS_PARAM_H
871 #include <sys/param.h>
872 #endif
873 #ifdef HAVE_SYS_MOUNT_H
874 #include <sys/mount.h>
875 #endif
876       main ()
877       {
878       struct statfs fsd;
879       fsd.f_fsize = 0;
880       exit (statfs (".", &fsd));
881       }],
882       fu_cv_sys_stat_statfs2_fsize=yes,
883       fu_cv_sys_stat_statfs2_fsize=no,
884       fu_cv_sys_stat_statfs2_fsize=no)])
885       AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
886       if test $fu_cv_sys_stat_statfs2_fsize = yes; then
887         space=yes
888         AC_DEFINE(STAT_STATFS2_FSIZE)
889       fi
890     fi
892     if test $space = no; then
893       # Ultrix
894       AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
895       AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
896       [AC_TRY_RUN([
897 #include <sys/types.h>
898 #ifdef HAVE_SYS_PARAM_H
899 #include <sys/param.h>
900 #endif
901 #ifdef HAVE_SYS_MOUNT_H
902 #include <sys/mount.h>
903 #endif
904 #ifdef HAVE_SYS_FS_TYPES_H
905 #include <sys/fs_types.h>
906 #endif
907       main ()
908       {
909       struct fs_data fsd;
910       /* Ultrix's statfs returns 1 for success,
911          0 for not mounted, -1 for failure.  */
912       exit (statfs (".", &fsd) != 1);
913       }],
914       fu_cv_sys_stat_fs_data=yes,
915       fu_cv_sys_stat_fs_data=no,
916       fu_cv_sys_stat_fs_data=no)])
917       AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
918       if test $fu_cv_sys_stat_fs_data = yes; then
919         space=yes
920         AC_DEFINE(STAT_STATFS2_FS_DATA)
921       fi
922     fi
924     dnl Not supported
925     dnl if test $space = no; then
926     dnl # SVR2
927     dnl AC_TRY_CPP([#include <sys/filsys.h>],
928     dnl   AC_DEFINE(STAT_READ_FILSYS) space=yes)
929     dnl fi
932 dnl AC_CHECK_HEADER_IN_PATH(HEADER-FILE, ADDITIONAL_PATH, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
933 AC_DEFUN(AC_CHECK_HEADER_IN_PATH,
934 [dnl Do the transliteration at runtime so arg 1 can be a shell variable.
935 ac_safe=`echo "$1" | tr './\055' '___'`
936 AC_MSG_CHECKING([for $1])
937 AC_CACHE_VAL(ac_cv_header_in_path_$ac_safe,
938 [AC_TRY_CPP([#include <$1>], ac_header_in_path=yes, [
939   ac_header_in_path_found=no
940   for ac_header_in_path_value in [$2]; do
941     ac_in_path_save_CPPFLAGS=$CPPFLAGS
942     CPPFLAGS="$CPPFLAGS -I$ac_header_in_path_value"
943     AC_TRY_CPP([#include <$1>], [
944 ac_header_in_path_found=yes
945 ac_header_in_path=$ac_header_in_path_value
946 ], )
947     CPPFLAGS=$ac_in_path_save_CPPFLAGS
948     if test x$ac_header_in_path_found = xyes; then
949         break
950     fi
951   done
952   if test $ac_header_in_path_found = xno; then
953     ac_header_in_path=no
954   fi
956   eval "ac_cv_header_in_path_$ac_safe=$ac_header_in_path"
957 ])dnl
958 eval "ac_header_in_path=`echo '$ac_cv_header_in_path_'$ac_safe`"
959 if test "$ac_header_in_path" = no; then
960   AC_MSG_RESULT(no)
961 ifelse([$4], , , [$4
962 ])dnl
963 else
964   if test -n "$ac_header_in_path"; then
965       AC_MSG_RESULT($ac_header_in_path)
966   else
967       AC_MSG_RESULT(yes)
968   fi
969   if test x$ac_header_in_path = xyes; then
970       ac_header_in_path=
971       eval "ac_cv_header_in_path_$ac_safe="
972   fi
973   ifelse([$3], , , [$3
974 ])dnl
978 dnl Hope I can check for libXpm only in the X11 library directory
979 AC_DEFUN(AC_LIB_XPM, [
980 AC_MSG_CHECKING(for -lXpm)
981 AC_CACHE_VAL(ac_cv_has_xpm, [
982     ac_cv_has_xpm=no
983     if test x$no_x = xyes; then
984         :
985     else
986         has_xpm_save_LIBS=$LIBS
987         LIBS="-lXpm $X_EXTRA_LIBS -lX11 $X_PRE_LIBS $LIBS"
988         has_xpm_save_LDFLAGS=$LDFLAGS
989         LDFLAGS="$LDFLAGS $X_LIBS"
990         has_xpm_save_CFLAGS=$CFLAGS
991         CFLAGS="$CFLAGS $X_CFLAGS"
992         AC_TRY_LINK([
993 #include <X11/Xlib.h>
994 #include <X11/xpm.h>
995 ], [XpmLibraryVersion();], ac_cv_has_xpm=yes)
996         CFLAGS="$has_xpm_save_CFLAGS"
997         LDFLAGS="$has_xpm_save_LDFLAGS"
998         LIBS="$has_xpm_save_LIBS"
999     fi
1001 AC_MSG_RESULT($ac_cv_has_xpm)
1004 dnl Hope I can check for libXext only in the X11 library directory
1005 dnl and shape.h will be in X11/extensions/shape.h
1006 AC_DEFUN(AC_X_SHAPE_EXTENSION, [
1007 AC_MSG_CHECKING(for X11 non-rectangular shape extension)
1008 AC_CACHE_VAL(ac_cv_has_shape, [
1009     ac_cv_has_shape=no
1010     if test x$no_x = xyes; then
1011         :
1012     else
1013         has_shape_save_LIBS=$LIBS
1014         LIBS="-lXext $X_EXTRA_LIBS -lX11 $X_PRE_LIBS $LIBS"
1015         has_shape_save_LDFLAGS=$LDFLAGS
1016         LDFLAGS="$LDFLAGS $X_LIBS"
1017         has_shape_save_CFLAGS=$CFLAGS
1018         CFLAGS="$CFLAGS $X_CFLAGS"
1019         AC_TRY_LINK([
1020 #include <X11/Xlib.h>
1021 #include <X11/Xutil.h>
1022 #include <X11/extensions/shape.h>
1023 ], [
1024 Display *dpy = (Display *)NULL;
1025 int a, b;
1026 XShapeQueryVersion(dpy,&a,&b);
1027 ], ac_cv_has_shape=yes)
1028         CFLAGS="$has_shape_save_CFLAGS"
1029         LDFLAGS="$has_shape_save_LDFLAGS"
1030         LIBS="$has_shape_save_LIBS"
1031     fi
1033 AC_MSG_RESULT($ac_cv_has_shape)
1036 dnl AC_TRY_WARNINGS(INCLUDES, FUNCTION-BODY,
1037 dnl             ACTION-IF-NO-WARNINGS [, ACTION-IF-WARNINGS-OR-ERROR])
1038 AC_DEFUN(AC_TRY_WARNINGS,
1039 [cat > conftest.$ac_ext <<EOF
1040 dnl This sometimes fails to find confdefs.h, for some reason.
1041 dnl [#]line __oline__ "[$]0"
1042 [#]line __oline__ "configure"
1043 #include "confdefs.h"
1044 [$1]
1045 int main() { return 0; }
1046 int t() {
1047 [$2]
1048 ; return 0; }
1050 ac_compile_warn='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 2>&1'
1051 if { if eval $ac_compile_warn; then :; else echo arning; fi; } | grep arning 1>&AC_FD_CC 2>&AC_FD_CC; then
1052   ifelse([$4], , :, [rm -rf conftest*
1053   $4])
1054 ifelse([$3], , , [else
1055   rm -rf conftest*
1056   $3
1057 ])dnl
1059 rm -f conftest*]
1062 dnl Find if make is GNU make.
1063 AC_DEFUN(AC_PROG_GNU_MAKE,
1064 [AC_MSG_CHECKING(whether we are using GNU make)
1065 set dummy ${MAKE-make}; ac_make=[$]2
1066 AC_CACHE_VAL(ac_cv_prog_gnu_make,
1067 [cat > conftestmake <<\EOF
1068 all:
1069         @echo ' '
1071 if ${MAKE-make} --version -f conftestmake 2>/dev/null | grep GNU >/dev/null 2>&1; then
1072   ac_cv_prog_gnu_make=yes
1073 else
1074   ac_cv_prog_gnu_make=no
1076 rm -f conftestmake])dnl
1077 if test $ac_cv_prog_gnu_make = yes; then
1078   AC_MSG_RESULT(yes)
1079   GNU_MAKE="GNU_MAKE=yes"
1080 else
1081   AC_MSG_RESULT(no)
1082   GNU_MAKE= 
1084 AC_SUBST([GNU_MAKE])dnl
1087 dnl 
1088 dnl Local additions to Autoconf macros.
1089 dnl Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc.
1090 dnl François Pinard <pinard@iro.umontreal.ca>, 1992.
1092 dnl ## ----------------------------------------- ##
1093 dnl ## ANSIfy the C compiler whenever possible.  ##
1094 dnl ## ----------------------------------------- ##
1096 dnl @defmac AC_PROG_CC_STDC
1097 dnl @maindex PROG_CC_STDC
1098 dnl @ovindex CC
1099 dnl If the C compiler in not in ANSI C mode by default, try to add an option
1100 dnl to output variable @code{CC} to make it so.  This macro tries various
1101 dnl options that select ANSI C on some system or another.  It considers the
1102 dnl compiler to be in ANSI C mode if it defines @code{__STDC__} to 1 and
1103 dnl handles function prototypes correctly.
1104 dnl 
1105 dnl If you use this macro, you should check after calling it whether the C
1106 dnl compiler has been set to accept ANSI C; if not, the shell variable
1107 dnl @code{ac_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
1108 dnl code in ANSI C, you can make an un-ANSIfied copy of it by using the
1109 dnl program @code{ansi2knr}, which comes with Ghostscript.
1110 dnl @end defmac
1112 dnl Unixware 2.1 defines __STDC__ to 1 only when some useful extensions are
1113 dnl turned off. They are on by default and turned off with the option -Xc. 
1114 dnl The consequence is that __STDC__ is defined but e.g. struct sigaction
1115 dnl is not defined. -- Norbert 
1117 dnl Below all tests but the one for HP-UX are removed. They caused more
1118 dnl problems than they soved, sigh. -- Norbert
1120 AC_DEFUN(MC_HPUX_PROG_CC_STDC,
1121 [AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
1122 AC_CACHE_VAL(ac_cv_prog_cc_stdc,
1123 [ac_cv_prog_cc_stdc=no
1124 ac_save_CFLAGS="$CFLAGS"
1125 dnl Don't try gcc -ansi; that turns off useful extensions and
1126 dnl breaks some systems' header files.
1127 dnl AIX                 -qlanglvl=ansi      (removed -- Norbert)
1128 dnl Ultrix and OSF/1    -std1               (removed -- Norbert)
1129 dnl HP-UX               -Aa -D_HPUX_SOURCE
1130 dnl SVR4                -Xc                 (removed -- Norbert)
1131 for ac_arg in "" "-Aa -D_HPUX_SOURCE" 
1133   CFLAGS="$ac_save_CFLAGS $ac_arg"
1134   AC_TRY_COMPILE(
1135 [#include <signal.h>
1136 #if !defined(__STDC__) || __STDC__ != 1
1137 choke me
1138 #endif  
1139 ], [int test (int i, double x);
1140 struct sigaction sa;
1141 struct s1 {int (*f) (int a);};
1142 struct s2 {int (*f) (double a);};],
1143 [ac_cv_prog_cc_stdc="$ac_arg"; break])
1144 done
1145 CFLAGS="$ac_save_CFLAGS"
1147 AC_MSG_RESULT($ac_cv_prog_cc_stdc)
1148 case "x$ac_cv_prog_cc_stdc" in
1149   x|xno) ;;
1150   *) CC="$CC $ac_cv_prog_cc_stdc" ;;
1151 esac