configure.ac

Thu, 02 May 2024 15:49:16 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 02 May 2024 15:49:16 +0200
changeset 716
5c30c8ef83a8
parent 714
24749c296a50
child 725
b15a2ae7bea7
permissions
-rw-r--r--

Version 0.9.19b3. The simulator thread can be paused to be able to add and delete simulators. Added simulated door and PSU status. Devices can now fully use multiple simulators. Better rounding of simulated temperature values. The server SIMULATOR DEL and ADD commands pause the simulator when the linked list is manipulated. Fixed SIGSEGV when a simulator is added. Added socket SO_REUSEADDR again to the server socket.

dnl Process this file with autoconf to produce a configure script.

AC_INIT(thermferm/thermferm.c)
AM_CONFIG_HEADER(config.h)
SUBDIRS="thermferm brewpanel tools www"
AC_SUBST(SUBDIRS)

dnl General settings
dnl After changeing the version number, run autoconf!
PACKAGE="mbsePi-apps"
VERSION="0.9.19b3"
COPYRIGHT="Copyright (C) 2014-2024 Michiel Broek, All Rights Reserved"
CYEARS="2014-2024"
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
AC_SUBST(COPYRIGHT)
AC_SUBST(CYEARS)
AC_PREFIX_DEFAULT(/usr/local)
AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
AC_DEFINE_UNQUOTED(COPYRIGHT, "$COPYRIGHT")
TARGET="$target"


dnl Checks for programs.
AC_PROG_CC
AC_PROG_RANLIB
dnl Try to find GNU install
AC_CHECK_PROG(INSTALL, ginstall, ginstall)
AC_CHECK_PROG(INSTALL, install, install)
AC_CHECK_PROG(TAR, tar, tar)

#
# Libraries for mbsePi-apps
#
AC_CHECK_LIB(mosquitto,mosquitto_lib_init,result=yes,result=no)
if test "$result" = "yes"; then
  AC_CHECK_HEADERS(mosquitto.h)
  LIBS="$LIBS -lmosquitto"
else
  AC_MSG_ERROR(mosquitto not found)
fi

WIRINGPI=No
AC_ARG_ENABLE(wiringpi,  [  --enable-wiringpi       Compile wiringPi code],     [ wiringpi=$enableval ], [ wiringpi=yes ])
if test "$wiringpi" = "yes"; then
  AC_CHECK_LIB(wiringPi,wiringPiSetup,result=yes,result=no)
  if test "$result" = "yes"; then
    LIBS="$LIBS -lwiringPi -lwiringPiDev"
    AC_CHECK_HEADERS(wiringPi.h,WIRINGPI=Yes,WIRINGPI=No)
  fi
else
  AC_MSG_RESULT(check wiringPi disabled)
fi

AC_CHECK_LIB(json-c,json_object_iter_init_default,result=yes,result=no)
if test "$result" = "yes"; then
  LIBS="$LIBS -ljson-c"
  AC_CHECK_HEADERS(json-c/json.h)
else
  AC_MSG_ERROR(json-c not found)
fi

AC_CHECK_LIB(websockets,lws_create_context,result=yes,result=no)
if test "$result" = "yes"; then
  LIBS="$LIBS -lwebsockets"
  AC_CHECK_HEADERS(libwebsockets.h)
else
  AC_MSG_ERROR(libwebsockets not found)
fi


#
# Additional commandline switches
#
AC_ARG_ENABLE(experiment,  [  --enable-experiment     Compile experimental code],     [ experiment=$enableval ], [ experiment=no ])
if test "$experiment" = "yes"; then
  AC_DEFINE(USE_EXPERIMENT)
fi

SIMULATOR=No
AC_ARG_ENABLE(simulator,  [  --enable-simulator      Compile simulator code], [ simulator=$enableval ], [ simulator=no ])
if test "$simulator" = "yes"; then
  AC_DEFINE(USE_SIMULATOR)
  SIMULATOR=Yes
fi

AC_ARG_ENABLE(debugging,   [  --enable-debugging      Compile for debugging], [ debugging=$enableval ], [ debugging=no ])
if test "$debugging" = "yes"; then
  CFLAGS="-O -g -Wall -Wshadow -Wwrite-strings -Wstrict-prototypes -Winline"    
else
  CFLAGS="-g -O2 -fomit-frame-pointer -fno-strict-aliasing -Wall -Wshadow -Wwrite-strings -Wstrict-prototypes -Winline"
fi
LIBS="$LIBS -lm"


AC_CHECK_LIB(xml2,xmlParseFile,result=yes,result=no)
if test "$result" = "yes"; then
  LIBS="$LIBS -lxml2"
  CFLAGS="$CFLAGS $(xml2-config --cflags)"
  AC_CHECK_HEADERS(libxml/xmlmemory.h)
else
  AC_MSG_ERROR(libxml2 not found)
fi

AC_CHECK_LIB(uuid,uuid_generate,result=yes,result=no)
if test "$result" = "yes"; then
  LIBS="$LIBS $(pkg-config --libs uuid)"
  CFLAGS="$CFLAGS $(pkg-config --cflags uuid)"
  AC_CHECK_HEADERS(uuid/uuid.h)
else
  AC_MSG_ERROR(libuuid not found)
fi

# Check for SDL
SDL_CFLAGS=""
SDL_LIBS=""
SDL="No"
AC_MSG_CHECKING(SDL library)
pkg-config --exists sdl
if test "$?" = "0"; then
  AC_MSG_RESULT(yes)
  AC_MSG_CHECKING(sdl library v2.0.0 or newer)
  pkg-config --atleast-version=2.0.0 sdl2
  if test "$?" = "0"; then
    AC_MSG_RESULT(found)
    SDL_CFLAGS="$(pkg-config --cflags sdl2)"
    SDL_LIBS="$(pkg-config --libs sdl2)"
    AC_CHECK_HEADERS(SDL2/SDL.h)
    SDL="Yes"
  else
    AC_MSG_RESULT(not found)
  fi
else
  AC_MSG_RESULT(no)
fi

# Check for SDL_ttf if base SDL2 is found.
if test "$SDL" = "Yes"; then
  AC_MSG_CHECKING(SDL2_ttf library)
  pkg-config --exists SDL2_ttf
  if test "$?" = "0"; then
    AC_MSG_RESULT(yes)
    AC_MSG_CHECKING(sdl2 library v2.0.0 or newer)
    pkg-config --atleast-version=2.0.0 SDL2_ttf
    if test "$?" = "0"; then
      AC_MSG_RESULT(found)
      # Override flags
      SDL_CFLAGS="$(pkg-config --cflags SDL2_ttf)"
      SDL_LIBS="$(pkg-config --libs SDL2_ttf)"
    else
      AC_MSG_ERROR(not found)
      SDL="No"
    fi
  else
    AC_MSG_RESULT(no)
  fi
fi

dnl Checks for header files.
AC_HEADER_STDC

AC_SUBST(SDL_CFLAGS)
AC_SUBST(SDL_LIBS)


AC_OUTPUT(
    Makefile.global
    www/version.php
)

AC_MSG_RESULT([
-=-=-=-=-=-=-=-=-=-= Configuration Complete =-=-=-=-=-=-=-=-=-=-

  Configuration summary :

    Version : ............ ${VERSION}
    Main directory : ..... ${prefix}
    WiringPi : ........... ${WIRINGPI}
    SDL2 library : ....... ${SDL}
    Simulator : .......... ${SIMULATOR}

  Now type 'make' and 'sudo make install'
])

mercurial