AC_INIT([mfi_agent], [1.0], [mike@crute.us]) AC_PREREQ([2.60]) AM_INIT_AUTOMAKE([foreign -Wall -Werror]) AM_SILENT_RULES([yes]) AC_PROG_CC AC_LANG_WERROR AC_PROG_CC_C99 PKG_PROG_PKG_CONFIG AC_CHECK_HEADER_STDBOOL AC_SEARCH_LIBS( [ev_run], [ev], [found_libev=yes], [found_libev=no] ) AC_CHECK_HEADER( [ev.h], , found_libev=no ) if test "x$found_libev" = xno; then AC_MSG_ERROR("libev not found") fi PKG_CHECK_MODULES( JSON_C, json-c, [found_json_c=yes], [found_json_c=no] ) if test "x$found_json_c" = xno; then AC_MSG_ERROR("libjson-c not found") fi PKG_CHECK_MODULES( WEBSOCKETS, libwebsockets, [found_libwebsockets=yes], [found_libwebsockets=no] ) if test "x$found_libwebsockets" = xno; then AC_MSG_ERROR("libwebsockets not found") fi AC_ARG_ENABLE( debug, AC_HELP_STRING([--enable-debug], [create a debug build]) ) AS_IF([test "x$enable_debug" = xyes], [ AM_CFLAGS="-g -DDEBUG $AM_CFLAGS" AM_CFLAGS="$AM_CFLAGS -Wno-long-long -Wall -W -Wformat=2" AM_CFLAGS="$AM_CFLAGS -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations" AM_CFLAGS="$AM_CFLAGS -Wwrite-strings -Wshadow -Wpointer-arith -Wsign-compare" AM_CFLAGS="$AM_CFLAGS -Wundef -Wbad-function-cast -Winline -Wcast-align" AM_CFLAGS="$AM_CFLAGS -Wdeclaration-after-statement -Wno-pointer-sign -Wno-attributes" AM_CFLAGS="$AM_CFLAGS -Wno-unused-result" ]) AC_ARG_ENABLE( [production], AC_HELP_STRING([--enable-production], [produce a production-ready build]) ) AS_IF([test "x$enable_production" = xyes], [ AM_CFLAGS="-s -Os $AM_CFLAGS" ]) if test "x$enable_debug" = xyes && test "x$enable_production" = xyes; then AC_MSG_ERROR([Production and Debug are mutually exclusive options]) fi # Always build static binaries to make it easier to deploy AM_LDFLAGS="-static $AM_LDFLAGS" AM_CFLAGS="-Wall -Werror $AM_CFLAGS" AC_SUBST(AM_CFLAGS) AC_SUBST(AM_LDFLAGS) AC_CONFIG_FILES([Makefile]) AC_OUTPUT