]> git.zarvox.org Git - crbtree.git/commitdiff
build: update build system
authorKay Sievers <kay@vrfy.org>
Thu, 10 Mar 2016 17:20:30 +0000 (18:20 +0100)
committerKay Sievers <kay@vrfy.org>
Thu, 10 Mar 2016 18:05:18 +0000 (19:05 +0100)
16 files changed:
.autom4te.cfg [new file with mode: 0644]
.editorconfig [new file with mode: 0644]
.gitignore
COPYING
Makefile.am
README
autogen.sh
configure.ac
m4/attributes.m4 [deleted file]
src/c-rbtree-private.h [moved from src/crbtree-private.h with 97% similarity]
src/c-rbtree.c [moved from src/crbtree.c with 98% similarity]
src/libcrbtree.pc.in [new file with mode: 0644]
src/org.bus1/c-rbtree.h [moved from src/crbtree.h with 97% similarity]
src/test-api.c
src/test-basic.c
src/test-map.c

diff --git a/.autom4te.cfg b/.autom4te.cfg
new file mode 100644 (file)
index 0000000..e54988b
--- /dev/null
@@ -0,0 +1,3 @@
+begin-language: "Autoconf-without-aclocal-m4"
+args: --cache=build/.autom4te.cache
+end-language: "Autoconf-without-aclocal-m4"
diff --git a/.editorconfig b/.editorconfig
new file mode 100644 (file)
index 0000000..fcd47c5
--- /dev/null
@@ -0,0 +1,17 @@
+# EditorConfig configuration for base
+# http://EditorConfig.org
+
+# top-most EditorConfig file
+root = true
+
+# Unix-style newlines with a newline ending every file, utf-8 charset
+[*]
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+charset = utf-8
+
+# match config files, set indent to spaces with width of eight
+[*.{c,h}]
+indent_style = space
+indent_size = 8
index 394b6fe5029d5b428c3bb61b48b2ac098ba29f16..80b2be554cf3923aa658bba229af5135233ff5e3 100644 (file)
@@ -6,27 +6,24 @@
 *.o
 *.stamp
 *.swp
+*.tar.xz
 *.trs
 *~
 
