I originally submitted this as a Debian bug, but it's more relevant here. I'm using Automake with a package that has its source in various subdirectories but builds the whole package with a single non-recursive Makefile, as mentioned in the Automake manual under Directories / Alternative. Everything works except that, after checking for a deficient snprintf, I call AC_LIBOBJ([util/snprintf]). This results in the following error from Automake:
configure.ac:25: required file `./util/snprintf.c' not found even though the file exists. The problem is in the dir_has_case_matching_file routine in Automake/FileUtils.pm, which assumes that the file that it's passed is a simple filename, or alternately is in require_file_internal in automake itself, which doesn't detect this case. A quick inspection of the former routine reveals that it will never work if passed a filename like util/snprintf.c (and a $dir of ., which is what happens in this case). The attached patch works around this and shouldn't have any negative side effects. It may not be as clean as upstream wants, since it supports a partial path as part of the filename, but the alternative of modifying require_file_internal looked slightly more complex. Let me know, though, if you'd rather have a patch for automake. An even better solution would be for Automake to pay attention to AC_CONFIG_LIBOBJ_DIR and look for AC_LIBOBJ files there. As near as I can tell, Automake currently ignores that setting. I think this fix is correct and should be used regardless of whether that bug is also fixed, though. -- Russ Allbery ([EMAIL PROTECTED]) <http://www.eyrie.org/~eagle/>
--- automake1.9-1.9.6/lib/Automake/FileUtils.pm.orig 2005-05-14 13:21:06.000000000 -0700 +++ automake1.9-1.9.6/lib/Automake/FileUtils.pm 2006-03-29 20:46:43.000000000 -0800 @@ -339,6 +339,16 @@ my ($dirname, $file_name) = @_; return 0 unless -f "$dirname/$file_name"; + # It's possible that the file name won't be a simple file name and + # instead will include a directory component. In that case, we have + # to figure out what the real directory is. + if ($file_name =~ m%/%) + { + my $partial_dir; + ($partial_dir, $file_name) = ($file_name =~ m%^(.*)/([^/]*)%); + $dirname = "$dirname/$partial_dir"; + } + # The file appears to exist, however it might be a mirage if the # system is case insensitive. Let's browse the directory and check # whether the file is really in. We maintain a cache of directories