Commit Graph

71 Commits

Author SHA1 Message Date
Harald Welte b4186824c2 ctrl: Add doxygen API documentation; generate html from it
Closes: OS#3293
Change-Id: I8dc2f24d4bf557ff7bb0f2f46881f9f8d9d7f86f
2018-05-26 21:58:15 +02:00
Harald Welte ed6057841d ctrl: Introduce libosmoctrl.map to avoid unintended exports
There are some symbols for use between control_cmd.c and control_if.c,
which are not supposed to be exported publicly.  Let's make sure we
keep those symbols local.

Change-Id: Ia85f36a9c4b2ebf4003718e0a230959638370320
2018-05-26 21:58:11 +02:00
Harald Welte ea4d8939af Add osmo_timerfd_* functions for osmo_fd-wrapped timerfd
Linux offers file descriptor based periodic (interval) timers,
which can achieve a higher precision than our userspace based
timers and which can be slave'd to CLOCK_MONOTINIC or other clock
sources.  Let's add some code for osmo_fd wrapped versions that
integrate well with our select() abstraction.

The code has been used in osmo-bts-trx since June 2017 (change-id
I51b19adde14ebb7ef3bb863d45e06243c323e22e), and I'm just renaming
and moving it to libosmocore here.  After a merge, the osmo-bts
implementations can be removed in favor if this one.

Change-Id: Ibeffba7c997252c003723bcd5d14122c4ded2fe7
2018-05-10 10:33:54 +02:00
Pau Espin cacaa4a161 configure: Check separately for lib implementing dlopen and dlsym
Sometimes the library probiding dlopen is not the same one providing
dlsym.
This is the case when compiling with AddressSanitizer enabled. In this
case, AC_SEARCH_LIBS([dlopen]...) reports no lib is required, but tests
using dlsym still require to link against -ldl.

Change-Id: Ic619b0885688066b60c97caf1e2c7e5402c1d9f7
2018-05-04 19:25:16 +02:00
Neels Hofmeyr 09ecbb7674 configure: add --enable-werror
Provide a sane means of adding the -Werror compiler flag.

Currently, some of our jenkins.sh add -Werror by passing 'CFLAGS="-Werror"',
but that actually *overwrites* all the other CFLAGS we might want to have set.

Maintain these exceptions from -Werror:
a) deprecation (allow upstream to mark deprecation without breaking builds);
b) "#warning" pragmas (allow to remind ourselves of errors without breaking
   builds)

As a last configure step before generating the output files, print the complete
CFLAGS and CPPFLAGS by means of AC_MSG_RESULT.

Change-Id: Ic5c8e68b64cd890b3309b4b26c7f22bde1edba83
2018-03-13 00:00:30 +00:00
Max 3da793857d Embedded: add sercomm stubs
The sercomm functions are unavailable in case of embedded build. Add
stub and link the tests against it.

Change-Id: I9bc5cb2f822b1a3ffdc6ec29f46b6bac8288314e
2018-01-21 19:08:05 +00:00
Max 89c8c4027b Embedded: disable stats test
As of 67bdd80a96 the stats.c is
effectively disable so we should disable the corresponding tests as
well.

Change-Id: I42ff7a6619c0a5926fdc2ec779cf04689c567e15
2018-01-21 19:05:00 +00:00
Harald Welte b93f60f7cd conv_acc: Our code requires SSSE3, not just SSE3
The accelerated convolutional decoder uses SSSE3 instructions such
as PSIGNW (via _mm_sign_epi16) which go beyond what SSE3 offers.  So
let's make sure we use the right compiler flag (-mssse3) and also the
right runtime check.

Without this patch, we would use illegal instructions e.g. on Opteron
Gen3 such as Opteron 2427, which are also used as build.opensuse.org
build hosts (build31 through build36) where we wouldn't pass "make
check" as a result.

