| 1 |
# Configure template for Recode. |
| 2 |
# Copyright (C) 1994-2023 Free Software Foundation, Inc. |
| 3 |
# Process this file with autoconf to produce a configure script. |
| 4 |
|
| 5 |
AC_PREREQ([2.71]) |
| 6 |
AC_INIT([recode],[3.7.15],[[email protected]]) |
| 7 |
AC_CONFIG_SRCDIR(src/recode.c) |
| 8 |
AC_CONFIG_AUX_DIR([build-aux]) |
| 9 |
AM_INIT_AUTOMAKE |
| 10 |
AC_CONFIG_MACRO_DIR(m4) |
| 11 |
AC_CANONICAL_HOST |
| 12 |
|
| 13 |
dnl Release number rules: |
| 14 |
dnl This is derived from "Versioning" chapter of info libtool documentation. |
| 15 |
dnl Format is MAJOR:MINOR:MICRO |
| 16 |
dnl 4a) Increment major when removing or changing interfaces. |
| 17 |
dnl 4a) 5) Increment minor when adding interfaces. |
| 18 |
dnl 6) Set minor to zero when removing or changing interfaces. |
| 19 |
dnl 3) Increment micro when interfaces not changed at all, |
| 20 |
dnl only bug fixes or internal changes made. |
| 21 |
dnl 4b) Set micro to zero when adding, removing or changing interfaces. |
| 22 |
|
| 23 |
dnl First extract pieces from the version number string |
| 24 |
RECODE_MAJOR_VERSION=`echo $VERSION | awk -F. '{print $1}'` |
| 25 |
RECODE_MINOR_VERSION=`echo $VERSION | awk -F. '{print $2}'` |
| 26 |
RECODE_MICRO_VERSION=`echo $VERSION | awk -F. '{print $3}'` |
| 27 |
|
| 28 |
dnl Version info for libraries = CURRENT:REVISION:AGE |
| 29 |
RECODE_SONUM=$RECODE_MAJOR_VERSION |
| 30 |
AGE=$RECODE_MINOR_VERSION |
| 31 |
REVISION=$RECODE_MICRO_VERSION |
| 32 |
CURRENT=`expr $RECODE_SONUM + $AGE` |
| 33 |
VERSION_INFO=$CURRENT:$REVISION:$AGE |
| 34 |
AC_SUBST(VERSION_INFO) |
| 35 |
|
| 36 |
AC_PROG_CC |
| 37 |
gl_EARLY |
| 38 |
LT_INIT |
| 39 |
AC_PROG_LEX([noyywrap]) |
| 40 |
AM_PATH_PYTHON([3.8]) |
| 41 |
gl_INIT |
| 42 |
|
| 43 |
dnl help2man |
| 44 |
AC_PATH_PROG([PERL], [perl]) |
| 45 |
AC_PATH_PROG([HELP2MAN], [help2man]) |
| 46 |
CROSS_COMPILING=$cross_compiling |
| 47 |
AC_SUBST([CROSS_COMPILING]) |
| 48 |
|
| 49 |
dnl Cython |
| 50 |
AC_CHECK_PROGS([CYTHON], [cython3 cython]) |
| 51 |
AM_CONDITIONAL([HAVE_CYTHON], test -n "$ac_cv_prog_CYTHON") |
| 52 |
|
| 53 |
AC_SUBST([objdir]) |
| 54 |
LT_SYS_MODULE_EXT |
| 55 |
case $host_os in |
| 56 |
*mingw* ) pyextext=.pyd;; |
| 57 |
*cygwin*) pyextext=.dll;; |
| 58 |
* ) pyextext=.so;; |
| 59 |
esac |
| 60 |
AC_SUBST([pyextext], [$pyextext]) |
| 61 |
|
| 62 |
dnl Extra warnings with GCC and compatible compilers |
| 63 |
AC_ARG_ENABLE([gcc-warnings], |
| 64 |
[AS_HELP_STRING([--disable-gcc-warnings], |
| 65 |
[turn off lots of GCC warnings])], |
| 66 |
[case $enableval in |
| 67 |
yes|no) ;; |
| 68 |
*) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;; |
| 69 |
esac |
| 70 |
gl_gcc_warnings=$enableval], |
| 71 |
[gl_gcc_warnings=yes] |
| 72 |
) |
| 73 |
if test "$gl_gcc_warnings" = yes; then |
| 74 |
dnl Set up the list of undesired warnings. |
| 75 |
nw= |
| 76 |
nw="$nw -Wsystem-headers" # Don’t let system headers trigger warnings |
| 77 |
nw="$nw -Wundef" # All compiler preprocessors support #if UNDEF |
| 78 |
nw="$nw -Wtraditional" # All compilers nowadays support ANSI C |
| 79 |
nw="$nw -Wdeclaration-after-statement" # We require C99. |
| 80 |
nw="$nw -Wstrict-overflow" # Use a lower level (see below). |
| 81 |
nw="$nw -Wconversion" # These warnings usually don’t point to mistakes. |
| 82 |
nw="$nw -Wsign-conversion" # Likewise. |
| 83 |
|
| 84 |
gl_MANYWARN_ALL_GCC([warnings]) |
| 85 |
|
| 86 |
dnl Enable all GCC warnings not in this list. |
| 87 |
gl_MANYWARN_COMPLEMENT([warnings], [$warnings], [$nw]) |
| 88 |
for w in $warnings; do |
| 89 |
gl_WARN_ADD([$w]) |
| 90 |
done |
| 91 |
|
| 92 |
dnl Add an extra warning |
| 93 |
gl_WARN_ADD([-Wstrict-overflow=1]) |
| 94 |
dnl Remove a warning being promoted to error: we trigger this and can't turn it off with pragmas. |
| 95 |
gl_WARN_ADD([-Wno-error=format-security]) |
| 96 |
|
| 97 |
# When compiling with GCC, prefer -isystem to -I when including system |
| 98 |
# include files, to avoid generating useless diagnostics for the files. |
| 99 |
ISYSTEM='-isystem ' |
| 100 |
else |
| 101 |
ISYSTEM='-I' |
| 102 |
fi |
| 103 |
AC_SUBST([ISYSTEM]) |
| 104 |
|
| 105 |
# Extra settings for running tests, e.g. LD_PRELOAD for ASAN |
| 106 |
AC_SUBST([TESTS_ENVIRONMENT_EXTRA]) |
| 107 |
|
| 108 |
# Gettext |
| 109 |
AM_GNU_GETTEXT_VERSION(0.19) |
| 110 |
AM_GNU_GETTEXT(external) |
| 111 |
AM_XGETTEXT_OPTION([--from-code=UTF-8]) |
| 112 |
|
| 113 |
AC_CONFIG_HEADERS([config.h]) |
| 114 |
|
| 115 |
AC_CONFIG_FILES([Makefile contrib/Makefile doc/Makefile lib/Makefile |
| 116 |
po/Makefile.in src/Makefile src/recode.x |
| 117 |
tests/Makefile tests/setup.py]) |
| 118 |
AC_CONFIG_FILES([build-aux/x-to-1], [chmod +x build-aux/x-to-1]) |
| 119 |
AC_OUTPUT |