6

I'm working on a project that has a custom INSTALL file. Running automake --add-missing (or more precisely, autoreconf -i) will generate the GNU default INSTALL file, and overwrite our file with it.

How can I prevent this behavior? I want it to either not generate the GNU INSTALL file at all, or alternatively, create it with a different name.

Also, I don't want to disable any other files that automake might generate.


Edit 1: From the automake manual:

If the --add-missing option is given, automake will add a generic version of the INSTALL file as well as the COPYING file containing the text of the current version of the GNU General Public License […]. However, an existing COPYING file will never be overwritten by automake.

It says that an existing COPYING file will not be overwritten, but doesn't say anything about the INSTALL file, so it seems like it will be unconditionally overwritten.

Edit 2: As requested, here are my configure.ac and Makefile.am, and also autogen.sh that we run to autoreconf the project:

configure.ac:

AC_INIT([program name], [version number], [bug report], [short name], [url])
AC_CONFIG_SRCDIR([Main/Source/main.cpp])

AM_PROG_AS 
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE
AC_PROG_CC
AC_PROG_CXX

CFLAGS="$CFLAGS $SDL_CFLAGS "
LIBS="$LIBS $SDL_LIBS"
CPPFLAGS="$SDL_CFLAGS -DLINUX
          -DLOCAL_STATE_DIR=\\\"$sharedstatedir/<program name>\\\"
          -DDATADIR=\\\"$datadir\\\" -DUSE_SDL -DGCC"

AC_PROG_INSTALL
AC_PROG_RANLIB
AC_CONFIG_FILES(<list of Makefiles in subdirs>)
AC_OUTPUT

Makefile.am:

SUBDIRS = FooLib Main Bar Baz
EXTRA_DIST = LICENSING <and a bunch of unrelated files>

autogen.sh:

autoreconf -f -i
  • Can you provide copies of your configure.ac and Makefile.in, please? Edit your question to include them, do not add them in a comment or a separate paste. Also add any other custom scripts you might be using. See gnu.org/software/automake/manual/html_node/Gnits.html#Gnits . You've probably have --add-missing somewhere. If you take that out, the INSTALL and COPYING files won't be created. Personally I don't think that is an especially useful option. – Faheem Mitha Apr 19 '15 at 14:52
  • @FaheemMitha Thanks. Added the snippets. Removing -i from autoreconf prevents it from installing all those files. – zenith Apr 19 '15 at 15:26
  • I rather think you want that -i for other things, but you can confirm that yourself. – Faheem Mitha Apr 19 '15 at 15:28
  • @FaheemMitha You're right, actually running it without -i gives an error: required file './compile' not found: 'automake --add-missing' can install 'compile' I guess that's why I was using it in the first place. – zenith Apr 19 '15 at 15:31
5

Add the foreign option to AM_INIT_AUTOMAKE in configure.ac. This will tell autotools that you are not following GNU coding standards, and Automake will not create the usual GNU project text files, including the AUTHORS, COPYING, INSTALL, NEWS, README, and ChangeLog files. The automatic creation of these files is really fairly useless. You can always create them yourself.

  • I actually tried using foreign which didn't overwrite the INSTALL file, but I'd want to keep the project gnu compliant because that's what it has been so far. Although if that doesn't work out I guess I'll just make it foreign. Or is using a custom INSTALL file non-GNU already? – zenith Apr 19 '15 at 15:21
  • @zenith I looked for a way to stop the INSTALL file being rewritten, though it really should not overwrite by default - that is wacky behavior. But I did not find anything. You could ask about this on the automake mailing list, and possibly submit a bug. You can make your project GNU compliant just by having those files. I don't think you need to have them automatically created for you. #autotools on freenode is another place where you can sometimes find people who can answer questions. I just posted a query there. – Faheem Mitha Apr 19 '15 at 15:25
  • Thanks, I'll look into those. And you're probably right in that having the GNU files automatically created isn't particularly useful, so I'll probably go with foreign if no better solutions show up. – zenith Apr 19 '15 at 15:36
  • @zenith So, I was talking to people on #autotools, and at least one person (Berndj) thinks the INSTALL overwrite thing is a bug. So, I recommend you file a bug report. If they don't agree, they will ignore it or close it or whatever. Check that the issue hasn't already been filed, of course. – Faheem Mitha Apr 19 '15 at 15:58
  • BTW, if you want to talk to me, I'm usually in the U&L main chat room. chat.stackexchange.com/rooms/26/unix-and-linux You can ping me there. – Faheem Mitha Apr 19 '15 at 16:03
4

The cause of the problem was the -f i.e. --force tag to autoreconf.

The man page for it states: "consider all files obsolete" which is a bit vague, so I couldn't initially connect it to my problem. Its html manual entry is even more misleading:

Remake even configure scripts and configuration headers that are newer than their input files (configure.ac and, if present, aclocal.m4).

It only talks about configure scripts, but in reality it also handles the standard GNU files.

And as it turns out, autoreconf -f actually calls automake --force-missing, which has a more explicit description: "force update of standard files", and its html manual entry makes it even clearer:

When used with --add-missing, causes standard files to be reinstalled even if they already exist in the source tree. […]

Removing the -f tag from the autoreconf invocation solved this.

Conclusion: The people working on autoreconf can't write manual entries. The people working on automake can.

  • Good detective work. File a documentation bug, maybe? I'm actually using autoreconf with the -f flag. Does this option have no legitimate use then? I think forcing a remake of generatef files might be an insurance policy of sorts, in case timestamps are wrong. Because of network file systems or whatever. Oh, and if you filed a bug report, link to it, either in your question or your answer. – Faheem Mitha Apr 20 '15 at 0:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.