All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] erofs-utils: introduce --with-lz4-include and --with-lz4-lib
@ 2018-12-19  4:05 Gao Xiang
  2018-12-19  4:05 ` [PATCH 2/2] erofs-utils: let erofs-utils use shared libraries if it can Gao Xiang
  2018-12-19  4:38 ` [PATCH v2 1/5] erofs-utils: introduce --with-lz4-include and --with-lz4-lib Gao Xiang
  0 siblings, 2 replies; 12+ messages in thread
From: Gao Xiang @ 2018-12-19  4:05 UTC (permalink / raw)


Signed-off-by: Gao Xiang <gaoxiang25 at huawei.com>
---
 Makefile.am  |  1 -
 configure.ac | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++---------
 2 files changed, 61 insertions(+), 11 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index b3dc472..cef847d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,7 +26,6 @@ noinst_HEADERS = erofs_config.h  \
 
 mkfs_erofs_CFLAGS = -Wall -Werror -DEROFS_MKFS_VERSION=\"v1.0\"
 mkfs_erofs_LDFLAGS  = --static
-mkfs_erofs_LDADD   = $(LIBLZ4_STATIC)
 ACLOCAL_AMFLAGS = -I m4
 
 if SUPPORT_LARG_FILE_AT_BIT32
diff --git a/configure.ac b/configure.ac
index 15974f8..4529576 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,27 +12,70 @@ AC_PROG_CC
 AC_PROG_INSTALL
 AC_PROG_LIBTOOL
 
+dnl EROFS_UTILS_PARSE_DIRECTORY
+dnl Input:  $1 = a string to a relative or absolute directory
+dnl Output: $2 = the variable to set with the absolute directory
+AC_DEFUN([EROFS_UTILS_PARSE_DIRECTORY],
+[
+ dnl Check if argument is a directory
+ if test -d $1 ; then
+    dnl Get the absolute path of the directory
+    dnl in case of relative directory.
+    dnl If realpath is not a valid command,
+    dnl an error is produced and we keep the given path.
+    local_tmp=`realpath $1 2>/dev/null`
+    if test "$local_tmp" != "" ; then
+       if test -d "$local_tmp" ; then
+           $2="$local_tmp"
+       else
+           $2=$1
+       fi
+    else
+       $2=$1
+    fi
+    dnl Check for space in the directory
+    if test `echo $1|cut -d' ' -f1` != $1 ; then
+        AC_MSG_ERROR($1 directory shall not contain any space.)
+    fi
+ else
+    AC_MSG_ERROR($1 shall be a valid directory)
+ fi
+])
 
 # checks system architecture firtly for enable support larg file
 ARCH_BIT=`getconf LONG_BIT`
 AM_CONDITIONAL([SUPPORT_LARG_FILE_AT_BIT32],[test x$ARCH_BIT = x32])
 
 # Checks for libraries.
-# Ask user for path to liblz4.a stuff:.
-AC_ARG_WITH(lz4,
-    [ --with-lz4=<path> prefix of liblz4.a installation. e.g. /usr/local or /usr],
-    [LIBLZ4_STATIC=$with_lz4/liblz4.a],
-    AC_MSG_ERROR([You must call configure with the --with-lz4 option.
-    This tells configure where to find the MySql C library and headers.
-    e.g. --with-lz4=/usr/local or --with-lz4=/usr])
-)
+# Ask user for LZ4 library path if needed.
+
+AC_ARG_WITH(lz4_include,
+   [  --with-lz4-include=DIR  LZ4 include directory ],
+   EROFS_UTILS_PARSE_DIRECTORY(["$withval"],[withval])
+   CPPFLAGS="$CPPFLAGS -I$withval")
+
+AC_ARG_WITH(lz4_lib,
+   [  --with-lz4-lib=DIR      LZ4 lib directory ], [
+   EROFS_UTILS_PARSE_DIRECTORY(["$withval"],[withval])
+   LDFLAGS="$LDFLAGS -L$withval"
+   lz4_lib_path="$withval"
+  ])
 