Change-Id: I2754164384109f2821fd98ffb48f625893f2923d
Fixes: OS#2386
2017-11-17 11:44:22 +01:00
Max ed029dfab9 Enable GnuTLS fallback
On systems with GNU/Linux kernel older than 3.17 (Debian 8 "jessie" for
example) the osmo_get_rand_id() would always return failure due to
missing getrandom() syscall.

To support such systems, let's add fallback code which uses GnuTLS
library. It can be disabled explicitly via '--disable-gnutls' option at
compile-time, otherwise ./configure will fail if both getrandom() and
GnuTLS are not available. When building with '--enable-embedded' the
fallback is disabled automatically.

Related: OS#1694

Change-Id: Ic77866ce65acf524b768882c751a4f9c0635740b
2017-11-02 18:06:26 +00:00
Max 4b2b0cc15d Add function to generate random identifier
The function is a wrapper on top of getrandom() (if available via glibc) or
corresponding syscall. If neither is available than failure is always
returned.

It's intended to generate small random data good enough for session
identifiers and keys. To generate long-term cryptographic keys it's
better to use special crypto libraries (like GnuTLS for example)
instead.

As an example it's used to replace old insecure random number generator
in osmo-auc-gen utility.

Change-Id: I0241b814ea4c4ce1458f7ad76e31d390383c2048
Related: OS#1694
2017-10-09 10:18:07 +00:00
Vadim Yanitskiy 272bd4fa66 Makefile.am: fix missing LTLDFLAGS for libosmocoding
Despite the libosmocoding.map is preset since the library release,
one was not used in a proper way. The LTLDFLAGS were missing, so
let's add them.

Change-Id: Idf677825ff642d50bea43c7f970810783e864fdd
2017-08-31 17:53:04 +07:00
Max ff932bbc38 Add release target to Makefile
Add simple helper target to automate basic release steps:
* version bump
* prepare release commit
* git commit, tag and sign

For library projects:
* update debian/changelog from TODO-RELEASE
* cleanup TODO-RELEASE

For non-library projects:
* update debian/changelog from git log

Note: it requires bumpversion package to be installed, debian/control is
adjusted accordingly. The helper itself is installed to facilitate reuse
by other libraries.

N. B: you still have to manually adjust LIBVERSION in previous commit -
see TODO-RELEASE header for details.

Use it as follows:
make REL=minor release

The REL parameter defines which component of the version [1] to bump and
can be any of { major, minor, patch }.

[1] http://semver.org/

Change-Id: I790ceb958195b9f6cbabfe8c977dc30e2bd7414b
Related: OS#1861
2017-08-08 11:55:03 +00:00
Pau Espin 639c408ec1 configure.ac: Add --disable-doxygen flag
This flag, when set, allows to unconditionally disable doxygen
documentation generation, even if doxygen command is found.

Change-Id: Iba1440292116af27b267c7a1fbec1c2336784efe
2017-07-06 10:45:26 +02:00
Pau Espin 1349249f88 configure.ac: Fix C(PP)FLAGS for BSD build
If we pass CFLAGS params to configure, then the CFLAGS set inside
configure.ac are not applied and the build fails if -Werror is enabled
because then BUILDING_LIBOSMOCORE is not defined.

Seeing the following output at configure time in FreeBSD build:
./configure: CFLAGS+= -fsanitize=address -fsanitize=undefined: not found
./configure: CPPFLAGS+= -fsanitize=address -fsanitize=undefined: not found
./configure: CFLAGS+= -DBUILDING_LIBOSMOCORE -Wall: not found
./configure: CPPFLAGS+= -DBUILDING_LIBOSMOCORE -Wall: not found

