From e2f6ecc4f5852aedeb648db3167fc40386f6e73e Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Thu, 5 Apr 2018 22:50:53 +0200 Subject: build: use squareball.m4 --- .gitignore | 1 + m4/squareball.m4 | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 m4/squareball.m4 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 +# +# 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"]) +]) -- cgit v1.2.3-18-g5258