aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2018-04-05 22:50:53 +0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2018-04-05 22:50:53 +0200
commite2f6ecc4f5852aedeb648db3167fc40386f6e73e (patch)
tree91b9bda23574ee3369049e4640aa82f21e53a208
parentc43b487246fdfd2ddc5c794763b18255ac6a318e (diff)
downloadblogc-e2f6ecc4f5852aedeb648db3167fc40386f6e73e.tar.gz
blogc-e2f6ecc4f5852aedeb648db3167fc40386f6e73e.tar.bz2
blogc-e2f6ecc4f5852aedeb648db3167fc40386f6e73e.zip
build: use squareball.m4
-rw-r--r--.gitignore1
-rw-r--r--m4/squareball.m446
2 files changed, 47 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 4d18f25..24441bd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -42,6 +42,7 @@ Makefile.in
/m4/*.m4
!/m4/ax_pthread.m4
!/m4/pkg.m4
+!/m4/squareball.m4
# man pages
/blogc*.[157]
diff --git a/m4/squareball.m4 b/m4/squareball.m4
new file mode 100644
index 0000000..297701d
--- /dev/null
+++ b/m4/squareball.m4
@@ -0,0 +1,46 @@
+# squareball: A general-purpose library for C99.
+# Copyright (C) 2014-2018 Rafael G. Martins <rafael@rafaelmartins.eng.br>
+#
+# This program can be distributed under the terms of the BSD License.
+# See the file LICENSE.
+
+# SQUAREBALL_INIT([VERSION_ATOM])
+#
+# This should be added to Makefile.am
+#
+# if INTERNAL_SQUAREBALL
+# SUBDIRS = squareball
+# endif
+#
+# The following variables will be exported to be used in the Makefile.am:
+#
+# - SQUAREBALL_CFLAGS
+# - SQUAREBALL_LIBS
+#
+# This macro requires squareball to be installed as a git submodule in the
+# top source dir.
+# ----------------------------------
+AC_DEFUN([SQUAREBALL_INIT], [
+ AC_ARG_WITH([squareball], [AS_HELP_STRING([--with-squareball=@<:@internal/system@:>@],
+ [whether to use library squareball from system [default=internal]])])
+ AS_IF([test "x$with_squareball" = "xsystem"], [
+ SQUAREBALL="system"
+ PKG_CHECK_MODULES([SQUAREBALL], [squareball$1], , [
+ AC_MSG_ERROR([library squareball requested from system but not found])
+ ])
+ ], [
+ SQUAREBALL="internal"
+ SQUAREBALL_CFLAGS='-I$(top_srcdir)/squareball/src'
+ SQUAREBALL_LIBS='$(top_builddir)/squareball/libsquareball.la'
+ AC_SUBST(SQUAREBALL_LIBS)
+ AC_SUBST(SQUAREBALL_CFLAGS)
+ ac_configure_args_pre="$ac_configure_args"
+ ac_configure_args_post="$ac_configure_args --enable-bundleme"
+ ac_configure_args="$ac_configure_args_post"
+ AC_CONFIG_COMMANDS_PRE([ac_configure_args="$ac_configure_args_pre"])
+ AC_CONFIG_COMMANDS_POST([ac_configure_args="$ac_configure_args_post"])
+ AC_CONFIG_SUBDIRS([squareball])
+ ac_configure_args="$ac_configure_args_pre"
+ ])
+ AM_CONDITIONAL(INTERNAL_SQUAREBALL, [test "x$with_squareball" != "xsystem"])
+])