Change-Id: I692bbc66e5343998eec360a02a3a1fe73478c5c6
2017-06-23 15:41:49 +02:00
Pau Espin 40e629bd66 configure.ac: Enable -Wall by default
Change-Id: I70f917e05ad46049487710d1752aad2505c96696
2017-06-23 10:21:54 +02:00
Neels Hofmeyr 249fb71a2e doxygen: add missing gb API doc generation
Files in include/osmocom/gprs/ and src/gb/ are not included in any doxygen
generated API docs. Add Doxyfile.gb.in and adjust configure.ac and Makefile.am.

Change-Id: Ieb64f497f55368e396872083237c9ff28da2dd93
2017-06-23 00:18:21 +00:00
Pau Espin 69dfe5aeec Fix compilation warning on deprecated macro
A warning was printed even if the deprecation didn't apply to
libosmocore because it is still allowed to use it internally.
This patch fixes this case while still printing a warning if external
projects build using libosmocore headers.

Change-Id: I32212f20756f828af1017482a71e29e4b3adbad4
2017-06-18 10:40:18 +02:00
Harald Welte 898ffefde4 add libpseudotalloc as super-simplistic talloc replacement
In tightly embedded builds (--enable-embedded), we want the ability to
replace talloc with a very simple heap allocator to avoid the complexity
of talloc without modifying all our code that assumes talloc.

This will break the hierarchical notion of the allocator, but
libosmo{core,gsm,coding,codec} don't rely on that anyway.

Change-Id: Ie341034076f242a813f081919dd09d845775ad35
2017-05-17 15:15:52 +01:00
Vadim Yanitskiy a8a5819155 configure.ac: check for __builtin_cpu_supports call support
The '__builtin_cpu_supports' is a GCC's built-in function which
returns a positive integer if the run-time CPU supports specified
SIMD feature and returns 0 otherwise. It is required for further
SSE optimization of Viterbi decoder.

This change adds a new check, whether compiler supports this call.
See /gcc/X86-Built-in-Functions.html at gcc.gnu.org for reference.

Change-Id: I5d52cfb3e8fab3eedc0293a2842708cbee0f476a
2017-05-08 02:02:49 +07:00
Vadim Yanitskiy 2c3066e5da configure.ac: add SIMD detection capabilities
This change adds a check whether compiler supports some SIMD
(Single Instruction, Multiple Data) instructions. It is enabled
by default, and can be disabled by configure option --disable-simd.
The check macro is based on the AX_EXT from autoconf-archive:

www.gnu.org/software/autoconf-archive/ax_ext.html

And depends on the ax_check_compile_flag macro:

www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html

Currently only the following SIMD extensions are being checked:
AVX2, SSE3, SSE4.1, but adding others is also possible. All found
extensions are being defined in the 'config.h' header.

Change-Id: Idf8fff984bd936a75c7c307338df88ba4b005817
2017-05-07 23:11:06 +07:00
Vadim Yanitskiy 3262f820b5 libosmocoding: migrate transcoding routines from OsmoBTS
There are some projects, such as GR-GSM and OsmocomBB, which would
benefit from using one shared implementation of GSM 05.03 code. So,
this commit introduces a new sub-library called libosmocoding, which
(for now) provides GSM, GPRS and EDGE transcoding routines, migrated
from OsmoBTS.

The original GSM 05.03 code from OsmoBTS was relicensed under
GPLv2-or-later with permission of copyright holders (Andreas Eversberg,
Alexander Chemeris and Tom Tsou).

The following data types are currently supported:

 - xCCH
 - PDTCH (CS 1-4 and MCS 1-9)
 - TCH/FR
 - TCH/HR
 - TCH/AFS
 - RCH/AHS
 - RACH
 - SCH

Change-Id: I0c3256b87686d878e4e716d12393cad5924fdfa1
2017-03-07 01:06:38 +07:00
Harald Welte 1a7d64ccd1 configure.ac: Disable PCSC related code on EMBEDDED
The EMBEDDED conditional is used for building inside 'bare iron'
embedded devices like OsmocomBB phones.  There's no PC/SC in them.

