2 ## This file is part of the libserialport project.
4 ## Copyright (C) 2010-2012 Bert Vermeulen <bert@biot.com>
5 ## Copyright (C) 2013 Martin Ling <martin-libserialport@earth.li>
7 ## This program is free software: you can redistribute it and/or modify
8 ## it under the terms of the GNU Lesser General Public License as
9 ## published by the Free Software Foundation, either version 3 of the
10 ## License, or (at your option) any later version.
12 ## This program is distributed in the hope that it will be useful,
13 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ## GNU General Public License for more details.
17 ## You should have received a copy of the GNU Lesser General Public License
18 ## along with this program. If not, see <http://www.gnu.org/licenses/>.
21 # We require at least autoconf 2.63 (AC_INIT format changed there).
24 # libserialport package version number (NOT the same as shared lib version!).
25 m4_define([sp_package_version_major], [0])
26 m4_define([sp_package_version_minor], [1])
27 m4_define([sp_package_version], [sp_package_version_major.sp_package_version_minor])
29 AC_INIT([libserialport], [sp_package_version], [martin-libserialport@earth.li],
30 [libserialport], [http://github.com/martinling/libserialport])
31 AC_CONFIG_MACRO_DIR([autostuff])
32 AC_CONFIG_AUX_DIR([autostuff])
36 # We require at least automake 1.11 (needed for 'silent rules').
37 AM_INIT_AUTOMAKE([1.11 -Wall -Werror])
38 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
39 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
41 AH_TOP([#ifndef SP_CONFIG_H
42 #define SP_CONFIG_H /* To stop multiple inclusions. */])
43 AH_BOTTOM([#endif /* SP_CONFIG_H */])
45 # Enable more compiler warnings via -Wall and -Wextra.
46 CFLAGS="$CFLAGS -Wall -Wextra"
48 # Checks for programs.
54 # Required for per-target flags or subdir-objects with C sources.
60 # Initialize pkg-config.
61 PKG_PROG_PKG_CONFIG([0.22])
63 # Library version for libserialport (NOT the same as the package version).
64 # Carefully read the libtool docs before updating these numbers!
65 # The algorithm for determining which number to change (and how) is nontrivial!
66 # http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
67 SP_LIB_VERSION_CURRENT=0
68 SP_LIB_VERSION_REVISION=0
70 SP_LIB_VERSION="$SP_LIB_VERSION_CURRENT:$SP_LIB_VERSION_REVISION:$SP_LIB_VERSION_AGE"
71 SP_LIB_LDFLAGS="-version-info $SP_LIB_VERSION"
72 AC_SUBST(SP_LIB_VERSION_CURRENT)
73 AC_SUBST(SP_LIB_VERSION_REVISION)
74 AC_SUBST(SP_LIB_VERSION_AGE)
75 AC_SUBST(SP_LIB_VERSION)
76 AC_SUBST(SP_LIB_LDFLAGS)
78 # Checks for header files.
79 # These are already checked: inttypes.h stdint.h stdlib.h string.h unistd.h.
80 AC_CHECK_HEADERS([sys/types.h sys/stat.h fcntl.h termios.h sys/ioctl.h errno.h])
84 PKG_CHECK_MODULES([libudev], [libudev >= 0],
85 [CFLAGS="$CFLAGS $libudev_CFLAGS"; LIBS="$LIBS $libudev_LIBS"],
86 [AC_MSG_ERROR([libudev.h not found])])
89 LDFLAGS="$LDFLAGS -Wl,-framework -Wl,IOKit -Wl,-framework -Wl,CoreFoundation"
90 AC_CHECK_HEADER(IOKit/IOKitLib.h, [], [AC_MSG_ERROR([IOKit/IOKitLib.h not found])])
94 # Checks for typedefs, structures, and compiler characteristics.
99 # Checks for library functions.
100 AC_CHECK_FUNCS([strerror])
102 AC_SUBST(MAKEFLAGS, '--no-print-directory')
103 AC_SUBST(AM_LIBTOOLFLAGS, '--silent')
105 SP_PACKAGE_VERSION_MAJOR=sp_package_version_major
106 SP_PACKAGE_VERSION_MINOR=sp_package_version_minor
107 SP_PACKAGE_VERSION=sp_package_version
109 AC_SUBST(SP_PACKAGE_VERSION_MAJOR)
110 AC_SUBST(SP_PACKAGE_VERSION_MINOR)
111 AC_SUBST(SP_PACKAGE_VERSION)
113 AC_CONFIG_FILES([Makefile libserialport.pc])
118 echo "libserialport configuration summary:"
120 echo " - Package version (major.minor): $SP_PACKAGE_VERSION"
121 echo " - Library version (current:revision:age): $SP_LIB_VERSION"
122 echo " - Prefix: $prefix"
123 echo " - Building on: $build"
124 echo " - Building for: $host"