Commit 500bfb4c authored by Jeroen Vreeken's avatar Jeroen Vreeken
Browse files

Add configure script for searching dependancies.

Console building can be switched on and off.
console_httpd and console_j2000_indi are now built only if all libs are
found.

Getting a working build:
1. run autoconf
2. run ./configure
3. make as usuall
parent ff4ab2ff
......@@ -19,3 +19,8 @@
.libs
bin
include
autom4te.cache
buildflags.mk
config.status
configure
.PHONY: clean all rel_mktemp_dir console help
include buildflags.mk
include build.mk
CONTROLLER_REL_TAR:=$(CURDIR)/controller_$(shell date +%Y%m%d%H%M).tar.gz
......@@ -143,10 +144,11 @@ TARGETS:=
$(eval $(call SUBDIR,controller))
controller: $(TARGETS)
ifdef BUILD_CONSOLE
TARGETS:=
$(eval $(call SUBDIR,console))
console: $(TARGETS)
endif
SRCS_IL = $(filter %.il,$(SRCS))
$(SRCS_IL): $(IL2C)
......
BUILD_CONSOLE=@BUILD_CONSOLE@
BUILD_CONSOLE_HTTPD=@BUILD_CONSOLE_HTTPD@
BUILD_CONSOLE_J2000_INDI=@BUILD_CONSOLE_J2000_INDI@
AC_INIT(dt_ctrl, git)
#######################################################################
#
# Enable/disable console
#
AC_ARG_ENABLE([console],
[AS_HELP_STRING([--disable-console], [Enable console @<:@yes@:>@])],
[:],
[enable_console=yes])
#######################################################################
#
# Check for libwebsocket
#
AC_ARG_WITH([libwebsocket],
[AS_HELP_STRING([--with-libwebsocket],
[build websocket base httpd deamon @<:@default=check@:>@])],
[],
[with_libwebsocket=check])
AS_CASE(["$with_libwebsocket"],
[yes],
[AC_CHECK_LIB(websockets,libwebsocket_create_context,[HAVE_LIBWEBSOCKET=1])]
[AC_CHECK_HEADERS([libwebsockets.h])],
[no],
[],
[AC_CHECK_LIB(websockets,libwebsocket_create_context,[HAVE_LIBWEBSOCKET=1],[HAVE_LIBWEBSOCKET=0])]
[AC_CHECK_HEADERS([libwebsockets.h])]
)
AS_IF([test "$ac_cv_header_libwebsockets_h" != yes],[HAVE_LIBWEBSOCKETS=0])
#######################################################################
#
# Check for libindi
#
AC_ARG_WITH([libindi],
[AS_HELP_STRING([--with-libindi],
[have indi library @<:@default=check@:>@])],
[],
[with_libindi=check])
AS_CASE(["$with_libindi"],
[yes],
[AC_CHECK_LIB(indi,IDLog,[HAVE_LIBINDI=1])]
[AC_CHECK_HEADERS([linindi/indidevapi.h])],
[no],
[],
[AC_CHECK_LIB(indi,IDLog,[HAVE_LIBINDI=1],[HAVE_LIBINDI=0])]
[AC_CHECK_HEADERS([linindi/indidevapi.h])]
)
AS_IF([test "$ac_cv_header_linindi_indidevapi_h" != yes],[HAVE_LIBINDI=0])
#######################################################################
#
# Some conclusions based on test results
#
AS_IF([test "$enable_console" = "yes"],
[AC_SUBST(BUILD_CONSOLE,["yes"])],
[AC_SUBST(BUILD_CONSOLE,[""])])
AS_IF([test "BUILD_CONSOLE = "yes" && test "$HAVE_LIBWEBSOCKET" = "1"],
[AC_SUBST(BUILD_CONSOLE_HTTPD,["yes"])],
[AC_SUBST(BUILD_CONSOLE_HTTPD,[""])])
AS_IF([test "BUILD_CONSOLE = "yes" && test "$HAVE_LIBINDI" = "1"],
[AC_SUBST(BUILD_CONSOLE_J2000_INDI,["yes"])],
[AC_SUBST(BUILD_CONSOLE_J2000_INDI,[""])])
#######################################################################
#
# Output
#
AC_CONFIG_FILES(buildflags.mk)
AC_OUTPUT
#######################################################################
#
# Tell the user our findings
#
AC_MSG_NOTICE([Build:])
AS_IF([test "$BUILD_CONSOLE" != ""],
AC_MSG_NOTICE([ console: yes]),
AC_MSG_NOTICE([ console: no]))
AS_IF([test "$BUILD_CONSOLE_HTTPD" != ""],
AC_MSG_NOTICE([ console_httpd: yes]),
AC_MSG_NOTICE([ console_httpd: no]))
AS_IF([test "$BUILD_CONSOLE_J2000_INDI" != ""],
AC_MSG_NOTICE([ console_j2000_indi: yes]),
AC_MSG_NOTICE([ console_j2000_indi: no]))
......@@ -23,10 +23,16 @@ CONSOLE_TARGETS += $(DIR)/console_weather
CONSOLE_TARGETS += $(DIR)/console_dt_model
CONSOLE_TARGETS += $(DIR)/await_controller
CONSOLE_TARGETS += $(DIR)/console_sattracker
ifdef BUILD_CONSOLE_HTTPD
CONSOLE_TARGETS += $(DIR)/console_httpd
endif
ifneq ($(OS), FreeBSD)
CONSOLE_TARGETS += $(DIR)/console_joystick
endif
ifdef BUILD_CONSOLE_J2000_INDI
CONSOLE_TARGETS += $(DIR)/console_j2000_indi
endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment