aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
blob: 916291ceb19647a162a667f334d271e8fbcec693 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
##
## This file is part of the libjaylink project.
##
## Copyright (C) 2014-2015 Marc Schink <jaylink-dev@marcschink.de>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program.  If not, see <http://www.gnu.org/licenses/>.
##

AC_PREREQ([2.64])

AC_INIT([libjaylink], [0.2.0], [jaylink-dev@marcschink.de], [libjaylink],
	[http://git.zapb.de/libjaylink.git])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build-aux])

AC_CANONICAL_HOST

AM_INIT_AUTOMAKE([-Wall -Werror check-news])

# Enable additional compiler warnings via -Wall and -Wextra. Use hidden
# visibility for all non-static symbols by default with -fvisibility=hidden.
JAYLINK_CFLAGS="-Wall -Wextra -Werror -fvisibility=hidden"

# Checks for programs.
AC_PROG_CC

# Automake >= 1.12 requires AM_PROG_AR when using options -Wall and -Werror.
# To be compatible with older versions of Automake use AM_PROG_AR if it's
# defined only. This line must occur before LT_INIT.
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])

# Initialize libtool.
LT_INIT

# Initialize pkg-config.
PKG_PROG_PKG_CONFIG

# Checks for libraries.

# Check for libusb-1.0 which is always needed.
PKG_CHECK_MODULES([libusb], [libusb-1.0 >= 1.0.9],
	[HAVE_LIBUSB=yes], [HAVE_LIBUSB=no])

AS_IF([test "x$HAVE_LIBUSB" = "xyes"],
	[AC_DEFINE([HAVE_LIBUSB], [1], [Define to 1 if libusb is available.])])

AS_IF([test "x$HAVE_LIBUSB" = "xyes"],
	[JAYLINK_PKG_LIBS="libusb-1.0"])

AS_IF([test "x$HAVE_LIBUSB" = "xyes"],
	[libusb_msg="yes"], [libusb_msg="no (missing: libusb-1.0)"])

AM_CONDITIONAL([HAVE_LIBUSB],
	[test "x$HAVE_LIBUSB" = "xyes"])

# Checks for header files.

# Checks for typedefs, structures, and compiler characteristics.
AC_C_BIGENDIAN

# Checks for library functions.

# Disable progress and informational output of libtool.
AC_SUBST([AM_LIBTOOLFLAGS], '--silent')

JAYLINK_SET_PACKAGE_VERSION([JAYLINK_VERSION_PACKAGE], [AC_PACKAGE_VERSION])

# Libtool interface version of libjaylink. This is not the same as the package
# version. For information about the versioning system of libtool, see:
# http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning
JAYLINK_SET_LIBRARY_VERSION([JAYLINK_VERSION_LIBRARY], [0:0:0])

AC_ARG_ENABLE([subproject-build], AS_HELP_STRING([--enable-subproject-build],
	[enable sub-project build [default=no]]))

AM_CONDITIONAL([SUBPROJECT_BUILD],
	[test "x$enable_subproject_build" = "xyes"])

# Libtool interface version is not used for sub-project build as libjaylink is
# built as libtool convenience library.
AS_IF([test "x$enable_subproject_build" != "xyes"],
	[JAYLINK_LDFLAGS="-version-info $JAYLINK_VERSION_LIBRARY"])

# Use C99 compatible stdio functions on MinGW instead of the incompatible
# functions provided by Microsoft.
AS_CASE([$host_os], [mingw*],
	[AC_DEFINE([__USE_MINGW_ANSI_STDIO], [1],
		[Define to 1 to use C99 compatible stdio functions on MinGW.])])

# Add the Winsock2 library on MinGW for socket and other network-related
# functions.
AS_CASE([$host_os], [mingw*], [JAYLINK_LIBS="$JAYLINK_LIBS -lws2_32"])

AC_SUBST([JAYLINK_CFLAGS])
AC_SUBST([JAYLINK_LDFLAGS])
AC_SUBST([JAYLINK_LIBS])
AC_SUBST([JAYLINK_PKG_LIBS])

AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([libjaylink/Makefile])
AC_CONFIG_FILES([libjaylink/version.h])
AC_CONFIG_FILES([libjaylink.pc])
AC_CONFIG_FILES([Doxyfile])

AC_OUTPUT

echo
echo "libjaylink configuration summary:"
echo " - Package version ................ $JAYLINK_VERSION_PACKAGE"
echo " - Library version ................ $JAYLINK_VERSION_LIBRARY"
echo " - Installation prefix ............ $prefix"
echo " - Building on .................... $build"
echo " - Building for ................... $host"

echo
echo "Enabled transports:"
echo " - USB ............................ $libusb_msg"
echo " - TCP ............................ yes"
echo