Define CMake variables to indicate init system for target
incase of cross compile, detecting systemd support based on
host directory structure is not right thing to do

Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.kheem@gmail.com>

--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -317,7 +317,7 @@ if(FLB_BINARY)
   install(TARGETS fluent-bit-bin RUNTIME DESTINATION ${FLB_INSTALL_BINDIR})
 
   # Detect init system, install upstart, systemd or init.d script
-  if(IS_DIRECTORY /lib/systemd/system)
+  if(IS_DIRECTORY /lib/systemd/system OR FLB_SYSTEMD)
     set(FLB_SYSTEMD_SCRIPT "${PROJECT_SOURCE_DIR}/init/${FLB_OUT_NAME}.service")
     configure_file(
       "${PROJECT_SOURCE_DIR}/init/systemd.in"
@@ -325,7 +325,7 @@ if(FLB_BINARY)
       )
     install(FILES ${FLB_SYSTEMD_SCRIPT} DESTINATION /lib/systemd/system)
     install(DIRECTORY DESTINATION ${FLB_INSTALL_CONFDIR})
-  elseif(IS_DIRECTORY /usr/share/upstart)
+  elseif(IS_DIRECTORY /usr/share/upstart OR FLB_UPSTART)
     set(FLB_UPSTART_SCRIPT "${PROJECT_SOURCE_DIR}/init/${FLB_OUT_NAME}.conf")
     configure_file(
       "${PROJECT_SOURCE_DIR}/init/upstart.in"
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -70,6 +70,8 @@ option(FLB_RECORD_ACCESSOR    "Enable re
 option(FLB_SYSTEM_STRPTIME    "Use strptime in system libc"  Yes)
 option(FLB_STATIC_CONF        "Build binary using static configuration")
 option(FLB_STREAM_PROCESSOR   "Enable Stream Processor"      Yes)
+option(FLB_SYSTEMD            "Enable systemd init system"   No)
+option(FLB_UPSTART            "Enable upstart init system"   No)
 option(FLB_CORO_STACK_SIZE    "Set coroutine stack size")
 
 # Metrics: Experimental Feature, disabled by default on 0.12 series