-/.config.args
-/.libs/
-/*.tar.xz
-/Makefile
-/Makefile.in
-/autom4te.cache/
 /aclocal.m4
-/build-aux/
-/config.h
-/config.h.in
+/build/
 /config.log
 /config.status
 /configure
-/libtool
-!/m4/attributes.m4
-/src/.deps/
-/src/.dirstamp
-/stamp-*
+.deps/
+.dirstamp
+/Makefile
+/Makefile.in
+/install-tree
+
+/src/libcrbtree.pc
+/libcrbtree.so.0
+
 /test-api
 /test-basic
 /test-map
diff --git a/COPYING b/COPYING
index 8cc26a1777c129661fdfcb8ea85eb039f85255a8..69713b23f47a23b968f03bd59cccafc1dd43fe0b 100644 (file)
--- a/COPYING
+++ b/COPYING
@@ -1,19 +1,19 @@
 LICENSE:
-        crbtree is free software; you can redistribute it and/or modify it
+        bus1 is free software; you can redistribute it and/or modify it
         under the terms of the GNU Lesser General Public License as published
         by the Free Software Foundation; either version 2.1 of the License, or
         (at your option) any later version.
 
-        crbtree is distributed in the hope that it will be useful, but
+        bus1 is distributed in the hope that it will be useful, but
         WITHOUT ANY WARRANTY; without even the implied warranty of
         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
         Lesser General Public License for more details.
 
         You should have received a copy of the GNU Lesser General Public
-        License along with crbtree; If not, see <http://www.gnu.org/licenses/>.
+        License along with bus1; If not, see <http://www.gnu.org/licenses/>.
 
-COPYRIGHT:
-        Copyright (C) 2014-2015 Red Hat, Inc.
+COPYRIGHT: (ordered alphabetically)
+        Copyright (C) 2015-2016 Red Hat, Inc.
 
-AUTHORS:
+AUTHORS: (ordered alphabetically)
         David Herrmann <dh.herrmann@gmail.com>
index 83e75f6f908872ac7dd871ea035aa3e1b20a316d..171ab630ee7b63d7647b9982084b48aee6e7066a 100644 (file)
@@ -1,38 +1,38 @@
 # ------------------------------------------------------------------------------
-# main
+# autotools
 
-ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
+SHELL = bash
+ACLOCAL_AMFLAGS = -I build/m4 ${ACLOCAL_FLAGS}
 AM_MAKEFLAGS = --no-print-directory
 AUTOMAKE_OPTIONS = color-tests parallel-tests
 
 GCC_COLORS ?= 'ooh, shiny!'
 export GCC_COLORS
 
-SUBDIRS = .
-
 # remove targets if the command fails
 .DELETE_ON_ERROR:
 
 # keep intermediate files
 .SECONDARY:
 
-# Keep the test-suite.log and Makefile around at all times
+# keep the test-suite.log and Makefile around at all times
 .PRECIOUS: $(TEST_SUITE_LOG) Makefile
 
+pkgincludedir=$(includedir)/org.bus1
+pkgconfiglibdir=$(libdir)/pkgconfig
+
+BUILT_SOURCES =
 CLEANFILES = $(BUILT_SOURCES)
-DISTCLEANFILES =
 EXTRA_DIST =
-BUILT_SOURCES =
-lib_LTLIBRARIES =
-noinst_LTLIBRARIES =
-bin_PROGRAMS =
-noinst_PROGRAMS =
-check_PROGRAMS =
-TESTS =
+pkginclude_HEADERS =
+pkgconfiglib_DATA =
+noinst_LIBRARIES =
+check_PROGRAMS = $(default_tests)
+TESTS = $(default_tests)
 default_tests =
 
 AM_CPPFLAGS = \
-       -include $(top_builddir)/config.h \
+       -include $(top_builddir)/build/config.h \
        -I $(top_srcdir)/src \
        -I $(top_builddir)/src \
        $(OUR_CPPFLAGS)
@@ -41,46 +41,58 @@ AM_CFLAGS = $(OUR_CFLAGS)
 AM_LDFLAGS = $(OUR_LDFLAGS)
 
 # ------------------------------------------------------------------------------
-# libcrbtree-private (used for our tests, which access internal data)
+# libcrbtree.a
 
-noinst_LTLIBRARIES += \
-       libcrbtree-private.la
+noinst_LIBRARIES += \
+       libcrbtree.a
 
-libcrbtree_private_la_SOURCES = \
-       src/crbtree.h \
-       src/crbtree-private.h \
-       src/crbtree.c
+pkginclude_HEADERS += \
+       src/org.bus1/c-rbtree.h
 
-libcrbtree_private_la_CFLAGS = \
-       $(AM_CFLAGS)
+libcrbtree_a_SOURCES = \
+       src/libcrbtree.sym \
+       src/c-rbtree-private.h \
+       src/c-rbtree.c
 
-libcrbtree_private_la_CPPFLAGS = \
-       $(AM_CPPFLAGS) \
-       -UNDEBUG
+# ------------------------------------------------------------------------------
+# libcrbtree.so.0
 
-libcrbtree_private_la_LDFLAGS = \
-       $(AM_LDFLAGS)
+libcrbtree.so.0: libcrbtree.a $(top_srcdir)/src/libcrbtree.sym
+       $(AM_V_CCLD)$(CCLD) $(AM_CFLAGS) $(AM_LDFLAGS) \
+       -shared \
+       -Wl,-soname=$@ \
+       -Wl,--version-script=$(top_srcdir)/src/libcrbtree.sym \
+       -Wl,--whole-archive libcrbtree.a -Wl,--no-whole-archive \
+       -o $@
 
-# ------------------------------------------------------------------------------
-# libcrbtree
+CLEANFILES += \
+       libcrbtree.so.0
+
+all-local: libcrbtree.so.0
 
-lib_LTLIBRARIES += \
-       libcrbtree.la
+install-exec-hook:
+       $(MKDIR_P) $(DESTDIR)$(libdir)
+       cp libcrbtree.so.0 $(DESTDIR)$(libdir)
+       $(AM_V_LN)ln -sf libcrbtree.so.0 $(DESTDIR)$(libdir)/libcrbtree.so
 
-libcrbtree_la_SOURCES = \
-       $(libcrbtree_private_la_SOURCES)
+uninstall-hook:
+       rm -f $(DESTDIR)$(libdir)/libcrbtree.so.0
 
-libcrbtree_la_CFLAGS = \
-       $(AM_CFLAGS)
+%.pc: %.pc.in
+       $(AM_V_GEN)$(SED) \
+               -e 's,@includedir\@,$(includedir),g' \
+               -e 's,@libdir\@,$(libdir),g' \
+               -e 's,@VERSION\@,$(VERSION),g' \
+               $< > $@
 
-libcrbtree_la_CPPFLAGS = \
-       $(AM_CPPFLAGS)
+pkgconfiglib_DATA += \
+       src/libcrbtree.pc
 
-libcrbtree_la_LDFLAGS = \
-       $(AM_LDFLAGS) \
-       -version-info $(LIBCRBTREE_CURRENT):$(LIBCRBTREE_REVISION):$(LIBCRBTREE_AGE) \
-       -Wl,--version-script=$(top_srcdir)/src/libcrbtree.sym
+EXTRA_DIST += \
+       src/libcrbtree.pc.in
 
+CLEANFILES += \
+       src/libcrbtree.pc
 # ------------------------------------------------------------------------------
 # test-api
 
@@ -91,7 +103,7 @@ test_api_SOURCES = \
        src/test-api.c
 
 test_api_LDADD = \
-       libcrbtree.la # explicitly linked against public library
+       libcrbtree.so.0 # explicitly linked against public library
 
 # ------------------------------------------------------------------------------
 # test-basic
@@ -103,7 +115,7 @@ test_basic_SOURCES = \
        src/test-basic.c
 
 test_basic_LDADD = \
-       libcrbtree-private.la
+       libcrbtree.a
 
 # ------------------------------------------------------------------------------
 # test-map
@@ -115,10 +127,20 @@ test_map_SOURCES = \
        src/test-map.c
 
 test_map_LDADD = \
-       libcrbtree-private.la
+       libcrbtree.a
 
 # ------------------------------------------------------------------------------
 # test suite
 
+AM_TESTS_ENVIRONMENT = LD_LIBRARY_PATH=$(abs_builddir)
 check_PROGRAMS += $(default_tests)
 TESTS += $(default_tests)
+
+# ------------------------------------------------------------------------------¶
+# check "make install" directory tree
+
+install-tree: all
+       rm -rf $(abs_srcdir)/install-tree
+       $(MAKE) install DESTDIR=$(abs_srcdir)/install-tree
+       tree $(abs_srcdir)/install-tree
+.PHONY: install-tree
diff --git a/README b/README
index b96e91129270e9bb2275c1ea134e5ce5f9b6e1b7..fe78e6a3e06ad72ea9ee266c01f9d803725179c0 100644 (file)
--- a/README
+++ b/README
@@ -1,17 +1,17 @@
 crbtree - Standalone Red-Black Tree Implementation in Standard ISO-C11
 
 DETAILS:
-        https://github.com/dvdhrm/crbtree
+        https://github.com/bus1/crbtree
 
 BUG REPORTS:
-        https://github.com/dvdhrm/crbtree/issues
+        https://github.com/bus1/crbtree/issues
 
 GIT:
-        git@github.com:dvdhrm/crbtree.git
-        https://github.com/dvdhrm/crbtree.git
+        git@github.com:bus1/crbtree.git
+        https://github.com/bus1/crbtree.git
 
 GITWEB:
-        https://github.com/dvdhrm/crbtree
+        https://github.com/bus1/crbtree
 
 LICENSE:
         LGPLv2.1+ (LICENSE.LGPL2.1)
index d969f8d3e9c73af58d313f4f52190daa98be9833..704bd2c1cfb15cefba409d6f152457a50c43f468 100755 (executable)
@@ -1,24 +1,29 @@
-#!/bin/sh
-
+#!/bin/bash
 set -e
 
 oldpwd=$(pwd)
 topdir=$(dirname $0)
-cd $topdir
 
+cd $topdir
+mkdir -p ./build/m4/
 autoreconf --force --install --symlink
+cd $oldpwd
 
-if [ -f "$topdir/.config.args" ]; then
-        args="$args $(cat $topdir/.config.args)"
+# https://wiki.debian.org/Multiarch/Tuples
+if [[ "$HOSTTYPE" == "x86_64" ]]; then
+        ARCHITECTURE_TUPLE=x86_64-linux-gnu
+elif [[ "$HOSTTYPE" == "arm" ]]; then
+        ARCHITECTURE_TUPLE=arm-linux-gnueabihf
+else
+        echo "Unknown HOSTTYPE"
+        exit 1
 fi
 
-cd $oldpwd
-
-if [ "x$1" = "xc" ]; then
-        $topdir/configure --enable-debug $args
+if [[ "$1" == "b" ]]; then
+        $topdir/configure --prefix=/usr --libdir=/usr/lib/$ARCHITECTURE_TUPLE
         make clean
-elif [ "x$1" = "xl" ]; then
-        $topdir/configure CC=clang $args
+elif [[ "$1" = "c" ]]; then
+        $topdir/configure
         make clean
 else
         echo
@@ -26,6 +31,6 @@ else
         echo "Initialized build system. For a common configuration please run:"
         echo "----------------------------------------------------------------"
         echo
-        echo "$topdir/configure $args"
+        echo "$topdir/configure"
         echo
 fi
index 02acd7e18bcf01291943d71406c63a3d7aed5a98..24a453a643bc57bd7b5fc07ae3992fc418ac8875 100644 (file)
@@ -2,24 +2,19 @@
 # versions
 
 AC_PREREQ([2.64])
-
 AC_INIT([crbtree],
         [1],
-        [http://www.github.com/dvdhrm/crbtree],
+        [http://www.github.com/bus1/crbtree],
         [crbtree],
-        [http://www.github.com/dvdhrm/crbtree])
-
-AC_SUBST([LIBCRBTREE_CURRENT], 0)
-AC_SUBST([LIBCRBTREE_AGE], 0)
-AC_SUBST([LIBCRBTREE_REVISION], 1)
+        [http://www.github.com/bus1/crbtree])
 
 # ------------------------------------------------------------------------------
-# main
+# autotools
 
-AC_CONFIG_SRCDIR([src/crbtree.h])
-AC_CONFIG_MACRO_DIR([m4])
-AC_CONFIG_HEADERS([config.h])
-AC_CONFIG_AUX_DIR([build-aux])
+AC_CONFIG_SRCDIR([src/org.bus1/c-rbtree.h])
+AC_CONFIG_MACRO_DIR([build/m4])
+AC_CONFIG_HEADERS([build/config.h])
+AC_CONFIG_AUX_DIR([build/build-aux])
 
 AC_USE_SYSTEM_EXTENSIONS
 AC_SYS_LARGEFILE
@@ -28,38 +23,39 @@ AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules tar-pax no-di
 AM_SILENT_RULES([yes])
 AC_CANONICAL_HOST
 AC_DEFINE_UNQUOTED([CANONICAL_HOST], "$host", [Canonical host string.])
-
-AC_PROG_MKDIR_P
-AC_PROG_LN_S
-AC_PROG_SED
-AC_PROG_GREP
-AC_PROG_AWK
 AC_PROG_CC_C99
-
-LT_PREREQ(2.2)
-LT_INIT([disable-static])
-
-AC_PATH_PROG([M4], [m4])
-AC_PATH_PROG([XSLTPROC], [xsltproc])
+AC_PROG_RANLIB
+AC_PROG_SED
 
 AS_IF([! ln --relative --help > /dev/null 2>&1], [AC_MSG_ERROR([*** ln doesn't support --relative ***])])
-
-# ------------------------------------------------------------------------------
-# arguments
-
-AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [enable debug options]))
+m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
 
 # ------------------------------------------------------------------------------
 # toolchain
 
-CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
+OUR_CFLAGS=${OUR_CFLAGS:-$(echo \
+        -g \
+        -Og \
         -pipe \
+        -ftrapv \
+        -ffast-math \
+        -fno-common \
+        -fdiagnostics-show-option \
+        -fno-strict-aliasing \
+        -fvisibility=hidden \
+        -ffunction-sections \
+        -fdata-sections \
+        -fstack-protector \
+        -fstack-protector-strong \
+        -fPIE \
+        --param=ssp-buffer-size=4 \
         -Wall \
         -Wextra \
         -Wno-inline \
         -Wundef \
-        "-Wformat=2 -Wformat-security -Wformat-nonliteral" \
-        -Wlogical-op \
+        -Wformat=2 \
+        -Wformat-security \
+        -Wformat-nonliteral \
         -Wsign-compare \
         -Wmissing-include-dirs \
         -Wold-style-definition \
@@ -67,7 +63,6 @@ CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
         -Winit-self \
         -Wdeclaration-after-statement \
         -Wfloat-equal \
-        -Wsuggest-attribute=noreturn \
         -Wmissing-prototypes \
         -Wstrict-prototypes \
         -Wredundant-decls \
@@ -84,54 +79,24 @@ CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
         -Wno-unused-result \
         -Werror=overflow \
         -Wdate-time \
-        -Wnested-externs \
-        -ffast-math \
-        -fno-common \
-        -fdiagnostics-show-option \
-        -fno-strict-aliasing \
-        -fvisibility=hidden \
-        -ffunction-sections \
-        -fdata-sections \
-        -fstack-protector \
-        -fstack-protector-strong \
-        -fPIE \
-        --param=ssp-buffer-size=4])
+        -Wnested-externs)}
 
-AS_CASE([$CC], [*clang*],
-        [CC_CHECK_FLAGS_APPEND([with_cppflags], [CPPFLAGS], [ \
-               -Wno-typedef-redefinition \
-               -Wno-gnu-variable-sized-type-not-at-end \
-        ])])
+OUR_CPPFLAGS=${OUR_CPPFLAGS:-$(echo \
+        -Wp,-D_FORTIFY_SOURCE=2 \
+        -Wno-typedef-redefinition \
+        -Wno-gnu-variable-sized-type-not-at-end)}
 
-CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
+OUR_LDFLAGS=${OUR_LDFLAGS:-$(echo \
         -Wl,--as-needed \
         -Wl,--no-undefined \
         -Wl,--gc-sections \
         -Wl,-z,relro \
         -Wl,-z,now \
-        -pie])
+        -pie)}
 
-AS_IF([test "x$enable_debug" = "xyes"],
-      [
-        CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [ \
-                -g \
-                -O0 \
-                -ftrapv])
-      ], [
-        CC_CHECK_FLAGS_APPEND([with_cppflags], [CPPFLAGS], [\
-               -Wp,-D_FORTIFY_SOURCE=2 \
-               -DNDEBUG])
-      ])
-
-AC_SUBST([OUR_CFLAGS], "$with_cflags")
-AC_SUBST([OUR_CPPFLAGS], "$with_cppflags")
-AC_SUBST([OUR_LDFLAGS], "$with_ldflags")
-
-# ------------------------------------------------------------------------------
-# system features
-
-# This makes sure pkg.m4 is available.
-m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
+AC_SUBST(OUR_CFLAGS)
+AC_SUBST(OUR_CPPFLAGS)
+AC_SUBST(OUR_LDFLAGS)
 
 # ------------------------------------------------------------------------------
 # report
@@ -140,9 +105,7 @@ AC_CONFIG_FILES([Makefile])
 
 AC_OUTPUT
 AC_MSG_RESULT([
-        $PACKAGE_NAME $VERSION ($LIBCRBTREE_CURRENT.$LIBCRBTREE_AGE.$LIBCRBTREE_REVISION)
-        debug:                  ${enable_debug}
-
+        $PACKAGE_NAME $VERSION
         prefix:                 ${prefix}
         exec_prefix:            ${exec_prefix}
         includedir:             ${includedir}
diff --git a/m4/attributes.m4 b/m4/attributes.m4
deleted file mode 100644 (file)
index e145f49..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-dnl Macros to check the presence of generic (non-typed) symbols.
-dnl Copyright (c) 2006-2008 Diego Pettenò <flameeyes@gmail.com>
-dnl Copyright (c) 2006-2008 xine project
-dnl Copyright (c) 2012 Lucas De Marchi <lucas.de.marchi@gmail.com>
-dnl
-dnl This program is free software; you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2, or (at your option)
-dnl any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-dnl GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program; if not, write to the Free Software
-dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-dnl 02110-1301, USA.
-dnl
-dnl As a special exception, the copyright owners of the
-dnl macro gives unlimited permission to copy, distribute and modify the
-dnl configure scripts that are the output of Autoconf when processing the
-dnl Macro. You need not follow the terms of the GNU General Public
-dnl License when using or distributing such scripts, even though portions
-dnl of the text of the Macro appear in them. The GNU General Public
-dnl License (GPL) does govern all other use of the material that
-dnl constitutes the Autoconf Macro.
-dnl
-dnl This special exception to the GPL applies to versions of the
-dnl Autoconf Macro released by this project. When you make and
-dnl distribute a modified version of the Autoconf Macro, you may extend
-dnl this special exception to the GPL to apply to your modified version as
-dnl well.
-
-dnl Check if FLAG in ENV-VAR is supported by compiler and append it
-dnl to WHERE-TO-APPEND variable. Note that we invert -Wno-* checks to
-dnl -W* as gcc cannot test for negated warnings.
-dnl CC_CHECK_FLAG_APPEND([WHERE-TO-APPEND], [ENV-VAR], [FLAG])
-
-AC_DEFUN([CC_CHECK_FLAG_APPEND], [
-  AC_CACHE_CHECK([if $CC supports flag $3 in envvar $2],
-                 AS_TR_SH([cc_cv_$2_$3]),
-          [eval "AS_TR_SH([cc_save_$2])='${$2}'"
-           eval "AS_TR_SH([$2])='-Werror `echo "$3" | sed 's/^-Wno-/-W/'`'"
-           AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return 0; } ])],
-                          [eval "AS_TR_SH([cc_cv_$2_$3])='yes'"],
-                          [eval "AS_TR_SH([cc_cv_$2_$3])='no'"])
-           eval "AS_TR_SH([$2])='$cc_save_$2'"])
-
-  AS_IF([eval test x$]AS_TR_SH([cc_cv_$2_$3])[ = xyes],
-        [eval "$1='${$1} $3'"])
-])
-
-dnl CC_CHECK_FLAGS_APPEND([WHERE-TO-APPEND], [ENV-VAR], [FLAG1 FLAG2])
-AC_DEFUN([CC_CHECK_FLAGS_APPEND], [
-  for flag in $3; do
-    CC_CHECK_FLAG_APPEND($1, $2, $flag)
-  done
-])
-
-dnl Check if the flag is supported by linker (cacheable)
-dnl CC_CHECK_LDFLAGS([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
-AC_DEFUN([CC_CHECK_LDFLAGS], [
-  AC_CACHE_CHECK([if $CC supports $1 flag],
-    AS_TR_SH([cc_cv_ldflags_$1]),
-    [ac_save_LDFLAGS="$LDFLAGS"
-     LDFLAGS="$LDFLAGS $1"
-     AC_LINK_IFELSE([int main() { return 1; }],
-       [eval "AS_TR_SH([cc_cv_ldflags_$1])='yes'"],
-       [eval "AS_TR_SH([cc_cv_ldflags_$1])="])
-     LDFLAGS="$ac_save_LDFLAGS"
-    ])
-
-  AS_IF([eval test x$]AS_TR_SH([cc_cv_ldflags_$1])[ = xyes],
-    [$2], [$3])
-])
similarity index 97%
rename from src/crbtree-private.h
rename to src/c-rbtree-private.h
index 417ff75870bec9dc4e3a5bce5690e2e61891c323..04bdf42fca53175e65c214402d52bcdf6e61e134 100644 (file)
@@ -24,7 +24,7 @@
  */
 
 #include <stddef.h>
