autoconf
[Top][All Lists]
Advanced

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

Re: msys : convert datadir to windows directory syntax


From: Keith MARSHALL
Subject: Re: msys : convert datadir to windows directory syntax
Date: Tue, 4 Sep 2007 10:16:08 +0100




Vincent Torri wrote, quoting me:
>> Yes.  You can use the MSYS_AC_CANONICAL_PATH macro, published some time
>> ago on the MinGW/MSYS lists:
>> http://article.gmane.org/gmane.comp.gnu.mingw.msys/2785
>
> I have a problem with that macro. First note, that I am using autoconf
> 2.61.
>
> Here is how I use that macro:
>
> in configure.ac:
>
> efreet_datadir=$datadir
> case "$host_os" in
>     mingw|mingw32)
>        MSYS_AC_CANONICAL_PATH([efreet_datadir], [$datadir])
>     ;;
> esac
> AC_SUBST(efreet_datadir)

You could just as well replace all the above with:

  MSYS_AC_CANONICAL_PATH([efreet_datadir],["/default/posix/datadir/path"])
  AC_SUBST([efreet_datadir])

because MSYS_AC_CANONICAL_PATH will DTRT on non-MSYS platforms anyway,
(i.e. it will leave "/default/posix/datadir/path" unchanged).

> But in the created Makefile, the value of efreet_datadir is:
>
> efreet_datadir =
> D:/msys/1.0/home/vincent/tmp/e17/libs/efreet/${datarootdir}
>
> do you know why ?

Yes.  Unless the user assigns it explicitly, on the `configure' command
line, the value of `$datadir' is unknown when the configure script is run;
it doesn't become fully defined until you invoke `make'.

In general, you shouldn't use `$datadir' in this way, within a configure
script; in autoconf-2.60 and later, its default definition is:

  datadir='${datarootdir}'
  datarootdir='${prefix}/share'

while in earlier versions of autoconf, it is simply:

  datadir='${prefix}/share'

both of which, ultimately, resolve to the same default value in `make',
if you use the convenional substitutions within `Makefile.in'.

You should also note that even the value of `$prefix' is not known when the
configure script is run, (again, unless the user has overridden the default
value).  This can make life difficult, when you want to manipulate paths
based on the default values of `${prefix}', `${datarootdir}' and friends,
especially since the actual default values for these are undocumented.

If you are prepared to work with undocumented features, you could achieve
your apparent goal using something like (untested):

  AC_SUBST([msys_default_prefix], ["$prefix"])
  test "x$prefix" = xNONE && msys_default_prefix=$ac_default_prefix
  MSYS_CANONICAL_PATH([msys_default_prefix], ["$msys_default_prefix"])
  AC_SUBST([efreet_datadir], ['${msys_default_prefix}/share'])

but do be aware that this may break, in some future release of autoconf.

HTH,
Keith.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]