cunixmakefileautotools

How can I tell autogen.sh to generate files(m4 and object files) in separate folder?


I am using ./autogen.sh --prefix=/usr/ to build a c project and all files created by the configuration process (and later the compiling and linking steps) are located in my source folder.

I would like to tell to use a different folder (say ./build like cmake projects usually do).

How can I do that?

Is there a command line parameter? Should I change a file?

Note: autogen.sh calls gnome-autogen.sh

edit

Trying cd build && ../autogen.sh --prefix=/usr/ fails with the error:

/usr/bin/gnome-autogen.sh: ./configure: not found

Solution

  • This isn't possible as far as I know. autogen is a strange beast; the files it creates are necessary to build the project (configure and Makefile.am).

    That means autogen is more part of the "unpack sources" than the "compile source code into product" step. After you have run autogen, you can run configure in the build directory to get a version of all files necessary to drive the build (config.h, Makefile, ...) for your specific architecture:

    ./autogen.sh
    mkdir build
    cd build
    ../configure --prefix=/usr
    

    See Compiling For Multiple Architectures in the file INSTALL.