11

Is there a way to set where autoconf generates the object files. I would like to have autoconf create all object files in a src/build/ instead of src/

I've tried setting VPATH but that doesn't seem to do anything. VPATH = build

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
Adam Magaluk
  • 1,716
  • 20
  • 29
  • 1
    autoconf does not generate object files. Your question is probably about automake, and autoconf is often used without automake. – William Pursell Oct 03 '11 at 04:44

1 Answers1

13

You do this by running configure from the directory where you want the object files. For instance, if configure and all your code is in a directory named src, then starting from that directory, these commands should do what you want:

$ mkdir build
$ cd build
$ ../configure
$ make

If you're not using Automake, you have to write your Makefile.in to handle this case; there are instructions for that in the autoconf manual.

zwol
  • 135,547
  • 38
  • 252
  • 361
  • I am using automake, but it fails on make. *** No rule to make target `IfxDatabase.lo', needed by `libifxapi.la'. Stop. Any suggestions? – Adam Magaluk Aug 22 '11 at 23:23
  • My bad, this does work just fine. I had VPATH set in my Makefile.am in the src dir when I was messing around earlier to get it to work. – Adam Magaluk Aug 22 '11 at 23:50
  • 4
    Keep in mind that you need to construct your Makefile.am correctly. It is very easy to write a Makefile.am for which a vpath build (a build outside the source directory) does not work. 'make distcheck' will catch such errors. – William Pursell Aug 23 '11 at 11:10
  • What about placing the generated `configure` and other files in a separate directory, is that possible? – Ciro Santilli OurBigBook.com Jun 14 '18 at 09:59
  • 1
    @CiroSantilli新疆改造中心六四事件法轮功 The generated `configure` needs to be at the top level of the source tree or it won't work correctly and also people won't be able to find it. [`AC_CONFIG_AUX_DIR`](https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Input.html) can be used to move most of the other files. But you should really ask a new question and explain in more detail what you want. – zwol Jun 14 '18 at 10:57
  • Thanks. Just want a full out of tree build, nothing generated in-tree. Lazy for new question now, will ping you if I do :-) – Ciro Santilli OurBigBook.com Jun 14 '18 at 11:01