Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use autotools nobase and nodist prefixs together on include_HEADERS

I have some header files in a sub directory, that must be copied to a same-named sub directory in my include directory. I can use the nobase prefix to make that happen (I'm working with heimdal code, fyi):

nobase_include_HEADERS = hcrypto/aes.h \
      hcrypto/bn.h      \
      hcrypto/cmac.h    \
      hcrypto/des.h     \
      hcrypto/dh.h      \
      hcrypto/dsa.h     \
etc...

But some of those header files are generated during the build process (since heimdal must be built before those header files exist), so I need to use the nodist prefix so that the dist doesn't die.

I found an article that said I could use them both together, and even provided a similar example, so I did this:

nobase_nodist_include_HEADERS = hcrypto/aes.h \
      hcrypto/bn.h      \
      hcrypto/cmac.h    \
      hcrypto/des.h     \
      hcrypto/dh.h      \
      hcrypto/dsa.h     \
etc...

I didn't notice any warnings or errors, but those header files DO NOT get copied to my include directory. Am I doing something wrong, or is there a bug in autotools?

Interesting, if I reverse the prefixes, I get this error:

Makefile.am:93: error: 'nodist_nobase_include_HEADERS' is used but 'nobase_includedir' is undefined

The reason for that error is explained here in the automake documentation:

‘nobase_’ should be specified first when used in conjunction with either ‘dist_’ or ‘nodist_’

I've also defined nodist_include_HEADERS (which is working). Maybe the two definitions are causing some kind of conflict?

I just tried removing the nodist_include_HEADERS and putting all my headers under the nobase_nodist_include_HEADERS line, but now NONE of my headers get installed.

Automake and system info: automake (GNU automake) 1.13.4 openSUSE 13.2 (x86_64)

like image 536
David Mulder Avatar asked Apr 27 '16 20:04

David Mulder


1 Answers

If the headers were generated by a program, you should mark them with BUILT_SOURCES, this way automake will not be confused to try to install them as dist.

Second, for headers files that are not meant to be installed, it's better to use SOURCES directive, rather than HEADERS. Try this:

nobase_include_SOURCES += hcrypto/aes.h \
    hcrypto/bn.h      \
    hcrypto/cmac.h    \
    hcrypto/des.h     \
    hcrypto/dh.h      \
    hcrypto/dsa.h
BUILT_SOURCES = hcrypto/aes.h \
    hcrypto/bn.h      \
    hcrypto/cmac.h    \
    hcrypto/des.h     \
    hcrypto/dh.h      \
    hcrypto/dsa.h
like image 101
fluter Avatar answered Oct 05 '22 11:10

fluter