On Fri, Oct 03, 2014 at 12:57:03PM +0200, Jan Engelhardt wrote:
When --disable-talloc was given to configure, it would
already link
libosmocore.so to libtalloc. Make it use pkg-config to discover
talloc's flags and location, and when the system talloc is used,
make sure to use its API header file too.
include/osmocom/core/talloc.h.in | 6 ++
Have you considered patching libosmocore.pc.in as well to list talloc
as "required" there? This way users of libosmocore do not need to check
for talloc themselves?
$ pkg-config --cflags --libs libosmocore
-I/home/ich/install/openbsc/include/ -L/home/ich/install/openbsc/lib -losmocore -ltalloc
AC_ARG_ENABLE(talloc,
[AS_HELP_STRING(
[--disable-talloc],
- [Disable building talloc memory allocator]
+ [Disable using bundled talloc memory allocator]
)],
[enable_talloc=$enableval], [enable_talloc="yes"])
AM_CONDITIONAL(ENABLE_TALLOC, [test x"$enable_talloc" = x"yes"])
+AS_IF([test x"$enable_talloc" = xno],
I think the wording does not reflect the two different usecases we have here.
* Firmware builds with no talloc
* People wanting to use
+#pragma once
+#if @OSMOCORE_INTERNAL_TALLOC@
+#include <osmocom/core/talloc_int.h>
+#else
+#include <talloc.h>
+#endif
Let's hope no-one puts -Iinclude/osmocom/core into the compile line or we
might end up with recursion. :)
diff --git a/include/osmocom/core/talloc_int.h
b/include/osmocom/core/talloc_int.h
new file mode 100644
index 0000000..dde102b
--- /dev/null
+++ b/include/osmocom/core/talloc_int.h
Do you know the '-M' option for send-email/format-patch? It helps with
reviewing simple renames.
diff --git a/tests/msgfile/msgfile_test.c
b/tests/msgfile/msgfile_test.c
index a919694..2684b6a 100644
--- a/tests/msgfile/msgfile_test.c
+++ b/tests/msgfile/msgfile_test.c
@@ -20,6 +20,7 @@
*/
#include <osmocom/core/msgfile.h>
+#include <osmocom/core/talloc.h>
Is this hunk needed?
If you address the pkg-config issue I am happy to inclue your patch. In
terms of options.. maybe we can just remove --disable-talloc instead of
having sort of a tri-state?
thanks a lot
holger