Upgrade to libtasn1 4.19.0
[platform/upstream/libtasn1.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 # Copyright (C) 2002-2022 Free Software Foundation, Inc.
3 #
4 # This file is part of LIBTASN1.
5 #
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
19 AC_INIT([GNU Libtasn1],
20         m4_esyscmd([build-aux/git-version-gen .tarball-version]),
21         [help-libtasn1@gnu.org])
22
23 # Library code modified:                              REVISION++
24 # Interfaces changed/added/removed:   CURRENT++       REVISION=0
25 # Interfaces added:                             AGE++
26 # Interfaces removed:                           AGE=0
27 AC_SUBST(LT_CURRENT, 12)
28 AC_SUBST(LT_REVISION, 3)
29 AC_SUBST(LT_AGE, 6)
30
31 AC_SUBST([MAJOR_VERSION], [`echo $PACKAGE_VERSION|cut -d'.' -f1`])
32 AC_SUBST([MINOR_VERSION], [`echo $PACKAGE_VERSION|cut -d'.' -f2`])
33 AC_SUBST([PATCH_VERSION], [`echo $PACKAGE_VERSION.0|cut -d. -f3|cut -d- -f1`])
34 AC_SUBST([NUMBER_VERSION], [`printf '0x%02x%02x%02x' $MAJOR_VERSION $MINOR_VERSION $PATCH_VERSION`])
35
36 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])
37
38 AC_CONFIG_AUX_DIR([build-aux])
39 AC_CONFIG_MACRO_DIR([m4])
40 AC_CONFIG_HEADERS(config.h)
41
42 AM_INIT_AUTOMAKE([-Wall -Wno-portability])
43 AM_SILENT_RULES([yes])
44
45 AC_PROG_CC
46 gl_EARLY
47 sgl_EARLY
48 AC_PROG_YACC
49
50 AC_ARG_ENABLE(doc,
51   AS_HELP_STRING([--disable-doc], [don't generate any documentation]),
52     enable_doc=$enableval, enable_doc=yes)
53 AM_CONDITIONAL(ENABLE_DOC, test "$enable_doc" != "no")
54
55 AC_CHECK_FUNCS([clock_gettime fmemopen])
56
57 AM_MISSING_PROG(HELP2MAN, help2man, $missing_dir)
58 LT_INIT([win32-dll])
59 GTK_DOC_CHECK(1.2)
60
61 AC_CHECK_SIZEOF(unsigned long int, 4)
62 AC_CHECK_SIZEOF(unsigned int, 4)
63
64 gl_INIT
65 sgl_INIT
66
67 AX_CODE_COVERAGE
68
69 AC_ARG_ENABLE([gcc-warnings],
70   [AS_HELP_STRING([--disable-gcc-warnings],
71     [disable GCC warnings (for developers)])],
72   [case $enableval in
73      yes|no) ;;
74      *)      AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
75    esac
76    gl_gcc_warnings=$enableval],
77   [gl_gcc_warnings=yes]
78 )
79
80 if test "$gl_gcc_warnings" = yes; then
81   gl_MANYWARN_ALL_GCC([warnings])
82   nw=
83   nw="$nw -Wsystem-headers"       # Don't let system headers trigger warnings
84   nw="$nw -Wc++-compat"           # We don't care strongly about C++ compilers
85   nw="$nw -Wundef"                # All compiler preprocessors support #if UNDEF
86   nw="$nw -Wtraditional"          # All compilers nowadays support ANSI C
87   nw="$nw -Wconversion"           # These warnings usually don't point to mistakes.
88   nw="$nw -Wpadded"               # Padding internal structs doesn't help.
89   nw="$nw -Wunused-macros"        # Lot's of warnings in ASN1.y
90   nw="$nw -Woverlength-strings"   # Modern compilers handle strings > 4096 gracefully
91   nw="$nw -Wsuggest-attribute=pure" # Asked for several nodes handling functions
92
93   gl_MANYWARN_COMPLEMENT([warnings], [$warnings], [$nw])
94   for w in $warnings; do
95     gl_WARN_ADD([$w])
96   done
97
98   gl_WARN_ADD([-Wno-type-limits]) # Too many warnings from gnulib macros
99   gl_WARN_ADD([-Wformat-truncation=1])
100   gl_WARN_ADD([-Wimplicit-fallthrough=2])
101   gl_WARN_ADD([-Wno-unused-parameter])
102   gl_WARN_ADD([-fdiagnostics-show-option])
103   gl_WARN_ADD([-fdiagnostics-color=always])      # colors even when using ccache
104 fi
105
106 AC_ARG_ENABLE([fuzzing],
107   [AS_HELP_STRING([--enable-fuzzing], [Turn on fuzzing build (for developers)])],
108   [enable_fuzzing=yes; AC_SUBST([LIB_FUZZING_ENGINE])], [enable_fuzzing=no; LIB_FUZZING_ENGINE=""])
109 AM_CONDITIONAL([FUZZING], [test "$enable_fuzzing" = "yes"])
110
111 OLD_LIBS=$LIBS
112 AC_SEARCH_LIBS([dlsym], [dl dld])
113 FUZZ_LIBS=$LIBS
114 LIBS=$OLD_LIBS
115 AC_SUBST([FUZZ_LIBS])
116
117 AC_CONFIG_FILES([
118   Makefile
119   doc/Makefile
120   doc/reference/Makefile
121   examples/Makefile
122   fuzz/Makefile
123   lib/Makefile
124   lib/gl/Makefile
125   lib/includes/libtasn1.h
126   lib/libtasn1.pc
127   src/Makefile
128   src/gl/Makefile
129   tests/Makefile
130 ])
131 AC_OUTPUT
132
133 AC_MSG_NOTICE([Summary of build options:
134
135   Version:           ${VERSION}
136   Libtool version    $LT_CURRENT:$LT_REVISION:$LT_AGE
137   DLL version:       $DLL_VERSION
138   Header version:    major $MAJOR_VERSION minor $MINOR_VERSION patch $PATCH_VERSION number $NUMBER_VERSION
139   Build/host system: ${build} / ${host}
140   Install prefix:    ${prefix}
141   Compiler:          ${CC}
142   Warning flags:     ${WARN_CFLAGS}
143   CFLAGS:            ${CFLAGS} ${CPPFLAGS}
144   LDFlags:           ${LDFLAGS}
145   Documentation:     ${enable_doc}
146   Library types:     Shared=${enable_shared}, Static=${enable_static}
147   Valgrind:          $gl_cv_prog_valgrind_works ${VALGRIND}
148   Version script:    $have_ld_version_script
149   Fuzzing build:     $enable_fuzzing $LIB_FUZZING_ENGINE
150 ])