Skip to contentSkip to conversation

Added a low-level endian conversion function check in configure.ac to add support for systems where only BSD-like 'betoh*(...)' functions are available (such as Android when compiling with Bionic).

PATCH New Charles Briere 4 participants 22 messages May 6, 2013 9 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 2/14 Added a low-level endian conversion function check in configure.ac to add support for systems where only BSD-like 'betoh*(...)' functions are available (such as Android when compiling with Bionic).

From: Pierre-Luc St-Charles <[email protected]>

---
 configure.ac                   | 10 ++++++++++
 src/bin/lttng-relayd/cmd-2-2.c |  1 +
 src/bin/lttng-relayd/main.c    |  1 +
 src/common/compat/endian.h     |  6 +++++-
 src/common/relayd/relayd.c     |  1 +
 5 files changed, 18 insertions(+), 1 deletion(-)
configure.ac +10 -0
index eee025a..618d203 100644
@@ -123,6 +123,16 @@ AC_CHECK_LIB([pthread], [pthread_create], [],
 ]
 )
 
+# Check low-level endian compat functions
+AC_CHECK_DECL(be64toh, [], 
+[
+	AC_CHECK_DECL(betoh64, [AC_DEFINE_UNQUOTED([LTTNG_HAVE_BETOH64], 1, [Has BSD-style endian conversion operations.])], 
+	[
+		AC_MSG_ERROR([Cannot find be64toh, betoh64 or any similar functions.])
+	])
+]
+)
+
 # Check libpopt
 AC_CHECK_LIB([popt], [poptGetContext], [],
 [
src/bin/lttng-relayd/cmd-2-2.c +1 -0
index 0450fbf..09ff7f5 100644
@@ -22,6 +22,7 @@
 
 #include <common/common.h>
 #include <common/sessiond-comm/relayd.h>
+#include <common/compat/endian.h>
 
 #include "cmd-generic.h"
 #include "cmd-2-1.h"
src/bin/lttng-relayd/main.c +1 -0
index 9a2b3bd..0bf3ead 100644
@@ -43,6 +43,7 @@
 #include <common/common.h>
 #include <common/compat/poll.h>
 #include <common/compat/socket.h>
+#include <common/compat/endian.h>
 #include <common/defaults.h>
 #include <common/futex.h>
 #include <common/sessiond-comm/sessiond-comm.h>
src/common/compat/endian.h +5 -1
index 2850866..b7f66cc 100644
@@ -15,11 +15,15 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#ifdef _COMPAT_ENDIAN_H
+#ifndef _COMPAT_ENDIAN_H
 #define _COMPAT_ENDIAN_H
 
 #ifdef __linux__
 #include <endian.h>
+#ifdef LTTNG_HAVE_BETOH64
+#define be64toh(x) betoh64(x)
+#define be32toh(x) betoh32(x)
+#endif // LTTNG_HAVE_BETOH64
 #elif defined(__FreeBSD__)
 #include <machine/endian.h>
 #else
src/common/relayd/relayd.c +1 -0
index 82bcf5f..ba7bd13 100644
@@ -26,6 +26,7 @@
 #include <common/common.h>
 #include <common/defaults.h>
 #include <common/sessiond-comm/relayd.h>
+#include <common/compat/endian.h>
 
 #include "relayd.h"
 
Signature · 1 line
1.8.1.msysgit.1
#2 lore raw

PATCH 3/14 Adding libext2_uuid support

In reply to a message not in the archive
---
 configure.ac             | 1 +
 src/common/Makefile.am   | 5 +++++
 src/common/compat/uuid.h | 2 +-
 3 files changed, 7 insertions(+), 1 deletion(-)
configure.ac +1 -0
index 618d203..b78cc94 100644
@@ -172,6 +172,7 @@ AC_CHECK_LIB([uuid], [uuid_generate],
 )
 AM_CONDITIONAL([LTTNG_BUILD_WITH_LIBUUID], [test "x$have_libuuid" = "xyes"])
 AM_CONDITIONAL([LTTNG_BUILD_WITH_LIBC_UUID], [test "x$have_libc_uuid" = "xyes"])
+AM_CONDITIONAL([LTTNG_BUILD_WITH_LIBEXT2_UUID], [test "x$have_libext2_uuid" = "xyes"])
 
 # URCU library version needed or newer
 liburcu_version=">= 0.7.2"
src/common/Makefile.am +5 -0
index f2ea40a..6aa6c4a 100644
@@ -14,7 +14,12 @@ noinst_LTLIBRARIES = libcommon.la
 
 libcommon_la_SOURCES = error.h error.c utils.c utils.h runas.c runas.h \
                        common.h futex.c futex.h uri.c uri.h defaults.c
+
+if LTTNG_BUILD_WITH_LIBEXT2_UUID
+libcommon_la_LIBADD = -lext2_uuid
+else
 libcommon_la_LIBADD = -luuid
+endif
 
 # Consumer library
 noinst_LTLIBRARIES += libconsumer.la
src/common/compat/uuid.h +1 -1
index 35faf53..448d6bd 100644
@@ -30,7 +30,7 @@
 #define UUID_STR_LEN		37
 #define UUID_LEN		16
 
-#ifdef LTTNG_HAVE_LIBUUID
+#if defined(LTTNG_HAVE_LIBUUID) || defined(LTTNG_HAVE_LIBEXT2_UUID)
 #include <uuid/uuid.h>
 
 /*
Signature · 1 line
1.8.1.msysgit.1
#3 lore raw

PATCH 4/14 Adding epoll compat for Android and gettid check for presence on any arch

In reply to a message not in the archive

From: Pierre-Luc St-Charles <[email protected]>

---
 configure.ac             |  6 ++++++
 src/common/compat/poll.h | 13 +++++++++++++
 src/common/compat/tid.h  |  6 ++++++
 src/common/uri.h         |  6 ++++++
 4 files changed, 31 insertions(+)
configure.ac +6 -0
index b78cc94..eb79fc4 100644
@@ -133,6 +133,12 @@ AC_CHECK_DECL(be64toh, [],
 ]
 )
 
+# Check if gettid() is already defined
+AC_CHECK_DECL(gettid,
+[
+	AC_DEFINE_UNQUOTED([LTTNG_HAVE_GETTID], 1, [Has already gettid defined])
+])
+
 # Check libpopt
 AC_CHECK_LIB([popt], [poptGetContext], [],
 [
src/common/compat/poll.h +13 -0
index 9e88976..3687c5d 100644
@@ -52,6 +52,19 @@ static inline void __lttng_poll_free(void *events)
 #ifdef HAVE_EPOLL
 #include <sys/epoll.h>
 #include <stdio.h>
+#ifdef __ANDROID__
+#include <asm/unistd.h>
+#ifndef EPOLLRDHUP
+#define EPOLLRDHUP 0x2000
+#endif
+#ifndef EPOLL_CLOEXEC
+#define EPOLL_CLOEXEC 02000000
+#endif
+static inline int epoll_create1(int flags)
+{
+	return syscall(__NR_epoll_create1,flags);
+}
+#endif /* __ANDROID__ */
 
 /* See man epoll(7) for this define path */
 #define COMPAT_EPOLL_PROC_PATH "/proc/sys/fs/epoll/max_user_watches"
src/common/compat/tid.h +6 -0
index 40f562f..81afa2b 100644
@@ -26,17 +26,23 @@
 #define LTTNG_TID_H
 
 #ifdef __linux__
+#ifdef __ANDROID__
+#include <sys/syscall.h>
+#else
 #include <syscall.h>
+#endif // __ANDROID__
 #endif
 
 #if defined(_syscall0)
 _syscall0(pid_t, gettid)
 #elif defined(__NR_gettid)
 #include <unistd.h>
+#ifndef LTTNG_HAVE_GETTID
 static inline pid_t gettid(void)
 {
 	return syscall(__NR_gettid);
 }
+#endif // LTTNG_HAVE_GETTID
 #else
 #include <sys/types.h>
 #include <unistd.h>
src/common/uri.h +6 -0
index 347b639..88a5e01 100644
@@ -21,6 +21,12 @@
 #include <netinet/in.h>
 #include <lttng/lttng.h>
 
+#ifdef __ANDROID__
+#ifndef in_port_t
+typedef uint16_t in_port_t;
+#endif // in_port_t
+#endif // __ANDROID__
+
 /* Destination type of lttng URI */
 enum lttng_dst_type {
 	LTTNG_DST_IPV4                        = 1,
Signature · 1 line
1.8.1.msysgit.1
#4 lore raw

PATCH 5/14 sys/un.h is already included in compat/socket.h and throws error if included before sock.h on Android.

In reply to a message not in the archive
---
 src/common/sessiond-comm/unix.h | 1 -
 1 file changed, 1 deletion(-)
src/common/sessiond-comm/unix.h +0 -1
index 34f156f..0252f4f 100644
@@ -20,7 +20,6 @@
 
 #define _GNU_SOURCE
 #include <limits.h>
-#include <sys/un.h>
 
 #include <common/compat/socket.h>
 
Signature · 1 line
1.8.1.msysgit.1
#5 lore raw

PATCH 6/14 Adding signal compat in order to implement missing functions on Android

In reply to a message not in the archive
---
 src/common/compat/Makefile.am     |  3 ++-
 src/common/compat/compat-signal.c | 14 ++++++++++++++
 src/common/compat/signal.h        | 14 ++++++++++++++
 src/common/consumer-timer.c       |  2 +-
 src/common/runas.c                |  2 +-
 5 files changed, 32 insertions(+), 3 deletions(-)
 create mode 100644 src/common/compat/compat-signal.c
 create mode 100644 src/common/compat/signal.h
src/common/compat/Makefile.am +2 -1
index 537375b..124ef08 100644
@@ -9,4 +9,5 @@ COMPAT=compat-poll.c
 endif
 
 libcompat_la_SOURCES = poll.h fcntl.h endian.h mman.h clone.h \
-                       socket.h compat-fcntl.c uuid.h tid.h $(COMPAT)
+                       socket.h compat-fcntl.c uuid.h tid.h \
+                       compat-signal.c $(COMPAT)
src/common/compat/compat-signal.c new file +14 -0
new file mode 100644
index 0000000..aba30db
@@ -0,0 +1,14 @@
+#include "signal.h"
+#ifdef __ANDROID__
+int __rt_sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *ts, long nr) {
+  return syscall(__NR_rt_sigtimedwait, set, info, ts, nr);
+}
+
+int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *ts) {
+  return __rt_sigtimedwait(set,info,ts,_NSIG/8);
+}
+
+int sigwaitinfo(const sigset_t *set, siginfo_t *info) {
+  return sigtimedwait(set, info, NULL);
+}
+#endif
src/common/compat/signal.h new file +14 -0
new file mode 100644
index 0000000..f7251d3
@@ -0,0 +1,14 @@
+#ifndef LTTNG_COMPAT_SIGNAL_H
+#define LTTNG_COMPAT_SIGNAL_H
+
+#include <signal.h>
+#ifdef __ANDROID__
+#include <sys/syscall.h>
+#include <asm/unistd.h>
+#include <linux/time.h>
+int __rt_sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *ts, long nr);
+int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *ts);
+int sigwaitinfo(const sigset_t *set, siginfo_t *info);
+#endif // __ANDROID__
+
+#endif //LTTNG_COMPAT_SIGNAL_H
src/common/consumer-timer.c +1 -1
index ef056d1..0ae369f 100644
@@ -19,8 +19,8 @@
 #define _GNU_SOURCE
 #include <assert.h>
 #include <inttypes.h>
-#include <signal.h>
 
+#include <common/compat/signal.h>
 #include <common/common.h>
 
 #include "consumer-timer.h"
src/common/runas.c +1 -1
index bd51cd4..0317cba 100644
@@ -28,12 +28,12 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <sched.h>
-#include <sys/signal.h>
 
 #include <common/common.h>
 #include <common/utils.h>
 #include <common/compat/mman.h>
 #include <common/compat/clone.h>
+#include <common/compat/signal.h>
 
 #include "runas.h"
 
Signature · 1 line
1.8.1.msysgit.1
#6 lore raw

PATCH 7/14 Adding missing SPLICE syscall wrappers for Android

In reply to a message not in the archive
---
 src/common/compat/fcntl.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
src/common/compat/fcntl.h +21 -0
index 04fe03a..80a6899 100644
@@ -31,6 +31,27 @@ typedef off64_t loff_t;
 #endif
 
 #ifdef __linux__
+#ifdef __ANDROID__
+#include <asm/unistd.h>
+#include <sys/syscall.h>
+#define SPLICE_F_MOVE		(0x01)
+#define SPLICE_F_NONBLOCK	(0x02)
+#define SPLICE_F_MORE		(0x04)
+#define SPLICE_F_GIFT		(0x08)
+static inline ssize_t splice(int fd_in, loff_t *off_in, int fd_out,
+	                      loff_t *off_out, size_t len, unsigned int flags)
+{
+	return syscall(__NR_splice,fd_in,off_in,fd_out,off_out,len,flags);
+}
+#include <linux/fs.h>
+#include <linux/fadvise.h>
+#define POSIX_FADV_DONTNEED 0
+static inline int posix_fadvise(int fd, off_t offset, off_t len, int advice)
+{
+       return -ENOSYS;
+}
+#endif /* __ANDROID__ */
+
 extern int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes,
 		unsigned int flags);
 #define lttng_sync_file_range(fd, offset, nbytes, flags) \
Signature · 1 line
1.8.1.msysgit.1
#7 lore raw

PATCH 8/14 Added configure option for specifying lttng run directory [LTTNG_RUNDIR] Set different default run directory for Android

In reply to a message not in the archive
---
 configure.ac          | 23 +++++++++++++++++++++--
 src/common/defaults.h |  2 --
 2 files changed, 21 insertions(+), 4 deletions(-)
configure.ac +21 -2
index eb79fc4..b3738d2 100644
@@ -43,8 +43,10 @@ AM_CONDITIONAL([NO_SHARED], [test x$enable_shared = xno])
 
 AM_CONDITIONAL([TARGET_HOST_ANDROID], [false])
 case "${host}" in
-    *-*-linux-androideabi) AM_CONDITIONAL([TARGET_HOST_ANDROID], [true])
-    ;;
+	*-*-linux-androideabi)
+		AM_CONDITIONAL([TARGET_HOST_ANDROID], [true])
+		target_host_android="yes"
+	;;
 esac
 
 AC_CHECK_HEADERS([ \
@@ -256,6 +258,23 @@ AC_CHECK_LIB([c], [open_memstream],
 ]
 )
 
+AC_ARG_VAR([LTTNG_RUNDIR], [Path to run directory, default to /var/run])
+
+AS_IF([test -n "$LTTNG_RUNDIR"],
+[
+	lttng_rundir=$LTTNG_RUNDIR
+],
+[
+	AS_IF([test "x$target_host_android" = "xyes"],
+	[
+		lttng_rundir="/data/lttng/var/run"
+	],
+	[
+		lttng_rundir="/var/run/lttng"
+	])
+])
+AC_DEFINE_UNQUOTED([DEFAULT_LTTNG_RUNDIR], ["$lttng_rundir"], [Location of the run directory])
+
 # For Python
 # SWIG version needed or newer:
 swig_version=2.0.0
src/common/defaults.h +0 -2
index fb6a975..74400d7 100644
@@ -76,8 +76,6 @@
 #define DEFAULT_USTCONSUMERD32_CMD_SOCK_PATH    DEFAULT_USTCONSUMERD32_PATH "/command"
 #define DEFAULT_USTCONSUMERD32_ERR_SOCK_PATH    DEFAULT_USTCONSUMERD32_PATH "/error"
 
-/* Default lttng run directory */
-#define DEFAULT_LTTNG_RUNDIR                    "/var/run/lttng"
 #define DEFAULT_LTTNG_HOME_RUNDIR               "%s/.lttng"
 #define DEFAULT_LTTNG_SESSIOND_PIDFILE          "lttng-sessiond.pid"
 
Signature · 1 line
1.8.1.msysgit.1
#8 lore raw

PATCH 9/14 Added ashmem framework support for ust apps and sessiond

In reply to a message not in the archive

From: Pierre-Luc St-Charles <[email protected]>

---
 src/bin/lttng-consumerd/lttng-consumerd.c |  6 +++
 src/bin/lttng-sessiond/shm.c              | 75 +++++++++++++++++++++++++++++++
 src/bin/lttng-sessiond/shm.h              | 16 +++++++
 3 files changed, 97 insertions(+)
src/bin/lttng-consumerd/lttng-consumerd.c +6 -0
index edf1f15..cbd610c 100644
@@ -28,7 +28,11 @@
 #include <string.h>
 #include <sys/ipc.h>
 #include <sys/resource.h>
+#ifdef __ANDROID__
+#include <linux/shm.h>
+#else
 #include <sys/shm.h>
+#endif
 #include <sys/socket.h>
 #include <sys/stat.h>
 #include <sys/types.h>
@@ -39,7 +43,9 @@
 #include <assert.h>
 #include <config.h>
 #include <urcu/compiler.h>
+#ifndef __ANDROID__
 #include <ulimit.h>
+#endif
 
 #include <common/defaults.h>
 #include <common/common.h>
src/bin/lttng-sessiond/shm.c +75 -0

90 lines not on this page · raw message

src/bin/lttng-sessiond/shm.h +16 -0
index bcce28b..abe965e 100644
@@ -21,4 +21,20 @@
 
 char *shm_ust_get_mmap(char *shm_path, int global);
 
+#ifdef __ANDROID__
+/*
+ * Temporary fix for missing ashmem references when compiling with the NDK
+ * (instead of trying to port via Android makefiles)
+ */
+#ifndef _CUTILS_ASHMEM_H
+#define _CUTILS_ASHMEM_H
+#define _CUTILS_ASHMEM_NO_NDK_H
+int ashmem_create_region(const char *name, size_t size);
+int ashmem_set_prot_region(int fd, int prot);
+int ashmem_pin_region(int fd, size_t offset, size_t len);
+int ashmem_unpin_region(int fd, size_t offset, size_t len);
+int ashmem_get_size_region(int fd);
+#endif //_CUTILS_ASHMEM_H
+#endif //__ANDROID__
+
 #endif /* _LTT_SHM_H */
Signature · 1 line
1.8.1.msysgit.1
#9 lore raw

PATCH 10/14 Added HOST_NAME_MAX definition to compat/socket.h if not already defined (which is the case for android)

In reply to a message not in the archive

From: Pierre-Luc St-Charles <[email protected]>

---
 src/bin/lttng-sessiond/consumer.c     | 1 +
 src/bin/lttng-sessiond/ust-metadata.c | 1 +
 src/common/compat/socket.h            | 9 +++++++++
 3 files changed, 11 insertions(+)
src/bin/lttng-sessiond/consumer.c +1 -0
index e3d1be0..98d79e4 100644
@@ -25,6 +25,7 @@
 #include <unistd.h>
 #include <inttypes.h>
 
+#include <common/compat/socket.h>
 #include <common/common.h>
 #include <common/defaults.h>
 #include <common/uri.h>
src/bin/lttng-sessiond/ust-metadata.c +1 -0
index b0f83d2..28f4d1a 100644
@@ -28,6 +28,7 @@
 #include <unistd.h>
 #include <inttypes.h>
 #include <common/common.h>
+#include <common/compat/socket.h>
 
 #include "ust-registry.h"
 #include "ust-clock.h"
src/common/compat/socket.h +9 -0
index 4d2925f..46aa9c5 100644
@@ -23,6 +23,15 @@
 
 #include <common/macros.h>
 
+#ifndef HOST_NAME_MAX
+/* 
+ * On some platforms (such as Android), this define might not be
+ * exposed in any kernel headers; the most commonly assigned value
+ * is 64. This can be verified using getconf HOST_MAX_NAME.
+ */
+#define HOST_NAME_MAX 64
+#endif
+
 #ifdef __linux__
 
 #define LTTNG_SOCK_CREDS SCM_CREDENTIALS
Signature · 1 line
1.8.1.msysgit.1
#10 lore raw

PATCH 11/14 Added configure.ac check for pthread_cond_timedwait_monotonic support (which is a non-standard pthread function) & usage handling in sessiond's main.c.

In reply to a message not in the archive

From: Michael Poupart <[email protected]>

---
 configure.ac                  | 17 +++++++++++++++++
 src/bin/lttng-sessiond/main.c |  7 +++++++
 2 files changed, 24 insertions(+)
configure.ac +17 -0
index b3738d2..c405020 100644
@@ -182,6 +182,23 @@ AM_CONDITIONAL([LTTNG_BUILD_WITH_LIBUUID], [test "x$have_libuuid" = "xyes"])
 AM_CONDITIONAL([LTTNG_BUILD_WITH_LIBC_UUID], [test "x$have_libc_uuid" = "xyes"])
 AM_CONDITIONAL([LTTNG_BUILD_WITH_LIBEXT2_UUID], [test "x$have_libext2_uuid" = "xyes"])
 
+# Check for the non-standard pthread_cond_timedwait_monotonic function in lpthread/libc
+AC_CHECK_LIB([pthread], [pthread_cond_timedwait_monotonic],
+[
+	have_pthread_cndtmwt_mono=yes
+],
+[
+	AC_CHECK_LIB([c], [pthread_cond_timedwait_monotonic],
+	[
+		have_pthread_cndtmwt_mono=yes
+	])
+])
+AS_IF([test "x$have_pthread_cndtmwt_mono" = "xyes"],
+[
+	AC_DEFINE_UNQUOTED([LTTNG_HAVE_PTHREAD_CNDTMWT_MONO], 1, [Has non-standard pthread_cond_timedwait_monotonic support.])
+])
+
+
 # URCU library version needed or newer
 liburcu_version=">= 0.7.2"
 
src/bin/lttng-sessiond/main.c +7 -0
index f6a051a..d8ff4c2 100644
@@ -1732,6 +1732,7 @@ static int spawn_consumer_thread(struct consumer_data *consumer_data)
 		goto error;
 	}
 
