Skip to content

Commit

Permalink
Merge pull request #13 from lwindg/master
Browse files Browse the repository at this point in the history
Add autoconf rule
  • Loading branch information
imZack committed Oct 5, 2015
2 parents af97a8b + 5c747ca commit 2a226ce
Show file tree
Hide file tree
Showing 10 changed files with 176 additions and 31 deletions.
19 changes: 0 additions & 19 deletions Makefile

This file was deleted.

7 changes: 7 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
SUBDIRS = src
dist_doc_DATA = README CHANGES BUGS

etcdir = /etc
etc_DATA = $(PACKAGE).conf

EXTRA_DIST = $(dist_doc_DATA) $(etc_DATA)
49 changes: 49 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])
AC_INIT([sanji-controller], [1.0.1], [[email protected]])
AM_INIT_AUTOMAKE([1.11 foreign])
AC_CONFIG_SRCDIR([src/sanji_controller.c])
AC_CONFIG_HEADERS([config.h])

# Checks for programs.
AC_PROG_AWK
AC_PROG_CC
AC_PROG_RANLIB
AC_PROG_INSTALL
AC_PROG_MAKE_SET

# Checks for libraries.
AC_SUBST(mosquitto_LIBS)
AC_CHECK_LIB([rt], [clock_gettime])
AC_CHECK_LIB([jansson], [json_object])
AC_CHECK_LIB([mosquitto], [mosquitto_lib_init],
[mosquitto_LIBS="-lmosquitto"],
AC_ERROR([Misssing mosquitto client library]))

# Checks for header files.
AC_CHECK_HEADERS([fcntl.h stdint.h stdlib.h string.h unistd.h utime.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T

# Checks for library functions.
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_FUNC_STRERROR_R
AC_CHECK_FUNCS([clock_gettime gethostname memmove memset strchr strerror strrchr utime])

AC_CONFIG_FILES([Makefile
src/Makefile
src/lib/Makefile])
AC_OUTPUT
1 change: 0 additions & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Section: libs
Homepage: http://www.moxa.com
#Vcs-Git: [email protected]:Sanji-IO/sanji-controller.git
#Vcs-Browser:
X-Python-Version: >= 2.5

Package: sanji-controller
Section: libs
Expand Down
2 changes: 1 addition & 1 deletion debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
#export DH_VERBOSE=1

%:
dh $@
dh $@ --with autotools-dev
2 changes: 1 addition & 1 deletion debian/source/format
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0 (native)
3.0 (quilt)
78 changes: 78 additions & 0 deletions sanji-controller.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
[global]

# =================================================================
# Connection
# =================================================================

# MQTT broker IP.
host = '127.0.0.1'

# MQTT broker port.
port = 1883

# Retry times to connect MQTT broker
# Max to 65535. If you want to try forever, use -1.
retry = -1


# =================================================================
# MQTT
# =================================================================

# Keep alive in seconds to MQTT broker.
# Max to 65535.
keepalive = 600

# On connection, a client sets the "clean session" flag,
# which is sometimes also known as the "clean start" flag.
#
# If clean session is set to false, then the connection is treated as durable.
# This means that when the client disconnects, any subscriptions it has will
# remain and any subsequent QoS 1 or 2 messages will be stored
# until it connects again in the future. If clean session is true,
# then all subscriptions will be removed for the client when it disconnects.
clean_session = true

# QoS for subscription and publication.
#
# Higher levels of QoS are more reliable,
# but involve higher latency and have higher bandwidth requirements.
# 0: The broker/client will deliver the message once, with no confirmation.
# 1: The broker/client will deliver the message at least once, with confirmation required.
# 2: The broker/client will deliver the message exactly once by using a four step handshake.
sub_qos = 2
pub_qos = 1

# Set the client id for this bridge connection. If not defined, this defaults
# to 'controller'.
cliet_id =

# Username and password (requires MQTT 3.1 broker).
username =
password =


# =================================================================
# Sanji Controller
# =================================================================

# The inverval in milliseconds for sanji controller to refresh sessions.
#
# Sanji controller will refresh every session status in order to
# drop TTL session, do heart beat with MQTT broker,
# and some protocol layer procedure.
#
# Noted, refresh interval MUST less then keepalive time.
# Max to 65535.
refresh_interval = 1000


# =================================================================
# MISC
# =================================================================

# Local id for extra topic
local_id =

# Enable mosquitto debug function.
mosq_debug = false
18 changes: 18 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
SUBDIRS = lib

libdir = lib
bin_PROGRAMS = sanji-controller
sanji_controller_SOURCES = \
debug.h \
error.h \
http.h \
list.h \
sanji_controller.h sanji_controller.c \
resource.h resource.c \
component.h component.c \
session.h session.c \
ini.h ini.c
sanji_controller_LDFLAGS = $(mosquitto_LIBS) $(jansson_LIBS)
sanji_controller_LDADD = $(libdir)/libsanjimisc.a

AM_CPPFLAGS = -I$(libdir)
13 changes: 13 additions & 0 deletions src/lib/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
noinst_LIBRARIES = libsanjimisc.a
libsanjimisc_a_SOURCES = \
bswap.h \
typedefs.h \
crc16.h crc16.c \
daemonize.h daemonize.c \
dt.h dt.c \
time_util.h time_util.c \
lock.h lock.c \
pid.h pid.c \
text_util.h text_util.c \
strext.h strext.c \
random_util.h random_util.c
18 changes: 9 additions & 9 deletions src/lib/build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ CFLAGS += -DDEBUG
endif

SRCS = \
crc16.c \
daemonize.c \
dt.c \
time_util.c \
lock.c \
pid.c \
text_util.c \
strext.c \
random_util.c
crc16.c \
daemonize.c \
dt.c \
time_util.c \
lock.c \
pid.c \
text_util.c \
strext.c \
random_util.c

OBJS = $(SRCS:.c=.o)

Expand Down

0 comments on commit 2a226ce

Please sign in to comment.