contrib: configure-for-system: use meson by default

With the deprecation of autotools, use meson by default. For the moment,
it's still possible to build with autotools passing -a/--autotools.

Additionally, as we allow to specify different build directories other
than './build', let's not asume that the user wants to overwrite it
by default. Instead, the script will asume ./build if the user doesn't
specify the build directory, but only if it doesn't exist. If it does,
the user will have to force overwritting it with `--meson ./build`.
This commit is contained in:
Íñigo Huguet 2024-05-22 13:23:57 +02:00 committed by Íñigo Huguet
parent a07627fdcc
commit 714d02697f

View file

@ -149,8 +149,9 @@ P_NOBUILD="${NOBUILD-0}"
P_DEBUG="${DEBUG-1}"
P_BUILD_TYPE="${BUILD_TYPE-}"
P_BUILD_TYPE="${BUILD_TYPE-meson}"
P_MESON_BUILDDIR="${MESON_BUILDDIR-./build}"
[ -n "$MESON_BUILDDIR" ] && P_MESON_BUILDDIR_FORCE=1
P_CFLAGS="${CFLAGS-}"
P_CC="${CC-$((! command -v gcc && command -v clang) &>/dev/null && echo clang || echo gcc)}"
@ -307,16 +308,6 @@ else
P_CFLAGS="-g -O2 -fexceptions${P_CFLAGS:+ }$P_CFLAGS"
fi
if [ -z "$P_BUILD_TYPE" ] ; then
if [ -d "$P_MESON_BUILDDIR" -a ! -f ./configure ] ; then
P_BUILD_TYPE=meson
elif [ ! -d "$P_MESON_BUILDDIR" -a -f ./configure ] ; then
P_BUILD_TYPE=autotools
else
P_BUILD_TYPE=autotools
fi
fi
while [[ $# -gt 0 ]] ; do
A="$1"
shift
@ -324,6 +315,7 @@ while [[ $# -gt 0 ]] ; do
--meson|-m)
P_BUILD_TYPE=meson
P_MESON_BUILDDIR="$1"
P_MESON_BUILDDIR_FORCE=1
shift
;;
--autotools|-a)
@ -346,6 +338,14 @@ while [[ $# -gt 0 ]] ; do
esac
done
if [ "$P_BUILD_TYPE" = meson -a "$P_MESON_BUILDDIR_FORCE" != 1 ]; then
if [ -d "$P_MESON_BUILDDIR" ]; then
echo "Build directory '$P_MESON_BUILDDIR' chosen by default, but it exists and will be overwritten." \
"If you really want that, pass '--meson \"$P_MESON_BUILDDIR\"'." >&2
exit 1
fi
fi
vars_with_vals
if [ "$P_BUILD_TYPE" == meson ] ; then