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 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
|
# Copyright (C) 2011-2025 Simon Josefsson
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
AC_INIT([Libidn2],
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
[help-libidn@gnu.org],,
[https://www.gnu.org/software/libidn/#libidn2])
# Library code modified: REVISION++
# Interfaces changed/added/removed: CURRENT++ REVISION=0
# Interfaces added: AGE++
# Interfaces removed: AGE=0
AC_SUBST(LT_CURRENT, 4)
AC_SUBST(LT_REVISION, 0)
AC_SUBST(LT_AGE, 4)
DLL_VERSION=`expr ${LT_CURRENT} - ${LT_AGE}`
AC_SUBST(DLL_VERSION)
AC_SUBST([MAJOR_VERSION], [`echo $PACKAGE_VERSION|cut -d'.' -f1`])
AC_SUBST([MINOR_VERSION], [`echo $PACKAGE_VERSION|cut -d'.' -f2`])
AC_SUBST([PATCH_VERSION], [`echo $PACKAGE_VERSION|cut -d'.' -f3`])
AC_SUBST([NUMBER_VERSION], [`printf '0x%02x%02x%04x' $MAJOR_VERSION $MINOR_VERSION $PATCH_VERSION`])
AC_MSG_NOTICE([$PACKAGE_NAME $PACKAGE_VERSION $PACKAGE_TARNAME $MAJOR_VERSION.$MINOR_VERSION.$PATCH_VERSION $NUMBER_VERSION $LT_CURRENT:$LT_REVISION:$LT_AGE $DLL_VERSION])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4 gl/m4 unistring/m4])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([1.14 tar-ustar -Wall -Wno-portability subdir-objects])
AM_SILENT_RULES([yes])
AC_PROG_CC
AC_USE_SYSTEM_EXTENSIONS
gl_EARLY
unistring_EARLY
AM_MISSING_PROG(HELP2MAN, help2man, $missing_dir)
LT_INIT([win32-dll])
gl_INIT
unistring_INIT
AC_DEFINE([GNULIB_NO_VLA], 1, [Disable VLA usage in gettext.h.])
# Detect the target system
case "${host_os}" in
linux-gnu)
build_linux_gnu=yes
esac
AM_CONDITIONAL([TEST_GLIBC], [test "$build_linux_gnu" = "yes"])
dnl Ideally, this should attempt a link, but this requires a separate
dnl version file, so we only check for compiler support here.
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
__attribute__((visibility("hidden")))
int
versioned_symbol_internal (void)
{
}
__typeof__ (versioned_symbol_internal) versioned_symbol
__attribute__ ((visibility ("default"),
alias ("versioned_symbol_internal")));
__asm__ (".symver versioned_symbol, versioned_symbol@IDN2_0.0.0");
])], [AC_DEFINE([HAVE_SYMVER_ALIAS_SUPPORT], [1],
[The toolchain supports aliases and .symver.])])
#
# check for gtk-doc
#
m4_ifdef([GTK_DOC_CHECK], [
GTK_DOC_CHECK([1.14],[--flavour no-tmpl])
],[
AM_CONDITIONAL([ENABLE_GTK_DOC], false)
])
# needed for some older versions of gtk-doc
m4_ifdef([GTK_DOC_USE_LIBTOOL], [], [
AM_CONDITIONAL([GTK_DOC_USE_LIBTOOL], false)
])
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.19.8])
AX_CODE_COVERAGE
AC_ARG_ENABLE([gcc-warnings],
[AS_HELP_STRING([[--enable-gcc-warnings[=TYPE]]],
[control generation of GCC warnings. The TYPE 'no' disables
warnings; 'yes' (default) generates cheap warnings;
'expensive' in addition generates expensive warnings
and 'error' also turn warnings into errors.])])
# https://www.gnu.org/software/gnulib//manual/html_node/manywarnings.html
AS_IF([test "$enable_gcc_warnings" != no],
[
# Set up the list of unwanted warning options.
nw=
if test "$enable_gcc_warnings" = yes; then
nw="$nw -fanalyzer"
fi
nw="$nw -Wbad-function-cast" # Casting a function's result is not more
# dangerous than casting any other value.
nw="$nw -Winline" # It's OK to not inline.
nw="$nw -Wsign-compare" # Too many false alarms.
nw="$nw -Wstrict-overflow" # It's OK to optimize strictly.
nw="$nw -Wsystem-headers" # Don't warn in system headers.
# https://github.com/pi-hole/FTL/pull/1428
nw="$nw -Wsuggest-attribute=pure"
nw="$nw -Wsuggest-attribute=const"
dnl nw="$nw -Wundef" # All compiler preprocessors support #if UNDEF
dnl nw="$nw -Wtraditional" # All compilers nowadays support ANSI C
dnl nw="$nw -Wconversion" # These warnings usually don't point to mistakes.
dnl nw="$nw -Wpadded" # Padding internal structs doesn't help.
dnl nw="$nw -Wc++-compat" # Compile using a C compiler.
dnl nw="$nw -Wtraditional-conversion" # Too many complaints for now.
dnl nw="$nw -Wunreachable-code" # gcc bug 40412
dnl nw="$nw -Wswitch-default" # Nothing wrong with default-less switch?
dnl nw="$nw -Wmissing-field-initializers" # Avoid spamming in tests/ directory
dnl gl_WARN_ADD([-fdiagnostics-show-option])
dnl gl_WARN_ADD([-fdiagnostics-color=always]) # colors even when using ccache
if test "$enable_gcc_warnings" = error; then
gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
gl_WARN_ADD([-Wno-error=analyzer-use-of-uninitialized-value], [WERROR_CFLAGS])
gl_WARN_ADD([-Wno-error=missing-field-initializers], [WERROR_TESTS_CFLAGS])
# GCC 11.4 false positive: test-glib.c: double-'free' of 'naemchen_bytes' [-Werror=analyzer-double-free]
gl_WARN_ADD([-Wno-error=analyzer-double-free], [WERROR_TESTS_CFLAGS])
fi
# Setup the list of meaningful warning options for the C compiler.
# The list comes from manywarnings.m4. Warning options that are not
# generally meaningful have already been filtered out (cf.
# build-aux/gcc-warning.spec).
gl_MANYWARN_ALL_GCC([possible_warning_options])
# Compute the list of warning options that are desired.
gl_MANYWARN_COMPLEMENT([desired_warning_options],
[$possible_warning_options], [$nw])
# Compute the list of remaining undesired warning options.
# Namely those, that were not in manywarnings.m4 because they were
# already listed in build-aux/gcc-warning.spec; this includes those
# that are implied by -Wall.
gl_MANYWARN_COMPLEMENT([remaining_undesired_warning_options],
[$nw], [$possible_warning_options])
# Add the desired warning options to WARN_CFLAGS.
for w in $desired_warning_options; do
gl_WARN_ADD([$w])
done
# Add the opposites of the remaining undesired warning options to
# WARN_CFLAGS.
for w in `echo "$remaining_undesired_warning_options" | sed -e 's/-W/-Wno-/g'`; do
gl_WARN_ADD([$w])
done
])
AC_ARG_ENABLE(doc,
AS_HELP_STRING([--disable-doc], [don't generate any documentation]),
enable_doc=$enableval, enable_doc=yes)
AM_CONDITIONAL(ENABLE_DOC, test "$enable_doc" != "no")
if test "$enable_doc" = "yes";then
AC_CONFIG_FILES([
doc/Makefile
doc/reference/Makefile
doc/reference/version.xml
])
fi
AC_CONFIG_FILES([
Makefile
examples/Makefile
lib/idn2.h
lib/Makefile
unistring/Makefile
gl/Makefile
libidn2.pc
po/Makefile.in
src/Makefile
tests/Makefile
fuzz/Makefile
])
gl_CONFIG_VERSION_STAMP
AC_OUTPUT
AC_MSG_NOTICE([summary of main build options:
Version: ${VERSION}
Libtool version $LT_CURRENT:$LT_REVISION:$LT_AGE
DLL version: $DLL_VERSION
Header version: major $MAJOR_VERSION minor $MINOR_VERSION patch $PATCH_VERSION number $NUMBER_VERSION
Build system: ${build}
Host/Target system: ${host}
Install prefix: ${prefix}
Compiler: ${CC}
CFLAGS: ${CFLAGS}
CPPFLAGS: ${CPPFLAGS}
LDFLAGS: ${LDFLAGS}
Library types: Shared=${enable_shared}, Static=${enable_static}
Warning flags: $enable_gcc_warnings
WERROR_CFLAGS: $WERROR_CFLAGS
WERROR_TESTS_CFLAGS: $WERROR_TESTS_CFLAGS
WARN_CFLAGS: $WARN_CFLAGS
Documentation: ${enable_doc}
nl_langinfo: $am_cv_langinfo_codeset
Libiconv: $am_cv_func_iconv_summary
LTLIBICONV: $LTLIBICONV
Libunistring: $ac_cv_libunistring
VERSION: $LIBUNISTRING_VERSION
LTLIBUNISTRING: $LTLIBUNISTRING
Version script: $have_ld_version_script
Valgrind: $gl_cv_prog_valgrind_works $VALGRIND_PROGRAM $DEFAULT_VALGRINDFLAGS $VALGRINDFLAGS
])
|