]> sigrok.org Git - libserialport.git/blame - configure.ac
Add new APIs to get some USB descriptor details for USB serial ports.
[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 37# We require at least automake 1.11 (needed for 'silent rules').
9fb99134 38AM_INIT_AUTOMAKE([1.11 -Wall -Werror check-news])
0662f2bb
ML
39m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
40m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
41
0662f2bb
ML
42# Enable more compiler warnings via -Wall and -Wextra.
43CFLAGS="$CFLAGS -Wall -Wextra"
44
45# Checks for programs.
46AC_PROG_CC
47AC_PROG_CPP
48AC_PROG_INSTALL
49AC_PROG_LN_S
50
0662f2bb
ML
51# Initialize libtool.
52LT_INIT
53
54# Initialize pkg-config.
f92f1f0c 55# We require at least 0.22, as "Requires.private" behaviour changed there.
0662f2bb
ML
56PKG_PROG_PKG_CONFIG([0.22])
57
58# Library version for libserialport (NOT the same as the package version).
59# Carefully read the libtool docs before updating these numbers!
60# The algorithm for determining which number to change (and how) is nontrivial!
61# http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
62SP_LIB_VERSION_CURRENT=0
63SP_LIB_VERSION_REVISION=0
64SP_LIB_VERSION_AGE=0
65SP_LIB_VERSION="$SP_LIB_VERSION_CURRENT:$SP_LIB_VERSION_REVISION:$SP_LIB_VERSION_AGE"
66SP_LIB_LDFLAGS="-version-info $SP_LIB_VERSION"
67AC_SUBST(SP_LIB_VERSION_CURRENT)
68AC_SUBST(SP_LIB_VERSION_REVISION)
69AC_SUBST(SP_LIB_VERSION_AGE)
70AC_SUBST(SP_LIB_VERSION)
71AC_SUBST(SP_LIB_LDFLAGS)
72
e4bffe06
UH
73# Checks for libraries.
74
75# This variable collects the pkg-config names of all detected libs.
76# It is then used to construct the "Requires.private:" field in the
77# libserialport.pc file.
78SP_PKGLIBS=""
a93fb468 79SP_LIBS=""
0662f2bb 80
1ebf4347
ML
81case $target_os in
82*linux*)
27e231ff 83 AM_CONDITIONAL([LINUX], true)
1ebf4347
ML
84 ;;
85*darwin*)
27e231ff 86 AM_CONDITIONAL([LINUX], false)
1ebf4347
ML
87 LDFLAGS="$LDFLAGS -Wl,-framework -Wl,IOKit -Wl,-framework -Wl,CoreFoundation"
88 AC_CHECK_HEADER(IOKit/IOKitLib.h, [], [AC_MSG_ERROR([IOKit/IOKitLib.h not found])])
89 ;;
a93fb468
AJ
90mingw* | cygwin*)
91 AM_CONDITIONAL([LINUX], false)
92 SP_LIBS="-lsetupapi -luuid"
93 ;;
27e231ff
ML
94*)
95 AM_CONDITIONAL([LINUX], false)
1ebf4347
ML
96esac
97
e4bffe06 98AC_SUBST(SP_PKGLIBS)
a93fb468 99AC_SUBST(SP_LIBS)
e4bffe06 100
7c3a1ee3 101# Define size_t if not defined as standard.
0662f2bb 102AC_TYPE_SIZE_T
2dcf8308
ML
103
104# Check for specific termios structures.
7c3a1ee3
UH
105AC_CHECK_TYPE([struct termios2], [AC_DEFINE(HAVE_TERMIOS2, 1)], [], [[#include <linux/termios.h>]])
106AC_CHECK_TYPE([struct termiox], [AC_DEFINE(HAVE_TERMIOX, 1)], [], [[#include <linux/termios.h>]])
5cea279a
ML
107AC_CHECK_MEMBERS([struct termios.c_ispeed, struct termios.c_ospeed],
108 [AC_DEFINE(HAVE_TERMIOS_SPEED, 1)], [], [[#include <linux/termios.h>]])
109AC_CHECK_MEMBERS([struct termios2.c_ispeed, struct termios2.c_ospeed],
110 [AC_DEFINE(HAVE_TERMIOS2_SPEED, 1)], [], [[#include <linux/termios.h>]])
0662f2bb 111
0662f2bb
ML
112AC_SUBST(MAKEFLAGS, '--no-print-directory')
113AC_SUBST(AM_LIBTOOLFLAGS, '--silent')
114
115SP_PACKAGE_VERSION_MAJOR=sp_package_version_major
116SP_PACKAGE_VERSION_MINOR=sp_package_version_minor
7de20e39 117SP_PACKAGE_VERSION_MICRO=sp_package_version_micro
0662f2bb
ML
118SP_PACKAGE_VERSION=sp_package_version
119
120AC_SUBST(SP_PACKAGE_VERSION_MAJOR)
121AC_SUBST(SP_PACKAGE_VERSION_MINOR)
7de20e39 122AC_SUBST(SP_PACKAGE_VERSION_MICRO)
0662f2bb
ML
123AC_SUBST(SP_PACKAGE_VERSION)
124
baba0759 125AC_CONFIG_FILES([Makefile libserialport.h libserialport.pc])
0662f2bb
ML
126
127AC_OUTPUT
128
129echo
130echo "libserialport configuration summary:"
131echo
7de20e39 132echo " - Package version (major.minor.micro): $SP_PACKAGE_VERSION"
0662f2bb
ML
133echo " - Library version (current:revision:age): $SP_LIB_VERSION"
134echo " - Prefix: $prefix"
135echo " - Building on: $build"
136echo " - Building for: $host"
137echo