Change-Id: I2ef7561d7fdb1ef1c060f8ac73d8588fc0f8eb3f
2017-01-15 18:04:02 +01:00
Harald Welte 1c67e754b8 configure.ac: Introduce --disable-ctrl
Using --disable-ctrl, one can disable the building of libosmoctrl.

The 'embedded' target will also automaticall disable ctrl.

Change-Id: I6912396338c5b23ae860fef2a55854d6df9a579d
2017-01-15 18:04:02 +01:00
Neels Hofmeyr 96831049d9 build: make check: disable sim_test when built with --disable-pcsc
Numerous issues caused sim_test to be attempted even though libosmosim was not
built:

In configure.ac, the ENABLE_PCSC variable lacked an AC_SUBST() to be exported.

Furthermore in configure.ac, no value 'yes'/'no' was assigned to the
ENABLE_PCSC variable, only to the enable_pcsc value.

In testsuite.at, encapsulating the sim_test in 'if ENABLE_PCSC' seems to have
no effect, regardless (not even when using a variable that should be defined
accurately).

So fix with these steps, similarly to how we do it in openbsc:

In AC_ARG_ENABLE, directly use 'ENABLE_PCSC' to assign 'yes'/'no'.
Export the same using AC_SUBST().
Add tests/atlocal.in to translate ENABLE_PCSC to enable_sim_test (also add
atlocal to AC_OUTPUT and distclean).
Use enable_sim_test in testuite.at, as seen in openbsc: use AT_CHECK() to
indicate skipping the test if enable_sim_test isn't 'yes'.

Change-Id: I9e8740c7d2dfbd272e22fee85972ef3fda7184a8
2016-11-16 16:40:44 +00:00
Neels Hofmeyr a23817622b configure: add --enable-sanitize, use in jenkins.sh
--enable-sanitize adds address sanitizer CFLAGS/CPPFLAGS to the entire build.
Also pass UBSAN_OPTIONS to the test suite run (only has effect during runtime).

Add this flag to jenkins.sh's configure step. To ensure that we get the
sanitize results, add 'make check' to jenkins to catch sanitize failures;

Keep 'make distcheck' without ASAN; it has its own configure which omits
--enable-sanitize. This way we test both with and without ASAN.

Change-Id: Idf7f46fa048608c2951f2473cb528f6c8dc2681d
2016-10-12 22:50:24 +00:00
Neels Hofmeyr cbdfa65dbe build: be robust against install-sh files above the root dir
Explicitly set AC_CONFIG_AUX_DIR.

To reproduce the error avoided by this patch:

  rm install-sh        # in case it was already generated.
  touch ../install-sh  # yes, outside this source tree
  autoreconf -fi

This will produce an error like

  ...
  configure.ac:16: error: required file '../ltmain.sh' not found
  configure.ac:5: installing '../missing'
  src/Makefile.am: installing '../depcomp'
  autoreconf: automake failed with exit status: 1

See also automake (vim `which automake`) and look for 'sub locate_aux_dir'.

Change-Id: If2afbe62e9ceeac8052c7b882ff92a548f3af0bf
2016-10-01 00:58:53 +02:00
Neels Hofmeyr fef2fa224a configure: check for pkg-config presence
On a fresh installation, I was puzzled by a configure.ac 'syntax error' for
PKG_CHECK_MODULES(TALLOC). It took me some time to figure out that merely
pkg-config was missing.

Add a check for pkg-config, which isn't as straightforward as I would wish,
so comment generously.

Change-Id: I2e7cdc37eb59f9947a45fbc5baddbaf71b655bc0
2016-08-09 14:35:27 +00:00
Harald Welte 90e614f7cc remove our internal copy of talloc, use system libtalloc
Shipping our own private copy of talloc was a good idea in 2008,
when it was not readily available on most target platforms.  Today,
the situation is quite different, as it is a standard library on
major Linux distributions.
2015-12-05 23:38:18 +01:00
Harald Welte 5fa0dcc275 configure: It should be --with-system-talloc, not --enable-system-talloc
As we are making a decision whether we should use an existing system
library, we call it --with-system-talloc, rather than
--enable-system-talloc.
2015-11-21 12:49:40 +01:00
Harald Welte d086f21195 configure.ac: Use AS_IF() instead of shell-if for PKG_CONFIG
https://autotools.io/pkgconfig/pkg_check_modules.html

