Append Git revision hash to package version
[libjaylink.git] / configure.ac
blob37d8f80190d6a42449dfff52afb8e05b6d310d7e
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.1.0], [BUG-REPORT-ADDRESS])
23 AC_CONFIG_HEADERS([config.h])
24 AC_CONFIG_MACRO_DIR([m4])
25 AC_CONFIG_AUX_DIR([build-aux])
27 AC_CANONICAL_HOST
29 AM_INIT_AUTOMAKE([foreign -Wall -Werror])
31 # Enable additional compiler warnings via -Wall and -Wextra. Use hidden
32 # visibility for all non-static symbols by default with -fvisibility=hidden.
33 CFLAGS="$CFLAGS -Wall -Wextra -Werror -fvisibility=hidden"
35 # Checks for programs.
36 AC_PROG_CC
38 # Automake >= 1.12 requires AM_PROG_AR when using options -Wall and -Werror.
39 # To be compatible with older versions of Automake use AM_PROG_AR if it's
40 # defined only. This line must occur before LT_INIT.
41 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
43 # Initialize libtool.
44 LT_INIT
46 # Initialize pkg-config.
47 PKG_PROG_PKG_CONFIG
49 # Checks for libraries.
51 # Check for libusb-1.0 which is always needed.
52 PKG_CHECK_MODULES([libusb], [libusb-1.0 >= 1.0.9],
53         [CFLAGS="$CFLAGS $libusb_CFLAGS"; LIBS="$LIBS $libusb_LIBS"])
55 # Checks for header files.
57 # Checks for typedefs, structures, and compiler characteristics.
58 AC_C_BIGENDIAN
60 # Checks for library functions.
62 # Disable progress and informational output of libtool.
63 AC_SUBST([AM_LIBTOOLFLAGS], '--silent')
65 JAYLINK_SET_PACKAGE_VERSION([JAYLINK_VERSION_PACKAGE], [AC_PACKAGE_VERSION])
67 # Libtool interface version of libjaylink. This is not the same as the package
68 # version. For information about the versioning system of libtool, see:
69 # http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning
70 JAYLINK_VERSION_LIB_CURRENT=0
71 JAYLINK_VERSION_LIB_REVISION=0
72 JAYLINK_VERSION_LIB_AGE=0
73 JAYLINK_VERSION_LIB="$JAYLINK_VERSION_LIB_CURRENT:$JAYLINK_VERSION_LIB_REVISION:$JAYLINK_VERSION_LIB_AGE"
75 AC_SUBST([JAYLINK_VERSION_LIB_CURRENT])
76 AC_SUBST([JAYLINK_VERSION_LIB_REVISION])
77 AC_SUBST([JAYLINK_VERSION_LIB_AGE])
78 AC_SUBST([JAYLINK_VERSION_LIB])
80 AC_ARG_ENABLE([subproject-build], AS_HELP_STRING([--enable-subproject-build],
81         [enable sub-project build [default=no]]))
83 AM_CONDITIONAL([SUBPROJECT_BUILD],
84         [test "x$enable_subproject_build" = "xyes"])
86 # Libtool interface version is not used for sub-project build as libjaylink is
87 # built as libtool convenience library.
88 AS_IF([test "x$enable_subproject_build" != "xyes"],
89         [JAYLINK_LIB_LDFLAGS="-version-info $JAYLINK_VERSION_LIB"])
91 AC_SUBST([JAYLINK_LIB_LDFLAGS])
93 # Use C99 compatible stdio functions on MinGW instead of the incompatible
94 # functions provided by Microsoft.
95 AS_CASE([$host_os], [mingw*],
96         [AC_DEFINE([__USE_MINGW_ANSI_STDIO], [1],
97                 [Define to 1 to use C99 compatible stdio functions on MinGW.])])
99 # Add the Winsock2 library on MinGW for socket and other network-related
100 # functions.
101 AS_CASE([$host_os], [mingw*], [LIBS="$LIBS -lws2_32"])
103 AC_CONFIG_FILES([Makefile])
104 AC_CONFIG_FILES([libjaylink/Makefile])
105 AC_CONFIG_FILES([libjaylink/version.h])
106 AC_CONFIG_FILES([libjaylink.pc])
108 AC_OUTPUT
110 echo
111 echo "libjaylink configuration summary:"
112 echo " - Package version ................ $JAYLINK_VERSION_PACKAGE"
113 echo " - Library version ................ $JAYLINK_VERSION_LIB"
114 echo " - Installation prefix ............ $prefix"
115 echo " - Building on .................... $build"
116 echo " - Building for ................... $host"
117 echo