[sheepdog] [PATCH v4 1/3] modify configure.ac to build sheepdog on rhel5 environment

Robin Dong robin.k.dong at gmail.com
Thu Aug 22 05:19:01 CEST 2013


From: Robin Dong <sanbai at taobao.com>

In our product machine we use rhel5 on 2.6.32-linux-kernel, but sheepdog can't build
on rhel5. It need some modifications to do this.

1. old version autoconf does not support AM_SILENT_RULES() so replace it with check for shell.
2. use SIZEOF_SHORT/INT/LONG instead of AC_TYPE_INT16/32/64.
3. check header files such as sys/eventfd.h sys/signalfd.h etc.
4. use SIZEOF_LONG instead of __SIZEOF_LONG__

Signed-off-by: Robin Dong <sanbai at taobao.com>
---
 Makefile.am      |    2 --
 configure.ac     |   47 +++++++++++++++++++++++++++++++++--------------
 include/bitops.h |    6 +++---
 3 files changed, 36 insertions(+), 19 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 915ce54..81f4a09 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -11,8 +11,6 @@ MAINTAINERCLEANFILES	= Makefile.in aclocal.m4 configure depcomp	\
 			  autoheader automake autoconf config.status	\
 			  config.log
 
-dist_doc_DATA		= 
-
 sheepdogsysconfdir	= ${SHEEPDOGCONFDIR}
 
 sheepdogsysconf_DATA	= 
diff --git a/configure.ac b/configure.ac
index 83d90be..9e878f5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,8 +16,6 @@
 #
 
 # bootstrap / init
-AC_PREREQ([2.61])
-
 m4_define([sheepdog_version], [0.7.50])
 
 m4_define([git_version],
@@ -35,7 +33,19 @@ AC_CANONICAL_HOST
 
 AC_LANG([C])
 
-AM_SILENT_RULES([yes])
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)])
+
+if make --help 2>&1 | grep -q no-print-directory; then
+	AM_MAKEFLAGS="$AM_MAKEFLAGS --no-print-directory";
+fi
+
+if make --help 2>&1 | grep -q quiet; then
+	AM_MAKEFLAGS="$AM_MAKEFLAGS --quiet"
+fi
+
+if libtool --help 2>&1 | grep -q quiet; then
+	AM_LIBTOOLFLAGS="--quiet";
+fi
 
 m4_ifndef([PKG_PROG_PKG_CONFIG], AC_MSG_ERROR([pkg-config not found]))
 
@@ -96,19 +106,28 @@ AC_CHECK_HEADERS([urcu.h urcu/uatomic.h],,
 AC_C_CONST
 AC_TYPE_UID_T
 AC_C_INLINE
-AC_TYPE_INT16_T
-AC_TYPE_INT32_T
-AC_TYPE_INT64_T
-AC_TYPE_INT8_T
 AC_TYPE_SIZE_T
-AC_TYPE_SSIZE_T
 AC_HEADER_TIME
-AC_TYPE_UINT16_T
-AC_TYPE_UINT32_T
-AC_TYPE_UINT64_T
-AC_TYPE_UINT8_T
 AC_C_VOLATILE
 
+AC_CHECK_SIZEOF(short)
+AC_CHECK_SIZEOF(int)
+AC_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF(long long)
+SIZEOF_SHORT=$ac_cv_sizeof_short
+SIZEOF_INT=$ac_cv_sizeof_int
+SIZEOF_LONG=$ac_cv_sizeof_long
+SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
+AC_SUBST(SIZEOF_SHORT)
+AC_SUBST(SIZEOF_INT)
+AC_SUBST(SIZEOF_LONG)
+AC_SUBST(SIZEOF_LONG_LONG)
+
+# Checks for header files.
+AC_CHECK_HEADERS([sys/eventfd.h])
+AC_CHECK_HEADERS([sys/signalfd.h])
+AC_CHECK_HEADERS([sys/timerfd.h])
+
 # Checks for library functions.
 AC_FUNC_CLOSEDIR_VOID
 AC_FUNC_ERROR_AT_LINE
@@ -124,7 +143,7 @@ AC_FUNC_VPRINTF
 AC_CHECK_FUNCS([alarm alphasort atexit bzero dup2 endgrent endpwent fcntl \
 		getcwd getpeerucred getpeereid gettimeofday inet_ntoa memmove \
 		memset mkdir scandir select socket strcasecmp strchr strdup \
-		strerror strrchr strspn strstr])
+		strerror strrchr strspn strstr fallocate])
 
 AC_CONFIG_FILES([Makefile
 		dog/Makefile
@@ -431,7 +450,7 @@ AC_MSG_RESULT([  Features                 =${PACKAGE_FEATURES}])
 AC_MSG_RESULT([])
 AC_MSG_RESULT([$PACKAGE build info:])
 AC_MSG_RESULT([  Library SONAME           = ${SONAME}])
-LIB_MSG_RESULT(m4_shift(local_soname_list))dnl
+AC_MSG_RESULT(m4_shift(local_soname_list))
 AC_MSG_RESULT([  Default optimization     = ${OPT_CFLAGS}])
 AC_MSG_RESULT([  Default debug options    = ${GDB_CFLAGS}])
 AC_MSG_RESULT([  Extra compiler warnings  = ${EXTRA_WARNING}])
diff --git a/include/bitops.h b/include/bitops.h
index c2ff3e7..c4e8f74 100644
--- a/include/bitops.h
+++ b/include/bitops.h
@@ -157,7 +157,7 @@ static inline void clear_bit(unsigned int nr, unsigned long *addr)
  * set bit if value is nonzero. The last (most significant) bit is
  * at position 64.
  */
-#if __SIZEOF_LONG__ == 4
+#if SIZEOF_LONG == 4
 static __always_inline int fls64(uint64_t x)
 {
 	uint32_t h = x >> 32;
@@ -169,7 +169,7 @@ static __always_inline int fls64(uint64_t x)
 		return 64 - __builtin_clzl(h);
 	return 32 - __builtin_clzl(x);
 }
-#elif __SIZEOF_LONG__ == 8
+#elif SIZEOF_LONG == 8
 static __always_inline int fls64(uint64_t x)
 {
 	if (x == 0)
@@ -177,7 +177,7 @@ static __always_inline int fls64(uint64_t x)
 	return 64 - __builtin_clzl(x);
 }
 #else
-#error __SIZEOF_LONG__ not 4 or 8
+#error SIZEOF_LONG not 4 or 8
 #endif
 
 #endif /* __BITOPS_H__ */
-- 
1.7.3.2




More information about the sheepdog mailing list