> If you have the first call to PKG_CHECK_MODULES inside a bash
> conditional block, the expansion of PKG_PROG_PKG_CONFIG will also be
> conditional

> You can solve this problem in two ways; you can either explicitly call
> PKG_PROG_PKG_CONFIG outside of any conditional, forcing checking for
> pkg-config as soon as possible; or you can rewrite your conditionals
> to use the proper syntax
2015-11-21 12:49:36 +01:00
Harald Welte a10ef29b47 use system-wide libtalloc with --enable-system-talloc
This introduces a new configure flag by which the libosmocore-internal
talloc code is not compiled, but rather a system-wide libtalloc is used.

When we started openbsc/libosmocore in 2008, libtalloc was not widely
present on systems yet.  This has changed meanwhile, and we should
simply use the system-wide library
2015-11-21 00:50:19 +01:00
Jan Engelhardt c2ddc4f555 build: have a disable-static build succeed
When using configure --disable-static, no libosmogsm.a will be
created, and the tests fail to link because symbols like _a5_3 and
_a5_4 are not exported through the only remaining libosmogsm.so.

A method to overcome this is an intermediate private non-distributed
library, examples of which are present in e.g. libabc, kmod and
systemd.

With this, disable-static can now be the default and practical compile
time be halved.
2015-09-16 18:08:48 +02:00
Sylvain Munaut 69b1b8bea6 build: Enable subdir-objects
This fixes warning (and even build on some newer automake).
This should now work in the CI as well thanks to the fix for tests.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-08-19 11:15:14 +02:00
Holger Hans Peter Freyther 538ff49837 Revert "configure.ac: Add subdir-objects"
This reverts commit 7c942ba147.
With automake 1.14 and using the above option the distclean
will fail with:

Making distclean in tests
gmake[2]: Entering directory '/home/builder/source/workspace/libosmocore/label/FreeBSD_amd64/libosmocore-0.8.0.47-7c94/_build/tests'
Makefile:848: ../src/gsm/.deps/a5.Po: No such file or directory
Makefile:849: ../src/gsm/.deps/kasumi.Po: No such file or directory
gmake[2]: *** No rule to make target '../src/gsm/.deps/kasumi.Po'.  Stop.
gmake[2]: Leaving directory '/home/builder/source/workspace/libosmocore/label/FreeBSD_amd64/libosmocore-0.8.0.47-7c94/_build/tests'
Makefile:506: recipe for target 'distclean-recursive' failed
gmake[1]: *** [distclean-recursive] Error 1
gmake[1]: Leaving directory '/home/builder/source/workspace/libosmocore/label/FreeBSD_amd64/libosmocore-0.8.0.47-7c94/_build'
Makefile:714: recipe for target 'distcheck' failed

