Need some m4 wizardry to quote []s in configure.ac

Dan Nicholson dbn.lists at gmail.com
Fri Mar 4 12:51:33 PST 2011


On Fri, Mar 4, 2011 at 10:50 AM, Jeremy Huddleston <jeremyhu at apple.com> wrote:
> How do I quote []s in m4?  I've tried escaping with \, 's, "s, ... I'm out of tricks...  I'm trying to update the poll() checks in libxcb and libXt to allow poll on darwin11, but the []s are getting stripped.  darwin[789]* is becoming darwin789*, and the \([^ ]*\) in sed is becoming \(^ *\) ...
>
> Here's what I want to do:
>
> case $host_os in
>        # darwin through Snow Leopard has poll() but can't be used to poll character devices.
>        darwin[789]*|darwin10*) ;;
>        darwin*)
>                _ac_xorg_macosx_version_min=`echo $CPPFLAGS $CFLAGS | sed 's/^.*-mmacosx-version-min=\([^ ]*\).*$/\1/'`
>                if test x$_ac_xorg_macosx_version_min = x ; then
>                        _ac_xorg_macosx_version_min=$MACOSX_DEPLOYMENT_TARGET
>                fi
>                case $_ac_xorg_macosx_version_min in
>                        10.[0123456]|10.[0123456].*) ;;
>                        *)
>                                AC_CHECK_FUNC(poll, [AC_DEFINE(USE_POLL, 1, [poll() function is available])], )
>                        ;;
>                esac
>                unset _ac_xorg_macosx_version_min
>                ;;
>        *)
>                AC_CHECK_FUNC(poll, [AC_DEFINE(USE_POLL, 1, [poll() function is available])], )
>        ;;
> esac

Normally you can just double up the [[, but if you really need it you
can use @<:@ and @:>@. I used them in mesa's configure.ac if you want
to have a look.

--
Dan


More information about the xorg-devel mailing list