+#ifndef LTTNG_HAVE_PTHREAD_CNDTMWT_MONO
 	/*
 	 * Set the monotonic clock in order to make sure we DO NOT jump in time
 	 * between the clock_gettime() call and the timedwait call. See bug #324
@@ -1743,6 +1744,7 @@ static int spawn_consumer_thread(struct consumer_data *consumer_data)
 		PERROR("pthread_condattr_setclock consumer data");
 		goto error;
 	}
+#endif
 
 	ret = pthread_cond_init(&consumer_data->cond, &consumer_data->condattr);
 	if (ret != 0) {
@@ -1792,8 +1794,13 @@ static int spawn_consumer_thread(struct consumer_data *consumer_data)
 			ret = pthread_cond_wait(&consumer_data->cond,
 					&consumer_data->cond_mutex);
 		} else {
+#ifdef LTTNG_HAVE_PTHREAD_CNDTMWT_MONO
+			ret = pthread_cond_timedwait_monotonic(&consumer_data->cond,
+					&consumer_data->cond_mutex, &timeout);
+#else
 			ret = pthread_cond_timedwait(&consumer_data->cond,
 					&consumer_data->cond_mutex, &timeout);
+#endif
 		}
 	}
 
Signature · 1 line
1.8.1.msysgit.1
#11 lore raw

PATCH 12/14 Using pthread_kill instead of pthread_cancel (not a good idea but requried for now)

In reply to a message not in the archive

From: Pierre-Luc St-Charles <[email protected]>

---
 configure.ac                  | 18 ++++++++++++++++++
 src/bin/lttng-sessiond/main.c |  8 ++++++++
 2 files changed, 26 insertions(+)
configure.ac +18 -0
index c405020..154b0a7 100644
@@ -198,6 +198,24 @@ AS_IF([test "x$have_pthread_cndtmwt_mono" = "xyes"],
 	AC_DEFINE_UNQUOTED([LTTNG_HAVE_PTHREAD_CNDTMWT_MONO], 1, [Has non-standard pthread_cond_timedwait_monotonic support.])
 ])
 
+# Check for pthread_cancel support (which might not be present in lightweight versions of lpthread)
+AC_CHECK_LIB([pthread], [pthread_cancel],
+[
+	have_pthread_cancel=yes
+],
+[
+	AC_CHECK_LIB([c], [pthread_cancel],
+	[
+		have_pthread_cancel=yes
+	])
+])
+AS_IF([test "x$have_pthread_cancel" = "xyes"],
+[
+	AC_DEFINE_UNQUOTED([LTTNG_HAVE_PTHREAD_CANCEL], 1, [Has standard pthread_cancel support.])
+],
+[
+	AC_MSG_WARN([The targeted platform does not support pthread_cancel; defaulting to pthread_kill, but it might not be 100% safe.])
+])
 
 # URCU library version needed or newer
 liburcu_version=">= 0.7.2"
src/bin/lttng-sessiond/main.c +8 -0
index d8ff4c2..73bdc0a 100644
@@ -1816,10 +1816,18 @@ static int spawn_consumer_thread(struct consumer_data *consumer_data)
 			 */
 			ERR("Condition timed out. The consumer thread was never ready."
 					" Killing it");
+#ifdef LTTNG_HAVE_PTHREAD_CANCEL
 			ret = pthread_cancel(consumer_data->thread);
 			if (ret < 0) {
 				PERROR("pthread_cancel consumer thread");
 			}
+#else
+			WARN("Using pthread_kill instead of pthread_cancel...");
+			ret = pthread_kill(consumer_data->thread,SIGTERM);
+			if (ret < 0) {
+				PERROR("pthread_kill consumer thread");
+			}
+#endif
 		} else {
 			PERROR("pthread_cond_wait failed consumer thread");
 		}
Signature · 1 line
1.8.1.msysgit.1
#12 lore raw

PATCH 13/14 Remove malloc in fscanf since it is not supported on all platforms.

In reply to a message not in the archive

From: Pierre-Luc St-Charles <[email protected]>

---
 src/bin/lttng-sessiond/kernel.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
src/bin/lttng-sessiond/kernel.c +2 -4
index 856d423..ed9e221 100644
@@ -591,7 +591,7 @@ error:
 ssize_t kernel_list_events(int tracer_fd, struct lttng_event **events)
 {
 	int fd, pos, ret;
-	char *event;
+	char event[LTTNG_SYMBOL_NAME_LEN];
 	size_t nbmem, count = 0;
 	FILE *fp;
 	struct lttng_event *elist;
@@ -622,7 +622,7 @@ ssize_t kernel_list_events(int tracer_fd, struct lttng_event **events)
 		goto end;
 	}
 
-	while (fscanf(fp, "event { name = %m[^;]; };%n\n", &event, &pos) == 1) {
+	while (fscanf(fp, "event { name = %[^;]; };%n\n", &event, &pos) == 1) {
 		if (count >= nbmem) {
 			struct lttng_event *new_elist;
 
@@ -633,7 +633,6 @@ ssize_t kernel_list_events(int tracer_fd, struct lttng_event **events)
 			new_elist = realloc(elist, nbmem * sizeof(struct lttng_event));
 			if (new_elist == NULL) {
 				PERROR("realloc list events");
-				free(event);
 				free(elist);
 				count = -ENOMEM;
 				goto end;
@@ -644,7 +643,6 @@ ssize_t kernel_list_events(int tracer_fd, struct lttng_event **events)
 		elist[count].name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
 		elist[count].enabled = -1;
 		count++;
-		free(event);
 	}
 
 	*events = elist;
Signature · 1 line
1.8.1.msysgit.1
#13 lore raw

PATCH 14/14 Cleaned up configure.ac: Replaced space indents by tabs, regrouped AC_ARG_WITH's, generalized the coding style, fixed a bad AS_HELP_STRING.

In reply to a message not in the archive

From: Pierre-Luc St-Charles <[email protected]>

---
 configure.ac | 315 ++++++++++++++++++++++++++++++++---------------------------
 1 file changed, 171 insertions(+), 144 deletions(-)
configure.ac +171 -144
index 154b0a7..e4d2c6f 100644
@@ -17,27 +17,32 @@ AC_CONFIG_HEADERS([include/config.h])
 AC_PROG_GREP
 # libtool link_all_deplibs fixup. See http://bugs.lttng.org/issues/321.
 AC_ARG_ENABLE(libtool-linkdep-fixup,
-	AS_HELP_STRING([--disable-libtool-linkdep-fixup],
-			[disable the libtool fixup for linking all dependent libraries (link_all_deplibs)]),
-	libtool_fixup=$enableval,
-	libtool_fixup=yes)
+[
+	AS_HELP_STRING([--disable-libtool-linkdep-fixup],[disable the libtool fixup for linking all dependent libraries (link_all_deplibs)])
+],
+[
+	libtool_fixup=$enableval
+],
+[
+	libtool_fixup=yes
+])
 
 AS_IF([test "x$libtool_fixup" = "xyes"],
-	    [
-	    libtool_m4="$srcdir/config/libtool.m4"
-	    libtool_flag_pattern=".*link_all_deplibs\s*,\s*\$1\s*)"
-	    AC_MSG_CHECKING([for occurence(s) of link_all_deplibs = no in $libtool_m4])
-	    libtool_flag_pattern_count=$(grep -c "$libtool_flag_pattern\s*=\s*no" $libtool_m4)
-	    AS_IF([test $libtool_flag_pattern_count -ne 0],
-	    [
-		  AC_MSG_RESULT([$libtool_flag_pattern_count])
-		  AC_MSG_WARN([the detected libtool will not link all dependencies, forcing link_all_deplibs = unknown])
-		  sed -i "s/\($libtool_flag_pattern\)\s*=\s*no/\1=unknown/g" $libtool_m4
-		  ],
-		  [
-		  AC_MSG_RESULT([none])
-		  ])
-	    ])
+[
+	libtool_m4="$srcdir/config/libtool.m4"
+	libtool_flag_pattern=".*link_all_deplibs\s*,\s*\$1\s*)"
+	AC_MSG_CHECKING([for occurence(s) of link_all_deplibs = no in $libtool_m4])
+	libtool_flag_pattern_count=$(grep -c "$libtool_flag_pattern\s*=\s*no" $libtool_m4)
+	AS_IF([test $libtool_flag_pattern_count -ne 0],
+	[
+		AC_MSG_RESULT([$libtool_flag_pattern_count])
+		AC_MSG_WARN([the detected libtool will not link all dependencies, forcing link_all_deplibs = unknown])
+		sed -i "s/\($libtool_flag_pattern\)\s*=\s*no/\1=unknown/g" $libtool_m4
+	],
+	[
+		AC_MSG_RESULT([none])
+	])
+])
 
 AM_CONDITIONAL([NO_SHARED], [test x$enable_shared = xno])
 
@@ -57,55 +62,55 @@ AC_CHECK_HEADERS([ \
 
 # Babeltrace viewer check
 AC_ARG_WITH([babeltrace-bin],
-	AS_HELP_STRING([--with-babeltrace-bin],
-	[Location of the babeltrace viewer executable (including the filename)]),
+	AS_HELP_STRING([--with-babeltrace-bin], [Location of the babeltrace viewer executable (including the filename)]),
 	[BABELTRACE_BIN="$withval"],
 	[BABELTRACE_BIN=''])
 AC_SUBST([BABELTRACE_BIN])
 
 # lttv-gui
 AC_ARG_WITH([lttv-gui-bin],
-	AS_HELP_STRING([--with-lttv-gui-bin],
-   [Location of the lttv GUI viewer executable (including the filename)]),
-   [LTTV_GUI_BIN="$withval"],
-   [LTTV_GUI_BIN=''])
+	AS_HELP_STRING([--with-lttv-gui-bin], [Location of the lttv GUI viewer executable (including the filename)]),
+	[LTTV_GUI_BIN="$withval"],
+	[LTTV_GUI_BIN=''])
 AC_SUBST([LTTV_GUI_BIN])
 
 AC_ARG_WITH([consumerd32-bin],
-	AS_HELP_STRING([--with-consumerd32-bin],
-	[Location of the 32-bit consumerd executable (including the filename)]),
+	AS_HELP_STRING([--with-consumerd32-bin], [Location of the 32-bit consumerd executable (including the filename)]),
 	[CONSUMERD32_BIN="$withval"],
 	[CONSUMERD32_BIN=''])
 AC_SUBST([CONSUMERD32_BIN])
 
 AC_ARG_WITH([consumerd64-bin],
-	AS_HELP_STRING([--with-consumerd64-bin],
-	[Location of the 64-bit consumerd executable (including the filename)]),
+	AS_HELP_STRING([--with-consumerd64-bin], [Location of the 64-bit consumerd executable (including the filename)]),
 	[CONSUMERD64_BIN="$withval"],
 	[CONSUMERD64_BIN=''])
 AC_SUBST([CONSUMERD64_BIN])
 
 AC_ARG_WITH([consumerd32-libdir],
-	AS_HELP_STRING([--with-consumerd32-libdir],
-	[Directory containing the 32-bit consumerd libraries]),
+	AS_HELP_STRING([--with-consumerd32-libdir], [Directory containing the 32-bit consumerd libraries]),
 	[CONSUMERD32_LIBDIR="$withval"],
 	[CONSUMERD32_LIBDIR=''])
 AC_SUBST([CONSUMERD32_LIBDIR])
 
 AC_ARG_WITH([consumerd64-libdir],
-	AS_HELP_STRING([--with-consumerd64-libdir],
-	[Directory containing the 64-bit consumerd libraries]),
+	AS_HELP_STRING([--with-consumerd64-libdir], [Directory containing the 64-bit consumerd libraries]),
 	[CONSUMERD64_LIBDIR="$withval"],
 	[CONSUMERD64_LIBDIR=''])
 AC_SUBST([CONSUMERD64_LIBDIR])
 
 AC_ARG_WITH([sessiond-bin],
-	AS_HELP_STRING([--with-sessiond-bin],
-	[Location of the sessiond executable (including the filename)]),
+	AS_HELP_STRING([--with-sessiond-bin], [Location of the sessiond executable (including the filename)]),
 	[SESSIOND_BIN="$withval"],
 	[SESSIOND_BIN=''])
 AC_SUBST([SESSIOND_BIN])
 
+# Option to only build the consumer daemon and its libraries
+AC_ARG_WITH([consumerd-only],
+	AS_HELP_STRING([--with-consumerd-only], [Only build the consumer daemon [default=no]]),
+	[consumerd_only=$withval],
+	[consumerd_only=no])
+AM_CONDITIONAL([BUILD_CONSUMERD_ONLY], [test "x$consumerd_only" = "xyes"])
+
 AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD32_BIN], "$CONSUMERD32_BIN", [Location of the 32-bit consumerd executable.])
 AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD64_BIN], "$CONSUMERD64_BIN", [Location of the 64-bit consumerd executable])
 AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD32_LIBDIR], "$CONSUMERD32_LIBDIR", [Search for consumerd 32-bit libraries in this location.])
@@ -117,23 +122,24 @@ AC_DEFINE_UNQUOTED([CONFIG_SESSIOND_BIN], "$SESSIOND_BIN", [Location of the sess
 # Check for pthread
 AC_CHECK_LIB([pthread], [pthread_create], [],
 [
-    # Check for pthread in a bionic libc...
+	# Check for pthread in a bionic libc...
 	AC_CHECK_LIB([c], [pthread_create], [], 
 	[
-	    AC_MSG_ERROR([Cannot find libpthread. Use [LDFLAGS]=-Ldir to specify its location.])
+		AC_MSG_ERROR([Cannot find libpthread. Use [LDFLAGS]=-Ldir to specify its location.])
 	])
-]
-)
+])
 
 # Check low-level endian compat functions
 AC_CHECK_DECL(be64toh, [], 
 [
-	AC_CHECK_DECL(betoh64, [AC_DEFINE_UNQUOTED([LTTNG_HAVE_BETOH64], 1, [Has BSD-style endian conversion operations.])], 
+	AC_CHECK_DECL(betoh64,
+	[
+		AC_DEFINE_UNQUOTED([LTTNG_HAVE_BETOH64], 1, [Has BSD-style endian conversion operations.])
+	],
 	[
 		AC_MSG_ERROR([Cannot find be64toh, betoh64 or any similar functions.])
 	])
-]
-)
+])
 
 # Check if gettid() is already defined
 AC_CHECK_DECL(gettid,
@@ -146,11 +152,10 @@ AC_CHECK_LIB([popt], [poptGetContext], [],
 [
 	# Check for libpopt in oprofile for Android
 	AC_CHECK_LIB([oprofile_popt], [poptGetContext], [], 
-    [
-        AC_MSG_ERROR([Cannot find libpopt. Use [LDFLAGS]=-Ldir to specify its location.])
-    ])
-]
-)
+	[
+		AC_MSG_ERROR([Cannot find libpopt. Use [LDFLAGS]=-Ldir to specify its location.])
+	])
+])
 
 # Check for libuuid
 AC_CHECK_LIB([uuid], [uuid_generate],
@@ -176,8 +181,7 @@ AC_CHECK_LIB([uuid], [uuid_generate],
 			AC_MSG_ERROR([Cannot find libuuid uuid_generate, libc uuid_create nor libext2_uuid uuid_generate. Use [LDFLAGS]=-Ldir to specify their location.])
 		])
 	])
-]
-)
+])
 AM_CONDITIONAL([LTTNG_BUILD_WITH_LIBUUID], [test "x$have_libuuid" = "xyes"])
 AM_CONDITIONAL([LTTNG_BUILD_WITH_LIBC_UUID], [test "x$have_libc_uuid" = "xyes"])
 AM_CONDITIONAL([LTTNG_BUILD_WITH_LIBEXT2_UUID], [test "x$have_libext2_uuid" = "xyes"])
@@ -222,41 +226,59 @@ liburcu_version=">= 0.7.2"
 
 # Check liburcu needed function calls
 AC_CHECK_DECL([cds_list_add], [],
-	[AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/list.h>]]
-)
+[
+	AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/list.h>]
+])
 AC_CHECK_DECL([cds_wfq_init], [],
-	[AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/wfqueue.h>]]
-)
+[
+	AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/wfqueue.h>]
+])
 AC_CHECK_DECL([cds_wfq_dequeue_blocking], [],
-    [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/wfqueue.h>]]
-)
+[
+	AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/wfqueue.h>]
+])
 AC_CHECK_DECL([futex_async], [],
-	[AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/futex.h>]]
-)
+[
+	AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/futex.h>]
+])
 AC_CHECK_DECL([rcu_thread_offline], [],
-	[AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu.h>]]
-)
+[
+	AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu.h>]
+])
 AC_CHECK_DECL([rcu_thread_online], [],
-	[AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu.h>]]
-)
+[
+	AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu.h>]
+])
 AC_CHECK_DECL([caa_likely], [],
-	[AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu.h>]]
-)
+[
+	AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu.h>]
+])
 
 # Check liblttng-ust-ctl library
 AC_ARG_ENABLE(lttng-ust,
-	AS_HELP_STRING([--disable-lttng-ust],[build without LTTng-UST (Userspace Tracing) support]),
-	lttng_ust_support=$enableval, lttng_ust_support=yes)
+[
+	AS_HELP_STRING([--disable-lttng-ust],[build without LTTng-UST (Userspace Tracing) support])
+],
+[
+	lttng_ust_support=$enableval
+],
+[
+	lttng_ust_support=yes
+])
 
-AS_IF([test "x$lttng_ust_support" = "xyes"], [
+AS_IF([test "x$lttng_ust_support" = "xyes"],
+[
 	AC_CHECK_LIB([lttng-ust-ctl], [ustctl_set_filter],
-		[
-			AC_DEFINE([HAVE_LIBLTTNG_UST_CTL], [1], [has LTTng-UST control support])
-			lttng_ust_ctl_found=yes
-		],
-		[AC_MSG_ERROR([Cannot find LTTng-UST 2.1.x. Use [LDFLAGS]=-Ldir to specify its location, or specify --disable-lttng-ust to build lttng-tools without LTTng-UST support.])],
-		[-lurcu-common -lurcu-bp -lurcu-cds -lc -lrt]
-	)
+	[
+		AC_DEFINE([HAVE_LIBLTTNG_UST_CTL], [1], [has LTTng-UST control support])
+		lttng_ust_ctl_found=yes
+	],
+	[
+		AC_MSG_ERROR([Cannot find LTTng-UST 2.1.x. Use [LDFLAGS]=-Ldir to specify its location, or specify --disable-lttng-ust to build lttng-tools without LTTng-UST support.])
+	],
+	[
+		-lurcu-common -lurcu-bp -lurcu-cds -lc -lrt
+	])
 ])
 AM_CONDITIONAL([HAVE_LIBLTTNG_UST_CTL], [test "x$lttng_ust_ctl_found" = xyes])
 AC_CHECK_FUNCS([sched_getcpu sysconf sync_file_range])
@@ -283,18 +305,15 @@ AM_CONDITIONAL([LTTNG_TOOLS_BUILD_WITH_LIBC_DL], [test "x$have_libc_dl" = "xyes"
 AC_CHECK_LIB([c], [fmemopen],
 [
 	AC_DEFINE_UNQUOTED([LTTNG_HAVE_FMEMOPEN], 1, [Has fmemopen support.])
-]
-)
+])
 
 # Check for open_memstream
 AC_CHECK_LIB([c], [open_memstream],
 [
 	AC_DEFINE_UNQUOTED([LTTNG_HAVE_OPEN_MEMSTREAM], 1, [Has open_memstream support.])
-]
-)
+])
 
 AC_ARG_VAR([LTTNG_RUNDIR], [Path to run directory, default to /var/run])
