I want to pass a constant in a C preprocessor style but with a Python script.
This constant is already declared with AC_DEFINE in my configure.ac file and used in my C program, and now I need to pass it to a Python script too.
I tried with a custom target in my Makefile.am with a sed call to preprocess a specific symbol in my Python script, but it seems dirty-coding to me.
How can I achieve this?
Create a config.py.in with some contents like MYVAR = '''@MYVAR@''' and add it to AC_CONFIG_FILES in your configure.ac. You can then import config in your other Python scripts.
This fulfills much the same function as config.h does for C programs.
autotools: pass constant from configure.ac to python script