-AC_SUBST(LIBLZ4_STATIC)
+AC_ARG_WITH(lz4,
+   [  --with-lz4=DIR          LZ4 install directory, e.g. /usr/local or /usr ], [
+   EROFS_UTILS_PARSE_DIRECTORY(["$withval"],[withval])
+   if test -z "$with_gmp_lib" && test -z "$with_gmp_include" ; then
+      CPPFLAGS="$CPPFLAGS -I$withval/include"
+      LDFLAGS="$LDFLAGS -L$withval/lib"
+      lz4_lib_path="$withval/lib"
+   else
+      AC_MSG_FAILURE([Do not use --with-lz4 and --with-lz4-include/--with-lz4-lib options simultaneously.])
+   fi
+  ])
 
 # Checks for header files.
 AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h stddef.h stdint.h stdlib.h string.h sys/time.h unistd.h])
 
-
 # Checks for typedefs, structures, and compiler characteristics.
 AC_C_INLINE
 AC_TYPE_INT64_T
@@ -45,5 +88,13 @@ AC_TYPE_UINT64_T
 AC_FUNC_MALLOC
 AC_CHECK_FUNCS([ftruncate getcwd gettimeofday memset realpath strdup strerror strrchr strtoull])
 
+# Configure lz4.
+have_lz4="1"
+AC_CHECK_HEADERS([lz4.h], , [have_lz4="0"])
+AC_CHECK_LIB(lz4, LZ4_versionNumber, [LIBS="-Wl,-Bstatic,-llz4,-Bdynamic $LIBS"] , [have_lz4="0"])
+if test "x${have_lz4}" = "x0" ; then
+  AC_MSG_ERROR([Cannot build without lz4])
+fi
+
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
-- 
2.14.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/2] erofs-utils: let erofs-utils use shared libraries if it can
  2018-12-19  4:05 [PATCH 1/2] erofs-utils: introduce --with-lz4-include and --with-lz4-lib Gao Xiang
@ 2018-12-19  4:05 ` Gao Xiang
  2018-12-19  4:38 ` [PATCH v2 1/5] erofs-utils: introduce --with-lz4-include and --with-lz4-lib Gao Xiang
  1 sibling, 0 replies; 12+ messages in thread
From: Gao Xiang @ 2018-12-19  4:05 UTC (permalink / raw)


As an option, add LDFLAGS=--static LIBS=-Wl,--static
in front of ./configure to force static compilation as before.

ex,
$ LDFLAGS=--static LIBS=-Wl,--static ./configure
$ make

Signed-off-by: Gao Xiang <gaoxiang25 at huawei.com>
---
 Makefile.am | 1 -
 1 file changed, 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index cef847d..4381d3d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -25,7 +25,6 @@ noinst_HEADERS = erofs_config.h  \
 				 mkfs_file.h
 
 mkfs_erofs_CFLAGS = -Wall -Werror -DEROFS_MKFS_VERSION=\"v1.0\"
-mkfs_erofs_LDFLAGS  = --static
 ACLOCAL_AMFLAGS = -I m4
 
 if SUPPORT_LARG_FILE_AT_BIT32
-- 
2.14.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 1/5] erofs-utils: introduce --with-lz4-include and --with-lz4-lib
  2018-12-19  4:05 [PATCH 1/2] erofs-utils: introduce --with-lz4-include and --with-lz4-lib Gao Xiang
  2018-12-19  4:05 ` [PATCH 2/2] erofs-utils: let erofs-utils use shared libraries if it can Gao Xiang
@ 2018-12-19  4:38 ` Gao Xiang
  2018-12-19  4:38   ` [PATCH v2 2/5] erofs-utils: let erofs-utils use shared libraries if it can Gao Xiang
                     ` (4 more replies)
  1 sibling, 5 replies; 12+ messages in thread
From: Gao Xiang @ 2018-12-19  4:38 UTC (permalink / raw)


Signed-off-by: Gao Xiang <gaoxiang25 at huawei.com>
---
v1 -> v2:
 - clean up configure.ac further.
 - refine commit messages.

 Makefile.am  |  1 -
 configure.ac | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++---------
 2 files changed, 61 insertions(+), 11 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index b3dc472..cef847d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,7 +26,6 @@ noinst_HEADERS = erofs_config.h  \
 
 mkfs_erofs_CFLAGS = -Wall -Werror -DEROFS_MKFS_VERSION=\"v1.0\"
 mkfs_erofs_LDFLAGS  = --static
