summaryrefslogtreecommitdiff
path: root/Build/source/texk/gregorio/gregorio-src/configure.ac
blob: 6a8dde28bca9177b07dc6e7aef83638da1e64d2e (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
dnl Gregorio
dnl Copyright (C) 2006-2015 The Gregorio Project (see CONTRIBUTORS.md)
dnl
dnl This file is part of Gregorio.
dnl
dnl Gregorio is free software: you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation, either version 3 of the License, or
dnl (at your option) any later version.
dnl
dnl Gregorio is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with Gregorio.  If not, see <http://www.gnu.org/licenses/>.

AC_INIT([gregorio],[4.1.1],[https://github.com/gregorio-project/gregorio/issues],[gregorio],[http://gregorio-project.github.io/])
FILENAME_VERSION="4_1_1"
AC_SUBST(FILENAME_VERSION)
AC_DEFINE_UNQUOTED(FILENAME_VERSION, "$FILENAME_VERSION", [version suitable for file names])
MK=""
AC_SUBST(MK)
AC_PREREQ(2.59)
AC_CONFIG_SRCDIR([src/gregorio-utils.c])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])

AM_INIT_AUTOMAKE([-Wall -Wno-portability subdir-objects foreign dist-bzip2 no-dist-gzip])

AC_PROG_CC
dnl AM_PROG_CC_C_O is deprecated since Automake 1.14, to be removed in the future
AM_PROG_CC_C_O
AC_PROG_CPP
AM_PROG_LEX
AC_PROG_YACC
AC_CHECK_TOOL([RC], [windres], [no])
AM_CONDITIONAL([HAVE_RC], [test x$RC != xno])

AX_CHECK_COMPILE_FLAG([-std=gnu89], [CFLAGS+=" -std=gnu89"])
dnl until flex gets their act together, use pedantic instead of pedantic-errors
AX_CHECK_COMPILE_FLAG([-pedantic], [CFLAGS+=" -pedantic"])
dnl AX_CHECK_COMPILE_FLAG([-pedantic-errors], [CFLAGS+=" -pedantic-errors"])
AX_CHECK_COMPILE_FLAG([-fstack-protector-strong], [CFLAGS+=" -fstack-protector-strong"])
AX_CHECK_COMPILE_FLAG([-fPIE], [CFLAGS+=" -fPIE"])
AX_CHECK_COMPILE_FLAG([-Wformat=2], [CFLAGS+=" -Wformat=2"])
AX_CHECK_COMPILE_FLAG([-Werror=format-security], [CFLAGS+=" -Werror=format-security"])
AX_CHECK_COMPILE_FLAG([-Wstrict-prototypes], [CFLAGS+=" -Wstrict-prototypes"])
AX_CHECK_COMPILE_FLAG([-Wdeclaration-after-statement], [CFLAGS+=" -Wdeclaration-after-statement"])
AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS+=" -Wall"])
AX_CHECK_COMPILE_FLAG([-Wextra], [CFLAGS+=" -Wextra"])
CPPFLAGS+=" -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 "
AX_CHECK_LINK_FLAG([-Wl,-z,relro], [LDFLAGS+=" -Wl,-z,relro"])
AX_CHECK_LINK_FLAG([-Wl,-z,now], [LDFLAGS+=" -Wl,-z,now"])
AX_CHECK_LINK_FLAG([-fPIE], [LDFLAGS+=" -fPIE"])
AX_CHECK_LINK_FLAG([-pie], [LDFLAGS+=" -pie"])

AC_HEADER_STDC

gl_FUNC_REALPATH_WORKS

dnl linux has integer types in stdint.h, solaris, vms in inttypes.h
AC_CHECK_HEADERS([stdint.h])
AC_CHECK_HEADERS([stdalign.h])

AC_DEFINE([_GNU_SOURCE], [1], [Always define this.])

AC_C_BIGENDIAN

AC_ARG_WITH([kpathsea], AS_HELP_STRING([--with-kpathsea], [Build with kpathsea.]))

AS_IF([test "x$with_kpathsea" = "xyes"], [
    PKG_PROG_PKG_CONFIG
    PKG_CHECK_MODULES([KPSE], [kpathsea], AC_DEFINE([USE_KPSE], [1], [Use kpathsea]),
      dnl if pkg-config doesn't know kpathsea, try -lkpathsea (the most common case)
      AC_CHECK_LIB([kpathsea], [kpse_set_program_name], [
          AC_DEFINE([USE_KPSE], [1], [Use kpathsea])
          KPSE_LIBS=" -lkpathsea"
      ], [
          AC_MSG_ERROR([unable to find the kpathsea library])
      ])
    )
])

AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug@<:@=sanitize,coverage@:>@], [Enable debugging options [with additional sanitize options].]), [
    AS_IF([test "x$enableval" != "xno"], [
        dnl AX_CHECK_COMPILE_FLAG([-g], [CFLAGS+=" -g"])
        AX_CHECK_COMPILE_FLAG([-Og], [CFLAGS+=" -Og"], [
            AX_CHECK_COMPILE_FLAG([-O0], [CFLAGS+=" -O0"])
        ])
        AS_IF([test "x$enableval" = "xsanitize"], [
            AX_CHECK_COMPILE_FLAG([-fsanitize=address,undefined], [CFLAGS+=" -fsanitize=address,undefined"])
        ])
        AS_IF([test "x$enableval" = "xcoverage"], [
            AX_CHECK_COMPILE_FLAG([--coverage], [CFLAGS+=" --coverage"])
            AX_CHECK_LINK_FLAG([--coverage], [LDFLAGS+=" --coverage"])
        ])
    ])
])

AC_CONFIG_HEADERS([src/config_.h])
AC_CONFIG_FILES([
    Makefile
    src/Makefile
    examples/Makefile
    contrib/Makefile
    doc/Makefile
    tex/Makefile
    fonts/Makefile
])
AC_OUTPUT