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:
- Run
makein QPhiX-Codegen. That will compile the code generator and run it. While running, it will create flat C++ code. - 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.txtsuch that the generated code can be compiled. - Run
cmakeandmakeon theMakefilegenerated bycmaketo 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:
- Run
./configure ... --enable-arch=ISA --with-codegen=path/to/codegen/directory CXX=$CXX CXXFLAGS=$CXXFLAGSto create theMakefile. In thatMakefile, it will have the needed compiler flags to include the generated header files and link tolibqphix_codegen.a. - Run
makeon theMakefilegenerated 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.