45d023362452f41380a9c68c70d581cd5edf2a2d
[platform/upstream/libtasn1.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 # Copyright (C) 2002-2014 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_PREREQ([2.61])
20 AC_INIT([GNU Libtasn1],[4.13],[help-libtasn1@gnu.org])
21 AC_CONFIG_AUX_DIR([build-aux])
22 AC_CONFIG_MACRO_DIR([m4])
23 AC_CONFIG_HEADERS(config.h)
24 AM_INIT_AUTOMAKE([1.10 -Wall -Wno-override])
25 AM_SILENT_RULES([yes])
26
27 # Library code modified:                              REVISION++
28 # Interfaces changed/added/removed:   CURRENT++       REVISION=0
29 # Interfaces added:                             AGE++
30 # Interfaces removed:                           AGE=0
31 AC_SUBST(LT_CURRENT, 11)
32 AC_SUBST(LT_REVISION, 5)
33 AC_SUBST(LT_AGE, 5)
34
35 AC_PROG_CC
36 gl_EARLY
37 lgl_EARLY
38 AC_PROG_YACC
39
40 AC_ARG_ENABLE(doc,
41   AS_HELP_STRING([--disable-doc], [don't generate any documentation]),
42     enable_doc=$enableval, enable_doc=yes)
43 AM_CONDITIONAL(ENABLE_DOC, test "$enable_doc" != "no")
44
45 dnl Checks for programs.
46 AM_MISSING_PROG(HELP2MAN, help2man, $missing_dir)
47 AC_LIBTOOL_WIN32_DLL
48 AM_PROG_AR
49 AM_PROG_LIBTOOL
50 GTK_DOC_CHECK(1.2)
51
52 AC_CHECK_SIZEOF(unsigned long int, 4)
53 AC_CHECK_SIZEOF(unsigned int, 4)
54
55 sj_UPDATE_HEADER_VERSION([$srcdir/lib/libtasn1.h])
56
57 # For gnulib compatibility modules.
58 gl_INIT
59 lgl_INIT
60
61 AC_ARG_ENABLE([gcc-warnings],
62   [AS_HELP_STRING([--disable-gcc-warnings],
63                   [disable GCC warnings (for developers)])],
64   [case $enableval in
65      yes|no) ;;
66      *)      AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
67    esac
68    gl_gcc_warnings=$enableval],
69   [gl_gcc_warnings=yes]
70 )
71
72 if test "$gl_gcc_warnings" = yes; then
73   nw="$nw -Wsystem-headers"         # Don't let system headers trigger warnings
74   nw="$nw -Wc++-compat"             # We don't care strongly about C++ compilers
75   nw="$nw -Wtraditional"            # Warns on #elif which we use often
76   nw="$nw -Wtraditional-conversion" # Too many warnings for now
77   nw="$nw -Wconversion"             # Too many warnings for now
78   nw="$nw -Wsign-conversion"        # Too many warnings for now
79   nw="$nw -Wold-style-definition"   #
80   nw="$nw -Wpadded"                 # Our structs are not padded
81   nw="$nw -Wundef"                  #
82   nw="$nw -Wunreachable-code"       # Too many false positives
83   nw="$nw -Wunused-macros"          # Breaks on bison generated ASN1.c
84   nw="$nw -Wswitch-default"         # Breaks on bison generated ASN1.c
85   nw="$nw -Wunsafe-loop-optimizations"
86   nw="$nw -Wstrict-overflow"
87   nw="$nw -Woverlength-strings"     # Some tests use large strings
88   nw="$nw -Wsuggest-attribute=pure" # Is it worth using pure attributes?
89
90   gl_MANYWARN_ALL_GCC([ws])
91   gl_MANYWARN_COMPLEMENT(ws, [$ws], [$nw])
92   for w in $ws; do
93     gl_WARN_ADD([$w])
94   done
95
96   gl_WARN_ADD([-Wno-type-limits])
97   gl_WARN_ADD([-Wno-missing-field-initializers])
98   gl_WARN_ADD([-Wno-unused-parameter])
99   gl_WARN_ADD([-Wno-stack-protector])            # Some functions cannot be protected
100   gl_WARN_ADD([-fdiagnostics-show-option])
101 fi
102
103 AC_CONFIG_FILES([
104   Makefile
105   doc/Makefile
106   doc/cyclo/Makefile
107   doc/reference/Makefile
108   doc/reference/version.xml
109   examples/Makefile
110   gl/Makefile
111   lib/Makefile
112   lib/gllib/Makefile
113   lib/libtasn1.pc
114   src/Makefile
115   tests/Makefile
116 ])
117 AC_OUTPUT
118
119 AC_MSG_NOTICE([summary of build options:
120
121   version:          ${VERSION} shared $LT_CURRENT:$LT_REVISION:$LT_AGE
122   Host type:        ${host}
123   Install prefix:   ${prefix}
124   Compiler:         ${CC}
125   Warning flags:    errors: ${WERROR_CFLAGS} warnings: ${WARN_CFLAGS}
126   Library types:    Shared=${enable_shared}, Static=${enable_static}
127   Valgrind:         ${VALGRIND}
128   Version script:   $have_ld_version_script
129 ])