I'm trying to build Emacs from sources. When configure options were listed without an array Emacs configured properly. When I added a Bash array to add optional options it broke configure. Here is the broken array:
BUILD_OPTS=('--with-xml2' '--without-x' '--without-sound' '--without-xpm'
'--without-jpeg' '--without-tiff' '--without-gif' '--without-png'
'--without-rsvg' '--without-imagemagick' '--without-xft' '--without-libotf'
'--without-m17n-flt' '--without-xaw3d' '--without-toolkit-scroll-bars'
'--without-gpm' '--without-dbus' '--without-gconf' '--without-gsettings'
'--without-makeinfo' '--without-compress-install')
if [[ ! -e "/usr/include/selinux/context.h" ]] &&
[[ ! -e "/usr/local/include/selinux/context.h" ]]; then
BUILD_OPTS+=('--without-selinux')
fi
PKG_CONFIG_PATH="${BUILD_PKGCONFIG[*]}" \
CPPFLAGS="${BUILD_CPPFLAGS[*]}" \
CFLAGS="${BUILD_CFLAGS[*]}" CXXFLAGS="${BUILD_CXXFLAGS[*]}" \
LDFLAGS="${BUILD_LDFLAGS[*]}" LIBS="${BUILD_LIBS[*]}" \
./configure --prefix="$INSTALL_PREFIX" --libdir="$INSTALL_LIBDIR" \
"${BUILD_OPTS[*]}"
When configuring with the array it results in:
configure: error: invlaid package name: xml2 --without-x --without-sound --without-xpm --without-jpeg --without-tiff --without-gif ...
I've been through 10.2. Array variables but I don't see what I am doing wrong. Changing to double quote and no quote did not help.
What is the problem and how do I fix it?
*
and@
behave the same way. Or am I missing something? – Jan 04 '18 at 02:09"${BUILD_PKGCONFIG[@]}"
- the quoting of the elements during array creation is not the issue here (nevertheless I've changed them in my example, to avoid confusion) – steeldriver Jan 04 '18 at 02:10${
and the[*]}
around it. Switching toarray name
will not make it clearer, in my opinion. – Weijun Zhou Jan 04 '18 at 03:29