diff --git a/Makefile.am b/Makefile.am index 8c3cd39..7a0b202 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ SUBDIRS = lib @DAEMON@ -include_HEADERS = yasnd.h yasnd-gammu.h yasnd-log.h yasnd-lpt.h +include_HEADERS = yasnd.h yasnd-log.h yasnd-lpt.h distclean-local: rm -rf aclocal.m4 m4 autom4te.cache compile depcomp install-sh missing configure Makefile.in config.h* &>/dev/null diff --git a/configure.ac b/configure.ac index 830ce70..287df1e 100644 --- a/configure.ac +++ b/configure.ac @@ -15,6 +15,7 @@ AM_PROG_CC_C_O LT_INIT # Checks for libraries. +AC_CHECK_LIB(pthread, pthread_create) PKG_CHECK_MODULES([libconfuse], [libconfuse >= 2.0]) # Checks for header files. diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 06a24eb..cc2de35 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -1,10 +1,11 @@ -include_HEADERS = $(top_srcdir)/yasnd.h yasnd-sock.h +include_HEADERS = $(top_srcdir)/yasnd.h yasnd-gammu.h yasnd-sock.h yasnd_LDADD = ${libconfuse_LIBS} yasnd_LDADD += $(top_srcdir)/lib/libyasnd.la +yasnd_LDADD += @GAMMU_LIBS@ sbin_PROGRAMS = yasnd -yasnd_SOURCES = yasnd.c yasnd-ipc.c yasnd-sock.c -yasnd_CPPFLAGS = -I$(top_srcdir) +yasnd_SOURCES = yasnd.c yasnd-gammu.c yasnd-ipc.c yasnd-sock.c +yasnd_CPPFLAGS = -I$(top_srcdir) @GAMMU_CFLAGS@ distclean-local: rm -f Makefile.in &>/dev/null diff --git a/lib/yasnd-gammu.c b/daemon/yasnd-gammu.c similarity index 98% rename from lib/yasnd-gammu.c rename to daemon/yasnd-gammu.c index 1cdffde..d34c48f 100644 --- a/lib/yasnd-gammu.c +++ b/daemon/yasnd-gammu.c @@ -1,10 +1,15 @@ -#include +#include "config.h" #include "yasnd.h" #include "yasnd-log.h" +#ifdef HAVE_LIBGAMMU +#include +#endif char* phone_device=NULL; // phone device for gammu, for example: "/dev/ttyACM0" char* phone_model=NULL; // gammu phone model, for example: "at" char* phone_connection=NULL; // gammu phone connection type, for example: "at" + +#ifdef HAVE_LIBGAMMU GSM_Error error; // structure to store possible gammu errors GSM_StateMachine *state_machine=NULL; // structure to interact with mobile phones volatile gboolean gammu_shutdown=FALSE; // variable that indicates gammu shutdown @@ -180,3 +185,4 @@ bool gammu_send_sms(const char* message) } return true; } +#endif diff --git a/yasnd-gammu.h b/daemon/yasnd-gammu.h similarity index 100% rename from yasnd-gammu.h rename to daemon/yasnd-gammu.h diff --git a/daemon/yasnd-ipc.c b/daemon/yasnd-ipc.c index 88dcf42..e530f4f 100644 --- a/daemon/yasnd-ipc.c +++ b/daemon/yasnd-ipc.c @@ -1,3 +1,4 @@ +#include "config.h" #include #include #include @@ -70,6 +71,7 @@ void* ipc_queue_loop(void* param) char dbg_txt[150]; sprintf(dbg_txt,"Read IPC message - Type: %ld Text: %s", qbuf.mtype, qbuf.mtext); log_debug(dbg_txt,DEBUG_ALL); +#ifdef HAVE_LIBGAMMU if (qbuf.mtype==SMS_RECEIVE_TYPE && sms_enable) { pid_t pid = fork(); @@ -103,6 +105,7 @@ void* ipc_queue_loop(void* param) // STUB: need to react on status, returned by thread waitpid(pid,NULL,0); } +#endif } } diff --git a/daemon/yasnd.c b/daemon/yasnd.c index 030d97c..74b80fa 100644 --- a/daemon/yasnd.c +++ b/daemon/yasnd.c @@ -1,3 +1,4 @@ +#include "config.h" #include #include #include @@ -152,9 +153,11 @@ void init() hosts[i].alert_sent=false; hosts[i].reaction_obtained=false; } +#ifdef HAVE_LIBGAMMU // initialize gammu structures if (sms_enable) gammu_init(); +#endif // initialize LPT control circuit lpt_init(); // initialize server socket @@ -281,8 +284,10 @@ void signal_handler(int signum) ipc_free(); // free config structure cfg_free(cfg); +#ifdef HAVE_LIBGAMMU // free gammu structure gammu_free(); +#endif // free hosts structures memory if (hosts!=NULL) free(hosts); diff --git a/lib/Makefile.am b/lib/Makefile.am index e47e73e..c4c25cc 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,7 +1,6 @@ lib_LTLIBRARIES = libyasnd.la -libyasnd_la_SOURCES = libyasnd.c yasnd-gammu.c yasnd-log.c yasnd-lpt.c -libyasnd_la_CPPFLAGS = -I$(top_srcdir) @GAMMU_CFLAGS@ -libyasnd_la_LIBADD = @GAMMU_LIBS@ +libyasnd_la_SOURCES = libyasnd.c yasnd-log.c yasnd-lpt.c +libyasnd_la_CPPFLAGS = -I$(top_srcdir) distclean-local: rm -f Makefile.in &>/dev/null