From 5aeb4ab9ed759d130efc1d1c27ae5afb0b6e9c18 Mon Sep 17 00:00:00 2001 From: Anton Lindqvist Date: Thu, 2 Dec 2021 11:57:40 +0100 Subject: [PATCH] configure: fix handling of non linux operating systems The OS whitelist conditional is malformed due to missing test(1) commands causing the following error to be emitted during configure while using something other than Linux: ../configure[3340]: xopenbsd: not found Instead, favor a switch statement which makes the line a bit shorter as well. Also, the AC_MSG_ERROR argument must be wrapped in brackets due to presence of a comma. Otherwise, the tail will be interpreted as an additional argument. --- configure.ac | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index e0dcb10f..32eae4fe 100644 --- a/configure.ac +++ b/configure.ac @@ -22,10 +22,13 @@ if test "z$with_os" = "z"; then with_os="linux" fi with_os=`echo ${with_os} | tr '[[:upper:]]' '[[:lower:]]' ` - -if test "x${with_os}" != xlinux && "x${with_os}" != xfreebsd && "x${with_os}" != xdarwin ; then - AC_MSG_ERROR(--with-os= argument must linux freebsd openbsd or darwin) -fi +case "x${with_os}" in +xlinux|xfreebsd|xopenbsd|xdarwin) + ;; +*) + AC_MSG_ERROR([--with-os= argument must be one of linux, freebsd, openbsd or darwin]) + ;; +esac # Checks for programs. AC_PROG_CC