-mkfs_erofs_LDADD   = $(LIBLZ4_STATIC)
 ACLOCAL_AMFLAGS = -I m4
 
 if SUPPORT_LARG_FILE_AT_BIT32
diff --git a/configure.ac b/configure.ac
index 15974f8..4529576 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,27 +12,70 @@ AC_PROG_CC
 AC_PROG_INSTALL
 AC_PROG_LIBTOOL
 
+dnl EROFS_UTILS_PARSE_DIRECTORY
+dnl Input:  $1 = a string to a relative or absolute directory
+dnl Output: $2 = the variable to set with the absolute directory
+AC_DEFUN([EROFS_UTILS_PARSE_DIRECTORY],
+[
+ dnl Check if argument is a directory
+ if test -d $1 ; then
+    dnl Get the absolute path of the directory
+    dnl in case of relative directory.
+    dnl If realpath is not a valid command,
+    dnl an error is produced and we keep the given path.
+    local_tmp=`realpath $1 2>/dev/null`
+    if test "$local_tmp" != "" ; then
+       if test -d "$local_tmp" ; then
+           $2="$local_tmp"
+       else
+           $2=$1
+       fi
+    else
+       $2=$1
+    fi
+    dnl Check for space in the directory
+    if test `echo $1|cut -d' ' -f1` != $1 ; then
+        AC_MSG_ERROR($1 directory shall not contain any space.)
+    fi
+ else
+    AC_MSG_ERROR($1 shall be a valid directory)
+ fi
+])
 
 # checks system architecture firtly for enable support larg file
 ARCH_BIT=`getconf LONG_BIT`
 AM_CONDITIONAL([SUPPORT_LARG_FILE_AT_BIT32],[test x$ARCH_BIT = x32])
 
 # Checks for libraries.
-# Ask user for path to liblz4.a stuff:.
-AC_ARG_WITH(lz4,
-    [ --with-lz4=<path> prefix of liblz4.a installation. e.g. /usr/local or /usr],
-    [LIBLZ4_STATIC=$with_lz4/liblz4.a],
-    AC_MSG_ERROR([You must call configure with the --with-lz4 option.
-    This tells configure where to find the MySql C library and headers.
-    e.g. --with-lz4=/usr/local or --with-lz4=/usr])
-)
+# Ask user for LZ4 library path if needed.
+
+AC_ARG_WITH(lz4_include,
+   [  --with-lz4-include=DIR  LZ4 include directory ],
+   EROFS_UTILS_PARSE_DIRECTORY(["$withval"],[withval])
+   CPPFLAGS="$CPPFLAGS -I$withval")
+
+AC_ARG_WITH(lz4_lib,
+   [  --with-lz4-lib=DIR      LZ4 lib directory ], [
+   EROFS_UTILS_PARSE_DIRECTORY(["$withval"],[withval])
+   LDFLAGS="$LDFLAGS -L$withval"
+   lz4_lib_path="$withval"
+  ])
 
-AC_SUBST(LIBLZ4_STATIC)
+AC_ARG_WITH(lz4,
+   [  --with-lz4=DIR          LZ4 install directory, e.g. /usr/local or /usr ], [
+   EROFS_UTILS_PARSE_DIRECTORY(["$withval"],[withval])
+   if test -z "$with_gmp_lib" && test -z "$with_gmp_include" ; then
+      CPPFLAGS="$CPPFLAGS -I$withval/include"
+      LDFLAGS="$LDFLAGS -L$withval/lib"
+      lz4_lib_path="$withval/lib"
+   else
+      AC_MSG_FAILURE([Do not use --with-lz4 and --with-lz4-include/--with-lz4-lib options simultaneously.])
+   fi
+  ])
 
 # Checks for header files.
 AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h stddef.h stdint.h stdlib.h string.h sys/time.h unistd.h])
 
-
 # Checks for typedefs, structures, and compiler characteristics.
 AC_C_INLINE
 AC_TYPE_INT64_T
@@ -45,5 +88,13 @@ AC_TYPE_UINT64_T
 AC_FUNC_MALLOC
 AC_CHECK_FUNCS([ftruncate getcwd gettimeofday memset realpath strdup strerror strrchr strtoull])
 
