Refactor configuration files.
[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(kmsg, AS_HELP_STRING([--enable-kmsg], [enable kmsg]),
25     [with_kmsg=yes],
26     with_kmsg=no)
27
28 AC_ARG_ENABLE(android_logger, AS_HELP_STRING([--enable-android-logger], [enable android logger]),
29     [with_android_logger=yes],
30     with_android_logger=no)
31
32 if test "x$with_systemd_journal" != "xno"; then
33         PKG_CHECK_MODULES(systemd_journal, [libsystemd-journal],
34                 [AC_DEFINE(HAVE_SYSTEMD_JOURNAL, 1, [Define if systemd journal is available])
35                 have_systemd_journal=yes],
36             have_systemd_journal=no)
37         if test "x$have_systemd_journal" = "xno" -a "x$with_systemd_journal" = "xyes"; then
38                 AC_MSG_ERROR([systemd journal requested but libraries not found])
39         fi
40 fi
41 AM_CONDITIONAL(HAVE_SYSTEMD_JOURNAL, [test "x$have_systemd_journal" = "xyes"])
42 AM_CONDITIONAL(WITH_SYSTEMD_JOURNAL, [test "x$with_systemd_journal" = "xyes"])
43 AM_CONDITIONAL(WITH_ANDROID_LOGGER, [test "x$with_android_logger" = "xyes"])
44 AM_CONDITIONAL(WITH_KMSG, [test "x$with_kmsg" = "xyes"])
45
46 if test "x$have_systemd_journal" = "xyes" ; then
47         systemd_journal=systemd-journal
48 fi
49 AC_SUBST(systemd_journal)
50
51 # check binary type for dlog debug mode
52 AC_ARG_ENABLE([debug_mode],
53         AS_HELP_STRING([--enable-debug_mode Turn on debug_mode]),
54                 [debug_mode=yes],
55                 debug_mode=no)
56 if test "x$debug_mode" = "xyes" ; then
57         DEBUG_CFLAGS+=" -DDLOG_DEBUG_ENABLE"
58 fi
59 AC_ARG_ENABLE([debug_enable],
60         AS_HELP_STRING([--enable-debug_enable Turn on debug_enable]),
61                 [debug_enable=yes],
62             debug_enable=no)
63 # check for fatal_on
64 AC_ARG_ENABLE([fatal_on],
65         AS_HELP_STRING([--enable-fatal_on Turn on fatal assertion]),
66                 [fatal_on=yes],
67             fatal_on=no)
68 if test "x$fatal_on" = "xyes" ; then
69         DEBUG_CFLAGS+=" -DFATAL_ON"
70 fi
71 AC_SUBST(DEBUG_CFLAGS)
72 # Checks for libraries.
73 # Checks for header files.
74 AC_HEADER_STDC
75 AC_CHECK_HEADERS([stdlib.h unistd.h ])
76
77 # Checks for typedefs, structures, and compiler characteristics.
78 AC_HEADER_STDBOOL
79 AC_C_CONST
80 AC_C_INLINE
81 AC_STRUCT_TM
82 AC_TYPE_PID_T
83 AC_TYPE_SIZE_T
84 AC_TYPE_SSIZE_T
85
86 # Checks for library functions.
87 AC_FUNC_MALLOC
88 AC_FUNC_STAT
89 AC_CHECK_FUNCS([memset])
90
91 PKG_PROG_PKG_CONFIG
92 PKG_CHECK_MODULES([CAPI_BASE_COMMON], [capi-base-common])
93
94 AC_SUBST(TZ_SYS_ETC)
95
96 # output files
97 AC_CONFIG_FILES([Makefile dlog.pc]
98                                 )
99 AC_OUTPUT