1 # Configure template for Recode.
2 # Copyright (C) 1994-2018 Free Software Foundation, Inc.
3 # Process this file with autoconf to produce a configure script.
6 AC_INIT(recode, 3.7.6, [rrt@sc3d.org])
7 AC_CONFIG_SRCDIR(src/recode.c)
8 AC_CONFIG_AUX_DIR([build-aux])
10 AC_CONFIG_MACRO_DIR(m4)
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.
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}'`
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)
44 dnl Set a value even if not found, so that an invocation via build-aux/missing works
45 AC_PATH_PROG([HELP2MAN], [help2man], [help2man])
48 AC_CHECK_PROG([CYTHON], [cython], [cython])
53 *mingw*|*cygwin* ) pyextext=.dll;;
56 AC_SUBST([pyextext], [$pyextext])
58 dnl Extra warnings with GCC and compatible compilers
59 AC_ARG_ENABLE([gcc-warnings],
60 [AS_HELP_STRING([--disable-gcc-warnings],
61 [turn off lots of GCC warnings])],
64 *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
66 gl_gcc_warnings=$enableval],
69 if test "$gl_gcc_warnings" = yes; then
70 dnl Set up the list of undesired warnings.
72 nw="$nw -Wsystem-headers" # Don’t let system headers trigger warnings
73 nw="$nw -Wundef" # All compiler preprocessors support #if UNDEF
74 nw="$nw -Wtraditional" # All compilers nowadays support ANSI C
75 nw="$nw -Wdeclaration-after-statement" # We require C99.
76 nw="$nw -Wstrict-overflow" # Use a lower level (see below).
77 nw="$nw -Wconversion" # These warnings usually don’t point to mistakes.
78 nw="$nw -Wsign-conversion" # Likewise.
80 gl_MANYWARN_ALL_GCC([warnings])
82 dnl Enable all GCC warnings not in this list.
83 gl_MANYWARN_COMPLEMENT([warnings], [$warnings], [$nw])
84 for w in $warnings; do
88 dnl Add an extra warning
89 gl_WARN_ADD([-Wstrict-overflow=1])
90 dnl Add some more safety measures
91 gl_WARN_ADD([-D_FORTIFY_SOURCE=2])
92 dnl Remove a warning being promoted to error: we trigger this and can't turn it off with pragmas.
93 gl_WARN_ADD([-Wno-error=format-security])
95 # When compiling with GCC, prefer -isystem to -I when including system
96 # include files, to avoid generating useless diagnostics for the files.
103 # Extra settings for running tests, e.g. LD_PRELOAD for ASAN
104 AC_SUBST([TESTS_ENVIRONMENT_EXTRA])
106 AC_CONFIG_HEADERS([config.h])
109 LIBS="$LIBICONV $LIBS"
112 AM_GNU_GETTEXT_VERSION(0.19)
113 AM_GNU_GETTEXT(external)
114 AM_XGETTEXT_OPTION([--from-code=UTF-8])
116 AC_OUTPUT(Makefile contrib/Makefile doc/Makefile lib/Makefile
117 po/Makefile.in src/Makefile tests/Makefile tests/setup.py)