> Thank you again.
> I'm not very familiar with m4 macros.
> I'll read soon the m4 documentation :)
I'm still learning them myself :)
My MSYS_AC_CANONICAL_PATH macro expands (approximately) to the
code in the win32path script I posted earlier. Copy and paste
it verbatim, into a file called acsite.m4, in the same place as
your installed autoconf.m4f, (for me that's in the directory
"/usr/share/autoconf/autoconf" in my MSYS tree), and it will be
available to all YOUR configure.ac scripts, OR into a file called
aclocal.m4, in the same directory as configure.ac, to make it
available to just that configure.ac -- (this is best for
distribution, as you can distribute both aclocal.m4 and its
dependent configure.ac along with your project).
Once you've made it available, you can simply use it, by saying
something like:
MSYS_AC_CANONICAL_PATH([ac_default_prefix], [/mingw])
in configure.ac -- this example makes the default value of the
--prefix=path option to configure resolve to the Win32 native
path to your MinGW tree, without requiring the user to specify
it explicitly. You could even simplify this further, by also
pasting another macro into acsite.m4 or aclocal.m4:
<macro name="MSYS_AC_PREFIX_DEFAULT">
# MSYS_AC_PREFIX_DEFAULT( PREFIX )
# --------------------------------
# Like standard AC_PREFIX_DEFAULT( PREFIX ), but resolves the assigned
# path using the MSYS_AC_CANONICAL_PATH macro, (defined below).
#
# (Ideally, autoconf should always define "ac_default_prefix" this way,
# but, for all autoconf versions to date, we need to force it).
#
AC_DEFUN([MSYS_AC_PREFIX_DEFAULT],
[MSYS_AC_CANONICAL_PATH([ac_default_prefix],[$1])dnl
])
</macro>
and then make your configure.ac begin like:
AC_INIT
MSYS_AC_PREFIX_DEFAULT([/mingw])
:
:
BTW, I've written MSYS_AC_CANONICAL_PATH so that it will leave a POSIX
path name untouched on any non-MSYS platform, so it can be used in ANY
configure.ac, which is written with portability in mind. However,
MSYS_AC_PREFIX_DEFAULT([/mingw])
isn't a good idea for portability -- better to use
AC_INIT
MSYS_AC_PREFIX_DEFAULT([/usr/local])
:
which preserves the default autoconf behaviour for non-MSYS platforms,
but maps the default prefix to the native Win32 representation of
/usr/local, (for me this becomes D:/MSYS/1.0/local), when you build
on an MSYS platform. One caveat however -- a standard MSYS install
DOESN'T create a /usr/local directory, so you need to mkdir it for
yourself, if you intend to use it -- a STANDARD autotool scripted
build WON'T do that for you, and will fail if the installation path
doesn't exist, when you do the "make install"; (you could, of course,
script a check in configure.ac, and arrange for configure to do the
appropriate mkdir, if necessary, but that isn't normal practice,
and may not be generally desirable).
HTH.
Keith.
|