As we are not required to use the option, let's fix the build
2015-08-18 13:17:53 +02:00
Harald Welte 7c942ba147 configure.ac: Add subdir-objects
Apparently this is required under latest autotools versions.
2015-08-15 10:49:46 +02:00
Harald Welte e15ac060e7 fix libosmocore build for NuttX target
this fixes some compilation issues with libosmocore under NuttX,
particularly as some #defines are missing or some header files are
slightly different.
2014-12-04 14:15:36 +01:00
Holger Hans Peter Freyther 18bcc8ab62 pcsc: Allow to disable the PCSC dependency
* PCSC is enabled by default
* --enable-pcsc is enabling it
* --disable-pcscis disabling it
* Fix the makefile of the utilities to not build pcsc and
use the right header files/libraries.
2014-11-14 15:06:09 +01:00
Harald Welte 495fe2682c sim: Use autotools for libpcsc-lite linkage 2014-10-26 19:09:22 +01:00
Harald Welte d54c2ee8c5 initial checkin of 'libosmosim' 2014-10-26 19:09:22 +01:00
Harald Welte 3ff81b1a6b libctrl: autotools build system integration
Now we actually build the recently-imported libctrl
2014-08-21 15:34:18 +02:00
Holger Hans Peter Freyther c2c042dfd7 backtrace: Speculative fix for FreeBSD10.0 and execinfo.h
FreeBSD 10.0 ships an execinfo.h but one needs to link to an
additional library for the backtrace functions. Check if there
is a backtrace symbol in libexecinfo and if so link to that
library.
2014-04-17 23:19:10 +02:00
Christian Vogel 854debc32c Replace obsolete automake AM_CONFIG_HEADER.
This fixes the following complaint by autoconf 2.69-1, automake 1.13.1-1.

:  configure.ac:80: error: 'AM_CONFIG_HEADER': this macro is obsolete.
:      You should use the 'AC_CONFIG_HEADERS' macro instead.
:      /usr/share/aclocal-1.13/obsolete-err.m4:12: AM_CONFIG_HEADER is expan
:      configure.ac:80: the top level

Automake 1:1.11.3-1ubuntu2, autoconf 2.68-1ubuntu2 don't even emit a warning
without, and work just fine with this patch.

Signed-off-by: Christian Vogel <vogelchr@vogel.cx>
2013-01-06 00:42:26 +01:00
Tobias Engel 597460fd97 Do not use --version-script linker flag on OSX
Add a check to not use --version-script linker flag if compiled on OSX
since it doesn't exist there
2012-10-27 10:03:12 +02:00
Harald Welte e3a10b66a4 libosmogb: make build conditional, disable in embedded build
when we build for osmocom-bb cross-compilation, we don't have
sockets nor netinet/in.h and thus NS/BSSGP make no sense...
2012-09-08 22:18:43 +02:00
Harald Welte 7c8e2cc7ac libosmogsm: Back-port SMS related fixes from openbsc
This was fixed in 9c3dc90d16a40789081c84e46620f4d66689fec1 of
openbsc.git, after the sms code had been migrated here:
    introduce HAVE_TM_GMTOFF_IN_TM

    Not all architectures have the tm.tm_gmtoff member.  This fixes cygwin builds.
2012-08-29 16:47:30 +02:00
Diego Elio Pettenò c5f055f9e5 build: use LT_INIT(pic-only) instead of forcing -fPIC.
This actually allows for the user to override the decision and at the
same time supports compilers that might not be able to use -fPIC at
all.

Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu>
2012-06-30 22:01:44 +02:00
Diego Elio Pettenò 406777cfdb build: LT_INIT already replaces AC_PROG_LIBTOOL.
Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu>
2012-06-30 22:01:43 +02:00
Diego Elio Pettenò 001ef7ea4d build: avoid calling undefined macro.
This line was reporting "command not found" and should not be a
problem, as there's a check for the same thing later on.

Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu>
2012-06-30 22:01:43 +02:00
Diego Elio Pettenò 8dd81fa31f build: avoid duplication of automake options, add no-dist-gzip.
There's little to no point to build the gzip version of the tarball
when we're building the bzip2 version.

Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu>
2012-06-30 22:01:43 +02:00
Diego Elio Pettenò d471a21920 build: simplify headers management and remove recursion
There is no real reason to keep the include directory a multi-level
recursion, so instead declare everything within include (so that we
can use proper nobase_ declarations) and be it.

Please note that since we removed the sub-Makefile.am, ./configure
will not create the directory structure for us on out-of-tree builds,
so we have to make sure the directory we're generating to exists first.

Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu>
2012-06-30 22:01:43 +02:00