blob: 5c034e5a325093eb85500add1a72629e31a7fbdf [file] [log] [blame]
Alexander Chemeris040b3052013-06-16 14:29:54 +04001dnl
2dnl Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
3dnl
4dnl This software is distributed under the terms of the GNU Public License.
5dnl See the COPYING file in the main directory for details.
6dnl
7dnl This program is free software: you can redistribute it and/or modify
8dnl it under the terms of the GNU General Public License as published by
9dnl the Free Software Foundation, either version 3 of the License, or
10dnl (at your option) any later version.
11dnl
12dnl This program is distributed in the hope that it will be useful,
13dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
14dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15dnl GNU General Public License for more details.
16dnl
17dnl You should have received a copy of the GNU General Public License
18dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
19dnl
20
Harald Weltedb9c1b52017-10-28 17:49:36 +020021AC_INIT([osmo-trx],
22 m4_esyscmd([./git-version-gen .tarball-veresion]),
23 [openbsc@lists.osmocom.org])
Alexander Chemeris040b3052013-06-16 14:29:54 +040024AC_PREREQ(2.57)
25AC_CONFIG_SRCDIR([Transceiver52M/Makefile.am])
Pau Espin Pedrol82f83ce2018-01-09 15:09:31 +010026AC_CONFIG_AUX_DIR([.])
Thomas Tsou3eaae802013-08-20 19:31:14 -040027AC_CONFIG_MACRO_DIR([config])
Alexander Chemeris040b3052013-06-16 14:29:54 +040028AM_CONFIG_HEADER(config.h)
Pau Espin Pedrol2ac788b2018-01-09 17:44:49 +010029AC_CONFIG_TESTDIR(tests)
Alexander Chemeris040b3052013-06-16 14:29:54 +040030
31AC_CANONICAL_BUILD
32AC_CANONICAL_HOST
33AC_CANONICAL_TARGET
34
Tom Tsou2cc2ddd2015-04-06 18:02:56 -070035AM_INIT_AUTOMAKE([subdir-objects])
Alexander Chemeris040b3052013-06-16 14:29:54 +040036
37dnl Linux kernel KBuild style compile messages
38m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
39
Max099a44a2017-08-28 12:10:55 +020040dnl include release helper
41RELMAKE='-include osmo-release.mk'
42AC_SUBST([RELMAKE])
43
Alexander Chemeris040b3052013-06-16 14:29:54 +040044AM_PROG_AS
45AC_PROG_CXX
Tom Tsou8ca237b2017-06-09 11:15:58 -070046AX_CXX_COMPILE_STDCXX_11
Alexander Chemeris040b3052013-06-16 14:29:54 +040047AC_PROG_LN_S
48AC_PROG_MAKE_SET
49AC_PROG_INSTALL
50AC_PATH_PROG([RM_PROG], [rm])
51
Pau Espin Pedrolc92dad32018-02-20 13:22:58 +010052dnl check for pkg-config (explained in detail in libosmocore/configure.ac)
53AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no)
54if test "x$PKG_CONFIG_INSTALLED" = "xno"; then
55 AC_MSG_WARN([You need to install pkg-config])
56fi
57PKG_PROG_PKG_CONFIG([0.20])
58
Alexander Chemeris040b3052013-06-16 14:29:54 +040059AC_LIBTOOL_WIN32_DLL
60AC_ENABLE_SHARED dnl do build shared libraries
61AC_DISABLE_STATIC dnl don't build static libraries
62AC_PROG_LIBTOOL
63
64dnl Checks for header files.
65AC_HEADER_STDC
66dnl This is required for GnuRadio includes to understand endianess correctly:
67AC_CHECK_HEADERS([byteswap.h])
68
69dnl Checks for typedefs, structures, and compiler characteristics.
70AC_C_CONST
71AC_C_INLINE
72AC_TYPE_SIZE_T
73AC_HEADER_TIME
74AC_C_BIGENDIAN
75
76AC_ARG_WITH(usrp1, [
77 AS_HELP_STRING([--with-usrp1],
78 [enable USRP1 gnuradio based transceiver])
79])
80
Alexander Chemeris040b3052013-06-16 14:29:54 +040081AC_ARG_WITH(singledb, [
82 AS_HELP_STRING([--with-singledb],
83 [enable single daughterboard use on USRP1])
84])
85
Thomas Tsou7e4e5362013-10-30 21:18:55 -040086AC_ARG_WITH(neon, [
87 AS_HELP_STRING([--with-neon],
88 [enable ARM NEON support])
89])
90
91AC_ARG_WITH(neon-vfpv4, [
92 AS_HELP_STRING([--with-neon-vfpv4],
93 [enable ARM NEON FMA support])
94])
95
Tom Tsou66133312015-05-18 16:26:33 -070096AC_ARG_WITH(sse, [
97 AS_HELP_STRING([--with-sse],
98 [enable x86 SSE support (default)])
99])
100
Thomas Tsou7e4e5362013-10-30 21:18:55 -0400101AS_IF([test "x$with_neon" = "xyes"], [
102 AC_DEFINE(HAVE_NEON, 1, Support ARM NEON)
103])
104
105AS_IF([test "x$with_neon_vfpv4" = "xyes"], [
106 AC_DEFINE(HAVE_NEON, 1, Support ARM NEON)
107 AC_DEFINE(HAVE_NEON_FMA, 1, Support ARM NEON with FMA)
108])
109
Alexander Chemeris040b3052013-06-16 14:29:54 +0400110AS_IF([test "x$with_usrp1" = "xyes"], [
Thomas Tsouc0641242013-10-11 14:55:31 -0400111 PKG_CHECK_MODULES(USRP, usrp >= 3.3)
Alexander Chemeris040b3052013-06-16 14:29:54 +0400112])
113
Thomas Tsoufffd9872013-11-04 10:20:21 -0800114AS_IF([test "x$with_usrp1" != "xyes"],[
Tom Tsou72bf7622017-03-07 14:16:46 -0800115 PKG_CHECK_MODULES(UHD, uhd >= 003.011,
116 [AC_DEFINE(USE_UHD_3_11, 1, UHD version 3.11.0 or higher)],
117 [PKG_CHECK_MODULES(UHD, uhd >= 003.009,
118 [AC_DEFINE(USE_UHD_3_9, 1, UHD version 3.9.0 or higher)],
119 [PKG_CHECK_MODULES(UHD, uhd >= 003.005)]
120 )]
Tom Tsou80cb0802017-01-19 13:44:02 -0800121 )
122 AC_DEFINE(USE_UHD, 1, All UHD versions)
Alexander Chemeris040b3052013-06-16 14:29:54 +0400123])
124
Alexander Chemeris040b3052013-06-16 14:29:54 +0400125AS_IF([test "x$with_singledb" = "xyes"], [
126 AC_DEFINE(SINGLEDB, 1, Define to 1 for single daughterboard)
127])
128
Thomas Tsoufffd9872013-11-04 10:20:21 -0800129# Find and define supported SIMD extensions
Tom Tsou66133312015-05-18 16:26:33 -0700130AS_IF([test "x$with_sse" != "xno"], [
Philipp Maiere8ae9fc2017-03-20 12:08:42 +0100131 AX_SSE
132], [
133 AM_CONDITIONAL(HAVE_SSE3, false)
134 AM_CONDITIONAL(HAVE_SSE4_1, false)
Tom Tsou66133312015-05-18 16:26:33 -0700135])
Thomas Tsoufffd9872013-11-04 10:20:21 -0800136
Vadim Yanitskiyee573572017-05-20 01:34:34 +0300137dnl Check if the compiler supports specified GCC's built-in function
138AC_DEFUN([CHECK_BUILTIN_SUPPORT], [
139 AC_CACHE_CHECK(
140 [whether ${CC} has $1 built-in],
141 [osmo_cv_cc_has_builtin], [
142 AC_LINK_IFELSE([
143 AC_LANG_PROGRAM([], [
144 __builtin_cpu_supports("sse");
145 ])
146 ],
147 [AS_VAR_SET([osmo_cv_cc_has_builtin], [yes])],
148 [AS_VAR_SET([osmo_cv_cc_has_builtin], [no])])
149 ]
150 )
151
152 AS_IF([test yes = AS_VAR_GET([osmo_cv_cc_has_builtin])], [
153 AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$1), 1,
154 [Define to 1 if compiler has the '$1' built-in function])
155 ], [
156 AC_MSG_WARN($2)
157 ])
158])
159
160dnl Check if the compiler supports runtime SIMD detection
161CHECK_BUILTIN_SUPPORT([__builtin_cpu_supports],
162 [Runtime SIMD detection will be disabled])
163
Alexander Chemeris040b3052013-06-16 14:29:54 +0400164AM_CONDITIONAL(USRP1, [test "x$with_usrp1" = "xyes"])
Thomas Tsou7e4e5362013-10-30 21:18:55 -0400165AM_CONDITIONAL(ARCH_ARM, [test "x$with_neon" = "xyes" || test "x$with_neon_vfpv4" = "xyes"])
166AM_CONDITIONAL(ARCH_ARM_A15, [test "x$with_neon_vfpv4" = "xyes"])
Alexander Chemeris040b3052013-06-16 14:29:54 +0400167
Alexander Chemeris040b3052013-06-16 14:29:54 +0400168PKG_CHECK_MODULES(LIBUSB, libusb-1.0)
Alexander Huemer6fafd332018-01-12 15:04:02 +0100169PKG_CHECK_MODULES(FFTWF, fftw3f)
Alexander Chemeris040b3052013-06-16 14:29:54 +0400170
Neels Hofmeyr24575a62016-07-05 13:00:18 +0200171AC_CHECK_HEADER([boost/config.hpp],[],
172 [AC_MSG_ERROR([boost/config.hpp not found, install e.g. libboost-dev])])
173
Alexander Chemeris040b3052013-06-16 14:29:54 +0400174dnl Output files
175AC_CONFIG_FILES([\
176 Makefile \
177 CommonLibs/Makefile \
178 GSM/Makefile \
179 Transceiver52M/Makefile \
Thomas Tsou7e4e5362013-10-30 21:18:55 -0400180 Transceiver52M/arm/Makefile \
Thomas Tsou17bbb9b2013-10-30 21:24:40 -0400181 Transceiver52M/x86/Makefile \
Pau Espin Pedrol2ac788b2018-01-09 17:44:49 +0100182 tests/Makefile \
183 tests/CommonLibs/Makefile \
Pau Espin Pedrolc2ba4272018-01-10 13:06:22 +0100184 tests/Transceiver52M/Makefile \
Thomas Tsou7e4e5362013-10-30 21:18:55 -0400185])
Alexander Chemeris040b3052013-06-16 14:29:54 +0400186
187AC_OUTPUT