blob: 586d7ef267cb26050ac65d578e9de5f452ffcb82 [file] [log] [blame]
Harald Welte3aa901d2018-08-13 18:32:36 +02001AC_INIT([osmo-remsim],
2 m4_esyscmd([./git-version-gen .tarball-version]),
3 [simtrace@lists.osmocom.org])
4
5dnl *This* is the root dir, even if an install-sh exists in ../ or ../../
6AC_CONFIG_AUX_DIR([.])
7
8LT_INIT
9
10AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip 1.9 tar-ustar])
11dnl tar-ustar: some asn1 filenames surpass the 99 char limit of tar, so we need
12dnl to make tar allow longer filenames.
13
14
15dnl kernel style compile messages
16m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
17
18dnl include release helper
19RELMAKE='-include osmo-release.mk'
20AC_SUBST([RELMAKE])
21
22dnl checks for programs
23AC_PROG_MAKE_SET
24AC_PROG_MKDIR_P
25AC_PROG_CC
26AC_PROG_INSTALL
27
28dnl check for pkg-config (explained in detail in libosmocore/configure.ac)
29AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no)
30if test "x$PKG_CONFIG_INSTALLED" = "xno"; then
31 AC_MSG_WARN([You need to install pkg-config])
32fi
33PKG_PROG_PKG_CONFIG([0.20])
34
Harald Welte73b6d702020-03-04 18:58:14 +010035AC_CHECK_LIB(csv, csv_init, CSV_LIBS="-lcsv", [AC_MSG_ERROR([*** libcsv library not found!])])
Harald Welteb0cef1d2018-10-15 02:03:10 +020036AC_CHECK_HEADERS([csv.h])
Harald Welte73b6d702020-03-04 18:58:14 +010037AC_SUBST(CSV_LIBS)
Harald Welteb0cef1d2018-10-15 02:03:10 +020038
Harald Welteb90fc442020-01-12 19:39:26 +010039PKG_CHECK_MODULES(OSMOCORE, libosmocore >= 1.3.0)
Harald Welte77911b02018-08-14 23:47:30 +020040PKG_CHECK_MODULES(OSMOGSM, libosmogsm >= 0.11.0)
Harald Welte8da22092020-02-16 15:59:32 +010041PKG_CHECK_MODULES(OSMOABIS, libosmoabis >= 0.8.0)
Harald Welte9353c602019-04-03 10:45:22 +000042
43AC_ARG_ENABLE([remsim-server],[AS_HELP_STRING([--disable-remsim-server], [Build osmo-remsim-server])],
44 [osmo_ac_build_server="$enableval"],[osmo_ac_build_server="yes"])
45if test "$osmo_ac_build_server" = "yes"; then
46 PKG_CHECK_MODULES(ULFIUS, libulfius)
Harald Welte0c50c342019-07-21 20:16:29 +020047 PKG_CHECK_MODULES(ORCANIA, liborcania)
Harald Welte9353c602019-04-03 10:45:22 +000048 PKG_CHECK_MODULES(JANSSON, jansson)
49 AC_DEFINE(BUILD_SERVER, 1, [Define if we want to build osmo-remsim-server])
50fi
51AM_CONDITIONAL(BUILD_SERVER, test "x$osmo_ac_build_server" = "xyes")
52AC_SUBST(BUILD_SERVER)
Harald Welte3aa901d2018-08-13 18:32:36 +020053
Harald Welted7468e02019-04-03 13:05:32 +020054AC_ARG_ENABLE([remsim-bankd],[AS_HELP_STRING([--disable-remsim-bankd], [Build osmo-remsim-bankd])],
55 [osmo_ac_build_bankd="$enableval"],[osmo_ac_build_bankd="yes"])
56if test "$osmo_ac_build_bankd" = "yes"; then
57 AC_DEFINE(BUILD_BANKD, 1, [Define if we want to build osmo-remsim-bankd])
Harald Weltef7598fe2019-12-16 16:52:45 +010058 PKG_CHECK_MODULES(OSMOSIM, libosmosim)
59 PKG_CHECK_MODULES(PCSC, libpcsclite)
Harald Welted7468e02019-04-03 13:05:32 +020060fi
61AM_CONDITIONAL(BUILD_BANKD, test "x$osmo_ac_build_bankd" = "xyes")
Harald Welted7468e02019-04-03 13:05:32 +020062AC_SUBST(BUILD_BANKD)
63
Harald Weltef7598fe2019-12-16 16:52:45 +010064AC_ARG_ENABLE([remsim-client],[AS_HELP_STRING([--disable-remsim-client], [Build osmo-remsim-client])],
65 [osmo_ac_build_client="$enableval"],[osmo_ac_build_client="yes"])
66if test "$osmo_ac_build_client" = "yes"; then
67 AC_DEFINE(BUILD_CLIENT, 1, [Define if we want to build osmo-remsim-client])
68 PKG_CHECK_MODULES(OSMOSIM, libosmosim)
69 PKG_CHECK_MODULES(OSMOUSB, libosmousb)
70 PKG_CHECK_MODULES(OSMOSIMTRACE2, libosmo-simtrace2)
71 PKG_CHECK_MODULES(USB, libusb-1.0)
Harald Welte9fac4962020-02-14 21:01:23 +010072
Harald Welte5b5d6ce2020-03-04 17:56:15 +010073 ifd_dropdir=`pkg-config --variable=usbdropdir libpcsclite`
Harald Welte9fac4962020-02-14 21:01:23 +010074 # allow user to override the dropdir for the PCSC driver bundle
75 AC_ARG_WITH(usbdropdir, [--with-usbdropdir PCSC bundle location],
76 [usbdropdir="${withval}"], [usbdropdir="${ifd_dropdir}"])
77 AC_SUBST(usbdropdir)
Harald Welte5b5d6ce2020-03-04 17:56:15 +010078 _serialconfdir=`pkg-config --variable=serialconfdir libpcsclite`
79 AC_ARG_WITH(serialconfdir, [--with-serialconfdir PCSC config directory location],
80 [serialconfdir="${withval}"], [serialconfdir="${_serialconfdir}"])
Harald Welted2dcb342020-03-04 16:11:11 +010081 AC_SUBST(serialconfdir)
Harald Weltef7598fe2019-12-16 16:52:45 +010082fi
83AM_CONDITIONAL(BUILD_CLIENT, test "x$osmo_ac_build_client" = "xyes")
84AC_SUBST(BUILD_CLIENT)
85
Harald Welted7468e02019-04-03 13:05:32 +020086
Harald Welte3aa901d2018-08-13 18:32:36 +020087AC_CONFIG_MACRO_DIR([m4])
88
89dnl checks for header files
90AC_HEADER_STDC
91
92AC_ARG_ENABLE(sanitize,
93 [AS_HELP_STRING(
94 [--enable-sanitize],
95 [Compile with address sanitizer enabled],
96 )],
97 [sanitize=$enableval], [sanitize="no"])
98if test x"$sanitize" = x"yes"
99then
100 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
101 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
102fi
103
104AC_ARG_ENABLE(werror,
105 AS_HELP_STRING(
106 [--enable-werror],
107 [Turn all compiler warnings into errors, with exceptions:
108 a) deprecation (allow upstream to mark deprecation without breaking builds);
109 b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
110 ]
111 )],
112 [werror=$enableval], [werror="no"])
113if test x"$werror" = x"yes"
114then
115 WERROR_FLAGS="-Werror"
116 WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
117 WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
118 CFLAGS="$CFLAGS $WERROR_FLAGS"
119 CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
120fi
121
Harald Welte3c4d0062019-03-31 18:55:18 +0200122# Generate manuals
123AC_ARG_ENABLE(manuals,
124 [AS_HELP_STRING(
125 [--enable-manuals],
126 [Generate manual PDFs [default=no]],
127 )],
128 [osmo_ac_build_manuals=$enableval], [osmo_ac_build_manuals="no"])
129AM_CONDITIONAL([BUILD_MANUALS], [test x"$osmo_ac_build_manuals" = x"yes"])
130AC_ARG_VAR(OSMO_GSM_MANUALS_DIR, [path to common osmo-gsm-manuals files, overriding pkg-config and "../osmo-gsm-manuals"
131 fallback])
132if test x"$osmo_ac_build_manuals" = x"yes"
133then
134 # Find OSMO_GSM_MANUALS_DIR (env, pkg-conf, fallback)
135 if test -n "$OSMO_GSM_MANUALS_DIR"; then
136 echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (from env)"
137 else
138 OSMO_GSM_MANUALS_DIR="$($PKG_CONFIG osmo-gsm-manuals --variable=osmogsmmanualsdir 2>/dev/null)"
139 if test -n "$OSMO_GSM_MANUALS_DIR"; then
140 echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (from pkg-conf)"
141 else
142 OSMO_GSM_MANUALS_DIR="../osmo-gsm-manuals"
143 echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (fallback)"
144 fi
145 fi
146 if ! test -d "$OSMO_GSM_MANUALS_DIR"; then
147 AC_MSG_ERROR("OSMO_GSM_MANUALS_DIR does not exist! Install osmo-gsm-manuals or set OSMO_GSM_MANUALS_DIR.")
148 fi
149
150 # Find and run check-depends
151 CHECK_DEPENDS="$OSMO_GSM_MANUALS_DIR/check-depends.sh"
152 if ! test -x "$CHECK_DEPENDS"; then
153 CHECK_DEPENDS="osmo-gsm-manuals-check-depends"
154 fi
155 if ! $CHECK_DEPENDS; then
156 AC_MSG_ERROR("missing dependencies for --enable-manuals")
157 fi
158
159 # Put in Makefile with absolute path
160 OSMO_GSM_MANUALS_DIR="$(realpath "$OSMO_GSM_MANUALS_DIR")"
161 AC_SUBST([OSMO_GSM_MANUALS_DIR])
162fi
163
Harald Welte75b8eb32020-03-04 17:11:36 +0100164# https://www.freedesktop.org/software/systemd/man/daemon.html
165AC_ARG_WITH([systemdsystemunitdir],
166 [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
167 [with_systemdsystemunitdir=auto])
168AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
169 def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
170
171 AS_IF([test "x$def_systemdsystemunitdir" = "x"],
172 [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
173 [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
174 with_systemdsystemunitdir=no],
175 [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
176AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
177 [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
178AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
179
Harald Welte3aa901d2018-08-13 18:32:36 +0200180CFLAGS="$CFLAGS -Wall"
181CPPFLAGS="$CPPFLAGS -Wall"
182
183AC_MSG_RESULT([CFLAGS="$CFLAGS"])
184AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
185
186AC_OUTPUT(
187 Makefile
Harald Welte798acd02019-04-03 09:33:12 +0200188 libosmo-rspro.pc
Harald Weltede80eb32020-03-04 17:07:57 +0100189 contrib/Makefile
190 contrib/etc_default/Makefile
191 contrib/systemd/Makefile
Harald Welte3c4d0062019-03-31 18:55:18 +0200192 doc/Makefile
193 doc/manuals/Makefile
Harald Welte3aa901d2018-08-13 18:32:36 +0200194 src/Makefile
195 src/rspro/Makefile
Harald Welted7468e02019-04-03 13:05:32 +0200196 src/bankd/Makefile
Harald Weltef7598fe2019-12-16 16:52:45 +0100197 src/client/Makefile
Harald Welte9fac4962020-02-14 21:01:23 +0100198 src/client/osmo-remsim-client-reader_conf
Harald Weltef5a0fa32019-03-03 15:44:18 +0100199 src/server/Makefile
Harald Welte3aa901d2018-08-13 18:32:36 +0200200 include/Makefile
201 include/osmocom/Makefile
202 include/osmocom/rspro/Makefile
203 )