clean up the Makefile and buggy code 13/47513/1 tizen_3.0.m1_mobile tizen_3.0.m1_tv accepted/tizen/mobile/20150914.120215 accepted/tizen/tv/20150914.120227 accepted/tizen/wearable/20150914.120249 submit/tizen/20150914.113313 submit/tizen_common/20151015.190624 submit/tizen_common/20151019.135620 submit/tizen_common/20151023.083358 submit/tizen_common/20151026.085049 tizen_3.0.m1_mobile_release tizen_3.0.m1_tv_release tizen_3.0.m2.a1_mobile_release tizen_3.0.m2.a1_tv_release
authorSangjung Woo <sangjung.woo@samsung.com>
Fri, 4 Sep 2015 04:51:07 +0000 (13:51 +0900)
committerSangjung Woo <sangjung.woo@samsung.com>
Fri, 4 Sep 2015 05:43:28 +0000 (14:43 +0900)
* remove 'HAVE_SYSTEMD_JOURNAL' macro that is defined in the code.
* remove unnecessary files such as dlog_logger and its unit files when
systemd-journal is used as log backend.

Change-Id: Idfc9ae4696675a36f5de29b432accf2abb0e8269
Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
Makefile.am
configure.ac
packaging/dlog.spec
src/logutil/logutil.c

index 0223827..2af8430 100755 (executable)
@@ -24,7 +24,7 @@ libdlog_la_LIBADD = -lpthread \
        $(systemd_journal_LIBS) \
        $(CAPI_BASE_COMMON_LIBS)
 
-bin_PROGRAMS = dlogutil dlog_logger
+bin_PROGRAMS = dlogutil
 
 dlogutil_CFLAGS =  \
        $(AM_CFLAGS) \
@@ -41,6 +41,9 @@ dlogutil_SOURCES = \
        include/logger.h \
        include/logprint.h
 
+if !HAVE_SYSTEMD_JOURNAL
+bin_PROGRAMS += dlog_logger
+
 dlog_logger_CFLAGS =  \
        $(AM_CFLAGS) \
        -fPIE
@@ -54,6 +57,7 @@ dlog_logger_SOURCES = \
        src/logger/logger.c \
        include/logger.h \
        include/logprint.h
+endif
 
 include/%: include/%.m4
        m4 -P $(M4_DEFINES) < $< > $@
index d5c2539..4aef358 100755 (executable)
@@ -21,10 +21,9 @@ AC_SUBST(M4_DEFINES)
 M4_DEFINES=
 
 # check for libsystemd-journal
-AC_ARG_WITH([systemd-journal],
-       AS_HELP_STRING([--with-systemd-journal], [check for systemd-journal]),
-       [], [with_systemd_journal=check])
-have_systemd_journal=no
+AC_ARG_ENABLE(journal, AS_HELP_STRING([--enable-journal], [enable systemd journal]),
+    [with_systemd_journal=yes],
+    with_systemd_journal=no)
 if test "x$with_systemd_journal" != "xno"; then
        PKG_CHECK_MODULES(systemd_journal, [libsystemd-journal],
                [AC_DEFINE(HAVE_SYSTEMD_JOURNAL, 1, [Define if systemd journal is available])
index 7be4bc4..5e1e7eb 100755 (executable)
@@ -13,6 +13,9 @@ Source203:  packaging/dlog_logger.conf-micro.in
 Source204:  packaging/dlog_logger.conf-debug.in
 Source301:  packaging/dlog_logger.service
 Source302:  packaging/dlog_logger.path
+
+%define systemd_journal ON
+
 BuildRequires: autoconf
 BuildRequires: automake
 BuildRequires: libtool
@@ -59,8 +62,10 @@ cp %{SOURCE102} .
 %autogen --disable-static
 %configure --disable-static \
                        --enable-fatal_on \
-                       --enable-engineer_mode \
-                       --with-systemd-journal
+%if %{?systemd_journal} == ON
+                       --enable-journal \
+%endif
+                       --enable-engineer_mode
 make %{?jobs:-j%jobs}
 
 %install
@@ -69,28 +74,31 @@ rm -rf %{buildroot}
 mkdir -p %{buildroot}/usr/bin/
 cp %{_builddir}/%{name}-%{version}/scripts/dlogctrl %{buildroot}/usr/bin/dlogctrl
 
+mkdir -p %{buildroot}/opt/etc
+cp %SOURCE201 %{buildroot}/opt/etc/dlog.conf
+
+%if %{?systemd_journal} == OFF
 mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants/
 install -m 0644 %SOURCE301 %{buildroot}%{_unitdir}
 install -m 0644 %SOURCE302 %{buildroot}%{_unitdir}
-
 ln -s ../dlog_logger.path %{buildroot}%{_unitdir}/multi-user.target.wants/dlog_logger.path
 
+# default set log output to external files
+cp %SOURCE202 %{buildroot}/opt/etc/dlog_logger.conf
+%endif
+
 mkdir -p %{buildroot}/usr/share/license
 cp LICENSE.Apache-2.0 %{buildroot}/usr/share/license/%{name}
 cp LICENSE.Apache-2.0 %{buildroot}/usr/share/license/libdlog
 cp LICENSE.Apache-2.0 %{buildroot}/usr/share/license/dlogutil
 
-mkdir -p %{buildroot}/opt/etc
-cp %SOURCE201 %{buildroot}/opt/etc/dlog.conf
-
-# default set log output to external files
-cp %SOURCE202 %{buildroot}/opt/etc/dlog_logger.conf
-
 mkdir -p %{buildroot}/var/log/dlog
 
+%if %{?systemd_journal} == ON
 # Workaround: replace with dlogutil script due to scheduling issue
 rm %{buildroot}/usr/bin/dlogutil
 cp %{_builddir}/%{name}-%{version}/scripts/dlogutil.sh %{buildroot}/usr/bin/dlogutil
+%endif
 
 mkdir -p %{buildroot}%{_udevrulesdir}
 cp 01-dlog.rules %{buildroot}%{_udevrulesdir}/01-dlog.rules
@@ -115,15 +123,18 @@ systemctl daemon-reload
 %files  -n dlogutil
 %manifest dlogutil.manifest
 /usr/share/license/dlogutil
-%attr(750,log,log) %{_bindir}/dlog_logger
 %attr(750,log,log) %{_bindir}/dlogutil
 %attr(755,log,log) %{_bindir}/dlogctrl
+%attr(755,log,log) /var/log/dlog
+%attr(644,root,root) %{_udevrulesdir}/01-dlog.rules
+
+%if %{?systemd_journal} == OFF
+%attr(750,log,log) %{_bindir}/dlog_logger
 %attr(664,log,log) /opt/etc/dlog_logger.conf
 %{_unitdir}/dlog_logger.service
 %{_unitdir}/dlog_logger.path
 %{_unitdir}/multi-user.target.wants/dlog_logger.path
-%attr(755,log,log) /var/log/dlog
-%attr(644,root,root) %{_udevrulesdir}/01-dlog.rules
+%endif
 
 %files  -n libdlog
 %manifest libdlog.manifest
index 75f56e3..bcbd596 100755 (executable)
@@ -33,7 +33,6 @@
 
 #include "dlog.h"
 
-#define  HAVE_SYSTEMD_JOURNAL
 #ifdef HAVE_SYSTEMD_JOURNAL
 #include <syslog.h>
 #include <systemd/sd-journal.h>