+# Configure lz4.
+have_lz4="1"
+AC_CHECK_HEADERS([lz4.h], , [have_lz4="0"])
+AC_CHECK_LIB(lz4, LZ4_versionNumber, [LIBS="-Wl,-Bstatic,-llz4,-Bdynamic $LIBS"] , [have_lz4="0"])
+if test "x${have_lz4}" = "x0" ; then
+  AC_MSG_ERROR([Cannot build without lz4])
+fi
+
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
-- 
2.14.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 2/5] erofs-utils: let erofs-utils use shared libraries if it can
  2018-12-19  4:38 ` [PATCH v2 1/5] erofs-utils: introduce --with-lz4-include and --with-lz4-lib Gao Xiang
@ 2018-12-19  4:38   ` Gao Xiang
  2018-12-20  6:49     ` Li Guifu
  2018-12-19  4:38   ` [PATCH v2 3/5] erofs-utils: silence `Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac' Gao Xiang
                     ` (3 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Gao Xiang @ 2018-12-19  4:38 UTC (permalink / raw)


As an option, add LDFLAGS=--static LIBS=-Wl,--static
in front of ./configure to force static compilation
as before.
 ex, (force static compilation)
 $ LDFLAGS=--static LIBS=-Wl,--static ./configure
 $ make

Signed-off-by: Gao Xiang <gaoxiang25 at huawei.com>
---
 Makefile.am | 1 -
 1 file changed, 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index cef847d..4381d3d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -25,7 +25,6 @@ noinst_HEADERS = erofs_config.h  \
 				 mkfs_file.h
 
 mkfs_erofs_CFLAGS = -Wall -Werror -DEROFS_MKFS_VERSION=\"v1.0\"
-mkfs_erofs_LDFLAGS  = --static
 ACLOCAL_AMFLAGS = -I m4
 
 if SUPPORT_LARG_FILE_AT_BIT32
-- 
2.14.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 3/5] erofs-utils: silence `Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac'
  2018-12-19  4:38 ` [PATCH v2 1/5] erofs-utils: introduce --with-lz4-include and --with-lz4-lib Gao Xiang
  2018-12-19  4:38   ` [PATCH v2 2/5] erofs-utils: let erofs-utils use shared libraries if it can Gao Xiang
@ 2018-12-19  4:38   ` Gao Xiang
  2018-12-20  6:49     ` Li Guifu
  2018-12-19  4:38   ` [PATCH v2 4/5] erofs-utils: add autogen.sh Gao Xiang
                     ` (2 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Gao Xiang @ 2018-12-19  4:38 UTC (permalink / raw)


Signed-off-by: Gao Xiang <gaoxiang25 at huawei.com>
---
 configure.ac | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index 4529576..858ae25 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,6 +3,7 @@
 
 AC_PREREQ([2.69])
 AC_INIT([mkfs.erofs], [0.0.1], [bluce.liguifu at huawei.com])
+AC_CONFIG_MACRO_DIR([m4])
 AM_INIT_AUTOMAKE([foreign -Wall -Werror])
 AC_CONFIG_SRCDIR([mkfs_main.c])
 AC_CONFIG_HEADERS([config.h])
-- 
2.14.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 4/5] erofs-utils: add autogen.sh
  2018-12-19  4:38 ` [PATCH v2 1/5] erofs-utils: introduce --with-lz4-include and --with-lz4-lib Gao Xiang
  2018-12-19  4:38   ` [PATCH v2 2/5] erofs-utils: let erofs-utils use shared libraries if it can Gao Xiang
  2018-12-19  4:38   ` [PATCH v2 3/5] erofs-utils: silence `Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac' Gao Xiang
@ 2018-12-19  4:38   ` Gao Xiang
  2018-12-20  6:49     ` Li Guifu
  2018-12-19  4:38   ` [PATCH v2 5/5] erofs-utils: add AC_CONFIG_AUX_DIR(config) Gao Xiang
  2018-12-20  6:48   ` [PATCH v2 1/5] erofs-utils: introduce --with-lz4-include and --with-lz4-lib Li Guifu
  4 siblings, 1 reply; 12+ messages in thread
From: Gao Xiang @ 2018-12-19  4:38 UTC (permalink / raw)


In order to avoid type too many commands by hand.

Signed-off-by: Gao Xiang <gaoxiang25 at huawei.com>
---
 README     | 2 +-
 autogen.sh | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)
 create mode 100755 autogen.sh

diff --git a/README b/README
index 79a1126..4e34159 100644
--- a/README
+++ b/README
@@ -22,7 +22,7 @@ How to build with lz4 static library
 eg. if lz4 lib has been installed into fold of /usr/local/lib
 	./configure --with-lz4=/usr/local/lib && make
 Maybe you should run this first:
-	libtoolize && aclocal && autoconf && autoheader && automake --add-missing
+	./autogen.sh
 
 Usage:
 $ ./mkfs.erofs
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..117f4bd
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+aclocal && \
+autoheader && \
+autoconf && \
+libtoolize && \
+automake -a -c
+
-- 
2.14.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 5/5] erofs-utils: add AC_CONFIG_AUX_DIR(config)
  2018-12-19  4:38 ` [PATCH v2 1/5] erofs-utils: introduce --with-lz4-include and --with-lz4-lib Gao Xiang
                     ` (2 preceding siblings ...)
  2018-12-19  4:38   ` [PATCH v2 4/5] erofs-utils: add autogen.sh Gao Xiang
