linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org,
	Aarushi Mehta <mehta.aaru20@gmail.com>,
	Julia Suvorova <jusual@mail.ru>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: [PATCH liburing 2/2] configure: move directory options to ./configure
Date: Sat, 25 May 2019 09:58:30 +0100	[thread overview]
Message-ID: <20190525085830.31577-3-stefanha@redhat.com> (raw)
In-Reply-To: <20190525085830.31577-1-stefanha@redhat.com>

libdir is hardcoded to ${prefix}/lib in Makefile.  Fedora x86_64 uses
/usr/lib64 and this means libaries will be installed in the wrong place.

This patch moves prefix, includedir, libdir, and mandir into ./configure
for easier customization.  To build and install on Fedora x86_64:

  # ./configure --libdir=/usr/lib64
  # make && make install

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 configure | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 Makefile  |  4 ----
 2 files changed, 54 insertions(+), 5 deletions(-)

diff --git a/configure b/configure
index ef71a14..19c2b54 100755
--- a/configure
+++ b/configure
@@ -10,6 +10,10 @@ else
 fi
 
 cc=gcc
+prefix=/usr
+includedir="$prefix/include"
+libdir="$prefix/lib"
+mandir="$prefix/man"
 
 TMPC="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.c"
 TMPC2="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}-2.c"
@@ -98,11 +102,60 @@ has() {
   type "$1" >/dev/null 2>&1
 }
 
+output_mak() {
+  echo "$1=$2" >> $config_host_mak
+}
+
 output_sym() {
-  echo "$1=y" >> $config_host_mak
+  output_mak "$1" "y"
   echo "#define $1" >> $config_host_h
 }
 
+print_and_output_mak() {
+  print_config "$1" "$2"
+  output_mak "$1" "$2"
+}
+
+for opt do
+  optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
+  case "$opt" in
+  --help|-h) show_help=yes
+  ;;
+  --prefix=*) prefix="$optarg"
+  ;;
+  --includedir=*) includedir="$optarg"
+  ;;
+  --libdir=*) libdir="$optarg"
+  ;;
+  --mandir=*) mandir="$optarg"
+  ;;
+  *)
+    echo "ERROR: unkown option $opt"
+    echo "Try '$0 --help' for more information"
+    exit 1
+  ;;
+  esac
+done
+
+if test "$show_help" = "yes"; then
+cat <<EOF
+
+Usage: configure [options]
+Options: [defaults in brackets after descriptions]
+  --help                   print this message
+  --prefix=PATH            install in PATH [$prefix]
+  --includedir=PATH        install headers in PATH [$includedir]
+  --libdir=PATH            install libraries in PATH [$libdir]
+  --mandir=PATH            install man pages in PATH [$mandir]
+EOF
+exit 0
+fi
+
+print_and_output_mak "prefix" "$prefix"
+print_and_output_mak "includedir" "$includedir"
+print_and_output_mak "libdir" "$libdir"
+print_and_output_mak "mandir" "$mandir"
+
 ##########################################
 # check for __kernel_rwf_t
 __kernel_rwf_t="no"
diff --git a/Makefile b/Makefile
index 6755713..ea639d6 100644
--- a/Makefile
+++ b/Makefile
@@ -5,10 +5,6 @@ TAG = $(NAME)-$(VERSION)
 RPMBUILD=$(shell `which rpmbuild >&/dev/null` && echo "rpmbuild" || echo "rpm")
 
 INSTALL=install
-prefix ?= /usr
-includedir=$(prefix)/include
-libdir=$(prefix)/lib
-mandir=$(prefix)/man
 
 default: all
 
-- 
2.21.0


  parent reply	other threads:[~2019-05-25  9:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-25  8:58 [PATCH liburing 0/2] pkg-config support Stefan Hajnoczi
2019-05-25  8:58 ` [PATCH liburing 1/2] pkgconfig: install a liburing.pc file Stefan Hajnoczi
2019-05-25  8:58 ` Stefan Hajnoczi [this message]
2019-05-25 12:37 ` [PATCH liburing 0/2] pkg-config support Jens Axboe

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

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

  git send-email \
    --in-reply-to=20190525085830.31577-3-stefanha@redhat.com \
    --to=stefanha@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=jusual@mail.ru \
    --cc=linux-block@vger.kernel.org \
    --cc=mehta.aaru20@gmail.com \
    /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.
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 NNTP newsgroup(s).