|
From: | 光先邹 |
Subject: | m4 didn't work with files in FAT system on Mac OS |
Date: | Thu, 1 May 2014 12:10:45 +0800 |
hi,
If the project was placed in FAT system,
1. run aclocal will not generate aclocal.m4
2. run auto header will output
error: AC_CONFIG_HEADERS not found in
% echo $M4
/Users/zouguangxian/tmp/m4-1.4.17/src/m4
% autoheader
autoheader: error: AC_CONFIG_HEADERS not found in configure.in
% head autom4te.cache/traces.0
%
The reason is st_ino of empty file in FAT system is 999999999, which will lead debug set back to stdout in function debug_set_file. Here is a patch which will resolve this problem.
% diff -u m4-1.4.17.orig/src/debug.c m4-1.4.17/src/debug.c
--- m4-1.4.17.orig/src/debug.c 2013-09-22 13:50:43.000000000 +0800
+++ m4-1.4.17/src/debug.c 2014-05-01 11:55:41.000000000 +0800
@@ -23,6 +23,8 @@
#include <stdarg.h>
#include <sys/stat.h>
+#include <sys/param.h>
+#include <sys/mount.h>
/* File for debugging output. */
FILE *debug = NULL;
@@ -151,6 +153,20 @@
&& stdout_stat.st_dev == debug_stat.st_dev
&& stdout_stat.st_ino != 0)
{
+ /* on fat file systems, zero-length files share this magic value */
+ if(debug_stat.st_ino == 999999999)
+ {
+ struct statfs sfsb;
+ if(fstatfs(fileno (debug), &sfsb) == 0)
+ {
+ if (strcasecmp(sfsb.f_fstypename, "msdos") == 0
+ || strcasecmp(sfsb.f_fstypename, "exfat") == 0)
+ {
+ return;
+ }
+ }
+ }
+
if (debug != stderr && close_stream (debug) != 0)
{
M4ERROR ((warning_status, errno,
—
Zou Guangxian
[Prev in Thread] | Current Thread | [Next in Thread] |