Autoconf: How to get installation paths into config.h

前端 未结 4 600
囚心锁ツ
囚心锁ツ 2021-02-04 08:00

My program needs to load some files at run time, which will be installed into whatever folder is given to ./configure --datadir=/somewhere

As my program nee

4条回答
  •  一整个雨季
    2021-02-04 08:33

    Your solution is the correct one. The reason why Autoconf/Automake don't (easily) support putting the installation paths into config.h is that you are in theory supposed to be able to override the paths at build time, like make prefix=/else/where. This possibility is nowadays somewhat arcane, but that's the reason. (Note that this is distinct from make install prefix=/else/where/, which is still useful, in spite of DESTDIR.)

提交回复
热议问题