]> sigrok.org Git - libserialport.git/blame - configure.ac
Doxyfile: Update to Doxygen 1.8.5 config file.
[libserialport.git] / configure.ac
CommitLineData
0662f2bb
ML
1##
2## This file is part of the libserialport project.
3##
4## Copyright (C) 2010-2012 Bert Vermeulen <bert@biot.com>
5## Copyright (C) 2013 Martin Ling <martin-libserialport@earth.li>
6##
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.
11##
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.
16##
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/>.
19##
20
21# We require at least autoconf 2.63 (AC_INIT format changed there).
22AC_PREREQ([2.63])
23
24# libserialport package version number (NOT the same as shared lib version!).
25m4_define([sp_package_version_major], [0])
26m4_define([sp_package_version_minor], [1])
7de20e39
UH
27m4_define([sp_package_version_micro], [0])
28m4_define([sp_package_version], [sp_package_version_major.sp_package_version_minor.sp_package_version_micro])
0662f2bb
ML
29
30AC_INIT([libserialport], [sp_package_version], [martin-libserialport@earth.li],
728f6de5 31 [libserialport], [http://sigrok.org/wiki/Libserialport])
0662f2bb
ML
32AC_CONFIG_MACRO_DIR([autostuff])
33AC_CONFIG_AUX_DIR([autostuff])
34
1ebf4347
ML
35AC_CANONICAL_TARGET
36
0662f2bb
ML
37# We require at least automake 1.11 (needed for 'silent rules').
38AM_INIT_AUTOMAKE([1.11 -Wall -Werror])
39m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
40m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
41
42AH_TOP([#ifndef SP_CONFIG_H
43#define SP_CONFIG_H /* To stop multiple inclusions. */])
44AH_BOTTOM([#endif /* SP_CONFIG_H */])
45
46# Enable more compiler warnings via -Wall and -Wextra.
47CFLAGS="$CFLAGS -Wall -Wextra"
48
49# Checks for programs.
50AC_PROG_CC
51AC_PROG_CPP
52AC_PROG_INSTALL
53AC_PROG_LN_S
54
55# Required for per-target flags or subdir-objects with C sources.
56AM_PROG_CC_C_O
57
58# Initialize libtool.
59LT_INIT
60
61# Initialize pkg-config.
f92f1f0c 62# We require at least 0.22, as "Requires.private" behaviour changed there.
0662f2bb
ML
63PKG_PROG_PKG_CONFIG([0.22])
64
65# Library version for libserialport (NOT the same as the package version).
66# Carefully read the libtool docs before updating these numbers!
67# The algorithm for determining which number to change (and how) is nontrivial!
68# http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
69SP_LIB_VERSION_CURRENT=0
70SP_LIB_VERSION_REVISION=0
71SP_LIB_VERSION_AGE=0
72SP_LIB_VERSION="$SP_LIB_VERSION_CURRENT:$SP_LIB_VERSION_REVISION:$SP_LIB_VERSION_AGE"
73SP_LIB_LDFLAGS="-version-info $SP_LIB_VERSION"
74AC_SUBST(SP_LIB_VERSION_CURRENT)
75AC_SUBST(SP_LIB_VERSION_REVISION)
76AC_SUBST(SP_LIB_VERSION_AGE)
77AC_SUBST(SP_LIB_VERSION)
78AC_SUBST(SP_LIB_LDFLAGS)
79
e4bffe06
UH
80# Checks for libraries.
81
82# This variable collects the pkg-config names of all detected libs.
83# It is then used to construct the "Requires.private:" field in the
84# libserialport.pc file.
85SP_PKGLIBS=""
0662f2bb 86
1ebf4347
ML
87case $target_os in
88*linux*)
397d89de
ML
89 # On Linux libudev is currently required for enumeration.
90 AC_ARG_WITH([libudev],
91 [AS_HELP_STRING([--with-libudev],
92 [use libudev for serial port enumeration @<:@default=check@:>@])],
93 [], [with_libudev=check])
94 AS_IF([test "x$with_libudev" != xno], [
1ebf4347 95 PKG_CHECK_MODULES([libudev], [libudev >= 0],
e4bffe06 96 [CFLAGS="$CFLAGS $libudev_CFLAGS"; LIBS="$LIBS $libudev_LIBS";
397d89de 97 SP_PKGLIBS="$SP_PKGLIBS libudev"; AC_DEFINE(HAVE_LIBUDEV)])], [])
1ebf4347
ML
98 ;;
99*darwin*)
100 LDFLAGS="$LDFLAGS -Wl,-framework -Wl,IOKit -Wl,-framework -Wl,CoreFoundation"
101 AC_CHECK_HEADER(IOKit/IOKitLib.h, [], [AC_MSG_ERROR([IOKit/IOKitLib.h not found])])
102 ;;
103esac
104
e4bffe06
UH
105AC_SUBST(SP_PKGLIBS)
106
107# Checks for header files.
108# These are already checked: inttypes.h dlfcn.h memory.h stdint.h stdlib.h
109# string.h strings.h sys/types.h sys/stat.h unistd.h
110AC_CHECK_HEADERS([errno.h fcntl.h stddef.h sys/ioctl.h termios.h])
111
0662f2bb
ML
112# Checks for typedefs, structures, and compiler characteristics.
113AC_C_INLINE
114AC_TYPE_SIZE_T
115AC_TYPE_SSIZE_T
7a6d2196 116AC_CHECK_TYPE([struct termios2],[AC_DEFINE(HAVE_TERMIOS2, 1)],[],[[#include <linux/termios.h>]])
40978c2b 117AC_CHECK_TYPE([struct termiox],[AC_DEFINE(HAVE_TERMIOX, 1)],[],[[#include <linux/termios.h>]])
0662f2bb
ML
118
119# Checks for library functions.
120AC_CHECK_FUNCS([strerror])
121
122AC_SUBST(MAKEFLAGS, '--no-print-directory')
123AC_SUBST(AM_LIBTOOLFLAGS, '--silent')
124
125SP_PACKAGE_VERSION_MAJOR=sp_package_version_major
126SP_PACKAGE_VERSION_MINOR=sp_package_version_minor
7de20e39 127SP_PACKAGE_VERSION_MICRO=sp_package_version_micro
0662f2bb
ML
128SP_PACKAGE_VERSION=sp_package_version
129
130AC_SUBST(SP_PACKAGE_VERSION_MAJOR)
131AC_SUBST(SP_PACKAGE_VERSION_MINOR)
7de20e39 132AC_SUBST(SP_PACKAGE_VERSION_MICRO)
0662f2bb
ML
133AC_SUBST(SP_PACKAGE_VERSION)
134
baba0759 135AC_CONFIG_FILES([Makefile libserialport.h libserialport.pc])
0662f2bb
ML
136
137AC_OUTPUT
138
139echo
140echo "libserialport configuration summary:"
141echo
7de20e39 142echo " - Package version (major.minor.micro): $SP_PACKAGE_VERSION"
0662f2bb
ML
143echo " - Library version (current:revision:age): $SP_LIB_VERSION"
144echo " - Prefix: $prefix"
145echo " - Building on: $build"
146echo " - Building for: $host"
147echo