-
 AS_IF([test -n "$LTTNG_RUNDIR"],
 [
 	lttng_rundir=$LTTNG_RUNDIR
@@ -315,54 +334,49 @@ AC_DEFINE_UNQUOTED([DEFAULT_LTTNG_RUNDIR], ["$lttng_rundir"], [Location of the r
 swig_version=2.0.0
 
 AC_ARG_ENABLE([python-bindings],
-              [AC_HELP_STRING([--enable-python-bindings],
-                              [compile Python bindings])],
-              [enable_python=yes], [enable_python=no])
+[
+	AS_HELP_STRING([--enable-python-bindings], [compile Python bindings])
+],
+[
+	enable_python=yes
+],
+[
+	enable_python=no
+])
 
 AM_CONDITIONAL([USE_PYTHON], [test "x${enable_python:-yes}" = xyes])
 
 if test "x${enable_python:-yes}" = xyes; then
-  AX_PKG_SWIG($swig_version, [], [ AC_MSG_ERROR([SWIG $swig_version or newer is needed]) ])
-  AM_PATH_PYTHON
-
-  AC_ARG_VAR([PYTHON_INCLUDE], [Include flags for python, bypassing python-config])
-  AC_ARG_VAR([PYTHON_CONFIG], [Path to python-config])
-  AS_IF([test -z "$PYTHON_INCLUDE"], [
-    AS_IF([test -z "$PYTHON_CONFIG"], [
-      AC_PATH_PROGS([PYTHON_CONFIG],
-                    [python$PYTHON_VERSION-config python-config],
-                    [no],
-                    [`dirname $PYTHON`])
-      AS_IF([test "$PYTHON_CONFIG" = no], [AC_MSG_ERROR([cannot find python-config for $PYTHON. Do you have python-dev installed?])])
-    ])
-    AC_MSG_CHECKING([python include flags])
-    PYTHON_INCLUDE=`$PYTHON_CONFIG --includes`
-    AC_MSG_RESULT([$PYTHON_INCLUDE])
-  ])
-
+	AX_PKG_SWIG($swig_version, [],
+	[
+		AC_MSG_ERROR([SWIG $swig_version or newer is needed])
+	])
+	AM_PATH_PYTHON
+	AC_ARG_VAR([PYTHON_INCLUDE], [Include flags for python, bypassing python-config])
+	AC_ARG_VAR([PYTHON_CONFIG], [Path to python-config])
+	AS_IF([test -z "$PYTHON_INCLUDE"],
+	[
+		AS_IF([test -z "$PYTHON_CONFIG"],
+		[
+			AC_PATH_PROGS([PYTHON_CONFIG], [python$PYTHON_VERSION-config python-config], [no], [`dirname $PYTHON`])
+			AS_IF([test "$PYTHON_CONFIG" = no],
+			[
+				AC_MSG_ERROR([cannot find python-config for $PYTHON. Do you have python-dev installed?])
+			])
+		])
+		AC_MSG_CHECKING([python include flags])
+		PYTHON_INCLUDE=`$PYTHON_CONFIG --includes`
+		AC_MSG_RESULT([$PYTHON_INCLUDE])
+	])
 else
-    AC_MSG_NOTICE([You may configure with --enable-python-bindings ]dnl
-[if you want Python bindings.])
-
+	AC_MSG_NOTICE([You may configure with --enable-python-bindings if you want Python bindings.])
 fi
 
-# Option to only build the consumer daemon and its libraries
-AC_ARG_WITH([consumerd-only],
-	AS_HELP_STRING([--with-consumerd-only],[Only build the consumer daemon [default=no]]),
-	[consumerd_only=$withval],
-	[consumerd_only=no])
-AM_CONDITIONAL([BUILD_CONSUMERD_ONLY], [test "x$consumerd_only" = "xyes"])
-
 # Epoll check. If not present, the build will fallback on poll() API
-AX_HAVE_EPOLL(
-	[AX_CONFIG_FEATURE_ENABLE(epoll)],
-	[AX_CONFIG_FEATURE_DISABLE(epoll)]
-)
-AX_CONFIG_FEATURE(
-	[epoll], [This platform supports epoll(7)],
-	[HAVE_EPOLL], [This platform supports epoll(7).],
-	[enable_epoll="yes"], [enable_epoll="no"]
-)
+AX_HAVE_EPOLL([AX_CONFIG_FEATURE_ENABLE(epoll)],[AX_CONFIG_FEATURE_DISABLE(epoll)])
+AX_CONFIG_FEATURE([epoll], [This platform supports epoll(7)],
+		[HAVE_EPOLL], [This platform supports epoll(7).],
+		[enable_epoll="yes"], [enable_epoll="no"])
 AM_CONDITIONAL([COMPAT_EPOLL], [ test "$enable_epoll" = "yes" ])
 
 AC_SYS_LARGEFILE
@@ -455,37 +469,43 @@ AS_ECHO()
 # Target architecture we're building for
 target_arch=$host_cpu
 [
-for f in $CFLAGS; do
-        if test $f = "-m32"; then
+	for f in $CFLAGS; do
+		if test $f = "-m32"; then
 			target_arch="32-bit"
-        elif test $f = "-m64"; then
+		elif test $f = "-m64"; then
 			target_arch="64-bit"
-        fi
-done
+		fi
+	done
 ]
 AS_ECHO_N("Target architecture: ")
 AS_ECHO($target_arch)
 
 # LTTng-UST enabled/disabled
 AS_ECHO_N("Lttng-UST support: ")
-AS_IF([test "x$lttng_ust_support" = "xyes"],[
+AS_IF([test "x$lttng_ust_support" = "xyes"],
+[
 	AS_ECHO("Enabled")
-],[
+],
+[
 	AS_ECHO("Disabled")
 ])
 
 #Python binding enabled/disabled
 AS_ECHO_N("Python binding: ")
-AS_IF([test "x${enable_python:-yes}" = xyes], [
+AS_IF([test "x${enable_python:-yes}" = xyes],
+[
 	AS_ECHO("Enabled")
-],[
+],
+[
 	AS_ECHO("Disabled")
 ])
 
 # Do we build only the consumerd, or everything
-AS_IF([test "x$consumerd_only" = "xyes"],[
+AS_IF([test "x$consumerd_only" = "xyes"],
+[
 	AS_ECHO("Only the consumerd daemon will be built.")
-],[
+],
+[
 	AS_ECHO("All binaries will be built.")
 ])
 
@@ -497,45 +517,52 @@ AS_ECHO_N("Libraries will be installed in: ")
 AS_ECHO("`eval eval echo $libdir`")
 
 # If we build the sessiond, print the paths it will use
-AS_IF([test "x$consumerd_only" = "xno"],[
+AS_IF([test "x$consumerd_only" = "xno"],
+[
 	AS_ECHO()
 	AS_ECHO_N("The lttng command will look for the lttng-sessiond executable at: ")
-	AS_IF([test "$SESSIOND_BIN" = ""],[
+	AS_IF([test "$SESSIOND_BIN" = ""],
+	[
 		AS_ECHO_N("`eval eval echo $bindir`")
 		AS_ECHO("/lttng-sessiond")
-	],[
+	],
+	[
 		AS_ECHO("$SESSIOND_BIN")
 	])
-
 	AS_ECHO()
 	AS_ECHO("The sessiond daemon will look in the following directories: ")
 	AS_ECHO_N("32-bit consumerd executable at: ")
-	AS_IF([test "$CONSUMERD32_BIN" = ""],[
+	AS_IF([test "$CONSUMERD32_BIN" = ""],
+	[
 		AS_ECHO_N("`eval eval echo $lttnglibexecdir`")
 		AS_ECHO("/lttng-consumerd")
-	],[
+	],
+	[
 		AS_ECHO("$CONSUMERD32_BIN")
 	])
-
 	AS_ECHO_N("32-bit consumer libraries in:   ")
-	AS_IF([test "$CONSUMERD32_LIBDIR" = ""],[
+	AS_IF([test "$CONSUMERD32_LIBDIR" = ""],
+	[
 		AS_ECHO("`eval eval echo $libdir`")
-	],[
+	],
+	[
 		AS_ECHO("$CONSUMERD32_LIBDIR")
 	])
-
 	AS_ECHO_N("64-bit consumerd executable at: ")
-	AS_IF([test "$CONSUMERD64_BIN" = ""],[
+	AS_IF([test "$CONSUMERD64_BIN" = ""],
+	[
 		AS_ECHO_N("`eval eval echo $lttnglibexecdir`")
 		AS_ECHO("/lttng-consumerd")
-	],[
+	],
+	[
 		AS_ECHO("$CONSUMERD64_BIN")
 	])
-
 	AS_ECHO_N("64-bit consumer libraries in:   ")
-	AS_IF([test "$CONSUMERD64_LIBDIR" = ""],[
+	AS_IF([test "$CONSUMERD64_LIBDIR" = ""],
+	[
 		AS_ECHO("`eval eval echo $libdir`")
-	],[
+	],
+	[
 		AS_ECHO("$CONSUMERD64_LIBDIR")
 	])
 ])
Signature · 1 line
1.8.1.msysgit.1

A message that is not in the archive (sent off-list or not yet received): [email protected]

#15 lore raw

Charles Briere:

Quoted 64 lines

From: Pierre-Luc St-Charles <[email protected]>

---
 configure.ac                   | 10 ++++++++++
 src/bin/lttng-relayd/cmd-2-2.c |  1 +
 src/bin/lttng-relayd/main.c    |  1 +
 src/common/compat/endian.h     |  6 +++++-
 src/common/relayd/relayd.c     |  1 +
 5 files changed, 18 insertions(+), 1 deletion(-)
configure.ac +10 -0
index eee025a..618d203 100644
@@ -123,6 +123,16 @@ AC_CHECK_LIB([pthread], [pthread_create], [],
 ]
 )
 
+# Check low-level endian compat functions
+AC_CHECK_DECL(be64toh, [], 
+[
+	AC_CHECK_DECL(betoh64, [AC_DEFINE_UNQUOTED([LTTNG_HAVE_BETOH64], 1, [Has BSD-style endian conversion operations.])], 
+	[
+		AC_MSG_ERROR([Cannot find be64toh, betoh64 or any similar functions.])
+	])
+]
+)
+
 # Check libpopt
 AC_CHECK_LIB([popt], [poptGetContext], [],
 [
src/bin/lttng-relayd/cmd-2-2.c +1 -0
index 0450fbf..09ff7f5 100644
@@ -22,6 +22,7 @@
 
 #include <common/common.h>
 #include <common/sessiond-comm/relayd.h>
+#include <common/compat/endian.h>
 
 #include "cmd-generic.h"
 #include "cmd-2-1.h"
src/bin/lttng-relayd/main.c +1 -0
index 9a2b3bd..0bf3ead 100644
@@ -43,6 +43,7 @@
 #include <common/common.h>
 #include <common/compat/poll.h>
 #include <common/compat/socket.h>
+#include <common/compat/endian.h>
 #include <common/defaults.h>
 #include <common/futex.h>
 #include <common/sessiond-comm/sessiond-comm.h>
src/common/compat/endian.h +0 -0
index 2850866..b7f66cc 100644
@@ -15,11 +15,15 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 

src/common/compat/endian.h line 26

Quoted 10 lines
src/common/compat/endian.h +5 -1
-#ifdef _COMPAT_ENDIAN_H
+#ifndef _COMPAT_ENDIAN_H
 #define _COMPAT_ENDIAN_H
 
 #ifdef __linux__
 #include <endian.h>
+#ifdef LTTNG_HAVE_BETOH64
+#define be64toh(x) betoh64(x)
+#define be32toh(x) betoh32(x)
+#endif // LTTNG_HAVE_BETOH64

Please don't use "//" for comments and instead use /* */.

It's used in some other patches so I'll only flag it once.

Thanks!

Quoted 15 lines
src/common/compat/endian.h +0 -0
 #elif defined(__FreeBSD__)
 #include <machine/endian.h>
 #else
src/common/relayd/relayd.c +1 -0
index 82bcf5f..ba7bd13 100644
@@ -26,6 +26,7 @@
 #include <common/common.h>
 #include <common/defaults.h>
 #include <common/sessiond-comm/relayd.h>
+#include <common/compat/endian.h>
 
 #include "relayd.h"
 

A message that is not in the archive (sent off-list or not yet received): [email protected]

#17 lore raw

Re: [PATCH lttng-tools 06/14] Adding signal compat in order to implement missing functions on Android

Charles Briere:

src/common/compat/compat-signal.c

Quoted 27 lines
---
 src/common/compat/Makefile.am     |  3 ++-
 src/common/compat/compat-signal.c | 14 ++++++++++++++
 src/common/compat/signal.h        | 14 ++++++++++++++
 src/common/consumer-timer.c       |  2 +-
 src/common/runas.c                |  2 +-
 5 files changed, 32 insertions(+), 3 deletions(-)
 create mode 100644 src/common/compat/compat-signal.c
 create mode 100644 src/common/compat/signal.h
src/common/compat/Makefile.am +2 -1
index 537375b..124ef08 100644
@@ -9,4 +9,5 @@ COMPAT=compat-poll.c
 endif
 
 libcompat_la_SOURCES = poll.h fcntl.h endian.h mman.h clone.h \
-                       socket.h compat-fcntl.c uuid.h tid.h $(COMPAT)
+                       socket.h compat-fcntl.c uuid.h tid.h \
+                       compat-signal.c $(COMPAT)
src/common/compat/compat-signal.c new file +0 -0
new file mode 100644
index 0000000..aba30db

It does not seems that there is any license at the beginning of the file (same for the header). Please check other files in compat/ and simply copy the header and add your copyright.

src/common/compat/compat-signal.c line 4

Quoted 5 lines
src/common/compat/compat-signal.c new file +4 -0
@@ -0,0 +1,14 @@
+#include "signal.h"
+#ifdef __ANDROID__
+int __rt_sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *ts, long nr) {
+  return syscall(__NR_rt_sigtimedwait, set, info, ts, nr);

This seems like a "two spaces" rather than a tab. The whole code base uses tabs.

Thanks!
David

Quoted 62 lines
src/common/compat/compat-signal.c new file +10 -0
+}
+
+int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *ts) {
+  return __rt_sigtimedwait(set,info,ts,_NSIG/8);
+}
+
+int sigwaitinfo(const sigset_t *set, siginfo_t *info) {
+  return sigtimedwait(set, info, NULL);
+}
+#endif
src/common/compat/signal.h new file +14 -0
new file mode 100644
index 0000000..f7251d3
@@ -0,0 +1,14 @@
+#ifndef LTTNG_COMPAT_SIGNAL_H
+#define LTTNG_COMPAT_SIGNAL_H
+
+#include <signal.h>
+#ifdef __ANDROID__
+#include <sys/syscall.h>
+#include <asm/unistd.h>
+#include <linux/time.h>
+int __rt_sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *ts, long nr);
+int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *ts);
+int sigwaitinfo(const sigset_t *set, siginfo_t *info);
+#endif // __ANDROID__
+
+#endif //LTTNG_COMPAT_SIGNAL_H
src/common/consumer-timer.c +1 -1
index ef056d1..0ae369f 100644
@@ -19,8 +19,8 @@
 #define _GNU_SOURCE
 #include <assert.h>
 #include <inttypes.h>
-#include <signal.h>
 
+#include <common/compat/signal.h>
 #include <common/common.h>
 
 #include "consumer-timer.h"
src/common/runas.c +1 -1
index bd51cd4..0317cba 100644
@@ -28,12 +28,12 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <sched.h>
-#include <sys/signal.h>
 
 #include <common/common.h>
 #include <common/utils.h>
 #include <common/compat/mman.h>
 #include <common/compat/clone.h>
+#include <common/compat/signal.h>
 
 #include "runas.h"
 

A message that is not in the archive (sent off-list or not yet received): [email protected]

#19 lore raw

Re: [PATCH lttng-tools 09/14] Added ashmem framework support for ust apps and sessiond

I'm wondering here if it's possible to make a compat layer for SHM. We *really* try to avoid #ifdef/#endif inside functions. This is basically what the compat layer was made for.

Here maybe you could create a lttng_shm_open() (and other calls) wrapper that uses a compat call based on the OS.

Charles Briere:

Quoted 73 lines

From: Pierre-Luc St-Charles <[email protected]>

---
 src/bin/lttng-consumerd/lttng-consumerd.c |  6 +++
 src/bin/lttng-sessiond/shm.c              | 75 +++++++++++++++++++++++++++++++
 src/bin/lttng-sessiond/shm.h              | 16 +++++++
 3 files changed, 97 insertions(+)
src/bin/lttng-consumerd/lttng-consumerd.c +6 -0
index edf1f15..cbd610c 100644
@@ -28,7 +28,11 @@
 #include <string.h>
 #include <sys/ipc.h>
 #include <sys/resource.h>
+#ifdef __ANDROID__
+#include <linux/shm.h>
+#else
 #include <sys/shm.h>
+#endif
 #include <sys/socket.h>
 #include <sys/stat.h>
 #include <sys/types.h>
@@ -39,7 +43,9 @@
 #include <assert.h>
 #include <config.h>
 #include <urcu/compiler.h>
+#ifndef __ANDROID__
 #include <ulimit.h>
+#endif
 
 #include <common/defaults.h>
 #include <common/common.h>
src/bin/lttng-sessiond/shm.c +19 -0
index b94f4eb..80c7b6f 100644
@@ -41,6 +41,8 @@
 static int get_wait_shm(char *shm_path, size_t mmap_size, int global)
 {
 	int wait_shm_fd, ret;
+
+#ifndef __ANDROID__
 	mode_t mode;
 
 	assert(shm_path);
@@ -114,6 +116,23 @@ static int get_wait_shm(char *shm_path, size_t mmap_size, int global)
 	}
 #else
 #warning "FreeBSD does not support setting file mode on shm FD. Remember that for secure use, lttng-sessiond should be started before applications linked on lttng-ust."
+#endif // !__ANDROID__
+#else
+    /*
+    * For ashmem, we must directly specify the ammount of mem we will need;
+    * also, once the memory region is opened, nobody can directly reopen or
+    * refer to it via its path (only via its fd).
+    */
+    wait_shm_fd = ashmem_create_region(shm_path, mmap_size);
+    if (wait_shm_fd < 0) {
+        PERROR("shm_open wait shm [ashmem_create_region]");
+        goto error;
+    }
+    ret = ashmem_set_prot_region(wait_shm_fd, PROT_READ | PROT_WRITE);
+    if (ret < 0) {
+        PERROR("shm_open wait shm [ashmem_create_region, ASHMEM_SET_NAME]");
+        goto error;
+    }
 #endif
 
 	DBG("Got the wait shm fd %d", wait_shm_fd);

src/bin/lttng-sessiond/shm.c char *shm_ust_get_mmap(char *shm_path, int global) · line 192

Quoted 8 lines
src/bin/lttng-sessiond/shm.c +5 -0
@@ -166,3 +185,59 @@ char *shm_ust_get_mmap(char *shm_path, int global)
 error:
 	return NULL;
 }
+
+#ifdef __ANDROID__
+#ifdef _CUTILS_ASHMEM_NO_NDK_H
+#include <linux/ashmem.h>
+#define ASHMEM_DEVICE "/dev/ashmem"

Document this function with at least the possible returned values.

src/bin/lttng-sessiond/shm.c char *shm_ust_get_mmap(char *shm_path, int global) · line 199

Quoted 7 lines
src/bin/lttng-sessiond/shm.c +7 -0
+int ashmem_create_region(const char *name, size_t size)
+{
+    int fd, ret;
+
+    fd = open(ASHMEM_DEVICE, O_RDWR);
+    if (fd < 0)
+        return fd;

Add {} for the if statement and you should make a goto error_open that goes just after the close(fd) and return ret = -1. If you use gotos in your function, it's important to use them for all error path and not having both return and goto making the code more difficult to follow and prone to errors in the long term if this code changes for instance. (mem leaks, fd leaks, etc...).

src/bin/lttng-sessiond/shm.c char *shm_ust_get_mmap(char *shm_path, int global) · line 207

Quoted 8 lines
src/bin/lttng-sessiond/shm.c +8 -0
+
+    if (name) {
+        char buf[ASHMEM_NAME_LEN];
+
+        strlcpy(buf, name, sizeof(buf));
+        ret = ioctl(fd, ASHMEM_SET_NAME, buf);
+        if (ret < 0)
+            goto error;

Add {} and add a PERROR() here so we can track why this fails in verbose mode.

src/bin/lttng-sessiond/shm.c char *shm_ust_get_mmap(char *shm_path, int global) · line 212

Quoted 5 lines
src/bin/lttng-sessiond/shm.c +5 -0
+    }
+
+    ret = ioctl(fd, ASHMEM_SET_SIZE, size);
+    if (ret < 0)
+        goto error;

Same.

Quoted 56 lines
src/bin/lttng-sessiond/shm.c +31 -0
+
+    return fd;
+
+error:
+    close(fd);
+    return ret;
+}
+
+int ashmem_set_prot_region(int fd, int prot)
+{
+    return ioctl(fd, ASHMEM_SET_PROT_MASK, prot);
+}
+
+int ashmem_pin_region(int fd, size_t offset, size_t len)
+{
+    struct ashmem_pin pin = { offset, len };
+    return ioctl(fd, ASHMEM_PIN, &pin);
+}
+
+int ashmem_unpin_region(int fd, size_t offset, size_t len)
+{
+    struct ashmem_pin pin = { offset, len };
+    return ioctl(fd, ASHMEM_UNPIN, &pin);
+}
+
+int ashmem_get_size_region(int fd)
+{
+    return ioctl(fd, ASHMEM_GET_SIZE, NULL);
+}
+#endif //_CUTILS_ASHMEM_NO_NDK_H
+#endif //__ANDROID__
src/bin/lttng-sessiond/shm.h +16 -0
index bcce28b..abe965e 100644
@@ -21,4 +21,20 @@
 
 char *shm_ust_get_mmap(char *shm_path, int global);
 
+#ifdef __ANDROID__
+/*
+ * Temporary fix for missing ashmem references when compiling with the NDK
+ * (instead of trying to port via Android makefiles)
+ */
+#ifndef _CUTILS_ASHMEM_H
+#define _CUTILS_ASHMEM_H
+#define _CUTILS_ASHMEM_NO_NDK_H
+int ashmem_create_region(const char *name, size_t size);
+int ashmem_set_prot_region(int fd, int prot);
+int ashmem_pin_region(int fd, size_t offset, size_t len);
+int ashmem_unpin_region(int fd, size_t offset, size_t len);
+int ashmem_get_size_region(int fd);
+#endif //_CUTILS_ASHMEM_H
+#endif //__ANDROID__
+
 #endif /* _LTT_SHM_H */

A message that is not in the archive (sent off-list or not yet received): 1367864331-15212-11-git-send-email-charlesbriere.flatzo@gmail.com

#21 lore raw

Re: [PATCH lttng-tools 11/14] Added configure.ac check for pthread_cond_timedwait_monotonic support (which is a non-standard pthread function) & usage handling in sessiond's main.c.

A compat layer should be used here for pthread.

Charles Briere:

Quoted 70 lines

From: Michael Poupart <[email protected]>

---
 configure.ac                  | 17 +++++++++++++++++
 src/bin/lttng-sessiond/main.c |  7 +++++++
 2 files changed, 24 insertions(+)
configure.ac +17 -0
index b3738d2..c405020 100644
@@ -182,6 +182,23 @@ AM_CONDITIONAL([LTTNG_BUILD_WITH_LIBUUID], [test "x$have_libuuid" = "xyes"])
 AM_CONDITIONAL([LTTNG_BUILD_WITH_LIBC_UUID], [test "x$have_libc_uuid" = "xyes"])
 AM_CONDITIONAL([LTTNG_BUILD_WITH_LIBEXT2_UUID], [test "x$have_libext2_uuid" = "xyes"])
 
+# Check for the non-standard pthread_cond_timedwait_monotonic function in lpthread/libc
+AC_CHECK_LIB([pthread], [pthread_cond_timedwait_monotonic],
+[
+	have_pthread_cndtmwt_mono=yes
+],
+[
+	AC_CHECK_LIB([c], [pthread_cond_timedwait_monotonic],
+	[
+		have_pthread_cndtmwt_mono=yes
+	])
+])
+AS_IF([test "x$have_pthread_cndtmwt_mono" = "xyes"],
+[
+	AC_DEFINE_UNQUOTED([LTTNG_HAVE_PTHREAD_CNDTMWT_MONO], 1, [Has non-standard pthread_cond_timedwait_monotonic support.])
+])
+
+
 # URCU library version needed or newer
 liburcu_version=">= 0.7.2"
 
src/bin/lttng-sessiond/main.c +7 -0
index f6a051a..d8ff4c2 100644
@@ -1732,6 +1732,7 @@ static int spawn_consumer_thread(struct consumer_data *consumer_data)
 		goto error;
 	}
 
+#ifndef LTTNG_HAVE_PTHREAD_CNDTMWT_MONO
 	/*
 	 * Set the monotonic clock in order to make sure we DO NOT jump in time
 	 * between the clock_gettime() call and the timedwait call. See bug #324
@@ -1743,6 +1744,7 @@ static int spawn_consumer_thread(struct consumer_data *consumer_data)
 		PERROR("pthread_condattr_setclock consumer data");
 		goto error;
 	}
+#endif
 
 	ret = pthread_cond_init(&consumer_data->cond, &consumer_data->condattr);
 	if (ret != 0) {
@@ -1792,8 +1794,13 @@ static int spawn_consumer_thread(struct consumer_data *consumer_data)
 			ret = pthread_cond_wait(&consumer_data->cond,
 					&consumer_data->cond_mutex);
 		} else {
+#ifdef LTTNG_HAVE_PTHREAD_CNDTMWT_MONO
+			ret = pthread_cond_timedwait_monotonic(&consumer_data->cond,
+					&consumer_data->cond_mutex, &timeout);
+#else
 			ret = pthread_cond_timedwait(&consumer_data->cond,
 					&consumer_data->cond_mutex, &timeout);
+#endif
 		}
 	}
 

A message that is not in the archive (sent off-list or not yet received): 1367864331-15212-12-git-send-email-charlesbriere.flatzo@gmail.com

#23 lore raw

Re: [PATCH lttng-tools 12/14] Using pthread_kill instead of pthread_cancel (not a good idea but requried for now)

Same, should be put in a compat layer.

Charles Briere:

Quoted 60 lines

From: Pierre-Luc St-Charles <[email protected]>

---
 configure.ac                  | 18 ++++++++++++++++++
 src/bin/lttng-sessiond/main.c |  8 ++++++++
 2 files changed, 26 insertions(+)
configure.ac +18 -0
index c405020..154b0a7 100644
@@ -198,6 +198,24 @@ AS_IF([test "x$have_pthread_cndtmwt_mono" = "xyes"],
 	AC_DEFINE_UNQUOTED([LTTNG_HAVE_PTHREAD_CNDTMWT_MONO], 1, [Has non-standard pthread_cond_timedwait_monotonic support.])
 ])
 
+# Check for pthread_cancel support (which might not be present in lightweight versions of lpthread)
+AC_CHECK_LIB([pthread], [pthread_cancel],
+[
+	have_pthread_cancel=yes
+],
+[
+	AC_CHECK_LIB([c], [pthread_cancel],
+	[
+		have_pthread_cancel=yes
+	])
+])
+AS_IF([test "x$have_pthread_cancel" = "xyes"],
+[
+	AC_DEFINE_UNQUOTED([LTTNG_HAVE_PTHREAD_CANCEL], 1, [Has standard pthread_cancel support.])
+],
+[
+	AC_MSG_WARN([The targeted platform does not support pthread_cancel; defaulting to pthread_kill, but it might not be 100% safe.])
+])
 
 # URCU library version needed or newer
 liburcu_version=">= 0.7.2"
src/bin/lttng-sessiond/main.c +8 -0
index d8ff4c2..73bdc0a 100644
@@ -1816,10 +1816,18 @@ static int spawn_consumer_thread(struct consumer_data *consumer_data)
 			 */
 			ERR("Condition timed out. The consumer thread was never ready."
 					" Killing it");
+#ifdef LTTNG_HAVE_PTHREAD_CANCEL
 			ret = pthread_cancel(consumer_data->thread);
 			if (ret < 0) {
 				PERROR("pthread_cancel consumer thread");
 			}
+#else
+			WARN("Using pthread_kill instead of pthread_cancel...");
+			ret = pthread_kill(consumer_data->thread,SIGTERM);
+			if (ret < 0) {
+				PERROR("pthread_kill consumer thread");
+			}
+#endif
 		} else {
 			PERROR("pthread_cond_wait failed consumer thread");
 		}

A message that is not in the archive (sent off-list or not yet received): 1367864331-15212-14-git-send-email-charlesbriere.flatzo@gmail.com

#25 lore raw

Re: [PATCH lttng-tools 14/14] Cleaned up configure.ac: Replaced space indents by tabs, regrouped AC_ARG_WITH's, generalized the coding style, fixed a bad AS_HELP_STRING.

Why?

Thanks!
David

Charles Briere:

Quoted 511 lines

From: Pierre-Luc St-Charles <[email protected]>

---
 configure.ac | 315 ++++++++++++++++++++++++++++++++---------------------------
 1 file changed, 171 insertions(+), 144 deletions(-)
configure.ac +171 -144
index 154b0a7..e4d2c6f 100644
@@ -17,27 +17,32 @@ AC_CONFIG_HEADERS([include/config.h])
 AC_PROG_GREP
 # libtool link_all_deplibs fixup. See http://bugs.lttng.org/issues/321.
 AC_ARG_ENABLE(libtool-linkdep-fixup,
-	AS_HELP_STRING([--disable-libtool-linkdep-fixup],
-			[disable the libtool fixup for linking all dependent libraries (link_all_deplibs)]),
-	libtool_fixup=$enableval,
-	libtool_fixup=yes)
+[
+	AS_HELP_STRING([--disable-libtool-linkdep-fixup],[disable the libtool fixup for linking all dependent libraries (link_all_deplibs)])
+],
+[
+	libtool_fixup=$enableval
+],
+[
+	libtool_fixup=yes
+])
 
 AS_IF([test "x$libtool_fixup" = "xyes"],
-	    [
-	    libtool_m4="$srcdir/config/libtool.m4"
-	    libtool_flag_pattern=".*link_all_deplibs\s*,\s*\$1\s*)"
-	    AC_MSG_CHECKING([for occurence(s) of link_all_deplibs = no in $libtool_m4])
-	    libtool_flag_pattern_count=$(grep -c "$libtool_flag_pattern\s*=\s*no" $libtool_m4)
-	    AS_IF([test $libtool_flag_pattern_count -ne 0],
-	    [
-		  AC_MSG_RESULT([$libtool_flag_pattern_count])
-		  AC_MSG_WARN([the detected libtool will not link all dependencies, forcing link_all_deplibs = unknown])
-		  sed -i "s/\($libtool_flag_pattern\)\s*=\s*no/\1=unknown/g" $libtool_m4
-		  ],
-		  [
-		  AC_MSG_RESULT([none])
-		  ])
-	    ])
+[
+	libtool_m4="$srcdir/config/libtool.m4"
+	libtool_flag_pattern=".*link_all_deplibs\s*,\s*\$1\s*)"
+	AC_MSG_CHECKING([for occurence(s) of link_all_deplibs = no in $libtool_m4])
+	libtool_flag_pattern_count=$(grep -c "$libtool_flag_pattern\s*=\s*no" $libtool_m4)
+	AS_IF([test $libtool_flag_pattern_count -ne 0],
+	[
+		AC_MSG_RESULT([$libtool_flag_pattern_count])
+		AC_MSG_WARN([the detected libtool will not link all dependencies, forcing link_all_deplibs = unknown])
+		sed -i "s/\($libtool_flag_pattern\)\s*=\s*no/\1=unknown/g" $libtool_m4
+	],
+	[
+		AC_MSG_RESULT([none])
+	])
+])
 
 AM_CONDITIONAL([NO_SHARED], [test x$enable_shared = xno])
 
@@ -57,55 +62,55 @@ AC_CHECK_HEADERS([ \
 
 # Babeltrace viewer check
 AC_ARG_WITH([babeltrace-bin],
-	AS_HELP_STRING([--with-babeltrace-bin],
-	[Location of the babeltrace viewer executable (including the filename)]),
+	AS_HELP_STRING([--with-babeltrace-bin], [Location of the babeltrace viewer executable (including the filename)]),
 	[BABELTRACE_BIN="$withval"],
 	[BABELTRACE_BIN=''])
 AC_SUBST([BABELTRACE_BIN])
 
 # lttv-gui
 AC_ARG_WITH([lttv-gui-bin],
-	AS_HELP_STRING([--with-lttv-gui-bin],
-   [Location of the lttv GUI viewer executable (including the filename)]),
-   [LTTV_GUI_BIN="$withval"],
-   [LTTV_GUI_BIN=''])
+	AS_HELP_STRING([--with-lttv-gui-bin], [Location of the lttv GUI viewer executable (including the filename)]),
+	[LTTV_GUI_BIN="$withval"],
+	[LTTV_GUI_BIN=''])
 AC_SUBST([LTTV_GUI_BIN])
 
 AC_ARG_WITH([consumerd32-bin],
-	AS_HELP_STRING([--with-consumerd32-bin],
-	[Location of the 32-bit consumerd executable (including the filename)]),
+	AS_HELP_STRING([--with-consumerd32-bin], [Location of the 32-bit consumerd executable (including the filename)]),
 	[CONSUMERD32_BIN="$withval"],
 	[CONSUMERD32_BIN=''])
 AC_SUBST([CONSUMERD32_BIN])
 
 AC_ARG_WITH([consumerd64-bin],
-	AS_HELP_STRING([--with-consumerd64-bin],
-	[Location of the 64-bit consumerd executable (including the filename)]),
+	AS_HELP_STRING([--with-consumerd64-bin], [Location of the 64-bit consumerd executable (including the filename)]),
 	[CONSUMERD64_BIN="$withval"],
 	[CONSUMERD64_BIN=''])
 AC_SUBST([CONSUMERD64_BIN])
 
 AC_ARG_WITH([consumerd32-libdir],
-	AS_HELP_STRING([--with-consumerd32-libdir],
-	[Directory containing the 32-bit consumerd libraries]),
+	AS_HELP_STRING([--with-consumerd32-libdir], [Directory containing the 32-bit consumerd libraries]),
 	[CONSUMERD32_LIBDIR="$withval"],
 	[CONSUMERD32_LIBDIR=''])
 AC_SUBST([CONSUMERD32_LIBDIR])
 
 AC_ARG_WITH([consumerd64-libdir],
-	AS_HELP_STRING([--with-consumerd64-libdir],
-	[Directory containing the 64-bit consumerd libraries]),
+	AS_HELP_STRING([--with-consumerd64-libdir], [Directory containing the 64-bit consumerd libraries]),
 	[CONSUMERD64_LIBDIR="$withval"],
 	[CONSUMERD64_LIBDIR=''])
 AC_SUBST([CONSUMERD64_LIBDIR])
 
 AC_ARG_WITH([sessiond-bin],
-	AS_HELP_STRING([--with-sessiond-bin],
-	[Location of the sessiond executable (including the filename)]),
+	AS_HELP_STRING([--with-sessiond-bin], [Location of the sessiond executable (including the filename)]),
 	[SESSIOND_BIN="$withval"],
 	[SESSIOND_BIN=''])
 AC_SUBST([SESSIOND_BIN])
 
+# Option to only build the consumer daemon and its libraries
+AC_ARG_WITH([consumerd-only],
+	AS_HELP_STRING([--with-consumerd-only], [Only build the consumer daemon [default=no]]),
+	[consumerd_only=$withval],
+	[consumerd_only=no])
+AM_CONDITIONAL([BUILD_CONSUMERD_ONLY], [test "x$consumerd_only" = "xyes"])
+
 AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD32_BIN], "$CONSUMERD32_BIN", [Location of the 32-bit consumerd executable.])
 AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD64_BIN], "$CONSUMERD64_BIN", [Location of the 64-bit consumerd executable])
 AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD32_LIBDIR], "$CONSUMERD32_LIBDIR", [Search for consumerd 32-bit libraries in this location.])
@@ -117,23 +122,24 @@ AC_DEFINE_UNQUOTED([CONFIG_SESSIOND_BIN], "$SESSIOND_BIN", [Location of the sess
 # Check for pthread
 AC_CHECK_LIB([pthread], [pthread_create], [],
 [
-    # Check for pthread in a bionic libc...
+	# Check for pthread in a bionic libc...
 	AC_CHECK_LIB([c], [pthread_create], [], 
 	[
-	    AC_MSG_ERROR([Cannot find libpthread. Use [LDFLAGS]=-Ldir to specify its location.])
+		AC_MSG_ERROR([Cannot find libpthread. Use [LDFLAGS]=-Ldir to specify its location.])
 	])
-]
-)
+])
 
 # Check low-level endian compat functions
 AC_CHECK_DECL(be64toh, [], 
 [
-	AC_CHECK_DECL(betoh64, [AC_DEFINE_UNQUOTED([LTTNG_HAVE_BETOH64], 1, [Has BSD-style endian conversion operations.])], 
+	AC_CHECK_DECL(betoh64,
+	[
+		AC_DEFINE_UNQUOTED([LTTNG_HAVE_BETOH64], 1, [Has BSD-style endian conversion operations.])
+	],
 	[
 		AC_MSG_ERROR([Cannot find be64toh, betoh64 or any similar functions.])
 	])
-]
-)
+])
 
 # Check if gettid() is already defined
 AC_CHECK_DECL(gettid,
@@ -146,11 +152,10 @@ AC_CHECK_LIB([popt], [poptGetContext], [],
 [
 	# Check for libpopt in oprofile for Android
 	AC_CHECK_LIB([oprofile_popt], [poptGetContext], [], 
-    [
-        AC_MSG_ERROR([Cannot find libpopt. Use [LDFLAGS]=-Ldir to specify its location.])
-    ])
-]
-)
+	[
+		AC_MSG_ERROR([Cannot find libpopt. Use [LDFLAGS]=-Ldir to specify its location.])
+	])
+])
 
 # Check for libuuid
 AC_CHECK_LIB([uuid], [uuid_generate],
@@ -176,8 +181,7 @@ AC_CHECK_LIB([uuid], [uuid_generate],
 			AC_MSG_ERROR([Cannot find libuuid uuid_generate, libc uuid_create nor libext2_uuid uuid_generate. Use [LDFLAGS]=-Ldir to specify their location.])
 		])
 	])
-]
-)
+])
 AM_CONDITIONAL([LTTNG_BUILD_WITH_LIBUUID], [test "x$have_libuuid" = "xyes"])
 AM_CONDITIONAL([LTTNG_BUILD_WITH_LIBC_UUID], [test "x$have_libc_uuid" = "xyes"])
 AM_CONDITIONAL([LTTNG_BUILD_WITH_LIBEXT2_UUID], [test "x$have_libext2_uuid" = "xyes"])
