blob: 6ba1d371f2d158089da621d14256a75340e17854 [file] [log] [blame]
Pau Espin Pedrol42b18e22018-05-03 18:20:57 +02001AC_INIT([libasn1c],
2 m4_esyscmd([./git-version-gen .tarball-version]),
Harald Weltebdff5e62010-06-12 19:05:23 +02003 [openbsc-devel@lists.openbsc.org])
4
5AM_INIT_AUTOMAKE([dist-bzip2])
6
7dnl kernel style compile messages
8m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
9
Pau Espin Pedrol96ef99e2018-05-03 17:15:26 +020010dnl include release helper
11RELMAKE='-include osmo-release.mk'
12AC_SUBST([RELMAKE])
13
Harald Weltebdff5e62010-06-12 19:05:23 +020014dnl checks for programs
15AC_PROG_MAKE_SET
16AC_PROG_CC
17AC_PROG_INSTALL
18LT_INIT
19AC_PROG_LIBTOOL
20
21AC_CONFIG_MACRO_DIR([m4])
22
Eric3bbf20f2022-05-23 23:49:22 +020023dnl patching ${archive_cmds} to affect generation of file "libtool" to fix linking with clang
24AS_CASE(["$LD"],[*clang*],
25 [AS_CASE(["${host_os}"],
26 [*linux*],[archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'])])
27
Holger Hans Peter Freytherf3c30492016-04-05 16:25:43 +020028PKG_CHECK_MODULES(LIBTALLOC, talloc)
Harald Weltefa034002010-07-18 23:15:24 +020029
Neels Hofmeyrbd217372017-11-17 01:43:36 +010030AC_ARG_ENABLE(sanitize,
31 [AS_HELP_STRING(
32 [--enable-sanitize],
33 [Compile with address sanitizer enabled],
34 )],
35 [sanitize=$enableval], [sanitize="no"])
36if test x"$sanitize" = x"yes"
37then
38 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
39 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
40fi
41
Neels Hofmeyr6e152f22018-03-05 19:46:44 +010042AC_ARG_ENABLE(werror,
43 [AS_HELP_STRING(
44 [--enable-werror],
45 [Turn all compiler warnings into errors, with exceptions:
46 a) deprecation (allow upstream to mark deprecation without breaking builds);
47 b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
48 ]
49 )],
50 [werror=$enableval], [werror="no"])
51if test x"$werror" = x"yes"
52then
53 WERROR_FLAGS="-Werror"
54 WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
55 WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
56 CFLAGS="$CFLAGS $WERROR_FLAGS"
57 CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
58fi
59
Harald Weltebdff5e62010-06-12 19:05:23 +020060# The following test is taken from WebKit's webkit.m4
61saved_CFLAGS="$CFLAGS"
62CFLAGS="$CFLAGS -fvisibility=hidden "
63AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
Harald Weltef6b91732015-08-31 09:06:57 +020064AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
Harald Weltebdff5e62010-06-12 19:05:23 +020065 [ AC_MSG_RESULT([yes])
66 SYMBOL_VISIBILITY="-fvisibility=hidden"],
67 AC_MSG_RESULT([no]))
68CFLAGS="$saved_CFLAGS"
69AC_SUBST(SYMBOL_VISIBILITY)
70
Harald Weltea37b06d2015-12-18 15:37:17 +010071AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug], [Buld the library with EMIT_ASN_DEBUG enabled])],
72 [build_debug="$enableval"], [build_debug="no"])
73AM_CONDITIONAL(BUILD_DEBUG, test "x$build_debug" = "xyes")
74
Neels Hofmeyr6e152f22018-03-05 19:46:44 +010075AC_MSG_RESULT([CFLAGS="$CFLAGS"])
76AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
77
Harald Weltebdff5e62010-06-12 19:05:23 +020078AC_OUTPUT(
79 libasn1c.pc
80 src/Makefile
Harald Welte98cb8362010-06-12 19:15:51 +020081 include/Makefile
82 include/asn1c/Makefile
Oliver Smith42413202020-05-14 11:38:03 +020083 Makefile
84 contrib/libasn1c.spec)