core: Add some generic panic handling

This also includes an option for a minimal 'infinite loop' type
panic that could be required for embedded target that don't have
abort() or fprintf()

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
diff --git a/configure.in b/configure.in
index 140fdc2..c3e0061 100644
--- a/configure.in
+++ b/configure.in
@@ -66,6 +66,17 @@
 	[enable_vty=0], [enable_vty=1])
 AM_CONDITIONAL(ENABLE_VTY, test "x$enable_vty" = "x1")
 
+AC_ARG_ENABLE(panic_infloop,
+	[AS_HELP_STRING(
+		[--enable-panic-infloop],
+		[Trigger infinite loop on panic rather than fprintf/abort]
+	)],
+	[panic_infloop=1], [panic_infloop=0])
+if test "x$panic_infloop" = "x1"
+then
+	AC_DEFINE([PANIC_INFLOOP],[1],[Use infinite loop on panic rather than fprintf/abort])
+fi
+
 
 AC_OUTPUT(
 	libosmocore.pc