@ 2018-12-19  4:38   ` Gao Xiang
  2018-12-20  6:50     ` Li Guifu
  2018-12-20  6:48   ` [PATCH v2 1/5] erofs-utils: introduce --with-lz4-include and --with-lz4-lib Li Guifu
  4 siblings, 1 reply; 12+ messages in thread
From: Gao Xiang @ 2018-12-19  4:38 UTC (permalink / raw)


Signed-off-by: Gao Xiang <gaoxiang25 at huawei.com>
---
 .gitignore   | 9 +--------
 configure.ac | 1 +
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/.gitignore b/.gitignore
index 7e0a1cf..3cebe03 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,17 +28,10 @@ TAGS
 .deps/
 Makefile.in
 aclocal.m4
-compile
-config.guess
 config.h
 config.h.in
-config.sub
 configure
-depcomp
-install-sh
 libtool
-ltmain.sh
 m4/
-missing
 stamp-h1
-
+config/
diff --git a/configure.ac b/configure.ac
index 858ae25..345e8ba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,6 +4,7 @@
 AC_PREREQ([2.69])
 AC_INIT([mkfs.erofs], [0.0.1], [bluce.liguifu at huawei.com])
 AC_CONFIG_MACRO_DIR([m4])
+AC_CONFIG_AUX_DIR(config)
 AM_INIT_AUTOMAKE([foreign -Wall -Werror])
 AC_CONFIG_SRCDIR([mkfs_main.c])
 AC_CONFIG_HEADERS([config.h])
-- 
2.14.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 1/5] erofs-utils: introduce --with-lz4-include and --with-lz4-lib
  2018-12-19  4:38 ` [PATCH v2 1/5] erofs-utils: introduce --with-lz4-include and --with-lz4-lib Gao Xiang
                     ` (3 preceding siblings ...)
  2018-12-19  4:38   ` [PATCH v2 5/5] erofs-utils: add AC_CONFIG_AUX_DIR(config) Gao Xiang
