Debian Codegraph @

configure.ac

raw ◀ ▶
Source reconstructed at patch state 0 of 3 — not the installed (fully patched) source.
3 Debian patches touch this file
1 dnl Process this file with autoconf to produce a configure script
2 AC_INIT([libosmo-sigtran],
3 m4_esyscmd([./git-version-gen .tarball-version]),
4 [[email protected]])
5
6 dnl *This* is the root dir, even if an install-sh exists in ../ or ../../
7 AC_CONFIG_AUX_DIR([.])
8
9 AM_INIT_AUTOMAKE([dist-bzip2])
10 AC_CONFIG_TESTDIR(tests)
11
12 CFLAGS="$CFLAGS -std=gnu11"
13
14 dnl kernel style compile messages
15 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
16
17 dnl include release helper
18 RELMAKE='-include osmo-release.mk'
19 AC_SUBST([RELMAKE])
20
21 dnl checks for programs
22 AC_PROG_MAKE_SET
23 AC_PROG_CC
24 AC_PROG_INSTALL
25 LT_INIT
26
27 dnl patching ${archive_cmds} to affect generation of file "libtool" to fix linking with clang
28 AS_CASE(["$LD"],[*clang*],
29 [AS_CASE(["${host_os}"],
30 [*linux*],[archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'])])
31
32 dnl check for pkg-config (explained in detail in libosmocore/configure.ac)
33 AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no)
34 if test "x$PKG_CONFIG_INSTALLED" = "xno"; then
35 AC_MSG_WARN([You need to install pkg-config])
36 fi
37 PKG_PROG_PKG_CONFIG([0.20])
38
39 PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.11.0)
40 PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.11.0)
41 PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.11.0)
42 PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 1.6.0)
43
44 old_LIBS=$LIBS
45 AC_SEARCH_LIBS([sctp_recvmsg], [sctp], [
46 AC_DEFINE(HAVE_LIBSCTP, 1, [Define 1 to enable SCTP support])
47 AC_SUBST(HAVE_LIBSCTP, [1])
48 if test -n "$ac_lib"; then
49 AC_SUBST(LIBSCTP_LIBS, [-l$ac_lib])
50 fi
51 ], [
52 AC_MSG_ERROR([sctp_recvmsg not found in searched libs])])
53 LIBS=$old_LIBS
54
55 AC_ARG_ENABLE(sanitize,
56 [AS_HELP_STRING(
57 [--enable-sanitize],
58 [Compile with address sanitizer enabled],
59 )],
60 [sanitize=$enableval], [sanitize="no"])
61 if test x"$sanitize" = x"yes"
62 then
63 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
64 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
65 fi
66
67 AC_ARG_ENABLE(werror,
68 [AS_HELP_STRING(
69 [--enable-werror],
70 [Turn all compiler warnings into errors, with exceptions:
71 a) deprecation (allow upstream to mark deprecation without breaking builds);
72 b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
73 ]
74 )],
75 [werror=$enableval], [werror="no"])
76 if test x"$werror" = x"yes"
77 then
78 WERROR_FLAGS="-Werror"
79 WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
80 WERROR_FLAGS+=" -Werror=implicit-int -Werror=int-conversion -Werror=old-style-definition"
81 WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
82 CFLAGS="$CFLAGS $WERROR_FLAGS"
83 CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
84 fi
85
86 # The following test is taken from WebKit's webkit.m4
87 saved_CFLAGS="$CFLAGS"
88 CFLAGS="$CFLAGS -fvisibility=hidden "
89 AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
90 AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
91 [ AC_MSG_RESULT([yes])
92 SYMBOL_VISIBILITY="-fvisibility=hidden"],
93 AC_MSG_RESULT([no]))
94 CFLAGS="$saved_CFLAGS"
95 AC_SUBST(SYMBOL_VISIBILITY)
96
97 CFLAGS="$CFLAGS -Wall"
98 CPPFLAGS="$CPPFLAGS -Wall"
99
100 AC_ARG_ENABLE(doxygen,
101 [AS_HELP_STRING(
102 [--disable-doxygen],
103 [Disable generation of documentation using doxygen],
104 )],
105 [doxygen=$enableval], [doxygen="yes"])
106 AC_PATH_PROG(DOXYGEN,doxygen,false)
107 AM_CONDITIONAL(HAVE_DOXYGEN, test $DOXYGEN != false && test "x$doxygen" = "xyes")
108
109 # Generate manuals
110 AC_ARG_ENABLE(manuals,
111 [AS_HELP_STRING(
112 [--enable-manuals],
113 [Generate manual PDFs [default=no]],
114 )],
115 [osmo_ac_build_manuals=$enableval], [osmo_ac_build_manuals="no"])
116 AM_CONDITIONAL([BUILD_MANUALS], [test x"$osmo_ac_build_manuals" = x"yes"])
117 AC_ARG_VAR(OSMO_GSM_MANUALS_DIR, [path to common osmo-gsm-manuals files, overriding pkg-config and "../osmo-gsm-manuals"
118 fallback])
119 if test x"$osmo_ac_build_manuals" = x"yes"
120 then
121 # Find OSMO_GSM_MANUALS_DIR (env, pkg-conf, fallback)
122 if test -n "$OSMO_GSM_MANUALS_DIR"; then
123 echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (from env)"
124 else
125 OSMO_GSM_MANUALS_DIR="$($PKG_CONFIG osmo-gsm-manuals --variable=osmogsmmanualsdir 2>/dev/null)"
126 if test -n "$OSMO_GSM_MANUALS_DIR"; then
127 echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (from pkg-conf)"
128 else
129 OSMO_GSM_MANUALS_DIR="../osmo-gsm-manuals"
130 echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (fallback)"
131 fi
132 fi
133 if ! test -d "$OSMO_GSM_MANUALS_DIR"; then
134 AC_MSG_ERROR("OSMO_GSM_MANUALS_DIR does not exist! Install osmo-gsm-manuals or set OSMO_GSM_MANUALS_DIR.")
135 fi
136
137 # Find and run check-depends
138 CHECK_DEPENDS="$OSMO_GSM_MANUALS_DIR/check-depends.sh"
139 if ! test -x "$CHECK_DEPENDS"; then
140 CHECK_DEPENDS="osmo-gsm-manuals-check-depends"
141 fi
142 if ! $CHECK_DEPENDS; then
143 AC_MSG_ERROR("missing dependencies for --enable-manuals")
144 fi
145
146 # Put in Makefile with absolute path
147 OSMO_GSM_MANUALS_DIR="$(realpath "$OSMO_GSM_MANUALS_DIR")"
148 AC_SUBST([OSMO_GSM_MANUALS_DIR])
149 fi
150
151 # https://www.freedesktop.org/software/systemd/man/daemon.html
152 AC_ARG_WITH([systemdsystemunitdir],
153 [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
154 [with_systemdsystemunitdir=auto])
155 AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
156 def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
157 AS_IF([test "x$def_systemdsystemunitdir" = "x"],
158 [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
159 [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
160 with_systemdsystemunitdir=no],
161 [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
162 AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
163 [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
164 AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
165
166 AC_ARG_ENABLE([external_tests],
167 AC_HELP_STRING([--enable-external-tests],
168 [Include the VTY/CTRL tests in make check [default=no]]),
169 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
170 if test "x$enable_ext_tests" = "xyes" ; then
171 AM_PATH_PYTHON
172 AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmo_verify_transcript_vty.py,yes)
173 if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
174 AC_MSG_ERROR([Please install https://gitea.osmocom.org/cellular-infrastructure/osmo-python-tests to run the VTY/CTRL tests.])
175 fi
176 fi
177 AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
178 AC_MSG_RESULT([$enable_ext_tests])
179 AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
180
181 AC_MSG_RESULT([CFLAGS="$CFLAGS"])
182 AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
183
184 AC_OUTPUT(
185 libosmo-sigtran.pc
186 include/osmocom/Makefile
187 include/osmocom/sccp/Makefile
188 include/osmocom/sigtran/Makefile
189 include/Makefile
190 src/Makefile
191 tests/Makefile
192 tests/m2ua/Makefile
193 tests/xua/Makefile
194 tests/ss7/Makefile
195 tests/vty/Makefile
196 examples/Makefile
197 stp/Makefile
198 doc/Makefile
199 doc/examples/Makefile
200 doc/manuals/Makefile
201 contrib/Makefile
202 contrib/systemd/Makefile
203 Doxyfile
204 Makefile)