[lug] Autoconf ?: PREFIX at compile time

Ed Hill ed at eh3.com
Wed Apr 17 17:19:57 MDT 2002


On Wed, 2002-04-17 at 17:02, Scott A. Herod wrote:
> Hello,
> 
>   A brief autoconf question: Is there a standard way to tell
> source code what autoconf's PREFIX variable is at compile time?
> I have code that needs to look for configuration files which
> should end up in ${prefix}/etc/ after an install.  ( I can tell
> the code at runtime how to find it's config files but I want to
> set the "correct" default if make install is used. )
> 
>   I guess using a -DINSTALL_PREFIX=@PREFIX@ on my compile line
> would work.  But is there a way to place such a macro in the
> config.h file?
> 


Hi Scott,

Heres some lines from my configure.in file that are more-or-less lifted
from Enlightenment's configure.in:


dnl reasonable guesses for where stuff is installed
if test "x$prefix" = "xNONE"; then
  prefix="/usr/local"
else
  prefix=$prefix
fi
PA_DATA_DIR=${prefix}/share/pa_data


then, I put the following in "acconfig.h" file:


/* Have an entry for that damn PA_DATA_DIR path...  */
#undef PA_DATA_DIR


which results in the following in my "config.h" file:


/* Have an entry for that damn PA_DATA_DIR path...  */
#define PA_DATA_DIR "/usr/local/share/pa_data"


hth,
Ed


-- 
Edward H. Hill III, PhD
Post-Doctoral Researcher   |  Email:       ed at eh3.com, ehill at mines.edu
Division of ESE            |  URL:         http://www.eh3.com
Colorado School of Mines   |  Phone:       303-273-3483
Golden, CO  80401          |  Fax:         303-273-3311
Key fingerprint = 5BDE 4DA1 66BE 4F7B BC17  3A0C 932B 7266 1E76 F123



More information about the LUG mailing list