@ 2018-12-20  6:48   ` Li Guifu
  4 siblings, 0 replies; 12+ messages in thread
From: Li Guifu @ 2018-12-20  6:48 UTC (permalink / raw)


On 2018/12/19 12:38, Gao Xiang wrote:
> Signed-off-by: Gao Xiang <gaoxiang25 at huawei.com>
> ---
> v1 -> v2:
>  - clean up configure.ac further.
>  - refine commit messages.
>
>  Makefile.am  |  1 -
>  configure.ac | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++---------
>  2 files changed, 61 insertions(+), 11 deletions(-)
>
> diff --git a/Makefile.am b/Makefile.am
> index b3dc472..cef847d 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -26,7 +26,6 @@ noinst_HEADERS = erofs_config.h  \
>  
>  mkfs_erofs_CFLAGS = -Wall -Werror -DEROFS_MKFS_VERSION=\"v1.0\"
>  mkfs_erofs_LDFLAGS  = --static
> -mkfs_erofs_LDADD   = $(LIBLZ4_STATIC)
>  ACLOCAL_AMFLAGS = -I m4
>  
>  if SUPPORT_LARG_FILE_AT_BIT32
> diff --git a/configure.ac b/configure.ac
> index 15974f8..4529576 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -12,27 +12,70 @@ AC_PROG_CC
>  AC_PROG_INSTALL
>  AC_PROG_LIBTOOL
>  
> +dnl EROFS_UTILS_PARSE_DIRECTORY
> +dnl Input:  $1 = a string to a relative or absolute directory
> +dnl Output: $2 = the variable to set with the absolute directory
> +AC_DEFUN([EROFS_UTILS_PARSE_DIRECTORY],
> +[
> + dnl Check if argument is a directory
> + if test -d $1 ; then
> +    dnl Get the absolute path of the directory
> +    dnl in case of relative directory.
> +    dnl If realpath is not a valid command,
> +    dnl an error is produced and we keep the given path.
> +    local_tmp=`realpath $1 2>/dev/null`
> +    if test "$local_tmp" != "" ; then
> +       if test -d "$local_tmp" ; then
> +           $2="$local_tmp"
> +       else
> +           $2=$1
> +       fi
> +    else
> +       $2=$1
> +    fi
> +    dnl Check for space in the directory
> +    if test `echo $1|cut -d' ' -f1` != $1 ; then
> +        AC_MSG_ERROR($1 directory shall not contain any space.)
> +    fi
> + else
> +    AC_MSG_ERROR($1 shall be a valid directory)
> + fi
> +])
>  
>  # checks system architecture firtly for enable support larg file
>  ARCH_BIT=`getconf LONG_BIT`
>  AM_CONDITIONAL([SUPPORT_LARG_FILE_AT_BIT32],[test x$ARCH_BIT = x32])
>  
>  # Checks for libraries.
> -# Ask user for path to liblz4.a stuff:.
> -AC_ARG_WITH(lz4,
> -    [ --with-lz4=<path> prefix of liblz4.a installation. e.g. /usr/local or /usr],
> -    [LIBLZ4_STATIC=$with_lz4/liblz4.a],
> -    AC_MSG_ERROR([You must call configure with the --with-lz4 option.
> -    This tells configure where to find the MySql C library and headers.
> -    e.g. --with-lz4=/usr/local or --with-lz4=/usr])
> -)
> +# Ask user for LZ4 library path if needed.
> +
> +AC_ARG_WITH(lz4_include,
> +   [  --with-lz4-include=DIR  LZ4 include directory ],
> +   EROFS_UTILS_PARSE_DIRECTORY(["$withval"],[withval])
> +   CPPFLAGS="$CPPFLAGS -I$withval")
> +
> +AC_ARG_WITH(lz4_lib,
> +   [  --with-lz4-lib=DIR      LZ4 lib directory ], [
> +   EROFS_UTILS_PARSE_DIRECTORY(["$withval"],[withval])
> +   LDFLAGS="$LDFLAGS -L$withval"
> +   lz4_lib_path="$withval"
> +  ])
>  
> -AC_SUBST(LIBLZ4_STATIC)
> +AC_ARG_WITH(lz4,
> +   [  --with-lz4=DIR          LZ4 install directory, e.g. /usr/local or /usr ], [
> +   EROFS_UTILS_PARSE_DIRECTORY(["$withval"],[withval])
> +   if test -z "$with_gmp_lib" && test -z "$with_gmp_include" ; then
> +      CPPFLAGS="$CPPFLAGS -I$withval/include"
> +      LDFLAGS="$LDFLAGS -L$withval/lib"
> +      lz4_lib_path="$withval/lib"
> +   else
> +      AC_MSG_FAILURE([Do not use --with-lz4 and --with-lz4-include/--with-lz4-lib options simultaneously.])
> +   fi
> +  ])
>  
>  # Checks for header files.
>  AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h stddef.h stdint.h stdlib.h string.h sys/time.h unistd.h])
>  
> -
>  # Checks for typedefs, structures, and compiler characteristics.
>  AC_C_INLINE
>  AC_TYPE_INT64_T
> @@ -45,5 +88,13 @@ AC_TYPE_UINT64_T
>  AC_FUNC_MALLOC
>  AC_CHECK_FUNCS([ftruncate getcwd gettimeofday memset realpath strdup strerror strrchr strtoull])
>  
> +# Configure lz4.
> +have_lz4="1"
> +AC_CHECK_HEADERS([lz4.h], , [have_lz4="0"])
> +AC_CHECK_LIB(lz4, LZ4_versionNumber, [LIBS="-Wl,-Bstatic,-llz4,-Bdynamic $LIBS"] , [have_lz4="0"])
> +if test "x${have_lz4}" = "x0" ; then
> +  AC_MSG_ERROR([Cannot build without lz4])
> +fi
> +
>  AC_CONFIG_FILES([Makefile])
>  AC_OUTPUT

Reviewed-by: Li Guifu <bluce.liguifu at huawei.com>

Thanks,

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2 2/5] erofs-utils: let erofs-utils use shared libraries if it can
  2018-12-19  4:38   ` [PATCH v2 2/5] erofs-utils: let erofs-utils use shared libraries if it can Gao Xiang