@@ -222,41 +226,59 @@ liburcu_version=">= 0.7.2"
 
 # Check liburcu needed function calls
 AC_CHECK_DECL([cds_list_add], [],
-	[AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/list.h>]]
-)
+[
+	AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/list.h>]
+])
 AC_CHECK_DECL([cds_wfq_init], [],
-	[AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/wfqueue.h>]]
-)
+[
+	AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/wfqueue.h>]
+])
 AC_CHECK_DECL([cds_wfq_dequeue_blocking], [],
-    [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/wfqueue.h>]]
-)
+[
+	AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/wfqueue.h>]
+])
 AC_CHECK_DECL([futex_async], [],
-	[AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/futex.h>]]
-)
+[
+	AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/futex.h>]
+])
 AC_CHECK_DECL([rcu_thread_offline], [],
-	[AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu.h>]]
-)
+[
+	AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu.h>]
+])
 AC_CHECK_DECL([rcu_thread_online], [],
-	[AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu.h>]]
-)
+[
+	AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu.h>]
+])
 AC_CHECK_DECL([caa_likely], [],
-	[AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu.h>]]
-)
+[
+	AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu.h>]
+])
 
 # Check liblttng-ust-ctl library
 AC_ARG_ENABLE(lttng-ust,
-	AS_HELP_STRING([--disable-lttng-ust],[build without LTTng-UST (Userspace Tracing) support]),
-	lttng_ust_support=$enableval, lttng_ust_support=yes)
+[
+	AS_HELP_STRING([--disable-lttng-ust],[build without LTTng-UST (Userspace Tracing) support])
+],
+[
+	lttng_ust_support=$enableval
+],
+[
+	lttng_ust_support=yes
+])
 
