configure: automatically define backend-specific constants
[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
8 # Init XO
9 PLATFORM_INIT
10
11 # Checks for programs.
12 dnl AC_PROG_CXX
13 AC_PROG_CC
14 AC_PROG_GCC_TRADITIONAL
15 AC_PROG_LIBTOOL
16
17 # backend: journald
18 AC_ARG_ENABLE(journal, AS_HELP_STRING([--enable-journal], [enable systemd journal]),
19     [with_systemd_journal=yes],
20     with_systemd_journal=no)
21 if test "x$with_systemd_journal" != "xno"; then
22         PKG_CHECK_MODULES(systemd_journal, [libsystemd-journal],
23                 [AC_DEFINE(DLOG_BACKEND_JOURNAL, 1, [Define if systemd journal is selected])
24                 have_systemd_journal=yes],
25                 have_systemd_journal=no)
26         if test "x$have_systemd_journal" = "xno" -a "x$with_systemd_journal" = "xyes"; then
27                 AC_MSG_ERROR([systemd journal requested but libraries not found])
28         fi
29 fi
30 AM_CONDITIONAL(WITH_SYSTEMD_JOURNAL, [test "x$have_systemd_journal" = "xyes"])
31
32 # backend: pipe
33 AC_ARG_ENABLE(pipe, AS_HELP_STRING([--enable-pipe], [enable pipe (log to pipe fd received via unix socket)]),
34         [with_pipe=yes],
35         with_pipe=no)
36 if test "x$with_pipe" = "xyes"; then
37         AC_DEFINE(DLOG_BACKEND_PIPE, 1, [Define if pipe backend is selected])
38 fi
39 AM_CONDITIONAL(WITH_PIPE, [test "x$with_pipe" = "xyes"])
40
41 # backend: kmsg (requires kernel patch)
42 AC_ARG_ENABLE(kmsg, AS_HELP_STRING([--enable-kmsg], [enable kmsg (requires kmsg extension patch)]),
43         [with_kmsg=yes],
44         with_kmsg=no)
45 if test "x$with_kmsg" = "xyes"; then
46         AC_DEFINE(DLOG_BACKEND_KMSG, 1, [Define if kmsg backend is selected])
47 fi
48 AM_CONDITIONAL(WITH_KMSG, [test "x$with_kmsg" = "xyes"])
49
50 # backend: android logger (requires kernel's CONFIG_ANDROID_LOGGER)
51 AC_ARG_ENABLE(android_logger, AS_HELP_STRING([--enable-android-logger], [enable android logger (kernels CONFIG_ANDROID_LOGGER)]),
52         [with_android_logger=yes],
53         with_android_logger=no)
54 if test "x$with_android_logger" = "xyes"; then
55         AC_DEFINE(DLOG_BACKEND_LOGGER, 1, [Define if (legacy) android logger backend is selected])
56 fi
57 AM_CONDITIONAL(WITH_ANDROID_LOGGER, [test "x$with_android_logger" = "xyes"])
58
59 # check binary type for dlog debug mode
60 AC_ARG_ENABLE([debug_mode],
61         AS_HELP_STRING([--enable-debug_mode Turn on debug_mode]),
62                 [debug_mode=yes],
63                 debug_mode=no)
64 if test "x$debug_mode" = "xyes" ; then
65         DEBUG_CFLAGS+=" -DDLOG_DEBUG_ENABLE"
66 fi
67 AC_ARG_ENABLE([debug_enable],
68         AS_HELP_STRING([--enable-debug_enable Turn on debug_enable]),
69                 [debug_enable=yes],
70             debug_enable=no)
71 # check for fatal_on
72 AC_ARG_ENABLE([fatal_on],
73         AS_HELP_STRING([--enable-fatal_on Turn on fatal assertion]),
74                 [fatal_on=yes],
75             fatal_on=no)
76 if test "x$fatal_on" = "xyes" ; then
77         DEBUG_CFLAGS+=" -DFATAL_ON"
78 fi
79 AC_SUBST(DEBUG_CFLAGS)
80 # Checks for libraries.
81 # Checks for header files.
82 AC_HEADER_STDC
83 AC_CHECK_HEADERS([stdlib.h unistd.h ])
84
85 # Checks for typedefs, structures, and compiler characteristics.
86 AC_HEADER_STDBOOL
87 AC_C_CONST
88 AC_C_INLINE
89 AC_STRUCT_TM
90 AC_TYPE_PID_T
91 AC_TYPE_SIZE_T
92 AC_TYPE_SSIZE_T
93
94 # Checks for library functions.
95 AC_FUNC_MALLOC
96 AC_FUNC_STAT
97 AC_CHECK_FUNCS([memset])
98
99 PKG_PROG_PKG_CONFIG
100 PKG_CHECK_MODULES([CAPI_BASE_COMMON], [capi-base-common])
101
102 AC_SUBST(TZ_SYS_ETC)
103
104 # output files
105 AC_CONFIG_FILES([Makefile dlog.pc])
106 AC_OUTPUT