Debian Codegraph @

texk/gregorio/gregorio-src/configure.ac

raw
1 dnl Gregorio
2 dnl Copyright (C) 2006-2025 The Gregorio Project (see CONTRIBUTORS.md)
3 dnl
4 dnl This file is part of Gregorio.
5 dnl
6 dnl Gregorio is free software: you can redistribute it and/or modify
7 dnl it under the terms of the GNU General Public License as published by
8 dnl the Free Software Foundation, either version 3 of the License, or
9 dnl (at your option) any later version.
10 dnl
11 dnl Gregorio is distributed in the hope that it will be useful,
12 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 dnl GNU General Public License for more details.
15 dnl
16 dnl You should have received a copy of the GNU General Public License
17 dnl along with Gregorio. If not, see <http://www.gnu.org/licenses/>.
18
19 AC_INIT([gregorio],[6.1.0],[https://github.com/gregorio-project/gregorio/issues],[gregorio],[http://gregorio-project.github.io/])
20 FILENAME_VERSION="6_1_0"
21 AC_SUBST(FILENAME_VERSION)
22 AC_DEFINE_UNQUOTED(FILENAME_VERSION, "$FILENAME_VERSION", [version suitable for file names])
23 MK=""
24 AC_SUBST(MK)
25 AC_PREREQ(2.59)
26 AC_CONFIG_SRCDIR([src/gregorio-utils.c])
27 AC_CONFIG_AUX_DIR([build-aux])
28 AC_CONFIG_MACRO_DIR([m4])
29
30 AM_INIT_AUTOMAKE([-Wall -Wno-portability subdir-objects foreign dist-bzip2 no-dist-gzip])
31
32 AC_PROG_CC
33 dnl AM_PROG_CC_C_O is deprecated since Automake 1.14, to be removed in the future
34 AM_PROG_CC_C_O
35 AC_PROG_CPP
36 AM_PROG_LEX
37 AC_PROG_YACC
38 AC_CHECK_TOOL([RC], [windres], [no])
39 AM_CONDITIONAL([HAVE_RC], [test x$RC != xno])
40
41 AC_CHECK_ALIGNOF(uint32_t)
42
43 AX_CHECK_COMPILE_FLAG([-std=gnu89], [CFLAGS+=" -std=gnu89"])
44 dnl until flex gets their act together, use pedantic instead of pedantic-errors
45 AX_CHECK_COMPILE_FLAG([-pedantic], [CFLAGS+=" -pedantic"])
46 dnl AX_CHECK_COMPILE_FLAG([-pedantic-errors], [CFLAGS+=" -pedantic-errors"])
47 AX_CHECK_COMPILE_FLAG([-fstack-protector-strong], [CFLAGS+=" -fstack-protector-strong"])
48 AX_CHECK_COMPILE_FLAG([-fPIE], [CFLAGS+=" -fPIE"])
49 AX_CHECK_COMPILE_FLAG([-Wformat=2], [CFLAGS+=" -Wformat=2"])
50 AX_CHECK_COMPILE_FLAG([-Werror=format-security], [CFLAGS+=" -Werror=format-security"])
51 AX_CHECK_COMPILE_FLAG([-Wstrict-prototypes], [CFLAGS+=" -Wstrict-prototypes"])
52 AX_CHECK_COMPILE_FLAG([-Wdeclaration-after-statement], [CFLAGS+=" -Wdeclaration-after-statement"])
53 AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS+=" -Wall"])
54 AX_CHECK_COMPILE_FLAG([-Wextra], [CFLAGS+=" -Wextra"])
55 AX_CHECK_COMPILE_FLAG([-Wno-gnu-statement-expression], [CFLAGS+=" -Wno-gnu-statement-expression"])
56 AX_CHECK_LINK_FLAG([-Wl,-z,relro], [LDFLAGS+=" -Wl,-z,relro"])
57 AX_CHECK_LINK_FLAG([-Wl,-z,now], [LDFLAGS+=" -Wl,-z,now"])
58 AX_CHECK_LINK_FLAG([-fPIE], [LDFLAGS+=" -fPIE"])
59 AX_CHECK_LINK_FLAG([-pie], [LDFLAGS+=" -pie"])
60
61 gl_FUNC_REALPATH_WORKS
62
63 dnl linux has integer types in stdint.h, solaris, vms in inttypes.h
64 AC_CHECK_HEADERS([stdint.h])
65 AC_CHECK_HEADERS([stdalign.h])
66
67 AC_DEFINE([_GNU_SOURCE], [1], [Always define this.])
68
69 AC_C_BIGENDIAN
70
71 AC_ARG_WITH([kpathsea], AS_HELP_STRING([--with-kpathsea], [Build with kpathsea.]))
72
73 AS_IF([test "x$with_kpathsea" = "xyes"], [
74 PKG_PROG_PKG_CONFIG
75 PKG_CHECK_MODULES([KPSE], [kpathsea], AC_DEFINE([USE_KPSE], [1], [Use kpathsea]),
76 dnl if pkg-config doesn't know kpathsea, try -lkpathsea (the most common case)
77 AC_CHECK_LIB([kpathsea], [kpse_set_program_name], [
78 AC_DEFINE([USE_KPSE], [1], [Use kpathsea])
79 KPSE_LIBS=" -lkpathsea"
80 ], [
81 AC_MSG_ERROR([unable to find the kpathsea library])
82 ])
83 )
84 ])
85
86 AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug@<:@=sanitize,coverage@:>@], [Enable debugging options [with additional sanitize options].]), [
87 AS_IF([test "x$enableval" != "xno"], [
88 dnl AX_CHECK_COMPILE_FLAG([-g], [CFLAGS+=" -g"])
89 AX_CHECK_COMPILE_FLAG([-Og], [CFLAGS+=" -Og"], [
90 AX_CHECK_COMPILE_FLAG([-O0], [CFLAGS+=" -O0"])
91 ])
92 AS_IF([test "x$enableval" = "xsanitize"], [
93 AX_CHECK_COMPILE_FLAG([-fsanitize=address,undefined], [CFLAGS+=" -fsanitize=address,undefined"])
94 ])
95 AS_IF([test "x$enableval" = "xcoverage"], [
96 AX_CHECK_COMPILE_FLAG([--coverage], [CFLAGS+=" --coverage"])
97 AX_CHECK_LINK_FLAG([--coverage], [LDFLAGS+=" --coverage"])
98 ])
99 ], [
100 CPPFLAGS+=" -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 "
101 ])
102 ], [
103 CPPFLAGS+=" -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 "
104 ])
105
106 AC_ARG_ENABLE([version-in-exe], AS_HELP_STRING([--disable-version-in-exe], [Disable version in executable name.]), [
107 AS_IF([test "x$enableval" != "xno"], [
108 GREGORIO_EXE_SUFFIX="-$FILENAME_VERSION"
109 ], [
110 GREGORIO_EXE_SUFFIX=""
111 ])
112 ], [
113 GREGORIO_EXE_SUFFIX="-$FILENAME_VERSION"
114 ])
115 AC_SUBST(GREGORIO_EXE_SUFFIX)
116
117 # AC_CANONICAL_HOST is needed to access the 'host_os' variable
118 AC_CANONICAL_HOST
119
120 build_linux=no
121 build_windows=no
122 build_mac=no
123
124 # Detect the target system
125 case "${host_os}" in
126 linux*)
127 build_linux=yes
128 ;;
129 cygwin*|mingw*)
130 build_windows=yes
131 ;;
132 darwin*)
133 build_mac=yes
134 ;;
135 *)
136 AC_MSG_ERROR(["OS $host_os is not supported"])
137 ;;
138 esac
139
140 # Pass the conditionals to automake
141 AM_CONDITIONAL([LINUX], [test "$build_linux" = "yes"])
142 AM_CONDITIONAL([WINDOWS], [test "$build_windows" = "yes"])
143 AM_CONDITIONAL([MACOSX], [test "$build_mac" = "yes"])
144
145 AC_CONFIG_HEADERS([src/config_.h])
146 AC_CONFIG_FILES([
147 Makefile
148 src/Makefile
149 examples/Makefile
150 contrib/Makefile
151 contrib/TeXShop/Makefile
152 contrib/vim/Makefile
153 contrib/vim/ftdetect/Makefile
154 contrib/vim/syntax/Makefile
155 doc/Makefile
156 tex/Makefile
157 fonts/Makefile
158 macosx/Makefile
159 ])
160 AC_OUTPUT