Discussion:
extract value of ${datadir}
Peter Johansson
2015-09-15 07:13:46 UTC
Permalink
Hi,

I need to to extract the value of ${datadir} so I can use it something like

val=*extract ${datadir}*

AC_CHECK_FILE([$val], [], [AC_MSG_ERROR([file $val needed])])

Cheers,
Peter
Gavin Smith
2015-09-15 09:48:12 UTC
Permalink
Post by Peter Johansson
I need to to extract the value of ${datadir} so I can use it something like
val=*extract ${datadir}*
AC_CHECK_FILE([$val], [], [AC_MSG_ERROR([file $val needed])])
Here's what I got with

echo datadir is $datadir
eval datadir=$datadir
echo datadir is $datadir
eval datadir=$datadir
echo datadir is $datadir

in configure.ac.

Output:

datadir is ${datarootdir}
datadir is ${prefix}/share
datadir is NONE/share

That NONE is a problem. Maybe if you specify a value for datadir
explicitly it will work.

The idea was to loop with the eval's until a fixed point was reached.

The answer appears to be you can do what you want only with difficulty.
Peter Johansson
2015-09-15 23:08:18 UTC
Permalink
Post by Gavin Smith
That NONE is a problem. Maybe if you specify a value for datadir
explicitly it will work.
The idea was to loop with the eval's until a fixed point was reached.
The answer appears to be you can do what you want only with difficulty.
Thanks Gavin,

I think I'll introduce a new variable independent from ${prefix}, and
then I won't have this problem.

Cheers,
Peter
Mike Frysinger
2015-09-15 15:42:36 UTC
Permalink
Post by Peter Johansson
I need to to extract the value of ${datadir} so I can use it something like
val=*extract ${datadir}*
AC_CHECK_FILE([$val], [], [AC_MSG_ERROR([file $val needed])])
you should never use AC_CHECK_FILE. it breaks cross-compilation.
-mike
Peter Johansson
2015-09-15 23:11:46 UTC
Permalink
Post by Mike Frysinger
you should never use AC_CHECK_FILE. it breaks cross-compilation.
I the typical case, I'd agree, but in this case it is a private project
that is never distributed more than to our devel machines and run
cluster. Cross-compilation will never be on the map.

Cheers,
Peter

Loading...