-#include "crbtree.h"
+#include "org.bus1/c-rbtree.h"
 
 /*
  * Macros
similarity index 98%
rename from src/crbtree.c
rename to src/c-rbtree.c
index 564bab2e94fb7a4ca0baed5c25b143ec23879c95..fffab86026c309001e4de93e65ae71354cd90699 100644 (file)
@@ -1,18 +1,18 @@
 /***
-  This file is part of crbtree. See COPYING for details.
+  This file is part of bus1. See COPYING for details.
 
-  crbtree is free software; you can redistribute it and/or modify it
+  bus1 is free software; you can redistribute it and/or modify it
   under the terms of the GNU Lesser General Public License as published by
   the Free Software Foundation; either version 2.1 of the License, or
   (at your option) any later version.
 
-  crbtree is distributed in the hope that it will be useful, but
+  bus1 is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   Lesser General Public License for more details.
 
   You should have received a copy of the GNU Lesser General Public License
-  along with crbtree; If not, see <http://www.gnu.org/licenses/>.
+  along with bus1; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
 /*
@@ -42,8 +42,9 @@
 
 #include <assert.h>
 #include <stddef.h>
-#include "crbtree.h"
-#include "crbtree-private.h"
+
+#include "c-rbtree-private.h"
+#include "org.bus1/c-rbtree.h"
 
 /**
  * c_rbnode_leftmost() - return leftmost child
diff --git a/src/libcrbtree.pc.in b/src/libcrbtree.pc.in
new file mode 100644 (file)
index 0000000..f44749c
--- /dev/null
@@ -0,0 +1,20 @@
+#  This file is part of bus1. See COPYING for details.
+#
+#  bus1 is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU Lesser General Public License as published by
+#  the Free Software Foundation; either version 2.1 of the License, or
+#  (at your option) any later version.
+#
+#  bus1 is distributed in the hope that it will be useful, but
+#  WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public License
+#  along with bus1; If not, see <http://www.gnu.org/licenses/>.
+
+Name: libcrbtree
+Description: Red-Black Tree Implementation
+Version: @VERSION@
+Libs: -L$@libdir@ -lcrbtree
+Cflags: -I$@includedir@
similarity index 97%
rename from src/crbtree.h
rename to src/org.bus1/c-rbtree.h
index b80364acf2634540df72a6539026f29f11b3c72e..126f73a2255ed1c8d3a51b13e39111657d52a077 100644 (file)
@@ -1,23 +1,23 @@
 #pragma once
 
 /***
-  This file is part of crbtree. See COPYING for details.
+  This file is part of bus1. See COPYING for details.
 
-  crbtree is free software; you can redistribute it and/or modify it
+  bus1 is free software; you can redistribute it and/or modify it
   under the terms of the GNU Lesser General Public License as published by
   the Free Software Foundation; either version 2.1 of the License, or
   (at your option) any later version.
 
-  crbtree is distributed in the hope that it will be useful, but
+  bus1 is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   Lesser General Public License for more details.
 
   You should have received a copy of the GNU Lesser General Public License
-  along with crbtree; If not, see <http://www.gnu.org/licenses/>.
+  along with bus1; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-/**
+/*
  * Standalone Red-Black-Tree Implementation in Standard ISO-C11
  *
  * This header provides an RB-Tree API, that is fully implemented in ISO-C11
@@ -54,7 +54,7 @@ typedef struct CRBTree CRBTree;
  * Each node in an RB-Tree must embed an CRBNode object. This object contains
  * pointers to its left and right child, which can be freely accessed by the
  * API user at any time. They are NULL, if the node does not have a left/right
- * child 
+ * child.
  *
  * The @__parent_and_color field must never be accessed directly. It encodes
  * the pointer to the parent node, and the color of the node. Use the accessor
index 69b2958c7e8415b8b8ca954ff981ce0f8c2797f0..b52c5b56c78eb0cacb0124a45485f681a968fc2c 100644 (file)
@@ -26,7 +26,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include "crbtree.h"
+
+#include "org.bus1/c-rbtree.h"
 
 static void test_api(void) {
         CRBTree t = {};
index 1f823e6be6411f6f4b4d7b87f77122f8a539ee5f..07e3c6563053fb9ab1c627e7c6752969f47e503e 100644 (file)
@@ -34,8 +34,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
-#include "crbtree.h"
-#include "crbtree-private.h"
+
+#include "org.bus1/c-rbtree.h"
+#include "c-rbtree-private.h"
 
 static size_t validate(CRBTree *t) {
         unsigned int i_black, n_black;
index d0ad8dce2181ca5606f52e5be5f565865e1123e1..72369565aad99cda3dc0b921fd6c91bad7937467 100644 (file)
@@ -29,8 +29,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
-#include "crbtree.h"
-#include "crbtree-private.h"
+
+#include "org.bus1/c-rbtree.h"
+#include "c-rbtree-private.h"
 
 typedef struct {
         unsigned long key;