@ 2018-12-20  6:49     ` Li Guifu
  0 siblings, 0 replies; 12+ messages in thread
From: Li Guifu @ 2018-12-20  6:49 UTC (permalink / raw)


On 2018/12/19 12:38, Gao Xiang wrote:
> As an option, add LDFLAGS=--static LIBS=-Wl,--static
> in front of ./configure to force static compilation
> as before.
>  ex, (force static compilation)
>  $ LDFLAGS=--static LIBS=-Wl,--static ./configure
>  $ make
>
> Signed-off-by: Gao Xiang <gaoxiang25 at huawei.com>
> ---
>  Makefile.am | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/Makefile.am b/Makefile.am
> index cef847d..4381d3d 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -25,7 +25,6 @@ noinst_HEADERS = erofs_config.h  \
>  				 mkfs_file.h
>  
>  mkfs_erofs_CFLAGS = -Wall -Werror -DEROFS_MKFS_VERSION=\"v1.0\"
> -mkfs_erofs_LDFLAGS  = --static
>  ACLOCAL_AMFLAGS = -I m4
>  
>  if SUPPORT_LARG_FILE_AT_BIT32

Reviewed-by: Li Guifu <bluce.liguifu at huawei.com>

Thanks,

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2 3/5] erofs-utils: silence `Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac'
  2018-12-19  4:38   ` [PATCH v2 3/5] erofs-utils: silence `Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac' Gao Xiang
@ 2018-12-20  6:49     ` Li Guifu
  0 siblings, 0 replies; 12+ messages in thread
From: Li Guifu @ 2018-12-20  6:49 UTC (permalink / raw)


On 2018/12/19 12:38, Gao Xiang wrote:
> Signed-off-by: Gao Xiang <gaoxiang25 at huawei.com>
> ---
>  configure.ac | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/configure.ac b/configure.ac
> index 4529576..858ae25 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -3,6 +3,7 @@
>  
>  AC_PREREQ([2.69])
>  AC_INIT([mkfs.erofs], [0.0.1], [bluce.liguifu at huawei.com])
> +AC_CONFIG_MACRO_DIR([m4])
>  AM_INIT_AUTOMAKE([foreign -Wall -Werror])
>  AC_CONFIG_SRCDIR([mkfs_main.c])
>  AC_CONFIG_HEADERS([config.h])

Reviewed-by: Li Guifu <bluce.liguifu at huawei.com>

Thanks,

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2 4/5] erofs-utils: add autogen.sh
  2018-12-19  4:38   ` [PATCH v2 4/5] erofs-utils: add autogen.sh Gao Xiang
