blob: c1868555200323271a7796a52a2e52e0d95a28e8 [file] [log] [blame]
Harald Welte3761ef42016-01-03 18:07:32 +01001AC_INIT([osmo-iuh],
2 m4_esyscmd([./git-version-gen .tarball-version]),
Daniel Willmann29b9e002015-12-15 15:10:31 +01003 [openbsc@lists.osmocom.org])
4
Neels Hofmeyr08d5c8c2016-10-01 00:34:48 +02005dnl *This* is the root dir, even if an install-sh exists in ../ or ../../
6AC_CONFIG_AUX_DIR([.])
7
Harald Welte0322feb2016-01-03 15:39:11 +01008LT_INIT
9
Neels Hofmeyrc636cab2016-08-26 23:41:46 +020010AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip 1.9 tar-ustar])
Neels Hofmeyre7d64762016-08-18 15:57:04 +020011dnl tar-ustar: some asn1 filenames surpass the 99 char limit of tar, so we need
12dnl to make tar allow longer filenames.
13
Daniel Willmann29b9e002015-12-15 15:10:31 +010014AC_CONFIG_TESTDIR(src/tests)
15
16dnl kernel style compile messages
17m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
18
Max5a3df8f2017-08-28 12:00:58 +020019dnl include release helper
20RELMAKE='-include osmo-release.mk'
21AC_SUBST([RELMAKE])
22
Daniel Willmann29b9e002015-12-15 15:10:31 +010023dnl checks for programs
24AC_PROG_MAKE_SET
25AC_PROG_MKDIR_P
26AC_PROG_CC
27AC_PROG_INSTALL
Daniel Willmann29b9e002015-12-15 15:10:31 +010028
Eric8d882712020-04-11 01:18:34 +020029dnl patching ${archive_cmds} to affect generation of file "libtool" to fix linking with clang
30AS_CASE(["$LD"],[*clang*],
31 [AS_CASE(["${host_os}"],
32 [*linux*],[archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'])])
33
Harald Welted37d3c82021-01-07 13:49:47 +010034AC_CHECK_HEADERS(netinet/sctp.h,,AC_MSG_ERROR(netinet/sctp.h not found))
35
Neels Hofmeyra44cb482016-10-01 00:52:01 +020036dnl check for pkg-config (explained in detail in libosmocore/configure.ac)
37AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no)
38if test "x$PKG_CONFIG_INSTALLED" = "xno"; then
39 AC_MSG_WARN([You need to install pkg-config])
40fi
41PKG_PROG_PKG_CONFIG([0.20])
42
Pau Espin Pedrol505fa9e2019-08-07 21:23:57 +020043PKG_CHECK_MODULES(OSMOCORE, libosmocore >= 0.12.0)
44PKG_CHECK_MODULES(OSMOGSM, libosmogsm >= 0.12.0)
45PKG_CHECK_MODULES(OSMOVTY, libosmovty >= 0.12.0)
46PKG_CHECK_MODULES(OSMOCTRL, libosmoctrl >= 0.12.0)
47PKG_CHECK_MODULES(OSMONETIF, libosmo-netif >= 0.3.0)
48PKG_CHECK_MODULES(OSMOSIGTRAN, libosmo-sigtran >= 0.10.0)
Pau Espin Pedrolba941e52018-05-03 18:29:14 +020049PKG_CHECK_MODULES(ASN1C, libasn1c >= 0.9.30)
Daniel Willmann29b9e002015-12-15 15:10:31 +010050
51AC_CONFIG_MACRO_DIR([m4])
52
53dnl checks for header files
54AC_HEADER_STDC
55
Neels Hofmeyr4325a2a2017-11-16 11:02:48 +010056AC_ARG_ENABLE(sanitize,
57 [AS_HELP_STRING(
58 [--enable-sanitize],
59 [Compile with address sanitizer enabled],
60 )],
61 [sanitize=$enableval], [sanitize="no"])
62if test x"$sanitize" = x"yes"
63then
64 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
65 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
66fi
67
Neels Hofmeyr666121a2018-03-05 20:43:10 +010068AC_ARG_ENABLE(werror,
69 [AS_HELP_STRING(
70 [--enable-werror],
71 [Turn all compiler warnings into errors, with exceptions:
72 a) deprecation (allow upstream to mark deprecation without breaking builds);
73 b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
74 ]
75 )],
76 [werror=$enableval], [werror="no"])
77if test x"$werror" = x"yes"
78then
79 WERROR_FLAGS="-Werror"
80 WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
81 WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
82 CFLAGS="$CFLAGS $WERROR_FLAGS"
83 CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
84fi
85
Pau Espin Pedrolaec91ab2018-01-22 19:03:37 +010086CFLAGS="$CFLAGS -Wall"
87CPPFLAGS="$CPPFLAGS -Wall"
88
Daniel Willmanndc468e62019-07-29 12:10:21 +020089# Generate manuals
90AC_ARG_ENABLE(manuals,
91 [AS_HELP_STRING(
92 [--enable-manuals],
93 [Generate manual PDFs [default=no]],
94 )],
95 [osmo_ac_build_manuals=$enableval], [osmo_ac_build_manuals="no"])
96AM_CONDITIONAL([BUILD_MANUALS], [test x"$osmo_ac_build_manuals" = x"yes"])
97AC_ARG_VAR(OSMO_GSM_MANUALS_DIR, [path to common osmo-gsm-manuals files, overriding pkg-config and "../osmo-gsm-manuals"
98 fallback])
99if test x"$osmo_ac_build_manuals" = x"yes"
100then
101 # Find OSMO_GSM_MANUALS_DIR (env, pkg-conf, fallback)
102 if test -n "$OSMO_GSM_MANUALS_DIR"; then
103 echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (from env)"
104 else
105 OSMO_GSM_MANUALS_DIR="$($PKG_CONFIG osmo-gsm-manuals --variable=osmogsmmanualsdir 2>/dev/null)"
106 if test -n "$OSMO_GSM_MANUALS_DIR"; then
107 echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (from pkg-conf)"
108 else
109 OSMO_GSM_MANUALS_DIR="../osmo-gsm-manuals"
110 echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (fallback)"
111 fi
112 fi
113 if ! test -d "$OSMO_GSM_MANUALS_DIR"; then
114 AC_MSG_ERROR("OSMO_GSM_MANUALS_DIR does not exist! Install osmo-gsm-manuals or set OSMO_GSM_MANUALS_DIR.")
115 fi
116
117 # Find and run check-depends
118 CHECK_DEPENDS="$OSMO_GSM_MANUALS_DIR/check-depends.sh"
119 if ! test -x "$CHECK_DEPENDS"; then
120 CHECK_DEPENDS="osmo-gsm-manuals-check-depends"
121 fi
122 if ! $CHECK_DEPENDS; then
123 AC_MSG_ERROR("missing dependencies for --enable-manuals")
124 fi
125
126 # Put in Makefile with absolute path
127 OSMO_GSM_MANUALS_DIR="$(realpath "$OSMO_GSM_MANUALS_DIR")"
128 AC_SUBST([OSMO_GSM_MANUALS_DIR])
129fi
130
Pau Espin Pedrola68b6822018-09-10 12:09:47 +0200131# https://www.freedesktop.org/software/systemd/man/daemon.html
132AC_ARG_WITH([systemdsystemunitdir],
133 [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
134 [with_systemdsystemunitdir=auto])
135AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
136 def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
137
138 AS_IF([test "x$def_systemdsystemunitdir" = "x"],
139 [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
140 [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
141 with_systemdsystemunitdir=no],
142 [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
143AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
144 [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
145AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
146
Neels Hofmeyr666121a2018-03-05 20:43:10 +0100147AC_MSG_RESULT([CFLAGS="$CFLAGS"])
148AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
149
Daniel Willmann29b9e002015-12-15 15:10:31 +0100150AC_OUTPUT(
Harald Welte216ac212016-01-03 18:12:22 +0100151 libosmo-ranap.pc
Harald Weltee844bf72019-05-06 15:25:10 +0200152 libosmo-sabp.pc
Daniel Willmann29b9e002015-12-15 15:10:31 +0100153 src/Makefile
154 src/hnbap/Makefile
155 src/ranap/Makefile
156 src/rua/Makefile
Harald Weltee844bf72019-05-06 15:25:10 +0200157 src/sabp/Makefile
Daniel Willmann29b9e002015-12-15 15:10:31 +0100158 src/tests/Makefile
Neels Hofmeyrc04a96c2016-01-04 18:03:31 +0100159 Makefile
160 include/Makefile
161 include/osmocom/Makefile
Neels Hofmeyrf1f2d7c2016-01-05 12:00:06 +0100162 include/osmocom/hnbap/Makefile
163 include/osmocom/ranap/Makefile
164 include/osmocom/rua/Makefile
Harald Weltee844bf72019-05-06 15:25:10 +0200165 include/osmocom/sabp/Makefile
Neels Hofmeyr926153b2016-08-18 02:15:56 +0200166 include/osmocom/iuh/Makefile
Neels Hofmeyr4d91ab22016-08-18 16:10:52 +0200167 doc/Makefile
Neels Hofmeyr01c71fc2016-08-18 16:11:37 +0200168 doc/examples/Makefile
Daniel Willmanndc468e62019-07-29 12:10:21 +0200169 doc/manuals/Makefile
Pau Espin Pedrola68b6822018-09-10 12:09:47 +0200170 contrib/Makefile
171 contrib/systemd/Makefile
Oliver Smith70abda02020-05-14 11:47:33 +0200172 contrib/osmo-iuh.spec
Neels Hofmeyrc04a96c2016-01-04 18:03:31 +0100173 )