-AS_IF([test "x$lttng_ust_support" = "xyes"], [
+AS_IF([test "x$lttng_ust_support" = "xyes"],
+[
 	AC_CHECK_LIB([lttng-ust-ctl], [ustctl_set_filter],
-		[
-			AC_DEFINE([HAVE_LIBLTTNG_UST_CTL], [1], [has LTTng-UST control support])
-			lttng_ust_ctl_found=yes
-		],
-		[AC_MSG_ERROR([Cannot find LTTng-UST 2.1.x. Use [LDFLAGS]=-Ldir to specify its location, or specify --disable-lttng-ust to build lttng-tools without LTTng-UST support.])],
-		[-lurcu-common -lurcu-bp -lurcu-cds -lc -lrt]
-	)
+	[
+		AC_DEFINE([HAVE_LIBLTTNG_UST_CTL], [1], [has LTTng-UST control support])
+		lttng_ust_ctl_found=yes
+	],
+	[
+		AC_MSG_ERROR([Cannot find LTTng-UST 2.1.x. Use [LDFLAGS]=-Ldir to specify its location, or specify --disable-lttng-ust to build lttng-tools without LTTng-UST support.])
+	],
+	[
+		-lurcu-common -lurcu-bp -lurcu-cds -lc -lrt
+	])
 ])
 AM_CONDITIONAL([HAVE_LIBLTTNG_UST_CTL], [test "x$lttng_ust_ctl_found" = xyes])
 AC_CHECK_FUNCS([sched_getcpu sysconf sync_file_range])
@@ -283,18 +305,15 @@ AM_CONDITIONAL([LTTNG_TOOLS_BUILD_WITH_LIBC_DL], [test "x$have_libc_dl" = "xyes"
 AC_CHECK_LIB([c], [fmemopen],
 [
 	AC_DEFINE_UNQUOTED([LTTNG_HAVE_FMEMOPEN], 1, [Has fmemopen support.])
-]
-)
+])
 
 # Check for open_memstream
 AC_CHECK_LIB([c], [open_memstream],
 [
 	AC_DEFINE_UNQUOTED([LTTNG_HAVE_OPEN_MEMSTREAM], 1, [Has open_memstream support.])
-]
-)
+])
 
 AC_ARG_VAR([LTTNG_RUNDIR], [Path to run directory, default to /var/run])
-
 AS_IF([test -n "$LTTNG_RUNDIR"],
 [
 	lttng_rundir=$LTTNG_RUNDIR
@@ -315,54 +334,49 @@ AC_DEFINE_UNQUOTED([DEFAULT_LTTNG_RUNDIR], ["$lttng_rundir"], [Location of the r
 swig_version=2.0.0
 
 AC_ARG_ENABLE([python-bindings],
-              [AC_HELP_STRING([--enable-python-bindings],
-                              [compile Python bindings])],
-              [enable_python=yes], [enable_python=no])
+[
+	AS_HELP_STRING([--enable-python-bindings], [compile Python bindings])
+],
+[
+	enable_python=yes
+],
+[
+	enable_python=no
+])
 
 AM_CONDITIONAL([USE_PYTHON], [test "x${enable_python:-yes}" = xyes])
 
 if test "x${enable_python:-yes}" = xyes; then
-  AX_PKG_SWIG($swig_version, [], [ AC_MSG_ERROR([SWIG $swig_version or newer is needed]) ])
-  AM_PATH_PYTHON
-
-  AC_ARG_VAR([PYTHON_INCLUDE], [Include flags for python, bypassing python-config])
-  AC_ARG_VAR([PYTHON_CONFIG], [Path to python-config])
-  AS_IF([test -z "$PYTHON_INCLUDE"], [
-    AS_IF([test -z "$PYTHON_CONFIG"], [
-      AC_PATH_PROGS([PYTHON_CONFIG],
-                    [python$PYTHON_VERSION-config python-config],
-                    [no],
-                    [`dirname $PYTHON`])
-      AS_IF([test "$PYTHON_CONFIG" = no], [AC_MSG_ERROR([cannot find python-config for $PYTHON. Do you have python-dev installed?])])
-    ])
-    AC_MSG_CHECKING([python include flags])
-    PYTHON_INCLUDE=`$PYTHON_CONFIG --includes`
-    AC_MSG_RESULT([$PYTHON_INCLUDE])
-  ])
-
+	AX_PKG_SWIG($swig_version, [],
+	[
+		AC_MSG_ERROR([SWIG $swig_version or newer is needed])
+	])
+	AM_PATH_PYTHON
+	AC_ARG_VAR([PYTHON_INCLUDE], [Include flags for python, bypassing python-config])
+	AC_ARG_VAR([PYTHON_CONFIG], [Path to python-config])
+	AS_IF([test -z "$PYTHON_INCLUDE"],
+	[
+		AS_IF([test -z "$PYTHON_CONFIG"],
+		[
+			AC_PATH_PROGS([PYTHON_CONFIG], [python$PYTHON_VERSION-config python-config], [no], [`dirname $PYTHON`])
+			AS_IF([test "$PYTHON_CONFIG" = no],
+			[
+				AC_MSG_ERROR([cannot find python-config for $PYTHON. Do you have python-dev installed?])
+			])
+		])
+		AC_MSG_CHECKING([python include flags])
+		PYTHON_INCLUDE=`$PYTHON_CONFIG --includes`
+		AC_MSG_RESULT([$PYTHON_INCLUDE])
+	])
 else
-    AC_MSG_NOTICE([You may configure with --enable-python-bindings ]dnl
-[if you want Python bindings.])
-
+	AC_MSG_NOTICE([You may configure with --enable-python-bindings if you want Python bindings.])
 fi
 
-# Option to only build the consumer daemon and its libraries
-AC_ARG_WITH([consumerd-only],
-	AS_HELP_STRING([--with-consumerd-only],[Only build the consumer daemon [default=no]]),
-	[consumerd_only=$withval],
-	[consumerd_only=no])
-AM_CONDITIONAL([BUILD_CONSUMERD_ONLY], [test "x$consumerd_only" = "xyes"])
-
 # Epoll check. If not present, the build will fallback on poll() API
-AX_HAVE_EPOLL(
-	[AX_CONFIG_FEATURE_ENABLE(epoll)],
-	[AX_CONFIG_FEATURE_DISABLE(epoll)]
-)
-AX_CONFIG_FEATURE(
-	[epoll], [This platform supports epoll(7)],
-	[HAVE_EPOLL], [This platform supports epoll(7).],
-	[enable_epoll="yes"], [enable_epoll="no"]
-)
+AX_HAVE_EPOLL([AX_CONFIG_FEATURE_ENABLE(epoll)],[AX_CONFIG_FEATURE_DISABLE(epoll)])
+AX_CONFIG_FEATURE([epoll], [This platform supports epoll(7)],
+		[HAVE_EPOLL], [This platform supports epoll(7).],
+		[enable_epoll="yes"], [enable_epoll="no"])
 AM_CONDITIONAL([COMPAT_EPOLL], [ test "$enable_epoll" = "yes" ])
 
 AC_SYS_LARGEFILE
@@ -455,37 +469,43 @@ AS_ECHO()
 # Target architecture we're building for
 target_arch=$host_cpu
 [
-for f in $CFLAGS; do
-        if test $f = "-m32"; then
+	for f in $CFLAGS; do
+		if test $f = "-m32"; then
 			target_arch="32-bit"
-        elif test $f = "-m64"; then
+		elif test $f = "-m64"; then
 			target_arch="64-bit"
-        fi
-done
+		fi
+	done
 ]
 AS_ECHO_N("Target architecture: ")
 AS_ECHO($target_arch)
 
 # LTTng-UST enabled/disabled
 AS_ECHO_N("Lttng-UST support: ")
-AS_IF([test "x$lttng_ust_support" = "xyes"],[
+AS_IF([test "x$lttng_ust_support" = "xyes"],
+[
 	AS_ECHO("Enabled")
-],[
+],
+[
 	AS_ECHO("Disabled")
 ])
 
 #Python binding enabled/disabled
 AS_ECHO_N("Python binding: ")
-AS_IF([test "x${enable_python:-yes}" = xyes], [
+AS_IF([test "x${enable_python:-yes}" = xyes],
+[
 	AS_ECHO("Enabled")
-],[
+],
+[
 	AS_ECHO("Disabled")
 ])
 
 # Do we build only the consumerd, or everything
-AS_IF([test "x$consumerd_only" = "xyes"],[
+AS_IF([test "x$consumerd_only" = "xyes"],
+[
 	AS_ECHO("Only the consumerd daemon will be built.")
-],[
+],
+[
 	AS_ECHO("All binaries will be built.")
 ])
 
@@ -497,45 +517,52 @@ AS_ECHO_N("Libraries will be installed in: ")
 AS_ECHO("`eval eval echo $libdir`")
 
 # If we build the sessiond, print the paths it will use
-AS_IF([test "x$consumerd_only" = "xno"],[
+AS_IF([test "x$consumerd_only" = "xno"],
+[
 	AS_ECHO()
 	AS_ECHO_N("The lttng command will look for the lttng-sessiond executable at: ")
-	AS_IF([test "$SESSIOND_BIN" = ""],[
+	AS_IF([test "$SESSIOND_BIN" = ""],
+	[
 		AS_ECHO_N("`eval eval echo $bindir`")
 		AS_ECHO("/lttng-sessiond")
-	],[
+	],
+	[
 		AS_ECHO("$SESSIOND_BIN")
 	])
-
 	AS_ECHO()
 	AS_ECHO("The sessiond daemon will look in the following directories: ")
 	AS_ECHO_N("32-bit consumerd executable at: ")
-	AS_IF([test "$CONSUMERD32_BIN" = ""],[
+	AS_IF([test "$CONSUMERD32_BIN" = ""],
+	[
 		AS_ECHO_N("`eval eval echo $lttnglibexecdir`")
 		AS_ECHO("/lttng-consumerd")
-	],[
+	],
+	[
 		AS_ECHO("$CONSUMERD32_BIN")
 	])
-
 	AS_ECHO_N("32-bit consumer libraries in:   ")
-	AS_IF([test "$CONSUMERD32_LIBDIR" = ""],[
+	AS_IF([test "$CONSUMERD32_LIBDIR" = ""],
+	[
 		AS_ECHO("`eval eval echo $libdir`")
-	],[
+	],
+	[
 		AS_ECHO("$CONSUMERD32_LIBDIR")
 	])
-
 	AS_ECHO_N("64-bit consumerd executable at: ")
-	AS_IF([test "$CONSUMERD64_BIN" = ""],[
+	AS_IF([test "$CONSUMERD64_BIN" = ""],
+	[
 		AS_ECHO_N("`eval eval echo $lttnglibexecdir`")
 		AS_ECHO("/lttng-consumerd")
-	],[
+	],
+	[
 		AS_ECHO("$CONSUMERD64_BIN")
 	])
-
 	AS_ECHO_N("64-bit consumer libraries in:   ")
-	AS_IF([test "$CONSUMERD64_LIBDIR" = ""],[
+	AS_IF([test "$CONSUMERD64_LIBDIR" = ""],
+	[
 		AS_ECHO("`eval eval echo $libdir`")
-	],[
+	],
+	[
 		AS_ECHO("$CONSUMERD64_LIBDIR")
 	])
 ])

A message that is not in the archive (sent off-list or not yet received): [email protected]

#27 lore raw

Re: [PATCH lttng-tools 14/14] Cleaned up configure.ac: Replaced space indents by tabs, regrouped AC_ARG_WITH's, generalized the coding style, fixed a bad AS_HELP_STRING.

Quoted 1 line · * David Goulet ([email protected]) wrote:

Why?

cleaning up the configure.ac is a good thing. However, this patch should probably be split into 3 patches.

1) Cleanup: configure.ac: replace space indents by tabs
2) Cleanup: configure.ac: regroup AC_ARG_WITH
3) Error message fix: configure.ac: fix bad AS_HELP_STRING

Not sure about "generalized coding style" though. It might require more explanation.

Thanks,

Mathieu

Quoted 521 lines

Thanks!
David

Charles Briere:

Quoted 501 lines

From: Pierre-Luc St-Charles <[email protected]>

---
 configure.ac | 315 ++++++++++++++++++++++++++++++++---------------------------
 1 file changed, 171 insertions(+), 144 deletions(-)
configure.ac +167 -142
index 154b0a7..e4d2c6f 100644
@@ -17,27 +17,32 @@ AC_CONFIG_HEADERS([include/config.h])
 AC_PROG_GREP
 # libtool link_all_deplibs fixup. See http://bugs.lttng.org/issues/321.
 AC_ARG_ENABLE(libtool-linkdep-fixup,
-	AS_HELP_STRING([--disable-libtool-linkdep-fixup],
-			[disable the libtool fixup for linking all dependent libraries (link_all_deplibs)]),
-	libtool_fixup=$enableval,
-	libtool_fixup=yes)
+[
+	AS_HELP_STRING([--disable-libtool-linkdep-fixup],[disable the libtool fixup for linking all dependent libraries (link_all_deplibs)])
+],
+[
+	libtool_fixup=$enableval
+],
+[
+	libtool_fixup=yes
+])
 
 AS_IF([test "x$libtool_fixup" = "xyes"],
-	    [
-	    libtool_m4="$srcdir/config/libtool.m4"
-	    libtool_flag_pattern=".*link_all_deplibs\s*,\s*\$1\s*)"
-	    AC_MSG_CHECKING([for occurence(s) of link_all_deplibs = no in $libtool_m4])
-	    libtool_flag_pattern_count=$(grep -c "$libtool_flag_pattern\s*=\s*no" $libtool_m4)
-	    AS_IF([test $libtool_flag_pattern_count -ne 0],
-	    [
-		  AC_MSG_RESULT([$libtool_flag_pattern_count])
-		  AC_MSG_WARN([the detected libtool will not link all dependencies, forcing link_all_deplibs = unknown])
-		  sed -i "s/\($libtool_flag_pattern\)\s*=\s*no/\1=unknown/g" $libtool_m4
-		  ],
-		  [
-		  AC_MSG_RESULT([none])
-		  ])
-	    ])
+[
+	libtool_m4="$srcdir/config/libtool.m4"
+	libtool_flag_pattern=".*link_all_deplibs\s*,\s*\$1\s*)"
+	AC_MSG_CHECKING([for occurence(s) of link_all_deplibs = no in $libtool_m4])
+	libtool_flag_pattern_count=$(grep -c "$libtool_flag_pattern\s*=\s*no" $libtool_m4)
+	AS_IF([test $libtool_flag_pattern_count -ne 0],
+	[
+		AC_MSG_RESULT([$libtool_flag_pattern_count])
+		AC_MSG_WARN([the detected libtool will not link all dependencies, forcing link_all_deplibs = unknown])
+		sed -i "s/\($libtool_flag_pattern\)\s*=\s*no/\1=unknown/g" $libtool_m4
+	],
+	[
+		AC_MSG_RESULT([none])
+	])
+])
 
 AM_CONDITIONAL([NO_SHARED], [test x$enable_shared = xno])
 
@@ -57,55 +62,55 @@ AC_CHECK_HEADERS([ \
 
 # Babeltrace viewer check
 AC_ARG_WITH([babeltrace-bin],
-	AS_HELP_STRING([--with-babeltrace-bin],
-	[Location of the babeltrace viewer executable (including the filename)]),
+	AS_HELP_STRING([--with-babeltrace-bin], [Location of the babeltrace viewer executable (including the filename)]),
 	[BABELTRACE_BIN="$withval"],
 	[BABELTRACE_BIN=''])
 AC_SUBST([BABELTRACE_BIN])
 
 # lttv-gui
 AC_ARG_WITH([lttv-gui-bin],
-	AS_HELP_STRING([--with-lttv-gui-bin],
-   [Location of the lttv GUI viewer executable (including the filename)]),
-   [LTTV_GUI_BIN="$withval"],
-   [LTTV_GUI_BIN=''])
+	AS_HELP_STRING([--with-lttv-gui-bin], [Location of the lttv GUI viewer executable (including the filename)]),
+	[LTTV_GUI_BIN="$withval"],
+	[LTTV_GUI_BIN=''])
 AC_SUBST([LTTV_GUI_BIN])
 
 AC_ARG_WITH([consumerd32-bin],
-	AS_HELP_STRING([--with-consumerd32-bin],
-	[Location of the 32-bit consumerd executable (including the filename)]),
+	AS_HELP_STRING([--with-consumerd32-bin], [Location of the 32-bit consumerd executable (including the filename)]),
 	[CONSUMERD32_BIN="$withval"],
 	[CONSUMERD32_BIN=''])
 AC_SUBST([CONSUMERD32_BIN])
 
 AC_ARG_WITH([consumerd64-bin],
-	AS_HELP_STRING([--with-consumerd64-bin],
-	[Location of the 64-bit consumerd executable (including the filename)]),
+	AS_HELP_STRING([--with-consumerd64-bin], [Location of the 64-bit consumerd executable (including the filename)]),
 	[CONSUMERD64_BIN="$withval"],
 	[CONSUMERD64_BIN=''])
 AC_SUBST([CONSUMERD64_BIN])
 
 AC_ARG_WITH([consumerd32-libdir],
-	AS_HELP_STRING([--with-consumerd32-libdir],
-	[Directory containing the 32-bit consumerd libraries]),
+	AS_HELP_STRING([--with-consumerd32-libdir], [Directory containing the 32-bit consumerd libraries]),
 	[CONSUMERD32_LIBDIR="$withval"],
 	[CONSUMERD32_LIBDIR=''])
 AC_SUBST([CONSUMERD32_LIBDIR])
 
 AC_ARG_WITH([consumerd64-libdir],
-	AS_HELP_STRING([--with-consumerd64-libdir],
-	[Directory containing the 64-bit consumerd libraries]),
+	AS_HELP_STRING([--with-consumerd64-libdir], [Directory containing the 64-bit consumerd libraries]),
 	[CONSUMERD64_LIBDIR="$withval"],
 	[CONSUMERD64_LIBDIR=''])
 AC_SUBST([CONSUMERD64_LIBDIR])
 
 AC_ARG_WITH([sessiond-bin],
-	AS_HELP_STRING([--with-sessiond-bin],
-	[Location of the sessiond executable (including the filename)]),
+	AS_HELP_STRING([--with-sessiond-bin], [Location of the sessiond executable (including the filename)]),
 	[SESSIOND_BIN="$withval"],
 	[SESSIOND_BIN=''])
 AC_SUBST([SESSIOND_BIN])
 
+# Option to only build the consumer daemon and its libraries
+AC_ARG_WITH([consumerd-only],
+	AS_HELP_STRING([--with-consumerd-only], [Only build the consumer daemon [default=no]]),
+	[consumerd_only=$withval],
+	[consumerd_only=no])
+AM_CONDITIONAL([BUILD_CONSUMERD_ONLY], [test "x$consumerd_only" = "xyes"])
+
 AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD32_BIN], "$CONSUMERD32_BIN", [Location of the 32-bit consumerd executable.])
 AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD64_BIN], "$CONSUMERD64_BIN", [Location of the 64-bit consumerd executable])
 AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD32_LIBDIR], "$CONSUMERD32_LIBDIR", [Search for consumerd 32-bit libraries in this location.])
@@ -117,23 +122,24 @@ AC_DEFINE_UNQUOTED([CONFIG_SESSIOND_BIN], "$SESSIOND_BIN", [Location of the sess
 # Check for pthread
 AC_CHECK_LIB([pthread], [pthread_create], [],
 [
-    # Check for pthread in a bionic libc...
+	# Check for pthread in a bionic libc...
 	AC_CHECK_LIB([c], [pthread_create], [], 
 	[
-	    AC_MSG_ERROR([Cannot find libpthread. Use [LDFLAGS]=-Ldir to specify its location.])
+		AC_MSG_ERROR([Cannot find libpthread. Use [LDFLAGS]=-Ldir to specify its location.])
 	])
-]
-)
+])
 
 # Check low-level endian compat functions
 AC_CHECK_DECL(be64toh, [], 
 [
-	AC_CHECK_DECL(betoh64, [AC_DEFINE_UNQUOTED([LTTNG_HAVE_BETOH64], 1, [Has BSD-style endian conversion operations.])], 
+	AC_CHECK_DECL(betoh64,
+	[
+		AC_DEFINE_UNQUOTED([LTTNG_HAVE_BETOH64], 1, [Has BSD-style endian conversion operations.])
+	],
 	[
 		AC_MSG_ERROR([Cannot find be64toh, betoh64 or any similar functions.])
 	])
-]
-)
+])
 
 # Check if gettid() is already defined
 AC_CHECK_DECL(gettid,
@@ -146,11 +152,10 @@ AC_CHECK_LIB([popt], [poptGetContext], [],
 [
 	# Check for libpopt in oprofile for Android
 	AC_CHECK_LIB([oprofile_popt], [poptGetContext], [], 
-    [
-        AC_MSG_ERROR([Cannot find libpopt. Use [LDFLAGS]=-Ldir to specify its location.])
-    ])
-]
-)
+	[
+		AC_MSG_ERROR([Cannot find libpopt. Use [LDFLAGS]=-Ldir to specify its location.])
+	])
+])
 
 # Check for libuuid
 AC_CHECK_LIB([uuid], [uuid_generate],
@@ -176,8 +181,7 @@ AC_CHECK_LIB([uuid], [uuid_generate],
 			AC_MSG_ERROR([Cannot find libuuid uuid_generate, libc uuid_create nor libext2_uuid uuid_generate. Use [LDFLAGS]=-Ldir to specify their location.])
 		])
 	])
-]
-)
+])
 AM_CONDITIONAL([LTTNG_BUILD_WITH_LIBUUID], [test "x$have_libuuid" = "xyes"])
 AM_CONDITIONAL([LTTNG_BUILD_WITH_LIBC_UUID], [test "x$have_libc_uuid" = "xyes"])
 AM_CONDITIONAL([LTTNG_BUILD_WITH_LIBEXT2_UUID], [test "x$have_libext2_uuid" = "xyes"])
@@ -222,41 +226,59 @@ liburcu_version=">= 0.7.2"
 
 # Check liburcu needed function calls
 AC_CHECK_DECL([cds_list_add], [],
-	[AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/list.h>]]
-)
+[
+	AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/list.h>]
+])
 AC_CHECK_DECL([cds_wfq_init], [],
-	[AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/wfqueue.h>]]
-)
+[
+	AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/wfqueue.h>]
+])
 AC_CHECK_DECL([cds_wfq_dequeue_blocking], [],
-    [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/wfqueue.h>]]
-)
+[
+	AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/wfqueue.h>]
+])
 AC_CHECK_DECL([futex_async], [],
-	[AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/futex.h>]]
-)
+[
+	AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/futex.h>]
+])
 AC_CHECK_DECL([rcu_thread_offline], [],
-	[AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu.h>]]
-)
+[
+	AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu.h>]
+])
 AC_CHECK_DECL([rcu_thread_online], [],
-	[AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu.h>]]
-)
+[
+	AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu.h>]
+])
 AC_CHECK_DECL([caa_likely], [],
-	[AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu.h>]]
-)
+[
+	AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu.h>]
+])
 
 # Check liblttng-ust-ctl library
 AC_ARG_ENABLE(lttng-ust,
-	AS_HELP_STRING([--disable-lttng-ust],[build without LTTng-UST (Userspace Tracing) support]),
-	lttng_ust_support=$enableval, lttng_ust_support=yes)
+[
+	AS_HELP_STRING([--disable-lttng-ust],[build without LTTng-UST (Userspace Tracing) support])
+],
+[
+	lttng_ust_support=$enableval
+],
+[
+	lttng_ust_support=yes
+])
 
