Allow jaylink_close() to return errors
[libjaylink.git] / configure.ac
blobd8c15d7b4ed34bf7c8072cf6c58fc22894288d0a
1 ##
2 ## This file is part of the libjaylink project.
3 ##
4 ## Copyright (C) 2014-2015 Marc Schink <jaylink-dev@marcschink.de>
5 ##
6 ## This program is free software: you can redistribute it and/or modify
7 ## it under the terms of the GNU General Public License as published by
8 ## the Free Software Foundation, either version 2 of the License, or
9 ## (at your option) any later version.
11 ## This program is distributed in the hope that it will be useful,
12 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 ## GNU General Public License for more details.
16 ## You should have received a copy of the GNU General Public License
17 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
20 AC_PREREQ([2.64])
22 # Package version of libjaylink. This is not the same as the libtool interface
23 # version.
24 m4_define([jaylink_version_package_major], [0])
25 m4_define([jaylink_version_package_minor], [1])
26 m4_define([jaylink_version_package_micro], [0])
27 m4_define([jaylink_version_package], [jaylink_version_package_major.jaylink_version_package_minor.jaylink_version_package_micro])
29 AC_INIT([libjaylink], [jaylink_version_package], [BUG-REPORT-ADDRESS])
30 AC_CONFIG_HEADERS([config.h])
31 AC_CONFIG_MACRO_DIR([m4])
32 AC_CONFIG_AUX_DIR([build-aux])
34 AC_CANONICAL_HOST
36 AM_INIT_AUTOMAKE([foreign -Wall -Werror])
38 # Enable additional compiler warnings via -Wall and -Wextra. Use hidden
39 # visibility for all non-static symbols by default with -fvisibility=hidden.
40 CFLAGS="$CFLAGS -Wall -Wextra -Werror -fvisibility=hidden"
42 # Checks for programs.
43 AC_PROG_CC
45 # Automake >= 1.12 requires AM_PROG_AR when using options -Wall and -Werror.
46 # To be compatible with older versions of Automake use AM_PROG_AR if it's
47 # defined only. This line must occur before LT_INIT.
48 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
50 # Initialize libtool.
51 LT_INIT
53 # Initialize pkg-config.
54 PKG_PROG_PKG_CONFIG
56 # Checks for libraries.
58 # Check for libusb-1.0 which is always needed.
59 PKG_CHECK_MODULES([libusb], [libusb-1.0 >= 1.0.9],
60         [CFLAGS="$CFLAGS $libusb_CFLAGS"; LIBS="$LIBS $libusb_LIBS"])
62 # Checks for header files.
64 # Checks for typedefs, structures, and compiler characteristics.
65 AC_C_BIGENDIAN
67 # Checks for library functions.
69 # Disable progress and informational output of libtool.
70 AC_SUBST([AM_LIBTOOLFLAGS], '--silent')
72 # Libtool interface version of libjaylink. This is not the same as the package
73 # version. For information about the versioning system of libtool, see:
74 # http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning
75 JAYLINK_VERSION_LIB_CURRENT=0
76 JAYLINK_VERSION_LIB_REVISION=0
77 JAYLINK_VERSION_LIB_AGE=0
78 JAYLINK_VERSION_LIB="$JAYLINK_VERSION_LIB_CURRENT:$JAYLINK_VERSION_LIB_REVISION:$JAYLINK_VERSION_LIB_AGE"
80 AC_SUBST([JAYLINK_VERSION_LIB_CURRENT])
81 AC_SUBST([JAYLINK_VERSION_LIB_REVISION])
82 AC_SUBST([JAYLINK_VERSION_LIB_AGE])
83 AC_SUBST([JAYLINK_VERSION_LIB])
85 AC_ARG_ENABLE([subproject-build], AS_HELP_STRING([--enable-subproject-build],
86         [enable sub-project build [default=no]]))
88 AM_CONDITIONAL([SUBPROJECT_BUILD],
89         [test "x$enable_subproject_build" = "xyes"])
91 # Libtool interface version is not used for sub-project build as libjaylink is
92 # built as libtool convenience library.
93 AS_IF([test "x$enable_subproject_build" != "xyes"],
94         [JAYLINK_LIB_LDFLAGS="-version-info $JAYLINK_VERSION_LIB"])
96 AC_SUBST([JAYLINK_LIB_LDFLAGS])
98 JAYLINK_VERSION_PACKAGE_MAJOR=jaylink_version_package_major
99 JAYLINK_VERSION_PACKAGE_MINOR=jaylink_version_package_minor
100 JAYLINK_VERSION_PACKAGE_MICRO=jaylink_version_package_micro
101 JAYLINK_VERSION_PACKAGE=jaylink_version_package
103 AC_SUBST([JAYLINK_VERSION_PACKAGE_MAJOR])
104 AC_SUBST([JAYLINK_VERSION_PACKAGE_MINOR])
105 AC_SUBST([JAYLINK_VERSION_PACKAGE_MICRO])
106 AC_SUBST([JAYLINK_VERSION_PACKAGE])
108 # Use C99 compatible stdio functions on MinGW instead of the incompatible
109 # functions provided by Microsoft.
110 AS_CASE([$host_os], [mingw*],
111         [AC_DEFINE([__USE_MINGW_ANSI_STDIO], [1],
112                 [Define to 1 to use C99 compatible stdio functions on MinGW.])])
114 AC_CONFIG_FILES([Makefile])
115 AC_CONFIG_FILES([libjaylink/Makefile])
116 AC_CONFIG_FILES([libjaylink/version.h])
117 AC_CONFIG_FILES([libjaylink.pc])
119 AC_OUTPUT
121 echo
122 echo "libjaylink configuration summary:"
123 echo " - Package version ................ $JAYLINK_VERSION_PACKAGE"
124 echo " - Library version ................ $JAYLINK_VERSION_LIB"
125 echo " - Installation prefix ............ $prefix"
126 echo " - Building on .................... $build"
127 echo " - Building for ................... $host"
128 echo