You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

305 lines
8.5 KiB

AC_INIT(dt_ctrl, git)
AC_SUBST(HOSTSYS,["$ac_cv_env_host_alias_value"])
AC_SUBST(BUILDSYS,["$ac_cv_env_build_alias_value"])
AS_IF([test "$HOSTSYS" == ""],[HOSTSYS_TMP=`uname -m`],[HOSTSYS_TMP="$HOSTSYS"])
AS_IF([echo "$HOSTSYS_TMP" | grep "arm"],[HAVE_ARM=1],[HAVE_ARM=0])
#######################################################################
#
# Enable/disable controller
#
AC_ARG_ENABLE([ethercat],
[AS_HELP_STRING([--disable-ethercat], [Enable/Disable Ethercat master @<:@yes@:>@])],
[:],
[enable_ethercat=yes])
AC_ARG_ENABLE([vesp],
[AS_HELP_STRING([--disable-vesp], [Enable/Disable vesp bus @<:@yes@:>@])],
[:],
[enable_vesp=yes])
AC_ARG_ENABLE([am335x],
[AS_HELP_STRING([--disable-am335x], [Enable/Disable am335x blocks @<:@yes@:>@])],
[:],
[enable_am335x=yes])
AC_ARG_ENABLE([test],
[AS_HELP_STRING([--disable-test], [Enable/Disable test blocks @<:@yes@:>@])],
[:],
[enable_test=yes])
AC_ARG_ENABLE([embedded],
[AS_HELP_STRING([--enable-embedded], [Enable/Disable embedde controller @<:@no@:>@])],
[enable_embedded=yes],
[:])
#######################################################################
#
# Enable/disable console
#
AC_ARG_ENABLE([console],
[AS_HELP_STRING([--disable-console], [Enable/Disable console @<:@yes@:>@])],
[:],
[enable_console=yes])
#######################################################################
#
# Check for libwebsockets
#
AC_ARG_WITH([libwebsockets],
[AS_HELP_STRING([--with-libwebsockets],
[use libwebsockets @<:@default=check@:>@])],
[],
[with_libwebsocket=check])
AS_CASE(["$with_libwebsockets"],
[yes],
[AC_CHECK_LIB(websockets,lws_create_context,[HAVE_LIBWEBSOCKETS=1])]
[AC_CHECK_HEADERS([libwebsockets.h])],
[no],
[],
[AC_CHECK_LIB(websockets,lws_create_context,[HAVE_LIBWEBSOCKETS=1],[HAVE_LIBWEBSOCKETS=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],
[use indi library @<:@default=check@:>@])],
[],
[with_libindi=check])
AS_CASE(["$with_libindi"],
[yes],
[AC_CHECK_LIB(indi,IDLog,[HAVE_LIBINDI=1])]
[AC_CHECK_HEADERS([libindi/indidevapi.h])],
[no],
[],
[AC_CHECK_LIB(indi,IDLog,[HAVE_LIBINDI=1],[HAVE_LIBINDI=0])]
[AC_CHECK_HEADERS([libindi/indidevapi.h])]
)
#######################################################################
#
# Check for libnova
#
AC_ARG_WITH([libnova],
[AS_HELP_STRING([--with-libnova],
[use nova library @<:@default=check@:>@])],
[],
[with_libnova=check])
AS_CASE(["$with_libnova"],
[yes],
[AC_CHECK_LIB(nova,ln_get_version,[HAVE_LIBNOVA=1])]
[AC_CHECK_HEADERS([libnova/libnova.h])],
[no],
[],
[AC_CHECK_LIB(nova,ln_get_version,[HAVE_LIBNOVA=1],[HAVE_LIBNOVA=0])]
[AC_CHECK_HEADERS([libnova/libnova.h])]
)
#######################################################################
#
# Support for linux joystick
AC_CHECK_HEADER(linux/joystick.h,[HAVE_HEADER_LINUX_JOYSTICK=1],[HAVE_HEADER_LINUX_JOYSTICK=0])
#######################################################################
#
# Real OS or embedded?
AC_CHECK_LIB(pthread,pthread_attr_init,[HAVE_LIBPTHREAD=1],[HAVE_LIBPTHREAD=0])
AC_CHECK_LIB(c,realpath,[HAVE_FILEIO=1],[HAVE_FILEIO=0])
AC_CHECK_HEADER(sys/socket.h,[HAVE_TCP=1],[HAVE_TCP=0])
AC_CHECK_HEADER(semaphore.h,[HAVE_SEMAPHORE=1],[HAVE_SEMAPHORE=0])
AC_CHECK_HEADER(dlfcn.h,[HAVE_DYNAMICLINKING=1],[HAVE_DYNAMICLINKING=0])
AC_CHECK_HEADER(sysclk.h,[HAVE_SYSTICK=1],[HAVE_SYSTICK=0])
AC_CHECK_HEADER(samx70.h,[HAVE_ATSAMX70=1],[HAVE_ATSAMX70=0])
#######################################################################
#
# Some conclusions based on test results
#
AS_IF([test "$enable_console" = "yes" && test "$HAVE_TCP" = "1"],
[AC_SUBST(BUILD_CONSOLE,["yes"])],
[AC_SUBST(BUILD_CONSOLE,[""])])
AS_IF([test "$BUILD_CONSOLE" == "yes" && test "$HAVE_LIBWEBSOCKETS" == "1"],
[AC_SUBST(BUILD_CONSOLE_HTTPD,["yes"])],
[AC_SUBST(BUILD_CONSOLE_HTTPD,[""])])
AS_IF([test "$BUILD_CONSOLE" = "yes" && test "$HAVE_LIBNOVA" = "1"],
[AC_SUBST(BUILD_CONSOLE_J2000,["yes"])],
[AC_SUBST(BUILD_CONSOLE_J2000,[""])])
AS_IF([test "$BUILD_CONSOLE" = "yes" && test "$HAVE_LIBNOVA" = "1"],
[AC_SUBST(BUILD_CONSOLE_SATTRACKER,["yes"])],
[AC_SUBST(BUILD_CONSOLE_SATTRACKER,[""])])
AS_IF([test "$BUILD_CONSOLE_J2000" = "yes" && test "$HAVE_LIBINDI" = "1"],
[AC_SUBST(BUILD_CONSOLE_J2000_INDI,["yes"])],
[AC_SUBST(BUILD_CONSOLE_J2000_INDI,[""])])
AS_IF([test "$enable_ethercat" = "yes"],
[AC_SUBST(BUILD_ETHERCAT,["yes"])],
[AC_SUBST(BUILD_ETHERCAT,[""])])
AS_IF([test "$enable_vesp" = "yes"],
[AC_SUBST(BUILD_VESP,["yes"])],
[AC_SUBST(BUILD_VESP,[""])])
AS_IF([test "$enable_am335x" = "yes" && test "$HAVE_ARM" = "1"],
[AC_SUBST(BUILD_AM335X,["yes"])],
[AC_SUBST(BUILD_AM335X,[""])])
AS_IF([test "$enable_test" = "yes"],
[AC_SUBST(BUILD_TEST,["yes"])],
[AC_SUBST(BUILD_TEST,[""])])
AS_IF([test "$HAVE_LIBPTHREAD" = "1"],
[AC_SUBST(CFLAGS_PTHREAD,["-DHAVE_PTHREAD"])],
[AC_SUBST(CFLAGS_PTHREAD,[""])])
AS_IF([test "$HAVE_LIBPTHREAD" = "1"],
[AC_SUBST(BUILD_PTHREAD,["yes"])],
[AC_SUBST(BUILD_PTHREAD,[""])])
AS_IF([test "$HAVE_TCP" = "1"],
[AC_SUBST(CFLAGS_TCP,["-DHAVE_TCP"])],
[AC_SUBST(CFLAGS_TCP,[""])])
AS_IF([test "$HAVE_TCP" = "1"],
[AC_SUBST(BUILD_TCP,["yes"])],
[AC_SUBST(BUILD_TCP,[""])])
AS_IF([test "$HAVE_SEMAPHORE" = "1"],
[AC_SUBST(CFLAGS_SEMAPHORE,["-DHAVE_SEMAPHORE"])],
[AC_SUBST(CFLAGS_SEMAPHORE,[""])])
AS_IF([test "$HAVE_HEADER_LINUX_JOYSTICK" = "1"],
[AC_SUBST(BUILD_LINUX_JOYSTICK,["yes"])],
[AC_SUBST(BUILD_LINUX_JOYSTICK,[""])])
AS_IF([test "$HAVE_DYNAMICLINKING" = "1"],
[AC_SUBST(BUILD_DYNAMICLINKING,["yes"])],
[AC_SUBST(BUILD_DYNAMICLINKING,[""])])
AS_IF([test "$HAVE_FILEIO" = "1"],
[AC_SUBST(BUILD_FILEIO,["yes"])],
[AC_SUBST(BUILD_FILEIO,[""])])
AS_IF([test "$HAVE_FILEIO" = "1"],
[AC_SUBST(CFLAGS_FILEIO,["-DHAVE_FILEIO"])],
[AC_SUBST(CFLAGS_FILEIO,[""])])
AS_IF([test "$enable_embedded" = "yes"],
[AC_SUBST(BUILD_EMBEDDED,["yes"])],
[AC_SUBST(BUILD_EMBEDDED,[""])])
AS_IF([test "$enable_embedded" = "yes"],
[AC_SUBST(CFLAGS_EMBEDDED,["-DHAVE_EMBEDDED"])],
[AC_SUBST(CFLAGS_EMBEDDED,[""])])
AS_IF([test "$HAVE_SYSTICK" = "1"],
[AC_SUBST(BUILD_SYSTICK,["yes"])],
[AC_SUBST(BUILD_SYSTICK,[""])])
AS_IF([test "$HAVE_SYSTICK" = "1"],
[AC_SUBST(CFLAGS_SYSTICK,["-DHAVE_SYSTICK -D_POSIX_TIMERS"])],
[AC_SUBST(CFLAGS_SYSTICK,[""])])
AS_IF([test "$HAVE_ATSAMX70" = "1"],
[AC_SUBST(BUILD_ATSAMX70,["yes"])],
[AC_SUBST(BUILD_ATSAMX70,[""])])
AS_IF([test "$HAVE_ATSAMX70" = "1"],
[AC_SUBST(CFLAGS_ATSAMX70,["-DHAVE_ATSAMX70"])],
[AC_SUBST(CFLAGS_ATSAMX70,[""])])
#######################################################################
#
# 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" != ""],
AC_MSG_NOTICE([ console_j2000_tracker: yes]),
AC_MSG_NOTICE([ console_j2000_tracker: no]))
AS_IF([test "$BUILD_CONSOLE_J2000_INDI" != ""],
AC_MSG_NOTICE([ console_j2000_indi: yes]),
AC_MSG_NOTICE([ console_j2000_indi: no]))
AS_IF([test "$BUILD_CONSOLE_SATTRACKER" != ""],
AC_MSG_NOTICE([ console_sattracker: yes]),
AC_MSG_NOTICE([ console_sattracker: no]))
AS_IF([test "$BUILD_ETHERCAT" != ""],
AC_MSG_NOTICE([ ethercat: yes]),
AC_MSG_NOTICE([ ethercat: no]))
AS_IF([test "$BUILD_VESP" != ""],
AC_MSG_NOTICE([ vesp: yes]),
AC_MSG_NOTICE([ vesp: no]))
AS_IF([test "$BUILD_LINUX_JOYSTICK" != ""],
AC_MSG_NOTICE([ linux joystick: yes]),
AC_MSG_NOTICE([ linux joystick: no]))
AS_IF([test "$BUILD_AM335X" != ""],
AC_MSG_NOTICE([ am335x: yes]),
AC_MSG_NOTICE([ am335x: no]))
AS_IF([test "$BUILD_ATSAMX70" != ""],
AC_MSG_NOTICE([ atsamx70: yes]),
AC_MSG_NOTICE([ atsamx70: no]))
AS_IF([test "$BUILD_SYSTICK" != ""],
AC_MSG_NOTICE([ systick: yes]),
AC_MSG_NOTICE([ systick: no]))
AS_IF([test "$BUILD_EMBEDDED" != ""],
AC_MSG_NOTICE([ embedded: yes]),
AC_MSG_NOTICE([ embedded: no]))
AS_IF([test "$BUILD_TEST" != ""],
AC_MSG_NOTICE([ test: yes]),
AC_MSG_NOTICE([ test: no]))