[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

defining directories with autotools



Hello,

I've got a problem across several of my packages:

Having all those $*dir's done by automake and autoconf is all fine, but
how does the program know at runtime what the user entered as argument
to configure? Say, the program has some datafiles it needs in
$datadir/program, how does it know that the user typed ./configure
--datadir=/opt/you/would/not/guess ?

The obvious answer for me was 'well, use -DDATADIR=foo/bar (with
adequate quoting) or -DHAVE_CONFIG_H'. If I use automake, only the
latter is really feasable without kludges, but the problem is that (at
least for me) those directories don't get expanded properly in config.h,
$datadir/program becomes ${prefix}/share/program and
$prefix/share/program becomes NONE/share/program if no explicit
arguments are givin to configure. Both are likely to be misinterpreted
by the executable. I helped myself with adding AM_CPPFLAGS =
-DDATADIR=\"$(pkgdatadir)\" in Makefile.am, but as I said above, this
feels rather like a kludge. And the programs aren't really so
complicated that it would be worth doing echo "DATADIR=$pkgdatadir" in
/etc/program, I think.

So, how's the right GNU way to do this? Or am I missing something
important alltogether and you are not supposed to define directories?

thanks for any hint,

Michael

-- 
"Branden, you reading? We need some serious flaming here. Go sick."
                -- Hamish Moffatt



Reply to: