|
@@ -22,13 +22,19 @@ m4_define([libmodbus_version],
|
|
|
[libmodbus_version_major.libmodbus_version_minor.libmodbus_version_micro])
|
|
|
|
|
|
AC_PREREQ([2.63])
|
|
|
-AC_INIT([libmodbus],[libmodbus_version],
|
|
|
-[https://github.com/stephane/libmodbus/issues])
|
|
|
-AC_CONFIG_HEADERS([config.h tests/unit-test.h])
|
|
|
-AM_INIT_AUTOMAKE([foreign])
|
|
|
-# enable nice build output on automake1.11
|
|
|
-m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
|
|
|
+AC_INIT([libmodbus],
|
|
|
+ [libmodbus_version],
|
|
|
+ [https://github.com/stephane/libmodbus/issues],
|
|
|
+ [libmodbus],
|
|
|
+ [http://libmodbus.org/])
|
|
|
+AC_CONFIG_SRCDIR([src/modbus.c])
|
|
|
+AC_CONFIG_AUX_DIR([build-aux])
|
|
|
+AM_INIT_AUTOMAKE([check-news foreign 1.11 -Wall -Wno-portability silent-rules tar-pax no-dist-gzip dist-xz subdir-objects])
|
|
|
+AC_PROG_CC_STDC
|
|
|
+AC_USE_SYSTEM_EXTENSIONS
|
|
|
+AC_SYS_LARGEFILE
|
|
|
AC_CONFIG_MACRO_DIR([m4])
|
|
|
+AM_SILENT_RULES([yes])
|
|
|
|
|
|
LIBMODBUS_VERSION_MAJOR=libmodbus_version_major
|
|
|
LIBMODBUS_VERSION_MINOR=libmodbus_version_minor
|
|
@@ -54,20 +60,16 @@ os_win32="false"
|
|
|
os_qnx="false"
|
|
|
case "${host_os}" in
|
|
|
*mingw32*)
|
|
|
- os_win32="true"
|
|
|
- ;;
|
|
|
+ os_win32="true"
|
|
|
+ ;;
|
|
|
*nto-qnx*)
|
|
|
- os_qnx="true"
|
|
|
- ;;
|
|
|
+ os_qnx="true"
|
|
|
+ ;;
|
|
|
esac
|
|
|
AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "true")
|
|
|
AM_CONDITIONAL(OS_QNX, test "$os_qnx" = "true")
|
|
|
|
|
|
-# Checks for programs.
|
|
|
-AC_PROG_CC
|
|
|
-AC_PROG_CXX
|
|
|
-AC_PROG_MAKE_SET
|
|
|
-LT_INIT([disable-static win32-dll])
|
|
|
+LT_INIT([disable-static win32-dll pic-only])
|
|
|
AC_CHECK_HEADERS([ \
|
|
|
arpa/inet.h \
|
|
|
errno.h \
|
|
@@ -89,18 +91,6 @@ AC_CHECK_HEADERS([ \
|
|
|
# Check whether to build docs / install man pages
|
|
|
AC_LIBMODBUS_CHECK_DOC_BUILD
|
|
|
|
|
|
-# Checks for header files.
|
|
|
-AC_HEADER_STDC
|
|
|
-
|
|
|
-# Checks for typedefs, structures, and compiler characteristics.
|
|
|
-AC_C_CONST
|
|
|
-AC_TYPE_SIZE_T
|
|
|
-AC_HEADER_TIME
|
|
|
-# AC_TYPE_UINT*_T: not supported by autoconf-2.59 of CentOS 5.3
|
|
|
-# AC_TYPE_UINT16_T
|
|
|
-# AC_TYPE_UINT32_T
|
|
|
-# AC_TYPE_UINT8_T
|
|
|
-
|
|
|
# Cygwin defines IPTOS_LOWDELAY but can't handle that flag so it's necessary to
|
|
|
# workaround that problem and Cygwin doesn't define MSG_DONTWAIT.
|
|
|
AC_CHECK_DECLS([__CYGWIN__])
|
|
@@ -109,21 +99,6 @@ AC_CHECK_DECLS([__CYGWIN__])
|
|
|
AC_FUNC_FORK
|
|
|
AC_CHECK_FUNCS([accept4 getaddrinfo gettimeofday inet_ntoa memset select socket strerror strlcpy])
|
|
|
|
|
|
-# Add -Wall -Werror for GCC if not already there
|
|
|
-if test "x$GCC" = "xyes"; then
|
|
|
- case " $CFLAGS " in
|
|
|
- *[[\ \ ]]-Wall[[\ \ ]]*) ;;
|
|
|
- *) CFLAGS="$CFLAGS -Wall" ;;
|
|
|
- esac
|
|
|
-fi
|
|
|
-
|
|
|
-if test "x$GCC" = "xyes"; then
|
|
|
- case " $CFLAGS " in
|
|
|
- *[[\ \ ]]-Werror[[\ \ ]]*) ;;
|
|
|
- *) CFLAGS="$CFLAGS -Werror" ;;
|
|
|
- esac
|
|
|
-fi
|
|
|
-
|
|
|
# Required for getaddrinfo (TCP PI - IPv6)
|
|
|
AC_CHECK_HEADERS([winsock2.h], HAVE_WINSOCK2_H=yes)
|
|
|
if test "x$HAVE_WINSOCK2_H" = "xyes"; then
|
|
@@ -136,6 +111,15 @@ AC_CHECK_DECLS([TIOCSRS485], [], [], [[#include <sys/ioctl.h>]])
|
|
|
# Check for RTS flags
|
|
|
AC_CHECK_DECLS([TIOCM_RTS], [], [], [[#include <sys/ioctl.h>]])
|
|
|
|
|
|
+my_CFLAGS="-Wall \
|
|
|
+-Wmissing-declarations -Wmissing-prototypes \
|
|
|
+-Wnested-externs -Wpointer-arith \
|
|
|
+-Wpointer-arith -Wsign-compare -Wchar-subscripts \
|
|
|
+-Wstrict-prototypes -Wshadow \
|
|
|
+-Wformat-security -Wtype-limits"
|
|
|
+AC_SUBST([my_CFLAGS])
|
|
|
+
|
|
|
+AC_CONFIG_HEADERS([config.h tests/unit-test.h])
|
|
|
AC_CONFIG_FILES([
|
|
|
Makefile
|
|
|
src/Makefile
|
|
@@ -146,4 +130,18 @@ AC_CONFIG_FILES([
|
|
|
libmodbus.pc
|
|
|
libmodbus.spec
|
|
|
])
|
|
|
+
|
|
|
AC_OUTPUT
|
|
|
+AC_MSG_RESULT([
|
|
|
+ $PACKAGE $VERSION
|
|
|
+ ===============
|
|
|
+
|
|
|
+ prefix: ${prefix}
|
|
|
+ sysconfdir: ${sysconfdir}
|
|
|
+ libdir: ${libdir}
|
|
|
+ includedir: ${includedir}
|
|
|
+
|
|
|
+ compiler: ${CC}
|
|
|
+ cflags: ${CFLAGS}
|
|
|
+ ldflags: ${LDFLAGS}
|
|
|
+])
|