@ 2018-12-20  6:49     ` Li Guifu
  0 siblings, 0 replies; 12+ messages in thread
From: Li Guifu @ 2018-12-20  6:49 UTC (permalink / raw)


On 2018/12/19 12:38, Gao Xiang wrote:
> In order to avoid type too many commands by hand.
>
> Signed-off-by: Gao Xiang <gaoxiang25 at huawei.com>
> ---
>  README     | 2 +-
>  autogen.sh | 8 ++++++++
>  2 files changed, 9 insertions(+), 1 deletion(-)
>  create mode 100755 autogen.sh
>
> diff --git a/README b/README
> index 79a1126..4e34159 100644
> --- a/README
> +++ b/README
> @@ -22,7 +22,7 @@ How to build with lz4 static library
>  eg. if lz4 lib has been installed into fold of /usr/local/lib
>  	./configure --with-lz4=/usr/local/lib && make
>  Maybe you should run this first:
> -	libtoolize && aclocal && autoconf && autoheader && automake --add-missing
> +	./autogen.sh
>  
>  Usage:
>  $ ./mkfs.erofs
> diff --git a/autogen.sh b/autogen.sh
> new file mode 100755
> index 0000000..117f4bd
> --- /dev/null
> +++ b/autogen.sh
> @@ -0,0 +1,8 @@
> +#!/bin/sh
> +
> +aclocal && \
> +autoheader && \
> +autoconf && \
> +libtoolize && \
> +automake -a -c
> +

Reviewed-by: Li Guifu <bluce.liguifu at huawei.com>

Thanks,

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2 5/5] erofs-utils: add AC_CONFIG_AUX_DIR(config)
  2018-12-19  4:38   ` [PATCH v2 5/5] erofs-utils: add AC_CONFIG_AUX_DIR(config) Gao Xiang
@ 2018-12-20  6:50     ` Li Guifu
  0 siblings, 0 replies; 12+ messages in thread
From: Li Guifu @ 2018-12-20  6:50 UTC (permalink / raw)


On 2018/12/19 12:38, Gao Xiang wrote:
> Signed-off-by: Gao Xiang <gaoxiang25 at huawei.com>
> ---
>  .gitignore   | 9 +--------
>  configure.ac | 1 +
>  2 files changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/.gitignore b/.gitignore
> index 7e0a1cf..3cebe03 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -28,17 +28,10 @@ TAGS
>  .deps/
>  Makefile.in
>  aclocal.m4
> -compile
> -config.guess
>  config.h
>  config.h.in
> -config.sub
>  configure
> -depcomp
> -install-sh
>  libtool
> -ltmain.sh
>  m4/
> -missing
>  stamp-h1
> -
> +config/
> diff --git a/configure.ac b/configure.ac
> index 858ae25..345e8ba 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -4,6 +4,7 @@
>  AC_PREREQ([2.69])
>  AC_INIT([mkfs.erofs], [0.0.1], [bluce.liguifu at huawei.com])
>  AC_CONFIG_MACRO_DIR([m4])
> +AC_CONFIG_AUX_DIR(config)
>  AM_INIT_AUTOMAKE([foreign -Wall -Werror])
>  AC_CONFIG_SRCDIR([mkfs_main.c])
>  AC_CONFIG_HEADERS([config.h])

Reviewed-by: Li Guifu <bluce.liguifu at huawei.com>

Thanks,

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-12-20  6:50 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-19  4:05 [PATCH 1/2] erofs-utils: introduce --with-lz4-include and --with-lz4-lib Gao Xiang
2018-12-19  4:05 ` [PATCH 2/2] erofs-utils: let erofs-utils use shared libraries if it can Gao Xiang
2018-12-19  4:38 ` [PATCH v2 1/5] erofs-utils: introduce --with-lz4-include and --with-lz4-lib Gao Xiang
2018-12-19  4:38   ` [PATCH v2 2/5] erofs-utils: let erofs-utils use shared libraries if it can Gao Xiang
2018-12-20  6:49     ` Li Guifu
2018-12-19  4:38   ` [PATCH v2 3/5] erofs-utils: silence `Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac' Gao Xiang
2018-12-20  6:49     ` Li Guifu
2018-12-19  4:38   ` [PATCH v2 4/5] erofs-utils: add autogen.sh Gao Xiang
2018-12-20  6:49     ` Li Guifu
2018-12-19  4:38   ` [PATCH v2 5/5] erofs-utils: add AC_CONFIG_AUX_DIR(config) Gao Xiang
2018-12-20  6:50     ` Li Guifu
2018-12-20  6:48   ` [PATCH v2 1/5] erofs-utils: introduce --with-lz4-include and --with-lz4-lib Li Guifu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.