Search code examples
cautotools

How can I change these variables?


I have in my C code, which I based on GNU hello, this

printf (_("%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_URL);

Now I want to change the package variables but I can't find where they are set. Do you know where I can change them? If I serach for the variables in my project I only find auto-generated files such as config.h etc.

The variables must come from somewhere, where is it?

The way I build my project is ./configure && make && sudo make install


Solution

  • They come from the configure script:

    # Identity of this package.
    PACKAGE_NAME='GNU Hello'
    PACKAGE_TARNAME='hello'
    PACKAGE_VERSION='2.7'
    PACKAGE_STRING='GNU Hello 2.7'
    PACKAGE_BUGREPORT='bug-hello@gnu.org'
    PACKAGE_URL='http://www.gnu.org/software/hello/'
    

    Makefile.in contains:

    PACKAGE_NAME = @PACKAGE_NAME@
    PACKAGE_STRING = @PACKAGE_STRING@
    PACKAGE_TARNAME = @PACKAGE_TARNAME@
    PACKAGE_URL = @PACKAGE_URL@
    PACKAGE_VERSION = @PACKAGE_VERSION@
    

    and there's presumably something in the configure script that replaces all the @VARNAME@ placeholders with the values of the variables.

    I found these with:

    grep -R PACKAGE_NAME .
    

    while in the hello-2.7 directory.