Fix: lib: pass down API function name to some helpers
[babeltrace.git] / configure.ac
index 6634c4c496de155f2518930b8920c2250879180c..f9f3fab71632018a2e7138fec64a63283edfe148 100644 (file)
@@ -4,29 +4,30 @@ dnl Copyright (C) 2017 EfficiOS, Inc.
 dnl
 dnl Process this file with autoconf to produce a configure script.
 
-##                     ##
-## Autoconf base setup ##
-##                     ##
-
-AC_PREREQ([2.69])
-
+# Project version information
 m4_define([bt_version_major], [2])
 m4_define([bt_version_minor], [1])
 m4_define([bt_version_patch], [0])
 m4_define([bt_version_dev_stage], [-rc1])
 m4_define([bt_version], bt_version_major[.]bt_version_minor[.]bt_version_patch[]bt_version_dev_stage)
-m4_define([bt_version_name], [])
-
-AC_INIT([babeltrace2],[bt_version],[jeremie dot galarneau at efficios dot com],[],[https://efficios.com/babeltrace/])
+m4_define([bt_version_name], [[Codename TBD]])
+m4_define([bt_version_description], [[Description TBD]])
 
+# Library version information of "libbabeltrace2"
 # Following the numbering scheme proposed by libtool for the library version
 # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
 m4_define([bt_lib_version_current], [0])
 m4_define([bt_lib_version_revision], [0])
 m4_define([bt_lib_version_age], [0])
 m4_define([bt_lib_version], bt_lib_version_current[:]bt_lib_version_revision[:]bt_lib_version_age)
-m4_define([bt_version_description], [])
-m4_define([bt_version_description_c_safe], AS_ESCAPE(bt_version_description))
+
+
+##                     ##
+## Autoconf base setup ##
+##                     ##
+
+AC_PREREQ([2.69])
+AC_INIT([babeltrace2],[bt_version],[jeremie dot galarneau at efficios dot com],[],[https://efficios.com/babeltrace/])
 
 AC_SUBST([BABELTRACE_LIBRARY_VERSION], bt_lib_version)
 
@@ -39,7 +40,7 @@ AC_DEFINE([BT_VERSION_MINOR], bt_version_minor, [Babeltrace minor version])
 AC_DEFINE([BT_VERSION_PATCH], bt_version_patch, [Babeltrace patch version])
 AC_DEFINE([BT_VERSION_DEV_STAGE], ["]bt_version_dev_stage["], [Babeltrace version development stage (can be empty)])
 AC_DEFINE([BT_VERSION_NAME], ["]bt_version_name["], [Babeltrace version name])
-AC_DEFINE([BT_VERSION_DESCRIPTION], ["]bt_version_description_c_safe["], [Babeltrace version description])
+AC_DEFINE([BT_VERSION_DESCRIPTION], ["]AS_ESCAPE(bt_version_description)["], [Babeltrace version description])
 
 AC_CANONICAL_TARGET
 AC_CANONICAL_HOST
@@ -199,19 +200,16 @@ AC_PROG_MAKE_SET
 AC_PROG_MKDIR_P
 AC_PROG_LN_S
 AC_PROG_SED
-AC_PATH_PROG([report_fold], [fold])
-
-# set $IN_GIT_REPO if we're in the Git repository; the `bootstrap` file
-# is not distributed in tarballs
-AS_IF([test -f "$srcdir/bootstrap"], [in_git_repo=yes], [in_git_repo=no])
-AM_CONDITIONAL([IN_GIT_REPO], [test "x$in_git_repo" = "xyes"])
+AC_CHECK_PROGS([FOLD], [fold])
+AC_CHECK_PROGS([ASCIIDOC], [asciidoc])
+AC_CHECK_PROGS([XMLTO], [xmlto])
 
 # check for bison
 AC_PROG_YACC
 AX_PROG_BISON_VERSION([2.5], [have_bison=yes])
 
 AS_IF([test "x$have_bison" != "xyes"], [
-  AS_IF([test "x$in_git_repo" = "xyes"], [
+  AE_IF_IN_GIT_REPO([
     AC_MSG_FAILURE([dnl
 Bison >= 2.4 is required when building from the Git repository. You can
 set the YACC variable to override automatic detection.
@@ -234,7 +232,7 @@ AC_PROG_LEX([noyywrap])
 AX_PROG_FLEX_VERSION([2.5.35], [have_flex=yes])
 
 AS_IF([test "x$have_flex" != "xyes"], [
-  AS_IF([test "x$in_git_repo" = "xyes"], [
+  AE_IF_IN_GIT_REPO([
     AC_MSG_FAILURE([dnl
 Flex >= 2.5.35 is required when building from the Git repository. You can
 set the LEX variable to override automatic detection.
@@ -250,6 +248,43 @@ detection.
 ])
 AM_CONDITIONAL([HAVE_FLEX], [test "x$have_flex" = "xyes"])
 
+# Always check for python, we will fail later if some features require it and
+# it's unavailable.
+AM_PATH_PYTHON([3.0], [
+  AE_PATH_PYTHON_MODULES([PYTHON])
+
+  # pythondir is the path where extra modules are to be installed
+  pythondir=$PYTHON_PREFIX/$PYTHON_MODULES_PATH
+
+  # pyexecdir is the path that contains shared objects used by the extra modules
+  pyexecdir=$PYTHON_EXEC_PREFIX/$PYTHON_MODULES_PATH
+
+  # If no PYTHON_CONFIG was specified by the user, try to find it, starting
+  # with the one specific to the configured python version.
+  AS_IF([test "x$PYTHON_CONFIG" = "x"], [
+    AC_CHECK_PROGS([PYTHON_CONFIG], [python$PYTHON_VERSION-config python-config])
+  ])
+
+  # If PYTHON_CONFIG is set use it to get the includes and ld flags, unless
+  # they were specified by the user.
+  AS_IF([test "x$PYTHON_CONFIG" != "x" ], [
+    AS_IF([test "x$PYTHON_INCLUDE" = "x"], [
+      AC_MSG_CHECKING([Python include flags])
+      PYTHON_INCLUDE=`$PYTHON_CONFIG --includes`
+      AC_MSG_RESULT([$PYTHON_INCLUDE])
+    ])
+
+    AS_IF([test "x$PYTHON_LDFLAGS" = "x"], [
+      AC_MSG_CHECKING([Python library flags])
+      # Python 3.8+ requires that we pass --embed to get the -lpython3.x flag.
+      AS_IF([! PYTHON_LDFLAGS=`$PYTHON_CONFIG --ldflags --embed`], [
+        PYTHON_LDFLAGS=`$PYTHON_CONFIG --ldflags`
+      ])
+      AC_MSG_RESULT([$PYTHON_LDFLAGS])
+    ])
+  ])
+], [:])
+
 # Initialize and configure libtool
 LT_INIT([win32-dll])
 
@@ -493,42 +528,6 @@ AE_IF_FEATURE_ENABLED([python-bindings],
   [AX_PKG_SWIG(2.0.0, [], [AC_MSG_ERROR([SWIG 2.0.0 or newer is required to build the python bindings])])]
 )
 
-# Always check for python, we will fail later if some features require it and
-# it's unavailable.
-AM_PATH_PYTHON([3.0], [
-  AE_PATH_PYTHON_MODULES([PYTHON])
-
-  # pythondir is the path where extra modules are to be installed
-  pythondir=$PYTHON_PREFIX/$PYTHON_MODULES_PATH
-
-  # pyexecdir is the path that contains shared objects used by the extra modules
-  pyexecdir=$PYTHON_EXEC_PREFIX/$PYTHON_MODULES_PATH
-
-  AS_IF([test -z "$PYTHON_CONFIG"], [
-    AC_PATH_PROGS([PYTHON_CONFIG],
-                  [python$PYTHON_VERSION-config python-config],
-                  [],
-                  [`dirname $PYTHON`])
-  ])
-
-  AS_IF([test -n "$PYTHON_CONFIG"], [
-    AS_IF([test -z "$PYTHON_INCLUDE"], [
-      AC_MSG_CHECKING([Python include flags])
-      PYTHON_INCLUDE=`$PYTHON_CONFIG --includes`
-      AC_MSG_RESULT([$PYTHON_INCLUDE])
-    ])
-
-    AS_IF([test -z "$PYTHON_LDFLAGS"], [
-      AC_MSG_CHECKING([Python library flags])
-      # Python 3.8+ requires that we pass --embed to get the -lpython3.x flag.
-      AS_IF([! PYTHON_LDFLAGS=`$PYTHON_CONFIG --ldflags --embed`], [
-        PYTHON_LDFLAGS=`$PYTHON_CONFIG --ldflags`
-      ])
-      AC_MSG_RESULT([$PYTHON_LDFLAGS])
-    ])
-  ])
-], [:])
-
 AS_IF([test "$PYTHON" != :], [have_python=yes], [have_python=no])
 AS_IF([test -n "$PYTHON_CONFIG"], [have_python_dev=yes], [have_python_dev=no])
 
@@ -565,8 +564,8 @@ AE_IF_FEATURE_ENABLED([debug-info], [
 
       # Turns out SLES12 doesn't bother shipping .pc file for libelf
       AC_MSG_WARN([Finding libelf without pkg-config.])
-      AC_CHECK_LIB([elf], [elf_version], [], [AC_MSG_ERROR(Missing libelf (from elfutils >= 0.154) which is required by debug info. You can disable this feature using --disable-debug-info.)])
-      AC_CHECK_LIB([dw], [dwarf_begin], [], [AC_MSG_ERROR(Missing libdw (from elfutils >= 0.154) which is required by debug info. You can disable this feature using --disable-debug-info.)])
+      AC_CHECK_LIB([elf], [elf_version], [:], [AC_MSG_ERROR(Missing libelf (from elfutils >= 0.154) which is required by debug info. You can disable this feature using --disable-debug-info.)])
+      AC_CHECK_LIB([dw], [dwarf_begin], [:], [AC_MSG_ERROR(Missing libdw (from elfutils >= 0.154) which is required by debug info. You can disable this feature using --disable-debug-info.)])
       AE_LIB_ELFUTILS([0], [154], [], [AC_MSG_ERROR(elfutils >= 0.154 is required to use the debug info feature. You can disable this feature using --disable-debug-info.)])
       ELFUTILS_LIBS="-lelf -ldw"
     ])
@@ -595,12 +594,9 @@ AE_IF_FEATURE_ENABLED([api-doc],
 have_asciidoc_xmlto=no
 warn_prebuilt_man_pages=no
 
-AC_PATH_PROG([ASCIIDOC], [asciidoc], [no])
-AC_PATH_PROG([XMLTO], [xmlto], [no])
-
 AE_IF_FEATURE_ENABLED([man-pages], [
-  AS_IF([test "x$ASCIIDOC" = "xno" || test "x$XMLTO" = "xno"], [
-    AS_IF([test "x$in_git_repo" = "xyes"], [
+  AS_IF([test "x$ASCIIDOC" = "x" || test "x$XMLTO" = "x"], [
+    AE_IF_IN_GIT_REPO([
       # this is an error because we're in the Git repo, which
       # means the man pages are not already generated for us,
       # thus asciixmlto are required because we were asked
@@ -797,6 +793,7 @@ AC_CONFIG_FILES([
   src/bindings/python/Makefile
   src/cli/Makefile
   src/common/Makefile
+  src/cpp-common/Makefile
   src/compat/Makefile
   src/ctfser/Makefile
   src/ctf-writer/Makefile
@@ -880,8 +877,8 @@ AS_IF([test -n "bt_version_name"], [
 AS_ECHO
 
 AS_IF([test -n "bt_version_description"], [
-  AS_IF([test -n "$report_fold"], [
-    AS_ECHO("`AS_ECHO("bt_version_description") | $report_fold -s`")
+  AS_IF([test -n "$FOLD"], [
+    AS_ECHO("`AS_ECHO("bt_version_description") | $FOLD -s`")
   ], [
     AS_ECHO("bt_version_description")
   ])
@@ -949,8 +946,8 @@ PPRINT_SUBTITLE([Documentation])
 # man pages build enabled/disabled
 m4_pushdef([build_man_pages_msg], [Build and install man pages])
 
-AS_IF([test "x$enable_man_pages" != "xno"], [
-  AS_IF([test "x$in_git_repo" = "xyes"], [
+AE_IF_FEATURE_ENABLED([man-pages], [
+  AE_IF_IN_GIT_REPO([
     PPRINT_PROP_BOOL([build_man_pages_msg], 1)
   ], [
     AS_IF([test "x$have_asciidoc_xmlto" = "xyes"], [
This page took 0.025661 seconds and 4 git commands to generate.