Run a script during the run of configure

Viewed 1189

I have a project QPhiX that uses GNU Autotools. There is a very related project called QPhiX-Codegen that is needed by the former. The overall build process works like this:

  1. Run make in QPhiX-Codegen. That will compile the code generator and run it. While running, it will create flat C++ code.
  2. Run a Python script that uses a template engine to wrap that flat C++ code into full header and source code files. That will also create a CMakeLists.txt such that the generated code can be compiled.
  3. Run cmake and make on the Makefile generated by cmake to compile the generated code into a static library, libqphix_codegen.a.

These three things are wrapped up in a Bash script that one calls with ./generate-and-compile $isa $cxx $cxxflags. The ISA could be AVX2, the C++ compiler could me mpiicpc.

Then one switches the directories to QPhiX and continues the build process:

  1. Run ./configure ... --enable-arch=ISA --with-codegen=path/to/codegen/directory CXX=$CXX CXXFLAGS=$CXXFLAGS to create the Makefile. In that Makefile, it will have the needed compiler flags to include the generated header files and link to libqphix_codegen.a.
  2. Run make on the Makefile generated by ./configure.

This process exposes more steps to the user than really needed. Also the user has to pass the same ISA flag, the same CXX and the same CXXFLAGS to two different scripts. Then they also have to put in this path to the code generator into the ./configure.

I think it would be most convenient for the user to have the code generator a git submodule in the QPhiX project. Then the ./configure could just run the codegen/generate-and-compile script and pass the options to it.

My question is: How would I run a script in the ./configure? Do I just put the snippet I want into configure.ac? That file looks like a shell script with some macros, but I am not sure whether that would be the right spot to put it.

1 Answers
Related