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