0

How can I use AS_INIT_GENERATE to generate a script that is not in the same directory as the configure script, in particular so that VPATH builds will be honoured?

For example, for a configure.ac file containing

AC_PREREQ([2.68])
AC_INIT([example],[0.1])
AS_INIT_GENERATED([src/file.sh]) || AS_EXIT
AC_OUTPUT

running the commands

~ $ autoreconf .
~ $ mkdir build && cd build
~/build $ ../configure

results in the error message

../configure: line 1648: src/file.sh: No such file or directory
../configure: line 1655: src/file.sh: No such file or directory

I guess I'd have to make sure that the src directory exists before I call AS_INIT_GENERATE to create src/file.sh, or maybe I'm doing it all wrong?

Zorawar
  • 6,505
  • 2
  • 23
  • 41

1 Answers1

0

Try something like this:

AC_PREREQ([2.68])
AC_INIT([example],[0.1])
test -d src || AS_MKDIR_P([src]) dnl <----- Create 'src' if it doesn't exist.
AS_INIT_GENERATED([src/file.sh]) || AS_EXIT
AC_OUTPUT
Jack Kelly
  • 18,264
  • 2
  • 56
  • 81
  • Yeah, creating the `src` directory explicitly seems to be the answer. Although, isn't the test for the existence of `src` redundant? Doesn't `mkdir -p` exit silently if the directory already exists? – Zorawar Aug 10 '12 at 13:52
  • On my machine, yes it is silent. I'm not 100% sure why I made the check. Just to be thorough, I suppose. – Jack Kelly Aug 10 '12 at 21:21