Add a pipe-based userspace logging backend.
[platform/core/system/dlog.git] / configure.ac
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ(2.61)
5 AC_INIT([dlog], [1.0], yk.yun@samsung.com)
6 AM_INIT_AUTOMAKE([-Wall -Werror foreign])
7 AC_CONFIG_HEADERS([config.h:config.hin])
8
9 # Init XO
10 PLATFORM_INIT
11
12 # Checks for programs.
13 dnl AC_PROG_CXX
14 AC_PROG_CC
15 AC_PROG_GCC_TRADITIONAL
16 AC_PROG_LIBTOOL
17
18 # check for libsystemd-journal
19 AC_ARG_ENABLE(journal, AS_HELP_STRING([--enable-journal], [enable systemd journal]),
20     [with_systemd_journal=yes],
21     with_systemd_journal=no)
22
23 #check for backends
24 AC_ARG_ENABLE(pipe, AS_HELP_STRING([--enable-pipe], [enable pipe]),
25     [with_pipe=yes],
26     with_pipe=no)
27
28 AC_ARG_ENABLE(kmsg, AS_HELP_STRING([--enable-kmsg], [enable kmsg]),
29     [with_kmsg=yes],
30     with_kmsg=no)
31
32 AC_ARG_ENABLE(android_logger, AS_HELP_STRING([--enable-android-logger], [enable android logger]),
33     [with_android_logger=yes],
34     with_android_logger=no)
35
36 if test "x$with_systemd_journal" != "xno"; then
37         PKG_CHECK_MODULES(systemd_journal, [libsystemd-journal],
38                 [AC_DEFINE(HAVE_SYSTEMD_JOURNAL, 1, [Define if systemd journal is available])
39                 have_systemd_journal=yes],
40             have_systemd_journal=no)
41         if test "x$have_systemd_journal" = "xno" -a "x$with_systemd_journal" = "xyes"; then
42                 AC_MSG_ERROR([systemd journal requested but libraries not found])
43         fi
44 fi
45 AM_CONDITIONAL(HAVE_SYSTEMD_JOURNAL, [test "x$have_systemd_journal" = "xyes"])
46 AM_CONDITIONAL(WITH_SYSTEMD_JOURNAL, [test "x$with_systemd_journal" = "xyes"])
47 AM_CONDITIONAL(WITH_PIPE, [test "x$with_pipe" = "xyes"])
48 AM_CONDITIONAL(WITH_ANDROID_LOGGER, [test "x$with_android_logger" = "xyes"])
49 AM_CONDITIONAL(WITH_KMSG, [test "x$with_kmsg" = "xyes"])
50
51 if test "x$have_systemd_journal" = "xyes" ; then
52         systemd_journal=systemd-journal
53 fi
54 AC_SUBST(systemd_journal)
55
56 # check binary type for dlog debug mode
57 AC_ARG_ENABLE([debug_mode],
58         AS_HELP_STRING([--enable-debug_mode Turn on debug_mode]),
59                 [debug_mode=yes],
60                 debug_mode=no)
61 if test "x$debug_mode" = "xyes" ; then
62         DEBUG_CFLAGS+=" -DDLOG_DEBUG_ENABLE"
63 fi
64 AC_ARG_ENABLE([debug_enable],
65         AS_HELP_STRING([--enable-debug_enable Turn on debug_enable]),
66                 [debug_enable=yes],
67             debug_enable=no)
68 # check for fatal_on
69 AC_ARG_ENABLE([fatal_on],
70         AS_HELP_STRING([--enable-fatal_on Turn on fatal assertion]),
71                 [fatal_on=yes],
72             fatal_on=no)
73 if test "x$fatal_on" = "xyes" ; then
74         DEBUG_CFLAGS+=" -DFATAL_ON"
75 fi
76 AC_SUBST(DEBUG_CFLAGS)
77 # Checks for libraries.
78 # Checks for header files.
79 AC_HEADER_STDC
80 AC_CHECK_HEADERS([stdlib.h unistd.h ])
81
82 # Checks for typedefs, structures, and compiler characteristics.
83 AC_HEADER_STDBOOL
84 AC_C_CONST
85 AC_C_INLINE
86 AC_STRUCT_TM
87 AC_TYPE_PID_T
88 AC_TYPE_SIZE_T
89 AC_TYPE_SSIZE_T
90
91 # Checks for library functions.
92 AC_FUNC_MALLOC
93 AC_FUNC_STAT
94 AC_CHECK_FUNCS([memset])
95
96 PKG_PROG_PKG_CONFIG
97 PKG_CHECK_MODULES([CAPI_BASE_COMMON], [capi-base-common])
98
99 AC_SUBST(TZ_SYS_ETC)
100
101 # output files
102 AC_CONFIG_FILES([Makefile dlog.pc]
103                                 )
104 AC_OUTPUT