1# libmodbus package version number, (as distinct from shared library version) 2# An odd micro number indicates in-progress development from Git 3# An even micro number indicates a released version 4# 5# Making a point release: 6# - increase libmodbus_version_micro to the next even number 7# 8# After the release: 9# - increase libmodbus_version_minor to the next odd number 10# 11# Take care to update the libtool versioning when required (LIBMODBUS_LD_*). 12# http://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html 13# 14m4_define([libmodbus_version_major], [3]) 15m4_define([libmodbus_version_minor], [1]) 16m4_define([libmodbus_version_micro], [6]) 17 18m4_define([libmodbus_release_status], 19 [m4_if(m4_eval(libmodbus_version_minor % 2), [1], [snapshot], [release])]) 20 21m4_define([libmodbus_version], 22 [libmodbus_version_major.libmodbus_version_minor.libmodbus_version_micro]) 23 24AC_PREREQ([2.63]) 25AC_INIT([libmodbus], 26 [libmodbus_version], 27 [https://github.com/stephane/libmodbus/issues], 28 [libmodbus], 29 [http://libmodbus.org/]) 30AC_CONFIG_SRCDIR([src/modbus.c]) 31AC_CONFIG_AUX_DIR([build-aux]) 32AM_INIT_AUTOMAKE([check-news foreign 1.11 -Wall -Wno-portability silent-rules tar-pax subdir-objects]) 33AC_PROG_CC_STDC 34AC_USE_SYSTEM_EXTENSIONS 35AC_SYS_LARGEFILE 36AC_CONFIG_MACRO_DIR([m4]) 37AM_SILENT_RULES([yes]) 38 39LIBMODBUS_VERSION_MAJOR=libmodbus_version_major 40LIBMODBUS_VERSION_MINOR=libmodbus_version_minor 41LIBMODBUS_VERSION_MICRO=libmodbus_version_micro 42LIBMODBUS_VERSION=libmodbus_version 43AC_SUBST(LIBMODBUS_VERSION_MAJOR) 44AC_SUBST(LIBMODBUS_VERSION_MINOR) 45AC_SUBST(LIBMODBUS_VERSION_MICRO) 46AC_SUBST(LIBMODBUS_VERSION) 47 48# ABI version 49# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html 50LIBMODBUS_LD_CURRENT=6 51LIBMODBUS_LD_REVISION=0 52LIBMODBUS_LD_AGE=1 53LIBMODBUS_LT_VERSION_INFO=$LIBMODBUS_LD_CURRENT:$LIBMODBUS_LD_REVISION:$LIBMODBUS_LD_AGE 54AC_SUBST(LIBMODBUS_LT_VERSION_INFO) 55 56AC_CANONICAL_HOST 57 58# OS check 59os_win32="false" 60os_cygwin="false" 61os_qnx="false" 62case "${host_os}" in 63 *mingw32*) 64 os_win32="true" 65 ;; 66 *nto-qnx*) 67 os_qnx="true" 68 ;; 69 *cygwin*) 70 os_cygwin="true" 71 ;; 72esac 73AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "true") 74AM_CONDITIONAL(OS_QNX, test "$os_qnx" = "true") 75 76LT_INIT([disable-static win32-dll pic-only]) 77AC_CHECK_HEADERS([ \ 78 arpa/inet.h \ 79 byteswap.h \ 80 errno.h \ 81 fcntl.h \ 82 limits.h \ 83 linux/serial.h \ 84 netdb.h \ 85 netinet/in.h \ 86 netinet/tcp.h \ 87 sys/ioctl.h \ 88 sys/params.h \ 89 sys/socket.h \ 90 sys/time.h \ 91 sys/types.h \ 92 termios.h \ 93 time.h \ 94 unistd.h \ 95]) 96 97# Check whether to build docs / install man pages 98AC_LIBMODBUS_CHECK_BUILD_DOC 99 100# Cygwin defines IPTOS_LOWDELAY but can't handle that flag so it's necessary to 101# workaround that problem and Cygwin doesn't define MSG_DONTWAIT. 102AC_CHECK_DECLS([__CYGWIN__]) 103 104# Checks for library functions. 105AC_CHECK_FUNCS([accept4 getaddrinfo gettimeofday inet_ntoa select socket strerror strlcpy]) 106 107# Required for MinGW with GCC v4.8.1 on Win7 108AC_DEFINE(WINVER, 0x0501, _) 109 110# Required for bswap 111AC_C_INLINE 112 113# libtool 114AC_PROG_CXX 115 116# Various types 117AC_TYPE_INT64_T 118AC_TYPE_SIZE_T 119AC_TYPE_SSIZE_T 120AC_TYPE_UINT16_T 121AC_TYPE_UINT32_T 122AC_TYPE_UINT8_T 123 124if test "$os_cygwin" = "false"; then 125 # Required for getaddrinfo (TCP IP - IPv6) 126 AC_CHECK_HEADERS([winsock2.h], HAVE_WINSOCK2_H=yes) 127 if test "x$HAVE_WINSOCK2_H" = "xyes"; then 128 LIBS="$LIBS -lws2_32" 129 AC_SUBST(LIBS) 130 fi 131fi 132 133# Check for RS485 support (Linux kernel version 2.6.28+) 134AC_CHECK_DECLS([TIOCSRS485], [], [], [[#include <sys/ioctl.h>]]) 135# Check for RTS flags 136AC_CHECK_DECLS([TIOCM_RTS], [], [], [[#include <sys/ioctl.h>]]) 137 138# Wtype-limits is not supported by gcc 4.2 (default on recent Mac OS X) 139my_CFLAGS="-Wall \ 140-Wmissing-declarations -Wmissing-prototypes \ 141-Wnested-externs -Wpointer-arith \ 142-Wpointer-arith -Wsign-compare -Wchar-subscripts \ 143-Wstrict-prototypes -Wshadow \ 144-Wformat-security" 145AC_SUBST([my_CFLAGS]) 146 147# Build options 148AC_ARG_ENABLE(tests, 149 AS_HELP_STRING([--disable-tests], 150 [Build tests (default: yes)]),, 151 [enable_tests=yes]) 152AM_CONDITIONAL(BUILD_TESTS, [test $enable_tests != no]) 153 154AC_CONFIG_HEADERS([config.h tests/unit-test.h]) 155AC_CONFIG_FILES([ 156 Makefile 157 src/Makefile 158 src/modbus-version.h 159 src/win32/modbus.dll.manifest 160 tests/Makefile 161 doc/Makefile 162 libmodbus.pc 163]) 164 165AC_OUTPUT 166AC_MSG_RESULT([ 167 $PACKAGE $VERSION 168 =============== 169 170 prefix: ${prefix} 171 sysconfdir: ${sysconfdir} 172 libdir: ${libdir} 173 includedir: ${includedir} 174 175 compiler: ${CC} 176 cflags: ${CFLAGS} 177 ldflags: ${LDFLAGS} 178 179 documentation: ${ac_libmodbus_build_doc} 180 tests: ${enable_tests} 181]) 182