-AS_IF([test "x$lttng_ust_support" = "xyes"], [
+AS_IF([test "x$lttng_ust_support" = "xyes"],
+[
 	AC_CHECK_LIB([lttng-ust-ctl], [ustctl_set_filter],
-		[
-			AC_DEFINE([HAVE_LIBLTTNG_UST_CTL], [1], [has LTTng-UST control support])
-			lttng_ust_ctl_found=yes
-		],
-		[AC_MSG_ERROR([Cannot find LTTng-UST 2.1.x. Use [LDFLAGS]=-Ldir to specify its location, or specify --disable-lttng-ust to build lttng-tools without LTTng-UST support.])],
-		[-lurcu-common -lurcu-bp -lurcu-cds -lc -lrt]
-	)
+	[
+		AC_DEFINE([HAVE_LIBLTTNG_UST_CTL], [1], [has LTTng-UST control support])
+		lttng_ust_ctl_found=yes
+	],
+	[
+		AC_MSG_ERROR([Cannot find LTTng-UST 2.1.x. Use [LDFLAGS]=-Ldir to specify its location, or specify --disable-lttng-ust to build lttng-tools without LTTng-UST support.])
+	],
+	[
+		-lurcu-common -lurcu-bp -lurcu-cds -lc -lrt
+	])
 ])
 AM_CONDITIONAL([HAVE_LIBLTTNG_UST_CTL], [test "x$lttng_ust_ctl_found" = xyes])
 AC_CHECK_FUNCS([sched_getcpu sysconf sync_file_range])
@@ -283,18 +305,15 @@ AM_CONDITIONAL([LTTNG_TOOLS_BUILD_WITH_LIBC_DL], [test "x$have_libc_dl" = "xyes"
 AC_CHECK_LIB([c], [fmemopen],
 [
 	AC_DEFINE_UNQUOTED([LTTNG_HAVE_FMEMOPEN], 1, [Has fmemopen support.])
-]
-)
+])
 
 # Check for open_memstream
 AC_CHECK_LIB([c], [open_memstream],
 [
 	AC_DEFINE_UNQUOTED([LTTNG_HAVE_OPEN_MEMSTREAM], 1, [Has open_memstream support.])
-]
-)
+])
 
 AC_ARG_VAR([LTTNG_RUNDIR], [Path to run directory, default to /var/run])
