Add missing call to libusb_exit()
[libjaylink.git] / configure.ac
blobe63400c7407d4bbdcaf1a686c362d4dea77c65b9
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 AC_INIT([libjaylink], [0.2.0], [jaylink-dev@marcschink.de], [libjaylink],
23         [http://git.zapb.de/libjaylink.git])
24 AC_CONFIG_HEADERS([config.h])
25 AC_CONFIG_MACRO_DIR([m4])
26 AC_CONFIG_AUX_DIR([build-aux])
28 AC_CANONICAL_HOST
30 AM_INIT_AUTOMAKE([-Wall -Werror check-news])
32 # Enable additional compiler warnings via -Wall and -Wextra. Use hidden
33 # visibility for all non-static symbols by default with -fvisibility=hidden.
34 JAYLINK_CFLAGS="-Wall -Wextra -Werror -fvisibility=hidden"
36 # Checks for programs.
37 AC_PROG_CC
39 # Automake >= 1.12 requires AM_PROG_AR when using options -Wall and -Werror.
40 # To be compatible with older versions of Automake use AM_PROG_AR if it's
41 # defined only. This line must occur before LT_INIT.
42 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
44 # Initialize libtool.
45 LT_INIT
47 # Initialize pkg-config.
48 PKG_PROG_PKG_CONFIG
50 # Checks for libraries.
52 # Check for libusb-1.0 which is always needed.
53 PKG_CHECK_MODULES([libusb], [libusb-1.0 >= 1.0.9],
54         [HAVE_LIBUSB=yes], [HAVE_LIBUSB=no])
56 AS_IF([test "x$HAVE_LIBUSB" = "xyes"],
57         [libusb_msg="yes"], [libusb_msg="no (missing: libusb-1.0)"])
59 # Checks for header files.
61 # Checks for typedefs, structures, and compiler characteristics.
62 AC_C_BIGENDIAN
64 # Checks for library functions.
66 # Disable progress and informational output of libtool.
67 AC_SUBST([AM_LIBTOOLFLAGS], '--silent')
69 JAYLINK_SET_PACKAGE_VERSION([JAYLINK_VERSION_PACKAGE], [AC_PACKAGE_VERSION])
71 # Libtool interface version of libjaylink. This is not the same as the package
72 # version. For information about the versioning system of libtool, see:
73 # http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning
74 JAYLINK_SET_LIBRARY_VERSION([JAYLINK_VERSION_LIBRARY], [0:0:0])
76 AC_ARG_ENABLE([subproject-build], AS_HELP_STRING([--enable-subproject-build],
77         [enable sub-project build [default=no]]))
79 AM_CONDITIONAL([SUBPROJECT_BUILD],
80         [test "x$enable_subproject_build" = "xyes"])
82 AC_ARG_WITH([libusb], [AS_HELP_STRING([--without-libusb],
83         [disable libusb support [default=detect]])])
85 AS_IF([test "x$with_libusb" != "xno"],
86         [with_libusb="yes"])
88 AS_IF([test "x$with_libusb$HAVE_LIBUSB" = "xyesyes"],
89         [AC_DEFINE([HAVE_LIBUSB], [1], [Define to 1 if libusb is available.])])
91 AS_IF([test "x$with_libusb" != "xyes"],
92         [libusb_msg="no (disabled)"])
94 AS_IF([test "x$with_libusb$HAVE_LIBUSB" = "xyesyes"],
95         [JAYLINK_PKG_LIBS="libusb-1.0"])
97 AM_CONDITIONAL([HAVE_LIBUSB],
98         [test "x$with_libusb$HAVE_LIBUSB" = "xyesyes"])
100 # Libtool interface version is not used for sub-project build as libjaylink is
101 # built as libtool convenience library.
102 AS_IF([test "x$enable_subproject_build" != "xyes"],
103         [JAYLINK_LDFLAGS="-version-info $JAYLINK_VERSION_LIBRARY"])
105 # Use C99 compatible stdio functions on MinGW instead of the incompatible
106 # functions provided by Microsoft.
107 AS_CASE([$host_os], [mingw*],
108         [AC_DEFINE([__USE_MINGW_ANSI_STDIO], [1],
109                 [Define to 1 to use C99 compatible stdio functions on MinGW.])])
111 # Add the Winsock2 library on MinGW for socket and other network-related
112 # functions.
113 AS_CASE([$host_os], [mingw*], [JAYLINK_LIBS="$JAYLINK_LIBS -lws2_32"])
115 AC_SUBST([JAYLINK_CFLAGS])
116 AC_SUBST([JAYLINK_LDFLAGS])
117 AC_SUBST([JAYLINK_LIBS])
118 AC_SUBST([JAYLINK_PKG_LIBS])
120 AC_CONFIG_FILES([Makefile])
121 AC_CONFIG_FILES([libjaylink/Makefile])
122 AC_CONFIG_FILES([libjaylink/version.h])
123 AC_CONFIG_FILES([libjaylink.pc])
124 AC_CONFIG_FILES([Doxyfile])
126 AC_OUTPUT
128 echo
129 echo "libjaylink configuration summary:"
130 echo " - Package version ................ $JAYLINK_VERSION_PACKAGE"
131 echo " - Library version ................ $JAYLINK_VERSION_LIBRARY"
132 echo " - Installation prefix ............ $prefix"
133 echo " - Building on .................... $build"
134 echo " - Building for ................... $host"
136 echo
137 echo "Enabled transports:"
138 echo " - USB ............................ $libusb_msg"
139 echo " - TCP ............................ yes"
140 echo