configure: regroup library checks
authorMichael Jeanson <mjeanson@efficios.com>
Mon, 22 Mar 2021 17:12:42 +0000 (13:12 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 23 Mar 2021 15:15:45 +0000 (11:15 -0400)
This is part of an effort to standardise our autotools setup across
project to simplify maintenance.

Change-Id: Ieec98a3ab09c2088408b0f0bbd9bc3b605077982
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
configure.ac

index 998981ac1ec90bed41f74f189027761428baa0be..54c8779116108aac0448e218c456cf079d5b0c51 100644 (file)
@@ -166,52 +166,79 @@ AX_PROG_JAR
 LT_INIT([disable-static])
 
 
-AM_CONDITIONAL([HAVE_CMAKE], [test "x$CMAKE" != "x"])
-
-AC_MSG_CHECKING([whether shared libraries are enabled])
-AS_IF([test "x$enable_shared" = "xyes"], [
-       AC_MSG_RESULT([yes])
-], [
-       AC_MSG_RESULT([no])
-       AC_MSG_ERROR([LTTng-UST requires shared libraries to be enabled])
-])
+##                ##
+## Library checks ##
+##                ##
 
-# Checks for library functions.
 AC_FUNC_CHOWN
 AC_FUNC_FORK
 AC_FUNC_MMAP
-AC_FUNC_REALLOC
 AC_FUNC_STRERROR_R
 AC_FUNC_STRNLEN
 AC_CHECK_FUNCS([ \
-       atexit \
-       clock_gettime \
-       ftruncate \
-       getpagesize \
-       gettimeofday \
-       localeconv \
-       memchr \
-       memmove \
-       memset \
-       mkdir \
-       munmap \
-       realpath \
-       sched_getcpu \
-       socket \
-       strchr \
-       strdup \
-       strerror \
-       strtol \
-       strtoul \
-       sysconf \
+  atexit \
+  clock_gettime \
+  ftruncate \
+  getpagesize \
+  gettimeofday \
+  localeconv \
+  memchr \
+  memmove \
+  memset \
+  mkdir \
+  munmap \
+  realpath \
+  sched_getcpu \
+  socket \
+  strchr \
+  strdup \
+  strerror \
+  strtol \
+  strtoul \
+  sysconf \
 ])
 
+# AC_FUNC_MALLOC causes problems when cross-compiling.
+#AC_FUNC_MALLOC
+#AC_FUNC_REALLOC
+
 # Check for pthread_setname_np and its signature
 LTTNG_PTHREAD_SETNAME_NP
 LTTNG_PTHREAD_GETNAME_NP
 
-# AC_FUNC_MALLOC causes problems when cross-compiling.
-#AC_FUNC_MALLOC
+# Check dor dlopen() in -ldl or -lc
+AC_CHECK_LIB([dl], [dlopen], [
+  libdl_name=dl
+  DL_LIBS="-ldl"
+], [
+  # dlopen not found in libdl, check in libc
+  AC_CHECK_LIB([c], [dlopen], [
+    libdl_name=c
+    DL_LIBS="-lc"
+  ], [
+    AC_MSG_ERROR([Cannot find dlopen in libdl nor libc. Use [LDFLAGS]=-Ldir to specify their location.])
+  ])
+])
+AC_SUBST(DL_LIBS)
+
+# Check if libdl has dlmopen()
+AC_CHECK_LIB([$libdl_name], [dlmopen], [
+  AC_DEFINE([HAVE_DLMOPEN], [1], [Define to 1 if dlmopen is available.])
+])
+
+# Require URCU >= 0.12 for DEFINE_URCU_TLS_INIT
+PKG_CHECK_MODULES([URCU], [liburcu >= 0.12])
+
+
+AM_CONDITIONAL([HAVE_CMAKE], [test "x$CMAKE" != "x"])
+
+AC_MSG_CHECKING([whether shared libraries are enabled])
+AS_IF([test "x$enable_shared" = "xyes"], [
+       AC_MSG_RESULT([yes])
+], [
+       AC_MSG_RESULT([no])
+       AC_MSG_ERROR([LTTng-UST requires shared libraries to be enabled])
+])
 
 # Set architecture specific options
 AS_CASE([$host_cpu],
@@ -243,32 +270,9 @@ AS_CASE([$host_os],
 # Configuration options, which will be installed in the config.h
 AH_TEMPLATE([LTTNG_UST_HAVE_SDT_INTEGRATION], [SystemTap integration via sdt.h])
 
-# Checks for libraries.
-AC_CHECK_LIB([dl], [dlopen], [
-       libdl_name=dl
-       DL_LIBS="-ldl"
-], [
-       #libdl not found, check for dlopen in libc.
-       AC_CHECK_LIB([c], [dlopen], [
-               libdl_name=c
-               DL_LIBS="-lc"
-       ], [
-               AC_MSG_ERROR([Cannot find dlopen in libdl nor libc. Use [LDFLAGS]=-Ldir to specify their location.])
-       ])
-])
-AC_SUBST(DL_LIBS)
-
-# Check if libdl has dlmopen support.
-AH_TEMPLATE([HAVE_DLMOPEN], ["Define to 1 if dlmopen is available."])
-AC_CHECK_LIB([$libdl_name], [dlmopen],
-       [AC_DEFINE([HAVE_DLMOPEN], [1])]
-)
 
 AM_CONDITIONAL([ENABLE_UST_DL], [test "x${ac_cv_have_decl_RTLD_DI_LINKMAP}" = "xyes"])
 
-# Require URCU >= 0.12 for DEFINE_URCU_TLS_INIT
-PKG_CHECK_MODULES([URCU], [liburcu >= 0.12])
-
 # numa.h integration
 AS_IF([test "x$NO_NUMA" = "x1"],[
       AS_IF([test "x$enable_numa" = "x" ], [enable_numa=no])
This page took 0.027296 seconds and 4 git commands to generate.