-
 AS_IF([test -n "$LTTNG_RUNDIR"],
 [
 	lttng_rundir=$LTTNG_RUNDIR
@@ -315,54 +334,49 @@ AC_DEFINE_UNQUOTED([DEFAULT_LTTNG_RUNDIR], ["$lttng_rundir"], [Location of the r
 swig_version=2.0.0
 
 AC_ARG_ENABLE([python-bindings],
-              [AC_HELP_STRING([--enable-python-bindings],
-                              [compile Python bindings])],
-              [enable_python=yes], [enable_python=no])
+[
+	AS_HELP_STRING([--enable-python-bindings], [compile Python bindings])
+],
+[
+	enable_python=yes
+],
+[
+	enable_python=no
+])
 
 AM_CONDITIONAL([USE_PYTHON], [test "x${enable_python:-yes}" = xyes])
 
 if test "x${enable_python:-yes}" = xyes; then
-  AX_PKG_SWIG($swig_version, [], [ AC_MSG_ERROR([SWIG $swig_version or newer is needed]) ])
-  AM_PATH_PYTHON
-
-  AC_ARG_VAR([PYTHON_INCLUDE], [Include flags for python, bypassing python-config])
-  AC_ARG_VAR([PYTHON_CONFIG], [Path to python-config])
-  AS_IF([test -z "$PYTHON_INCLUDE"], [
-    AS_IF([test -z "$PYTHON_CONFIG"], [
-      AC_PATH_PROGS([PYTHON_CONFIG],
-                    [python$PYTHON_VERSION-config python-config],
-                    [no],
-                    [`dirname $PYTHON`])
-      AS_IF([test "$PYTHON_CONFIG" = no], [AC_MSG_ERROR([cannot find python-config for $PYTHON. Do you have python-dev installed?])])
-    ])
-    AC_MSG_CHECKING([python include flags])
-    PYTHON_INCLUDE=`$PYTHON_CONFIG --includes`
-    AC_MSG_RESULT([$PYTHON_INCLUDE])
-  ])
-
+	AX_PKG_SWIG($swig_version, [],
+	[
+		AC_MSG_ERROR([SWIG $swig_version or newer is needed])
+	])
+	AM_PATH_PYTHON
+	AC_ARG_VAR([PYTHON_INCLUDE], [Include flags for python, bypassing python-config])
+	AC_ARG_VAR([PYTHON_CONFIG], [Path to python-config])
+	AS_IF([test -z "$PYTHON_INCLUDE"],
+	[
+		AS_IF([test -z "$PYTHON_CONFIG"],
+		[
+			AC_PATH_PROGS([PYTHON_CONFIG], [python$PYTHON_VERSION-config python-config], [no], [`dirname $PYTHON`])
+			AS_IF([test "$PYTHON_CONFIG" = no],
+			[
+				AC_MSG_ERROR([cannot find python-config for $PYTHON. Do you have python-dev installed?])
+			])
+		])
+		AC_MSG_CHECKING([python include flags])
+		PYTHON_INCLUDE=`$PYTHON_CONFIG --includes`
+		AC_MSG_RESULT([$PYTHON_INCLUDE])
+	])
 else
-    AC_MSG_NOTICE([You may configure with --enable-python-bindings ]dnl
-[if you want Python bindings.])
-
+	AC_MSG_NOTICE([You may configure with --enable-python-bindings if you want Python bindings.])
 fi
 
-# Option to only build the consumer daemon and its libraries
-AC_ARG_WITH([consumerd-only],
-	AS_HELP_STRING([--with-consumerd-only],[Only build the consumer daemon [default=no]]),
-	[consumerd_only=$withval],
-	[consumerd_only=no])
-AM_CONDITIONAL([BUILD_CONSUMERD_ONLY], [test "x$consumerd_only" = "xyes"])
-
 # Epoll check. If not present, the build will fallback on poll() API
-AX_HAVE_EPOLL(
-	[AX_CONFIG_FEATURE_ENABLE(epoll)],
-	[AX_CONFIG_FEATURE_DISABLE(epoll)]
-)
-AX_CONFIG_FEATURE(
-	[epoll], [This platform supports epoll(7)],
-	[HAVE_EPOLL], [This platform supports epoll(7).],
-	[enable_epoll="yes"], [enable_epoll="no"]
-)
+AX_HAVE_EPOLL([AX_CONFIG_FEATURE_ENABLE(epoll)],[AX_CONFIG_FEATURE_DISABLE(epoll)])
+AX_CONFIG_FEATURE([epoll], [This platform supports epoll(7)],
+		[HAVE_EPOLL], [This platform supports epoll(7).],
+		[enable_epoll="yes"], [enable_epoll="no"])
 AM_CONDITIONAL([COMPAT_EPOLL], [ test "$enable_epoll" = "yes" ])
 
 AC_SYS_LARGEFILE
@@ -455,37 +469,43 @@ AS_ECHO()
 # Target architecture we're building for
 target_arch=$host_cpu
 [
-for f in $CFLAGS; do
-        if test $f = "-m32"; then
+	for f in $CFLAGS; do
+		if test $f = "-m32"; then
 			target_arch="32-bit"
-        elif test $f = "-m64"; then
+		elif test $f = "-m64"; then
 			target_arch="64-bit"
-        fi
-done
+		fi
+	done
 ]
 AS_ECHO_N("Target architecture: ")
 AS_ECHO($target_arch)
 
 # LTTng-UST enabled/disabled
 AS_ECHO_N("Lttng-UST support: ")
-AS_IF([test "x$lttng_ust_support" = "xyes"],[
+AS_IF([test "x$lttng_ust_support" = "xyes"],
+[
 	AS_ECHO("Enabled")
-],[
+],
+[
 	AS_ECHO("Disabled")
 ])
 
 #Python binding enabled/disabled
 AS_ECHO_N("Python binding: ")
-AS_IF([test "x${enable_python:-yes}" = xyes], [
+AS_IF([test "x${enable_python:-yes}" = xyes],
+[
 	AS_ECHO("Enabled")
-],[
+],
+[
 	AS_ECHO("Disabled")
 ])
 
 # Do we build only the consumerd, or everything
-AS_IF([test "x$consumerd_only" = "xyes"],[
+AS_IF([test "x$consumerd_only" = "xyes"],
+[
 	AS_ECHO("Only the consumerd daemon will be built.")
-],[
+],
+[
 	AS_ECHO("All binaries will be built.")
 ])
 
@@ -497,45 +517,52 @@ AS_ECHO_N("Libraries will be installed in: ")
 AS_ECHO("`eval eval echo $libdir`")
 
 # If we build the sessiond, print the paths it will use
-AS_IF([test "x$consumerd_only" = "xno"],[
+AS_IF([test "x$consumerd_only" = "xno"],
+[
 	AS_ECHO()
 	AS_ECHO_N("The lttng command will look for the lttng-sessiond executable at: ")
-	AS_IF([test "$SESSIOND_BIN" = ""],[
+	AS_IF([test "$SESSIOND_BIN" = ""],
+	[
 		AS_ECHO_N("`eval eval echo $bindir`")
 		AS_ECHO("/lttng-sessiond")
-	],[
+	],
+	[
 		AS_ECHO("$SESSIOND_BIN")
 	])
-
 	AS_ECHO()
 	AS_ECHO("The sessiond daemon will look in the following directories: ")
 	AS_ECHO_N("32-bit consumerd executable at: ")
-	AS_IF([test "$CONSUMERD32_BIN" = ""],[
+	AS_IF([test "$CONSUMERD32_BIN" = ""],
+	[
 		AS_ECHO_N("`eval eval echo $lttnglibexecdir`")
 		AS_ECHO("/lttng-consumerd")
-	],[
+	],
+	[
 		AS_ECHO("$CONSUMERD32_BIN")
 	])
-
 	AS_ECHO_N("32-bit consumer libraries in:   ")
-	AS_IF([test "$CONSUMERD32_LIBDIR" = ""],[
+	AS_IF([test "$CONSUMERD32_LIBDIR" = ""],
+	[
 		AS_ECHO("`eval eval echo $libdir`")
-	],[
+	],
+	[
 		AS_ECHO("$CONSUMERD32_LIBDIR")
 	])
-
 	AS_ECHO_N("64-bit consumerd executable at: ")
-	AS_IF([test "$CONSUMERD64_BIN" = ""],[
+	AS_IF([test "$CONSUMERD64_BIN" = ""],
+	[
 		AS_ECHO_N("`eval eval echo $lttnglibexecdir`")
 		AS_ECHO("/lttng-consumerd")
-	],[
+	],
+	[
 		AS_ECHO("$CONSUMERD64_BIN")
 	])
-
 	AS_ECHO_N("64-bit consumer libraries in:   ")

configure.ac AS_ECHO_N("Libraries will be installed in: ") · line 568

Quoted 10 lines
configure.ac +4 -2
-	AS_IF([test "$CONSUMERD64_LIBDIR" = ""],[
+	AS_IF([test "$CONSUMERD64_LIBDIR" = ""],
+	[
 		AS_ECHO("`eval eval echo $libdir`")
-	],[
+	],
+	[
 		AS_ECHO("$CONSUMERD64_LIBDIR")
 	])
 ])

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

A message that is not in the archive (sent off-list or not yet received): 20130506192838.GA21679@Krystal

#29 lore raw

Re: [PATCH lttng-tools 14/14] Cleaned up configure.ac: Replaced space indents by tabs, regrouped AC_ARG_WITH's, generalized the coding style, fixed a bad AS_HELP_STRING.

Hmm, I agree the 3+ patch split might be a better idea; as for the 'generalized coding style', it was more of a parenthesis usage & positionning cleanup to make sure the same style was applied everywhere (I tried to pick whatever style was the most present at the time). There were a lot of floating brackets here and there, and some function arguments were not properly tabbed. These changes fixed most (?) of these issues while keeping readability in mind.

We'll get working on all these fixes in the next few days, but for now, thanks for the comments!

Quoted 629 lines · Mathieu Desnoyers
Quoted 1 line · * David Goulet ([email protected]) wrote:

Why?

cleaning up the configure.ac is a good thing. However, this patch should probably be split into 3 patches.

1) Cleanup: configure.ac: replace space indents by tabs
2) Cleanup: configure.ac: regroup AC_ARG_WITH
3) Error message fix: configure.ac: fix bad AS_HELP_STRING

Not sure about "generalized coding style" though. It might require more explanation.

Thanks,

Mathieu

Quoted 11 lines

Thanks!
David

Charles Briere:

Quoted 6 lines

From: Pierre-Luc St-Charles <[email protected]>

---
 configure.ac | 315

++++++++++++++++++++++++++++++++---------------------------

Quoted 9 lines

configure.ac AC_CONFIG_HEADERS([include/config.h]) · line 18

Quoted 9 lines
 1 file changed, 171 insertions(+), 144 deletions(-)
configure.ac +0 -0
index 154b0a7..e4d2c6f 100644
@@ -17,27 +17,32 @@ AC_CONFIG_HEADERS([include/config.h])
 AC_PROG_GREP
 # libtool link_all_deplibs fixup. See

http://bugs.lttng.org/issues/321.

Quoted 3 lines

configure.ac AC_CONFIG_HEADERS([include/config.h]) · line 21

Quoted 3 lines
configure.ac +0 -2
 AC_ARG_ENABLE(libtool-linkdep-fixup,
-   AS_HELP_STRING([--disable-libtool-linkdep-fixup],
-                   [disable the libtool fixup for linking all

dependent libraries (link_all_deplibs)]),

Quoted 4 lines

configure.ac AC_CONFIG_HEADERS([include/config.h]) · line 21

Quoted 4 lines
configure.ac +2 -2
-   libtool_fixup=$enableval,
-   libtool_fixup=yes)
+[
+   AS_HELP_STRING([--disable-libtool-linkdep-fixup],[disable the

libtool fixup for linking all dependent libraries (link_all_deplibs)])

Quoted 8 lines
Quoted 8 lines
configure.ac +7 -0
+],
+[
+   libtool_fixup=$enableval
+],
+[
+   libtool_fixup=yes
+])
 
Quoted 5 lines

configure.ac AC_CONFIG_HEADERS([include/config.h]) · line 29

Quoted 5 lines
configure.ac +0 -4
 AS_IF([test "x$libtool_fixup" = "xyes"],
-       [
-       libtool_m4="$srcdir/config/libtool.m4"
-       libtool_flag_pattern=".*link_all_deplibs\s*,\s*\$1\s*)"
-       AC_MSG_CHECKING([for occurence(s) of link_all_deplibs = no in

$libtool_m4])

Quoted 1 line

configure.ac AC_CONFIG_HEADERS([include/config.h]) · line 30

Quoted 1 line
configure.ac +0 -1
-       libtool_flag_pattern_count=$(grep -c

"$libtool_flag_pattern\s*=\s*no" $libtool_m4)

Quoted 4 lines

configure.ac AC_CONFIG_HEADERS([include/config.h]) · line 34

Quoted 4 lines
configure.ac +0 -4
-       AS_IF([test $libtool_flag_pattern_count -ne 0],
-       [
-             AC_MSG_RESULT([$libtool_flag_pattern_count])
-             AC_MSG_WARN([the detected libtool will not link all

dependencies, forcing link_all_deplibs = unknown])

Quoted 1 line

configure.ac AC_CONFIG_HEADERS([include/config.h]) · line 35

Quoted 1 line
configure.ac +0 -1
-             sed -i

"s/\($libtool_flag_pattern\)\s*=\s*no/\1=unknown/g" $libtool_m4

Quoted 9 lines

configure.ac AC_CONFIG_HEADERS([include/config.h]) · line 34

Quoted 9 lines
configure.ac +4 -5
-             ],
-             [
-             AC_MSG_RESULT([none])
-             ])
-       ])
+[
+   libtool_m4="$srcdir/config/libtool.m4"
+   libtool_flag_pattern=".*link_all_deplibs\s*,\s*\$1\s*)"
+   AC_MSG_CHECKING([for occurence(s) of link_all_deplibs = no in

$libtool_m4])

Quoted 1 line

configure.ac AC_CONFIG_HEADERS([include/config.h]) · line 35

Quoted 1 line
configure.ac +1 -0
+   libtool_flag_pattern_count=$(grep -c

"$libtool_flag_pattern\s*=\s*no" $libtool_m4)

Quoted 4 lines

configure.ac AC_CONFIG_HEADERS([include/config.h]) · line 39

Quoted 4 lines
configure.ac +4 -0
+   AS_IF([test $libtool_flag_pattern_count -ne 0],
+   [
+           AC_MSG_RESULT([$libtool_flag_pattern_count])
+           AC_MSG_WARN([the detected libtool will not link all

dependencies, forcing link_all_deplibs = unknown])

Quoted 1 line

configure.ac AC_CONFIG_HEADERS([include/config.h]) · line 40

Quoted 1 line
configure.ac +1 -0
+           sed -i "s/\($libtool_flag_pattern\)\s*=\s*no/\1=unknown/g"

$libtool_m4

Quoted 6 lines
Quoted 6 lines
configure.ac +5 -0
+   ],
+   [
+           AC_MSG_RESULT([none])
+   ])
+])
 
Quoted 8 lines

configure.ac AC_CHECK_HEADERS([ \ · line 61

Quoted 8 lines
configure.ac +0 -2
 AM_CONDITIONAL([NO_SHARED], [test x$enable_shared = xno])
 
@@ -57,55 +62,55 @@ AC_CHECK_HEADERS([ \
 
 # Babeltrace viewer check
 AC_ARG_WITH([babeltrace-bin],
-   AS_HELP_STRING([--with-babeltrace-bin],
-   [Location of the babeltrace viewer executable (including the

filename)]),

Quoted 1 line

configure.ac AC_CHECK_HEADERS([ \ · line 65

Quoted 1 line
configure.ac +1 -0
+   AS_HELP_STRING([--with-babeltrace-bin], [Location of the

babeltrace viewer executable (including the filename)]),

Quoted 8 lines

configure.ac AC_CHECK_HEADERS([ \ · line 69

Quoted 8 lines
configure.ac +0 -2
    [BABELTRACE_BIN="$withval"],
    [BABELTRACE_BIN=''])
 AC_SUBST([BABELTRACE_BIN])
 
 # lttv-gui
 AC_ARG_WITH([lttv-gui-bin],
-   AS_HELP_STRING([--with-lttv-gui-bin],
-   [Location of the lttv GUI viewer executable (including the

filename)]),

Quoted 3 lines

configure.ac AC_CHECK_HEADERS([ \ · line 72

Quoted 3 lines
configure.ac +1 -2
-   [LTTV_GUI_BIN="$withval"],
-   [LTTV_GUI_BIN=''])
+   AS_HELP_STRING([--with-lttv-gui-bin], [Location of the lttv GUI

viewer executable (including the filename)]),

Quoted 7 lines

configure.ac AC_CHECK_HEADERS([ \ · line 76

Quoted 7 lines
configure.ac +2 -2
+   [LTTV_GUI_BIN="$withval"],
+   [LTTV_GUI_BIN=''])
 AC_SUBST([LTTV_GUI_BIN])
 
 AC_ARG_WITH([consumerd32-bin],
-   AS_HELP_STRING([--with-consumerd32-bin],
-   [Location of the 32-bit consumerd executable (including the

filename)]),

Quoted 1 line

configure.ac AC_CHECK_HEADERS([ \ · line 78

Quoted 1 line
configure.ac +1 -0
+   AS_HELP_STRING([--with-consumerd32-bin], [Location of the 32-bit

consumerd executable (including the filename)]),

Quoted 7 lines

configure.ac AC_CHECK_HEADERS([ \ · line 83

Quoted 7 lines
configure.ac +0 -2
    [CONSUMERD32_BIN="$withval"],
    [CONSUMERD32_BIN=''])
 AC_SUBST([CONSUMERD32_BIN])
 
 AC_ARG_WITH([consumerd64-bin],
-   AS_HELP_STRING([--with-consumerd64-bin],
-   [Location of the 64-bit consumerd executable (including the

filename)]),

Quoted 1 line

configure.ac AC_CHECK_HEADERS([ \ · line 84

Quoted 1 line
configure.ac +1 -0
+   AS_HELP_STRING([--with-consumerd64-bin], [Location of the 64-bit

consumerd executable (including the filename)]),

Quoted 8 lines

configure.ac AC_CHECK_HEADERS([ \ · line 90

Quoted 8 lines
configure.ac +1 -2
    [CONSUMERD64_BIN="$withval"],
    [CONSUMERD64_BIN=''])
 AC_SUBST([CONSUMERD64_BIN])
 
 AC_ARG_WITH([consumerd32-libdir],
-   AS_HELP_STRING([--with-consumerd32-libdir],
-   [Directory containing the 32-bit consumerd libraries]),
+   AS_HELP_STRING([--with-consumerd32-libdir], [Directory containing

the 32-bit consumerd libraries]),

Quoted 8 lines

configure.ac AC_CHECK_HEADERS([ \ · line 96

Quoted 8 lines
configure.ac +1 -2
    [CONSUMERD32_LIBDIR="$withval"],
    [CONSUMERD32_LIBDIR=''])
 AC_SUBST([CONSUMERD32_LIBDIR])
 
 AC_ARG_WITH([consumerd64-libdir],
-   AS_HELP_STRING([--with-consumerd64-libdir],
-   [Directory containing the 64-bit consumerd libraries]),
+   AS_HELP_STRING([--with-consumerd64-libdir], [Directory containing

the 64-bit consumerd libraries]),

Quoted 8 lines

configure.ac AC_CHECK_HEADERS([ \ · line 102

Quoted 8 lines
configure.ac +1 -2
    [CONSUMERD64_LIBDIR="$withval"],
    [CONSUMERD64_LIBDIR=''])
 AC_SUBST([CONSUMERD64_LIBDIR])
 
 AC_ARG_WITH([sessiond-bin],
-   AS_HELP_STRING([--with-sessiond-bin],
-   [Location of the sessiond executable (including the filename)]),
+   AS_HELP_STRING([--with-sessiond-bin], [Location of the sessiond

executable (including the filename)]),

Quoted 7 lines

configure.ac AC_CHECK_HEADERS([ \ · line 109

Quoted 7 lines
configure.ac +3 -0
    [SESSIOND_BIN="$withval"],
    [SESSIOND_BIN=''])
 AC_SUBST([SESSIOND_BIN])
 
+# Option to only build the consumer daemon and its libraries
+AC_ARG_WITH([consumerd-only],
+   AS_HELP_STRING([--with-consumerd-only], [Only build the consumer

daemon [default=no]]),

Quoted 3 lines

configure.ac AC_CHECK_HEADERS([ \ · line 112

Quoted 3 lines
configure.ac +3 -0
+   [consumerd_only=$withval],
+   [consumerd_only=no])
+AM_CONDITIONAL([BUILD_CONSUMERD_ONLY], [test "x$consumerd_only" =

"xyes"])

Quoted 2 lines

configure.ac AC_CHECK_HEADERS([ \ · line 114

Quoted 2 lines
configure.ac +1 -0
+
 AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD32_BIN], "$CONSUMERD32_BIN",

[Location of the 32-bit consumerd executable.])

Quoted 1 line

configure.ac AC_CHECK_HEADERS([ \ · line 115

Quoted 1 line
configure.ac +0 -0
 AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD64_BIN], "$CONSUMERD64_BIN",

[Location of the 64-bit consumerd executable])

Quoted 1 line

configure.ac AC_CHECK_HEADERS([ \ · line 116

Quoted 1 line
configure.ac +0 -0
 AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD32_LIBDIR],

"$CONSUMERD32_LIBDIR", [Search for consumerd 32-bit libraries in this location.])

Quoted 1 line

configure.ac AC_DEFINE_UNQUOTED([CONFIG_SESSIOND_BIN],

Quoted 1 line
configure.ac +0 -0
@@ -117,23 +122,24 @@ AC_DEFINE_UNQUOTED([CONFIG_SESSIOND_BIN],

"$SESSIOND_BIN", [Location of the sess

Quoted 8 lines

configure.ac AC_DEFINE_UNQUOTED([CONFIG_SESSIOND_BIN], · line 123

Quoted 8 lines
configure.ac +1 -2
 # Check for pthread
 AC_CHECK_LIB([pthread], [pthread_create], [],
 [
-    # Check for pthread in a bionic libc...
+   # Check for pthread in a bionic libc...
    AC_CHECK_LIB([c], [pthread_create], [],
    [
-       AC_MSG_ERROR([Cannot find libpthread. Use [LDFLAGS]=-Ldir to

specify its location.])

Quoted 1 line

configure.ac AC_DEFINE_UNQUOTED([CONFIG_SESSIOND_BIN], · line 128

Quoted 1 line
configure.ac +1 -0
+           AC_MSG_ERROR([Cannot find libpthread. Use [LDFLAGS]=-Ldir

to specify its location.])

Quoted 9 lines

configure.ac AC_DEFINE_UNQUOTED([CONFIG_SESSIOND_BIN], · line 131

Quoted 9 lines
configure.ac +1 -3
    ])
-]
-)
+])
 
 # Check low-level endian compat functions
 AC_CHECK_DECL(be64toh, [],
 [
-   AC_CHECK_DECL(betoh64, [AC_DEFINE_UNQUOTED([LTTNG_HAVE_BETOH64],

1, [Has BSD-style endian conversion operations.])],

Quoted 3 lines

configure.ac AC_DEFINE_UNQUOTED([CONFIG_SESSIOND_BIN], · line 137

Quoted 3 lines
configure.ac +3 -0
+   AC_CHECK_DECL(betoh64,
+   [
+           AC_DEFINE_UNQUOTED([LTTNG_HAVE_BETOH64], 1, [Has BSD-style

endian conversion operations.])

Quoted 3 lines

configure.ac AC_DEFINE_UNQUOTED([CONFIG_SESSIOND_BIN], · line 140

Quoted 3 lines
configure.ac +1 -0
+   ],
    [
            AC_MSG_ERROR([Cannot find be64toh, betoh64 or any similar

functions.])

Quoted 5 lines
Quoted 5 lines
configure.ac +1 -2
    ])
-]
-)
+])
 
Quoted 8 lines

configure.ac AC_CHECK_LIB([popt], [poptGetContext], [], · line 150

Quoted 8 lines
configure.ac +0 -2
 # Check if gettid() is already defined
 AC_CHECK_DECL(gettid,
@@ -146,11 +152,10 @@ AC_CHECK_LIB([popt], [poptGetContext], [],
 [
    # Check for libpopt in oprofile for Android
    AC_CHECK_LIB([oprofile_popt], [poptGetContext], [],
-    [
-        AC_MSG_ERROR([Cannot find libpopt. Use [LDFLAGS]=-Ldir to

specify its location.])

Quoted 5 lines

configure.ac AC_CHECK_LIB([popt], [poptGetContext], [], · line 156

Quoted 5 lines
configure.ac +2 -3
-    ])
-]
-)
+   [
+           AC_MSG_ERROR([Cannot find libpopt. Use [LDFLAGS]=-Ldir to

specify its location.])

Quoted 7 lines

configure.ac AC_CHECK_LIB([uuid], [uuid_generate], · line 181

Quoted 7 lines
configure.ac +2 -0
+   ])
+])
 
 # Check for libuuid
 AC_CHECK_LIB([uuid], [uuid_generate],
@@ -176,8 +181,7 @@ AC_CHECK_LIB([uuid], [uuid_generate],
                    AC_MSG_ERROR([Cannot find libuuid uuid_generate,

libc uuid_create nor libext2_uuid uuid_generate. Use [LDFLAGS]=-Ldir to specify their location.])

Quoted 6 lines

configure.ac AC_CHECK_LIB([uuid], [uuid_generate], · line 185

Quoted 6 lines
configure.ac +1 -2
            ])
    ])
-]
-)
+])
 AM_CONDITIONAL([LTTNG_BUILD_WITH_LIBUUID], [test "x$have_libuuid" =

"xyes"])

Quoted 1 line

configure.ac AC_CHECK_LIB([uuid], [uuid_generate], · line 186

Quoted 1 line
configure.ac +0 -0
 AM_CONDITIONAL([LTTNG_BUILD_WITH_LIBC_UUID], [test "x$have_libc_uuid"

= "xyes"])

Quoted 1 line

configure.ac AC_CHECK_LIB([uuid], [uuid_generate], · line 187

Quoted 1 line
configure.ac +0 -0
 AM_CONDITIONAL([LTTNG_BUILD_WITH_LIBEXT2_UUID], [test

"x$have_libext2_uuid" = "xyes"])

Quoted 5 lines

configure.ac liburcu_version=">= 0.7.2" · line 225

Quoted 5 lines
configure.ac +0 -1
@@ -222,41 +226,59 @@ liburcu_version=">= 0.7.2"
 
 # Check liburcu needed function calls
 AC_CHECK_DECL([cds_list_add], [],
-   [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])],

[[#include <urcu/list.h>]]

Quoted 3 lines

configure.ac liburcu_version=">= 0.7.2" · line 230

Quoted 3 lines
configure.ac +2 -1
-)
+[
+   AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])],

[[#include <urcu/list.h>]

Quoted 3 lines

configure.ac liburcu_version=">= 0.7.2" · line 228

Quoted 3 lines
configure.ac +1 -1
+])
 AC_CHECK_DECL([cds_wfq_init], [],
-   [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])],

[[#include <urcu/wfqueue.h>]]

Quoted 3 lines

configure.ac liburcu_version=">= 0.7.2" · line 234

Quoted 3 lines
configure.ac +2 -1
-)
+[
+   AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])],

[[#include <urcu/wfqueue.h>]

Quoted 3 lines

configure.ac liburcu_version=">= 0.7.2" · line 231

Quoted 3 lines
configure.ac +1 -1
+])
 AC_CHECK_DECL([cds_wfq_dequeue_blocking], [],
-    [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])],

[[#include <urcu/wfqueue.h>]]

Quoted 3 lines

configure.ac liburcu_version=">= 0.7.2" · line 238

Quoted 3 lines
configure.ac +2 -1
-)
+[
+   AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])],

[[#include <urcu/wfqueue.h>]

Quoted 3 lines

configure.ac liburcu_version=">= 0.7.2" · line 234

Quoted 3 lines
configure.ac +1 -1
+])
 AC_CHECK_DECL([futex_async], [],
-   [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])],

[[#include <urcu/futex.h>]]

Quoted 3 lines

configure.ac liburcu_version=">= 0.7.2" · line 242

Quoted 3 lines
configure.ac +2 -1
-)
+[
+   AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])],

[[#include <urcu/futex.h>]

Quoted 3 lines

configure.ac liburcu_version=">= 0.7.2" · line 237

Quoted 3 lines
configure.ac +1 -1
+])
 AC_CHECK_DECL([rcu_thread_offline], [],
-   [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])],

[[#include <urcu.h>]]

Quoted 3 lines

configure.ac liburcu_version=">= 0.7.2" · line 246

Quoted 3 lines
configure.ac +2 -1
-)
+[
+   AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])],

[[#include <urcu.h>]

Quoted 3 lines

configure.ac liburcu_version=">= 0.7.2" · line 240

Quoted 3 lines
configure.ac +1 -1
+])
 AC_CHECK_DECL([rcu_thread_online], [],
-   [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])],

[[#include <urcu.h>]]

Quoted 3 lines

configure.ac liburcu_version=">= 0.7.2" · line 250

Quoted 3 lines
configure.ac +2 -1
-)
+[
+   AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])],

[[#include <urcu.h>]

Quoted 3 lines

configure.ac liburcu_version=">= 0.7.2" · line 243

Quoted 3 lines
configure.ac +1 -1
+])
 AC_CHECK_DECL([caa_likely], [],
-   [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])],

[[#include <urcu.h>]]

Quoted 3 lines

configure.ac liburcu_version=">= 0.7.2" · line 254

Quoted 3 lines
configure.ac +2 -1
-)
+[
+   AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])],

[[#include <urcu.h>]

Quoted 5 lines

configure.ac liburcu_version=">= 0.7.2" · line 248

Quoted 5 lines
configure.ac +1 -1
+])
 
 # Check liblttng-ust-ctl library
 AC_ARG_ENABLE(lttng-ust,
-   AS_HELP_STRING([--disable-lttng-ust],[build without LTTng-UST

(Userspace Tracing) support]),

Quoted 3 lines

configure.ac liburcu_version=">= 0.7.2" · line 260

Quoted 3 lines
configure.ac +2 -1
-   lttng_ust_support=$enableval, lttng_ust_support=yes)
+[
+   AS_HELP_STRING([--disable-lttng-ust],[build without LTTng-UST

(Userspace Tracing) support])

Quoted 8 lines
Quoted 8 lines
configure.ac +7 -0
+],
+[
+   lttng_ust_support=$enableval
+],
+[
+   lttng_ust_support=yes
+])
 
Quoted 6 lines

configure.ac liburcu_version=">= 0.7.2" · line 254

Quoted 6 lines
configure.ac +2 -3
-AS_IF([test "x$lttng_ust_support" = "xyes"], [
+AS_IF([test "x$lttng_ust_support" = "xyes"],
+[
    AC_CHECK_LIB([lttng-ust-ctl], [ustctl_set_filter],
-           [
-                   AC_DEFINE([HAVE_LIBLTTNG_UST_CTL], [1], [has

LTTng-UST control support])

Quoted 3 lines

configure.ac liburcu_version=">= 0.7.2" · line 257

Quoted 3 lines
configure.ac +0 -3
-                   lttng_ust_ctl_found=yes
-           ],
-           [AC_MSG_ERROR([Cannot find LTTng-UST 2.1.x. Use

[LDFLAGS]=-Ldir to specify its location, or specify --disable-lttng-ust to build lttng-tools without LTTng-UST support.])],

Quoted 4 lines

configure.ac liburcu_version=">= 0.7.2" · line 273

Quoted 4 lines
configure.ac +2 -2
-           [-lurcu-common -lurcu-bp -lurcu-cds -lc -lrt]
-   )
+   [
+           AC_DEFINE([HAVE_LIBLTTNG_UST_CTL], [1], [has LTTng-UST

control support])

Quoted 4 lines

configure.ac liburcu_version=">= 0.7.2" · line 277

Quoted 4 lines
configure.ac +4 -0
+           lttng_ust_ctl_found=yes
+   ],
+   [
+           AC_MSG_ERROR([Cannot find LTTng-UST 2.1.x. Use

[LDFLAGS]=-Ldir to specify its location, or specify --disable-lttng-ust to build lttng-tools without LTTng-UST support.])

Quoted 6 lines

configure.ac liburcu_version=">= 0.7.2" · line 283

Quoted 6 lines
configure.ac +4 -0
+   ],
+   [
+           -lurcu-common -lurcu-bp -lurcu-cds -lc -lrt
+   ])
 ])
 AM_CONDITIONAL([HAVE_LIBLTTNG_UST_CTL], [test "x$lttng_ust_ctl_found"

= xyes])

Quoted 2 lines

configure.ac AM_CONDITIONAL([LTTNG_TOOLS_BUILD_WITH_LIBC_DL],

Quoted 2 lines
configure.ac +0 -0
 AC_CHECK_FUNCS([sched_getcpu sysconf sync_file_range])
@@ -283,18 +305,15 @@ AM_CONDITIONAL([LTTNG_TOOLS_BUILD_WITH_LIBC_DL],

[test "x$have_libc_dl" = "xyes"

Quoted 3 lines

configure.ac AM_CONDITIONAL([LTTNG_TOOLS_BUILD_WITH_LIBC_DL], · line 307

Quoted 3 lines
configure.ac +0 -0
 AC_CHECK_LIB([c], [fmemopen],
 [
    AC_DEFINE_UNQUOTED([LTTNG_HAVE_FMEMOPEN], 1, [Has fmemopen

support.])

Quoted 8 lines

configure.ac AM_CONDITIONAL([LTTNG_TOOLS_BUILD_WITH_LIBC_DL], · line 313

Quoted 8 lines
configure.ac +1 -2
-]
-)
+])
 
 # Check for open_memstream
 AC_CHECK_LIB([c], [open_memstream],
 [
    AC_DEFINE_UNQUOTED([LTTNG_HAVE_OPEN_MEMSTREAM], 1, [Has

open_memstream support.])

Quoted 5 lines

configure.ac AM_CONDITIONAL([LTTNG_TOOLS_BUILD_WITH_LIBC_DL], · line 316

Quoted 5 lines
configure.ac +1 -2
-]
-)
+])
 
 AC_ARG_VAR([LTTNG_RUNDIR], [Path to run directory, default to

/var/run])

Quoted 5 lines

configure.ac AC_DEFINE_UNQUOTED([DEFAULT_LTTNG_RUNDIR],

Quoted 5 lines
configure.ac +0 -1
-
 AS_IF([test -n "$LTTNG_RUNDIR"],
 [
    lttng_rundir=$LTTNG_RUNDIR
@@ -315,54 +334,49 @@ AC_DEFINE_UNQUOTED([DEFAULT_LTTNG_RUNDIR],

["$lttng_rundir"], [Location of the r

Quoted 8 lines

configure.ac AC_DEFINE_UNQUOTED([DEFAULT_LTTNG_RUNDIR], · line 338

Quoted 8 lines
configure.ac +2 -3
 swig_version=2.0.0
 
 AC_ARG_ENABLE([python-bindings],
-              [AC_HELP_STRING([--enable-python-bindings],
-                              [compile Python bindings])],
-              [enable_python=yes], [enable_python=no])
+[
+   AS_HELP_STRING([--enable-python-bindings], [compile Python

bindings])

Quoted 8 lines
Quoted 8 lines
configure.ac +7 -0
+],
+[
+   enable_python=yes
+],
+[
+   enable_python=no
+])
 
Quoted 4 lines

configure.ac AC_DEFINE_UNQUOTED([DEFAULT_LTTNG_RUNDIR], · line 325

Quoted 4 lines
configure.ac +0 -1
 AM_CONDITIONAL([USE_PYTHON], [test "x${enable_python:-yes}" = xyes])
 
 if test "x${enable_python:-yes}" = xyes; then
-  AX_PKG_SWIG($swig_version, [], [ AC_MSG_ERROR([SWIG $swig_version

or newer is needed]) ])

Quoted 3 lines

configure.ac AC_DEFINE_UNQUOTED([DEFAULT_LTTNG_RUNDIR], · line 328

Quoted 3 lines
configure.ac +0 -3
-  AM_PATH_PYTHON
-
-  AC_ARG_VAR([PYTHON_INCLUDE], [Include flags for python, bypassing

python-config])

Quoted 8 lines

configure.ac AC_DEFINE_UNQUOTED([DEFAULT_LTTNG_RUNDIR], · line 336

Quoted 8 lines
configure.ac +0 -8
-  AC_ARG_VAR([PYTHON_CONFIG], [Path to python-config])
-  AS_IF([test -z "$PYTHON_INCLUDE"], [
-    AS_IF([test -z "$PYTHON_CONFIG"], [
-      AC_PATH_PROGS([PYTHON_CONFIG],
-                    [python$PYTHON_VERSION-config python-config],
-                    [no],
-                    [`dirname $PYTHON`])
-      AS_IF([test "$PYTHON_CONFIG" = no], [AC_MSG_ERROR([cannot find

python-config for $PYTHON. Do you have python-dev installed?])])

Quoted 4 lines
Quoted 4 lines
configure.ac +0 -4
-    ])
-    AC_MSG_CHECKING([python include flags])
-    PYTHON_INCLUDE=`$PYTHON_CONFIG --includes`
-    AC_MSG_RESULT([$PYTHON_INCLUDE])
Quoted 8 lines

configure.ac AC_DEFINE_UNQUOTED([DEFAULT_LTTNG_RUNDIR], · line 355

Quoted 8 lines
configure.ac +6 -2
-  ])
-
+   AX_PKG_SWIG($swig_version, [],
+   [
+           AC_MSG_ERROR([SWIG $swig_version or newer is needed])
+   ])
+   AM_PATH_PYTHON
+   AC_ARG_VAR([PYTHON_INCLUDE], [Include flags for python, bypassing

python-config])

Quoted 6 lines

configure.ac AC_DEFINE_UNQUOTED([DEFAULT_LTTNG_RUNDIR], · line 361

Quoted 6 lines
configure.ac +6 -0
+   AC_ARG_VAR([PYTHON_CONFIG], [Path to python-config])
+   AS_IF([test -z "$PYTHON_INCLUDE"],
+   [
+           AS_IF([test -z "$PYTHON_CONFIG"],
+           [
+                   AC_PATH_PROGS([PYTHON_CONFIG],

[python$PYTHON_VERSION-config python-config], [no], [dirname $PYTHON])

Quoted 3 lines

configure.ac AC_DEFINE_UNQUOTED([DEFAULT_LTTNG_RUNDIR], · line 364

Quoted 3 lines
configure.ac +3 -0
+                   AS_IF([test "$PYTHON_CONFIG" = no],
+                   [
+                           AC_MSG_ERROR([cannot find python-config

for $PYTHON. Do you have python-dev installed?])

Quoted 8 lines

configure.ac AC_DEFINE_UNQUOTED([DEFAULT_LTTNG_RUNDIR], · line 344

Quoted 8 lines
configure.ac +6 -1
+                   ])
+           ])
+           AC_MSG_CHECKING([python include flags])
+           PYTHON_INCLUDE=`$PYTHON_CONFIG --includes`
+           AC_MSG_RESULT([$PYTHON_INCLUDE])
+   ])
 else
-    AC_MSG_NOTICE([You may configure with --enable-python-bindings

]dnl

Quoted 3 lines

configure.ac AC_DEFINE_UNQUOTED([DEFAULT_LTTNG_RUNDIR], · line 372

Quoted 3 lines
configure.ac +1 -2
-[if you want Python bindings.])
-
+   AC_MSG_NOTICE([You may configure with --enable-python-bindings if

you want Python bindings.])

Quoted 5 lines

configure.ac AC_DEFINE_UNQUOTED([DEFAULT_LTTNG_RUNDIR], · line 351

Quoted 5 lines
configure.ac +0 -3
 fi
 
-# Option to only build the consumer daemon and its libraries
-AC_ARG_WITH([consumerd-only],
-   AS_HELP_STRING([--with-consumerd-only],[Only build the consumer

daemon [default=no]]),

Quoted 3 lines

configure.ac AC_DEFINE_UNQUOTED([DEFAULT_LTTNG_RUNDIR], · line 354

Quoted 3 lines
configure.ac +0 -3
-   [consumerd_only=$withval],
-   [consumerd_only=no])
-AM_CONDITIONAL([BUILD_CONSUMERD_ONLY], [test "x$consumerd_only" =

"xyes"])

Quoted 4 lines
Quoted 4 lines
configure.ac +0 -3
-
 # Epoll check. If not present, the build will fallback on poll() API
-AX_HAVE_EPOLL(
-   [AX_CONFIG_FEATURE_ENABLE(epoll)],
Quoted 8 lines

configure.ac AC_DEFINE_UNQUOTED([DEFAULT_LTTNG_RUNDIR], · line 376

Quoted 8 lines
configure.ac +0 -7
-   [AX_CONFIG_FEATURE_DISABLE(epoll)]
-)
-AX_CONFIG_FEATURE(
-   [epoll], [This platform supports epoll(7)],
-   [HAVE_EPOLL], [This platform supports epoll(7).],
-   [enable_epoll="yes"], [enable_epoll="no"]
-)
 

+AX_HAVE_EPOLL([AX_CONFIG_FEATURE_ENABLE(epoll)],[AX_CONFIG_FEATURE_DISABLE(epoll)])

Quoted 64 lines
Quoted 64 lines
configure.ac +20 -11
+AX_CONFIG_FEATURE([epoll], [This platform supports epoll(7)],
+           [HAVE_EPOLL], [This platform supports epoll(7).],
+           [enable_epoll="yes"], [enable_epoll="no"])
 AM_CONDITIONAL([COMPAT_EPOLL], [ test "$enable_epoll" = "yes" ])
 
 AC_SYS_LARGEFILE
@@ -455,37 +469,43 @@ AS_ECHO()
 # Target architecture we're building for
 target_arch=$host_cpu
 [
-for f in $CFLAGS; do
-        if test $f = "-m32"; then
+   for f in $CFLAGS; do
+           if test $f = "-m32"; then
                    target_arch="32-bit"
-        elif test $f = "-m64"; then
+           elif test $f = "-m64"; then
                    target_arch="64-bit"
-        fi
-done
+           fi
+   done
 ]
 AS_ECHO_N("Target architecture: ")
 AS_ECHO($target_arch)
 
 # LTTng-UST enabled/disabled
 AS_ECHO_N("Lttng-UST support: ")
-AS_IF([test "x$lttng_ust_support" = "xyes"],[
+AS_IF([test "x$lttng_ust_support" = "xyes"],
+[
    AS_ECHO("Enabled")
-],[
+],
+[
    AS_ECHO("Disabled")
 ])
 
 #Python binding enabled/disabled
 AS_ECHO_N("Python binding: ")
-AS_IF([test "x${enable_python:-yes}" = xyes], [
+AS_IF([test "x${enable_python:-yes}" = xyes],
+[
    AS_ECHO("Enabled")
-],[
+],
+[
    AS_ECHO("Disabled")
 ])
 
 # Do we build only the consumerd, or everything
-AS_IF([test "x$consumerd_only" = "xyes"],[
+AS_IF([test "x$consumerd_only" = "xyes"],
+[
    AS_ECHO("Only the consumerd daemon will be built.")
-],[
+],
+[
    AS_ECHO("All binaries will be built.")
 ])
 
@@ -497,45 +517,52 @@ AS_ECHO_N("Libraries will be installed in: ")
 AS_ECHO("`eval eval echo $libdir`")
 
Quoted 6 lines

configure.ac AS_ECHO_N("Libraries will be installed in: ") · line 523

Quoted 6 lines
configure.ac +2 -1
 # If we build the sessiond, print the paths it will use
-AS_IF([test "x$consumerd_only" = "xno"],[
+AS_IF([test "x$consumerd_only" = "xno"],
+[
    AS_ECHO()
    AS_ECHO_N("The lttng command will look for the lttng-sessiond

executable at: ")

Quoted 5 lines
Quoted 5 lines
configure.ac +2 -1
-   AS_IF([test "$SESSIOND_BIN" = ""],[
+   AS_IF([test "$SESSIOND_BIN" = ""],
+   [
            AS_ECHO_N("`eval eval echo $bindir`")
            AS_ECHO("/lttng-sessiond")
Quoted 8 lines

configure.ac AS_ECHO_N("Libraries will be installed in: ") · line 533

Quoted 8 lines
configure.ac +2 -2
-   ],[
+   ],
+   [
            AS_ECHO("$SESSIOND_BIN")
    ])
-
    AS_ECHO()
    AS_ECHO("The sessiond daemon will look in the following

directories: ")

Quoted 43 lines
Quoted 43 lines
configure.ac +16 -11
    AS_ECHO_N("32-bit consumerd executable at: ")
-   AS_IF([test "$CONSUMERD32_BIN" = ""],[
+   AS_IF([test "$CONSUMERD32_BIN" = ""],
+   [
            AS_ECHO_N("`eval eval echo $lttnglibexecdir`")
            AS_ECHO("/lttng-consumerd")
-   ],[
+   ],
+   [
            AS_ECHO("$CONSUMERD32_BIN")
    ])
-
    AS_ECHO_N("32-bit consumer libraries in:   ")
-   AS_IF([test "$CONSUMERD32_LIBDIR" = ""],[
+   AS_IF([test "$CONSUMERD32_LIBDIR" = ""],
+   [
            AS_ECHO("`eval eval echo $libdir`")
-   ],[
+   ],
+   [
            AS_ECHO("$CONSUMERD32_LIBDIR")
    ])
-
    AS_ECHO_N("64-bit consumerd executable at: ")
-   AS_IF([test "$CONSUMERD64_BIN" = ""],[
+   AS_IF([test "$CONSUMERD64_BIN" = ""],
+   [
            AS_ECHO_N("`eval eval echo $lttnglibexecdir`")
            AS_ECHO("/lttng-consumerd")
-   ],[
+   ],
+   [
            AS_ECHO("$CONSUMERD64_BIN")
    ])
-
    AS_ECHO_N("64-bit consumer libraries in:   ")
-   AS_IF([test "$CONSUMERD64_LIBDIR" = ""],[
+   AS_IF([test "$CONSUMERD64_LIBDIR" = ""],
+   [
            AS_ECHO("`eval eval echo $libdir`")
-   ],[
+   ],
+   [
Quoted 8 lines

configure.ac AS_ECHO_N("Libraries will be installed in: ") · line 568

Quoted 3 lines
configure.ac +0 -0
            AS_ECHO("$CONSUMERD64_LIBDIR")
    ])
 ])

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

Quoted 5 lines

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

#30 lore raw

Re: [PATCH lttng-tools 01/14] Adding some checks for Android specific libraries to the configure step

In reply to a message not in the archive

Hi Charles,

These patches does not apply on git HEAD master...

Can you rebase and send me back the patches? I also just sent some comments on most of them.

Since master is moving quite a bit these days, once rebased, send the commit id you've been applying these on.

Thanks!
David

Charles Briere:

Quoted 185 lines
---
 configure.ac                        | 34 ++++++++++++++++++++++++++++++----
 src/bin/lttng-consumerd/Makefile.am |  6 +++++-
 src/bin/lttng-relayd/Makefile.am    |  9 ++++++++-
 src/bin/lttng-sessiond/Makefile.am  |  6 +++++-
 tests/unit/Makefile.am              | 18 +++++++++++++-----
 5 files changed, 61 insertions(+), 12 deletions(-)
configure.ac +30 -4
index 4f85fc1..eee025a 100644
@@ -41,6 +41,12 @@ AS_IF([test "x$libtool_fixup" = "xyes"],
 
 AM_CONDITIONAL([NO_SHARED], [test x$enable_shared = xno])
 
+AM_CONDITIONAL([TARGET_HOST_ANDROID], [false])
+case "${host}" in
+    *-*-linux-androideabi) AM_CONDITIONAL([TARGET_HOST_ANDROID], [true])
+    ;;
+esac
+
 AC_CHECK_HEADERS([ \
 	sys/types.h unistd.h fcntl.h string.h pthread.h limits.h \
 	signal.h stdlib.h sys/un.h sys/socket.h stdlib.h stdio.h \
@@ -108,12 +114,24 @@ AC_DEFINE_UNQUOTED([CONFIG_SESSIOND_BIN], "$SESSIOND_BIN", [Location of the sess
 
 # Check for pthread
 AC_CHECK_LIB([pthread], [pthread_create], [],
-	[AC_MSG_ERROR([Cannot find libpthread. Use [LDFLAGS]=-Ldir to specify its location.])]
+[
+    # Check for pthread in a bionic libc...
+	AC_CHECK_LIB([c], [pthread_create], [], 
+	[
+	    AC_MSG_ERROR([Cannot find libpthread. Use [LDFLAGS]=-Ldir to specify its location.])
+	])
+]
 )
 
 # Check libpopt
 AC_CHECK_LIB([popt], [poptGetContext], [],
-	[AC_MSG_ERROR([Cannot find libpopt. Use [LDFLAGS]=-Ldir to specify its location.])]
+[
+	# Check for libpopt in oprofile for Android
+	AC_CHECK_LIB([oprofile_popt], [poptGetContext], [], 
+    [
+        AC_MSG_ERROR([Cannot find libpopt. Use [LDFLAGS]=-Ldir to specify its location.])
+    ])
+]
 )
 
 # Check for libuuid
@@ -130,7 +148,15 @@ AC_CHECK_LIB([uuid], [uuid_generate],
 		have_libc_uuid=yes
 	],
 	[
-		AC_MSG_ERROR([Cannot find libuuid uuid_generate nor libc uuid_create. Use [LDFLAGS]=-Ldir to specify their location.])
+		# uuid_create not found in libc, check for bionic's impl in e2fsprog.
+		AC_CHECK_LIB([ext2_uuid], [uuid_generate],
+		[
+			AC_DEFINE_UNQUOTED([LTTNG_HAVE_LIBEXT2_UUID], 1, [Has libext2_uuid uuid support.])
+			have_libext2_uuid=yes
+		],
+		[
+			AC_MSG_ERROR([Cannot find libuuid uuid_generate, libc uuid_create nor libext2_uuid uuid_generate. Use [LDFLAGS]=-Ldir to specify their location.])
+		])
 	])
 ]
 )
@@ -175,7 +201,7 @@ AS_IF([test "x$lttng_ust_support" = "xyes"], [
 			lttng_ust_ctl_found=yes
 		],
 		[AC_MSG_ERROR([Cannot find LTTng-UST 2.1.x. Use [LDFLAGS]=-Ldir to specify its location, or specify --disable-lttng-ust to build lttng-tools without LTTng-UST support.])],
-		[-lurcu-common -lurcu-bp -lurcu-cds -lrt]
+		[-lurcu-common -lurcu-bp -lurcu-cds -lc -lrt]
 	)
 ])
 AM_CONDITIONAL([HAVE_LIBLTTNG_UST_CTL], [test "x$lttng_ust_ctl_found" = xyes])
src/bin/lttng-consumerd/Makefile.am +5 -1
index a418eb4..c38590e 100644
@@ -4,7 +4,7 @@ lttnglibexec_PROGRAMS = lttng-consumerd
 
 lttng_consumerd_SOURCES = lttng-consumerd.c lttng-consumerd.h
 
-lttng_consumerd_LDADD = -lrt \
+lttng_consumerd_LDADD = \
 	   $(top_builddir)/src/common/libconsumer.la \
 	   $(top_builddir)/src/common/sessiond-comm/libsessiond-comm.la \
 	   $(top_builddir)/src/common/libcommon.la
@@ -12,3 +12,7 @@ lttng_consumerd_LDADD = -lrt \
 if HAVE_LIBLTTNG_UST_CTL
 lttng_consumerd_LDADD += -llttng-ust-ctl
 endif
+
+if !TARGET_HOST_ANDROID
+lttng_consumerd_LDADD += -lrt 
+endif
src/bin/lttng-relayd/Makefile.am +8 -1
index ed82144..cb9076a 100644
@@ -11,10 +11,17 @@ lttng_relayd_SOURCES = main.c lttng-relayd.h utils.h utils.c cmd.h \
                        cmd-2-1.c cmd-2-1.h \
                        cmd-2-2.c cmd-2-2.h
 
+if !TARGET_HOST_ANDROID
+lttng_relayd_LDADD = -lrt
+else
+lttng_relayd_LDADD = 
+endif
+
 # link on liblttngctl for check if relayd is already alive.
-lttng_relayd_LDADD = -lrt -lurcu-common -lurcu \
+lttng_relayd_LDADD += -lurcu-common -lurcu \
 		$(top_builddir)/src/lib/lttng-ctl/liblttng-ctl.la \
 		$(top_builddir)/src/common/sessiond-comm/libsessiond-comm.la \
 		$(top_builddir)/src/common/hashtable/libhashtable.la \
 		$(top_builddir)/src/common/libcommon.la \
 		$(top_builddir)/src/common/compat/libcompat.la
+
src/bin/lttng-sessiond/Makefile.am +5 -1
index 244bc70..63e9555 100644
@@ -37,7 +37,7 @@ endif
 lttng_sessiond_SOURCES += lttng-sessiond.h main.c
 
 # link on liblttngctl for check if sessiond is already alive.
-lttng_sessiond_LDADD = -lrt -lurcu-common -lurcu \
+lttng_sessiond_LDADD = -lurcu-common -lurcu \
 		$(top_builddir)/src/lib/lttng-ctl/liblttng-ctl.la \
 		$(top_builddir)/src/common/sessiond-comm/libsessiond-comm.la \
 		$(top_builddir)/src/common/kernel-ctl/libkernel-ctl.la \
@@ -49,4 +49,8 @@ lttng_sessiond_LDADD = -lrt -lurcu-common -lurcu \
 
 if HAVE_LIBLTTNG_UST_CTL
 lttng_sessiond_LDADD += -llttng-ust-ctl
+endif 
+
+if !TARGET_HOST_ANDROID
+lttng_sessiond_LDADD += -lrt
 endif
tests/unit/Makefile.am +13 -5
index c9e1bfc..3a59a7c 100644
@@ -33,8 +33,7 @@ SESSIONS=$(top_srcdir)/src/bin/lttng-sessiond/session.c	\
 	 $(top_srcdir)/src/common/error.c
 
 test_session_SOURCES = test_session.c $(SESSIONS)
-test_session_LDADD = $(LIBTAP) $(LIBCOMMON) $(LIBSESSIOND_COMM) $(LIBHASHTABLE) \
-					 -lrt
+test_session_LDADD = $(LIBTAP) $(LIBCOMMON) $(LIBSESSIOND_COMM) $(LIBHASHTABLE)
 
 # UST data structures unit test
 if HAVE_LIBLTTNG_UST_CTL
@@ -53,7 +52,11 @@ UST_DATA_TRACE=$(top_srcdir)/src/bin/lttng-sessiond/trace-ust.c \
 
 test_ust_data_SOURCES = test_ust_data.c $(UST_DATA_TRACE)
 test_ust_data_LDADD = $(LIBTAP) $(LIBCOMMON) $(LIBSESSIOND_COMM) $(LIBHASHTABLE) \
-					  -lrt -llttng-ust-ctl
+					  -llttng-ust-ctl
+if !TARGET_HOST_ANDROID
+test_ust_data_LDADD += -lrt
+endif
+
 endif
 
 # Kernel data structures unit test
@@ -64,5 +67,10 @@ KERN_DATA_TRACE=$(top_srcdir)/src/bin/lttng-sessiond/trace-kernel.c	\
 		$(top_srcdir)/src/common/utils.c
 
 test_kernel_data_SOURCES = test_kernel_data.c $(KERN_DATA_TRACE)
-test_kernel_data_LDADD = $(LIBTAP) $(LIBCOMMON) $(LIBSESSIOND_COMM) $(LIBHASHTABLE) \
-						 -lrt
+test_kernel_data_LDADD = $(LIBTAP) $(LIBCOMMON) $(LIBSESSIOND_COMM) $(LIBHASHTABLE)
+
+if !TARGET_HOST_ANDROID
+test_session_LDADD += -lrt
+test_kernel_data_LDADD += -lrt
+endif
+