unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Vladimir Panteleev <notmuch@thecybershadow.net>
To: notmuch@notmuchmail.org
Cc: Vladimir Panteleev <vladimir@thecybershadow.net>
Subject: [PATCH 4/8] configure: Refactor uname parsing into a case statement
Date: Tue, 22 Aug 2017 22:43:35 +0000	[thread overview]
Message-ID: <20170822224339.22601-5-notmuch@thecybershadow.net> (raw)
In-Reply-To: <20170822224339.22601-1-notmuch@thecybershadow.net>

From: Vladimir Panteleev <vladimir@thecybershadow.net>

This will allow matching unames using patterns.
---
 configure | 101 +++++++++++++++++++++++++++++++++-----------------------------
 1 file changed, 54 insertions(+), 47 deletions(-)

diff --git a/configure b/configure
index c5e2ffed..17ac67bb 100755
--- a/configure
+++ b/configure
@@ -650,59 +650,66 @@ libdir_in_ldconfig=0
 
 printf "Checking which platform we are on... "
 uname=$(uname)
-if [ $uname = "Darwin" ] ; then
-    printf "Mac OS X.\n"
-    platform=MACOSX
-    linker_resolves_library_dependencies=0
-elif [ $uname = "SunOS" ] ; then
-    printf "Solaris.\n"
-    platform=SOLARIS
-    linker_resolves_library_dependencies=0
-elif [ $uname = "FreeBSD" ] ; then
-    printf "FreeBSD.\n"
-    platform=FREEBSD
-    linker_resolves_library_dependencies=0
-elif [ $uname = "OpenBSD" ] ; then
-    printf "OpenBSD.\n"
-    platform=OPENBSD
-    linker_resolves_library_dependencies=0
-elif [ $uname = "Linux" ] || [ $uname = "GNU" ] ; then
-    printf "%s\n" "$uname"
-    platform="$uname"
-    linker_resolves_library_dependencies=1
-
-    printf "Checking for %s in ldconfig... " "$libdir_expanded"
-    ldconfig_paths=$(/sbin/ldconfig -N -X -v 2>/dev/null | sed -n -e 's,^\(/.*\):\( (.*)\)\?$,\1,p')
-    # Separate ldconfig_paths only on newline (not on any potential
-    # embedded space characters in any filenames). Note, we use a
-    # literal newline in the source here rather than something like:
-    #
-    #	IFS=$(printf '\n')
-    #
-    # because the shell's command substitution deletes any trailing newlines.
-    IFS="
+case "$uname" in
+    Darwin)
+	printf "Mac OS X.\n"
+	platform=MACOSX
+	linker_resolves_library_dependencies=0
+	;;
+    SunOS)
+	printf "Solaris.\n"
+	platform=SOLARIS
+	linker_resolves_library_dependencies=0
+	;;
+    FreeBSD)
+	printf "FreeBSD.\n"
+	platform=FREEBSD
+	linker_resolves_library_dependencies=0
+	;;
+    OpenBSD)
+	printf "OpenBSD.\n"
+	platform=OPENBSD
+	linker_resolves_library_dependencies=0
+	;;
+    Linux|GNU)
+	printf "%s\n" "$uname"
+	platform="$uname"
+	linker_resolves_library_dependencies=1
+
+	printf "Checking for %s in ldconfig... " "$libdir_expanded"
+	ldconfig_paths=$(/sbin/ldconfig -N -X -v 2>/dev/null | sed -n -e 's,^\(/.*\):\( (.*)\)\?$,\1,p')
+	# Separate ldconfig_paths only on newline (not on any potential
+	# embedded space characters in any filenames). Note, we use a
+	# literal newline in the source here rather than something like:
+	#
+	#	IFS=$(printf '\n')
+	#
+	# because the shell's command substitution deletes any trailing newlines.
+	IFS="
 "
-    for path in $ldconfig_paths; do
-	if [ "$path" = "$libdir_expanded" ]; then
-	    libdir_in_ldconfig=1
+	for path in $ldconfig_paths; do
+	    if [ "$path" = "$libdir_expanded" ]; then
+		libdir_in_ldconfig=1
+	    fi
+	done
+	IFS=$DEFAULT_IFS
+	if [ "$libdir_in_ldconfig" = '0' ]; then
+	    printf "No (will set RPATH)\n"
+	else
+	    printf "Yes\n"
 	fi
-    done
-    IFS=$DEFAULT_IFS
-    if [ "$libdir_in_ldconfig" = '0' ]; then
-	printf "No (will set RPATH)\n"
-    else
-	printf "Yes\n"
-    fi
-else
-    printf "Unknown.\n"
-    platform="$uname"
-    linker_resolves_library_dependencies=0
-    cat <<EOF
+	;;
+    *)
+	printf "Unknown.\n"
+	platform="$uname"
+	linker_resolves_library_dependencies=0
+	cat <<EOF
 
 *** Warning: Unknown platform. Notmuch might or might not build correctly.
 
 EOF
-fi
+	;;
+esac
 
 if [ $errors -gt 0 ]; then
     cat <<EOF
-- 
2.13.3

  parent reply	other threads:[~2017-08-22 22:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-22 22:43 [PATCH 0/8] notmuch on Windows (Cygwin) and AppVeyor Vladimir Panteleev
2017-08-22 22:43 ` [PATCH 1/8] lib: Fix talloc not being defined on Cygwin Vladimir Panteleev
2017-08-22 22:43 ` [PATCH 2/8] Split CONFIGURE_LDFLAGS out of FINAL_LIBNOTMUCH_LDFLAGS Vladimir Panteleev
2017-08-22 22:43 ` [PATCH 3/8] lib: Fix libnotmuch.so link under Cygwin Vladimir Panteleev
2017-08-22 22:43 ` Vladimir Panteleev [this message]
2017-08-22 22:43 ` [PATCH 5/8] configure: Detect Cygwin, and set PLATFORM accordingly Vladimir Panteleev
2017-08-22 22:43 ` [PATCH 6/8] Fix linking shared library on Cygwin Vladimir Panteleev
2017-08-22 22:43 ` [PATCH 7/8] test: Don't attempt to build symbol-test " Vladimir Panteleev
2017-08-22 22:43 ` [PATCH 8/8] Add AppVeyor CI configuration and test script Vladimir Panteleev
2017-08-25 11:35 ` [PATCH 0/8] notmuch on Windows (Cygwin) and AppVeyor David Bremner
2017-08-25 18:52   ` Vladimir Panteleev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170822224339.22601-5-notmuch@thecybershadow.net \
    --to=notmuch@thecybershadow.net \
    --cc=notmuch@notmuchmail.org \
    --cc=vladimir@thecybershadow.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).