aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile49
-rw-r--r--Makefile.am11
-rw-r--r--Makefile.inc62
-rw-r--r--aminclude.am166
-rwxr-xr-xbootstrap7
-rw-r--r--configure.ac151
-rw-r--r--doxygen.cfg (renamed from platform/linux-generic/Doxyfile.in)12
-rw-r--r--m4/ax_prog_doxygen.m4532
-rw-r--r--m4/ax_pthread.m4332
-rw-r--r--pkgconfig/libodp.pc.in11
-rw-r--r--platform/Makefile.am1
-rw-r--r--platform/linux-generic/Makefile142
-rw-r--r--platform/linux-generic/Makefile.am84
-rw-r--r--platform/linux-generic/odp_barrier.c (renamed from platform/linux-generic/source/odp_barrier.c)0
-rw-r--r--platform/linux-generic/odp_buffer.c (renamed from platform/linux-generic/source/odp_buffer.c)0
-rw-r--r--platform/linux-generic/odp_buffer_pool.c (renamed from platform/linux-generic/source/odp_buffer_pool.c)0
-rw-r--r--platform/linux-generic/odp_coremask.c (renamed from platform/linux-generic/source/odp_coremask.c)0
-rw-r--r--platform/linux-generic/odp_init.c (renamed from platform/linux-generic/source/odp_init.c)0
-rw-r--r--platform/linux-generic/odp_linux.c (renamed from platform/linux-generic/source/odp_linux.c)0
-rw-r--r--platform/linux-generic/odp_packet.c (renamed from platform/linux-generic/source/odp_packet.c)0
-rw-r--r--platform/linux-generic/odp_packet_flags.c (renamed from platform/linux-generic/source/odp_packet_flags.c)0
-rw-r--r--platform/linux-generic/odp_packet_io.c (renamed from platform/linux-generic/source/odp_packet_io.c)0
-rw-r--r--platform/linux-generic/odp_packet_netmap.c (renamed from platform/linux-generic/source/odp_packet_netmap.c)0
-rw-r--r--platform/linux-generic/odp_packet_socket.c (renamed from platform/linux-generic/source/odp_packet_socket.c)0
-rw-r--r--platform/linux-generic/odp_queue.c (renamed from platform/linux-generic/source/odp_queue.c)0
-rw-r--r--platform/linux-generic/odp_ring.c (renamed from platform/linux-generic/source/odp_ring.c)0
-rw-r--r--platform/linux-generic/odp_rwlock.c (renamed from platform/linux-generic/source/odp_rwlock.c)0
-rw-r--r--platform/linux-generic/odp_schedule.c (renamed from platform/linux-generic/source/odp_schedule.c)0
-rw-r--r--platform/linux-generic/odp_shared_memory.c (renamed from platform/linux-generic/source/odp_shared_memory.c)0
-rw-r--r--platform/linux-generic/odp_spinlock.c (renamed from platform/linux-generic/source/odp_spinlock.c)0
-rw-r--r--platform/linux-generic/odp_system_info.c (renamed from platform/linux-generic/source/odp_system_info.c)0
-rw-r--r--platform/linux-generic/odp_thread.c (renamed from platform/linux-generic/source/odp_thread.c)0
-rw-r--r--platform/linux-generic/odp_ticketlock.c (renamed from platform/linux-generic/source/odp_ticketlock.c)0
-rw-r--r--platform/linux-generic/odp_time.c (renamed from platform/linux-generic/source/odp_time.c)0
-rw-r--r--platform/linux-generic/odp_timer.c (renamed from platform/linux-generic/source/odp_timer.c)0
-rw-r--r--platform/linux-keystone2/Makefile118
-rw-r--r--platform/linux-keystone2/Makefile.am95
-rw-r--r--platform/linux-keystone2/README10
-rw-r--r--platform/linux-keystone2/odp_buffer.c (renamed from platform/linux-keystone2/source/odp_buffer.c)0
-rw-r--r--platform/linux-keystone2/odp_buffer_pool.c (renamed from platform/linux-keystone2/source/odp_buffer_pool.c)0
-rw-r--r--platform/linux-keystone2/odp_init.c (renamed from platform/linux-keystone2/source/odp_init.c)0
-rw-r--r--platform/linux-keystone2/odp_packet.c (renamed from platform/linux-keystone2/source/odp_packet.c)0
-rw-r--r--platform/linux-keystone2/odp_packet_io.c (renamed from platform/linux-keystone2/source/odp_packet_io.c)0
-rw-r--r--platform/linux-keystone2/odp_queue.c (renamed from platform/linux-keystone2/source/odp_queue.c)0
-rw-r--r--platform/linux-keystone2/odp_shared_memory.c (renamed from platform/linux-keystone2/source/odp_shared_memory.c)0
-rw-r--r--test/Makefile17
-rw-r--r--test/Makefile.am1
-rw-r--r--test/Makefile.inc10
-rw-r--r--test/api_test/Makefile87
-rw-r--r--test/api_test/Makefile.am8
-rw-r--r--test/example/Makefile44
-rw-r--r--test/example/Makefile.am5
-rw-r--r--test/generator/Makefile44
-rw-r--r--test/generator/Makefile.am5
-rw-r--r--test/l2fwd/Makefile43
-rw-r--r--test/l2fwd/Makefile.am5
-rw-r--r--test/packet/Makefile43
-rw-r--r--test/packet/Makefile.am5
-rw-r--r--test/packet_netmap/Makefile45
-rw-r--r--test/packet_netmap/Makefile.am7
-rw-r--r--test/timer/Makefile44
-rw-r--r--test/timer/Makefile.am5
62 files changed, 1444 insertions, 757 deletions
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 7d10fd5e5..000000000
--- a/Makefile
+++ /dev/null
@@ -1,49 +0,0 @@
-# Copyright (c) 2013, Linaro Limited
-# All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-
-.DEFAULT_GOAL := default
-
-ODP_ROOT = $(CURDIR)
-ODP_TESTS = $(ODP_ROOT)/test
-
-include $(ODP_ROOT)/Makefile.inc
-
-.PHONY: default
-default: lib tests
-
-.PHONY: all
-all: tests_install docs_install
-
-.PHONY: tests_install
-tests_install: tests
- $(MAKE) -C test install
-
-.PHONY: tests
-tests: libs_install
- $(MAKE) -C $(ODP_TESTS)
-
-.PHONY: docs
-docs:
- $(MAKE) -C $(ODP_DIR) docs
-
-.PHONY: docs_install
-docs_install: docs
- $(MAKE) -C $(ODP_DIR) docs_install
-
-.PHONY: lib
-lib:
- $(MAKE) -C $(ODP_DIR) libs
-
-.PHONY: clean
-clean:
- $(MAKE) -C $(ODP_DIR) clean
- $(MAKE) -C $(ODP_TESTS) clean
-
-.PHONY: libs_install
-libs_install: lib
- $(MAKE) -C platform/$(PLATFORM) install
-
-.PHONY: install
-install: libs_install docs_install tests_install
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 000000000..36d5c2389
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,11 @@
+ACLOCAL_AMFLAGS=-I m4
+AUTOMAKE_OPTIONS = foreign
+
+SUBDIRS = platform test
+
+include $(top_srcdir)/aminclude.am
+
+EXTRA_DIST = bootstrap $(DX_CONFIG)
+
+clean-local:
+ rm -rf $(top_builddir)/doxygen-doc
diff --git a/Makefile.inc b/Makefile.inc
deleted file mode 100644
index ff16043c4..000000000
--- a/Makefile.inc
+++ /dev/null
@@ -1,62 +0,0 @@
-# Copyright (c) 2013, Linaro Limited
-# All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-
-PLATFORM ?= linux-generic
-OBJ_DIR = ./obj
-ODP_DIR = $(ODP_ROOT)/platform/$(PLATFORM)
-
-export DESTDIR = $(ODP_ROOT)/build
-
-CC ?= gcc
-LD ?= gcc
-AR ?= ar
-ECHO := @echo
-MKDIR := mkdir -p
-RMDIR := rm -rf
-RM := rm -f
-COPY := cp -r
-SYNC := rsync -a --delete
-
-ifneq ($(VERBOSE),yes)
-Q = @
-MAKEFLAGS += --no-print-directory
-endif
-
-QUIET_CC = $(Q:@=@echo ' CC '$@;)
-QUIET_LD = $(Q:@=@echo ' LD '$@;)
-QUIET_AR = $(Q:@=@echo ' AR '$@;)
-export Q QUIET_CC QUIET_LD QUIET_AR
-
-ifeq ($(ODP_DEBUG_PRINT),no)
-EXTRA_CFLAGS += -DODP_DEBUG_PRINT=0
-else
-EXTRA_CFLAGS += -DODP_DEBUG_PRINT=1
-endif
-
-ifeq ($(DEBUG),yes)
-EXTRA_CFLAGS += -O0 -g
-else
-EXTRA_CFLAGS += -O3
-endif
-
-EXTRA_CFLAGS += -pthread
-EXTRA_CFLAGS += -W -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
-EXTRA_CFLAGS += -Wmissing-declarations -Wold-style-definition -Wpointer-arith
-EXTRA_CFLAGS += -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral
-EXTRA_CFLAGS += -Wformat-security -Wundef -Wwrite-strings
-
-
-LDFLAGS += -pthread
-LDFLAGS += $(CFLAGS)
-
-STD_LIBS += -lrt
-
-include $(wildcard $(ODP_DIR)/Makefile.inc)
-
-.PHONY: default
-default:
-
-$(OBJ_DIR):
- $(Q)$(MKDIR) $(OBJ_DIR)
diff --git a/aminclude.am b/aminclude.am
new file mode 100644
index 000000000..fc9665ae4
--- /dev/null
+++ b/aminclude.am
@@ -0,0 +1,166 @@
+# LICENSE
+#
+# Copyright (c) 2009 Oren Ben-Kiki <oren@ben-kiki.org>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+#
+
+## --------------------------------- ##
+## Format-independent Doxygen rules. ##
+## --------------------------------- ##
+
+if DX_COND_doc
+
+## ------------------------------- ##
+## Rules specific for HTML output. ##
+## ------------------------------- ##
+
+if DX_COND_html
+
+DX_CLEAN_HTML = @DX_DOCDIR@/html
+
+endif DX_COND_html
+
+## ------------------------------ ##
+## Rules specific for CHM output. ##
+## ------------------------------ ##
+
+if DX_COND_chm
+
+DX_CLEAN_CHM = @DX_DOCDIR@/chm
+
+if DX_COND_chi
+
+DX_CLEAN_CHI = @DX_DOCDIR@/@PACKAGE@.chi
+
+endif DX_COND_chi
+
+endif DX_COND_chm
+
+## ------------------------------ ##
+## Rules specific for MAN output. ##
+## ------------------------------ ##
+
+if DX_COND_man
+
+DX_CLEAN_MAN = @DX_DOCDIR@/man
+
+endif DX_COND_man
+
+## ------------------------------ ##
+## Rules specific for RTF output. ##
+## ------------------------------ ##
+
+if DX_COND_rtf
+
+DX_CLEAN_RTF = @DX_DOCDIR@/rtf
+
+endif DX_COND_rtf
+
+## ------------------------------ ##
+## Rules specific for XML output. ##
+## ------------------------------ ##
+
+if DX_COND_xml
+
+DX_CLEAN_XML = @DX_DOCDIR@/xml
+
+endif DX_COND_xml
+
+## ----------------------------- ##
+## Rules specific for PS output. ##
+## ----------------------------- ##
+
+if DX_COND_ps
+
+DX_CLEAN_PS = @DX_DOCDIR@/@PACKAGE@.ps
+
+DX_PS_GOAL = doxygen-ps
+
+doxygen-ps: @DX_DOCDIR@/@PACKAGE@.ps
+
+@DX_DOCDIR@/@PACKAGE@.ps: @DX_DOCDIR@/@PACKAGE@.tag
+ cd @DX_DOCDIR@/latex; \
+ rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
+ $(DX_LATEX) refman.tex; \
+ $(MAKEINDEX_PATH) refman.idx; \
+ $(DX_LATEX) refman.tex; \
+ countdown=5; \
+ while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
+ refman.log > /dev/null 2>&1 \
+ && test $$countdown -gt 0; do \
+ $(DX_LATEX) refman.tex; \
+ countdown=`expr $$countdown - 1`; \
+ done; \
+ $(DX_DVIPS) -o ../@PACKAGE@.ps refman.dvi
+
+endif DX_COND_ps
+
+## ------------------------------ ##
+## Rules specific for PDF output. ##
+## ------------------------------ ##
+
+if DX_COND_pdf
+
+DX_CLEAN_PDF = @DX_DOCDIR@/@PACKAGE@.pdf
+
+DX_PDF_GOAL = doxygen-pdf
+
+doxygen-pdf: @DX_DOCDIR@/@PACKAGE@.pdf
+
+@DX_DOCDIR@/@PACKAGE@.pdf: @DX_DOCDIR@/@PACKAGE@.tag
+ cd @DX_DOCDIR@/latex; \
+ rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
+ $(DX_PDFLATEX) refman.tex; \
+ $(DX_MAKEINDEX) refman.idx; \
+ $(DX_PDFLATEX) refman.tex; \
+ countdown=5; \
+ while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
+ refman.log > /dev/null 2>&1 \
+ && test $$countdown -gt 0; do \
+ $(DX_PDFLATEX) refman.tex; \
+ countdown=`expr $$countdown - 1`; \
+ done; \
+ mv refman.pdf ../@PACKAGE@.pdf
+
+endif DX_COND_pdf
+
+## ------------------------------------------------- ##
+## Rules specific for LaTeX (shared for PS and PDF). ##
+## ------------------------------------------------- ##
+
+if DX_COND_latex
+
+DX_CLEAN_LATEX = @DX_DOCDIR@/latex
+
+endif DX_COND_latex
+
+.PHONY: doxygen-run doxygen-doc $(DX_PS_GOAL) $(DX_PDF_GOAL)
+
+.INTERMEDIATE: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
+
+doxygen-run: @DX_DOCDIR@/@PACKAGE@.tag
+
+doxygen-doc: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
+
+@DX_DOCDIR@/@PACKAGE@.tag: $(DX_CONFIG) $(pkginclude_HEADERS)
+ rm -rf @DX_DOCDIR@
+ $(DX_ENV) $(DX_DOXYGEN) $(srcdir)/$(DX_CONFIG)
+
+DX_CLEANFILES = \
+ @DX_DOCDIR@/@PACKAGE@.tag \
+ -r \
+ $(DX_CLEAN_HTML) \
+ $(DX_CLEAN_CHM) \
+ $(DX_CLEAN_CHI) \
+ $(DX_CLEAN_MAN) \
+ $(DX_CLEAN_RTF) \
+ $(DX_CLEAN_XML) \
+ $(DX_CLEAN_PS) \
+ $(DX_CLEAN_PDF) \
+ $(DX_CLEAN_LATEX)
+
+endif DX_COND_doc
diff --git a/bootstrap b/bootstrap
new file mode 100755
index 000000000..12f9388b5
--- /dev/null
+++ b/bootstrap
@@ -0,0 +1,7 @@
+#! /bin/sh
+set -x
+aclocal -I config
+libtoolize --copy
+autoheader
+automake --add-missing --copy
+autoconf
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 000000000..873ea9eab
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,151 @@
+AC_PREREQ([2.5])
+AC_INIT([OpenDataPlane], [0.2], [lng-odp@lists.linaro.org])
+AC_CONFIG_SRCDIR([include/config.h.in])
+AM_CONFIG_HEADER([include/config.h])
+
+AC_USE_SYSTEM_EXTENSIONS
+AC_SYS_LARGEFILE
+AC_CONFIG_MACRO_DIR([m4])
+AM_SILENT_RULES([yes])
+
+DX_HTML_FEATURE(ON)
+DX_PDF_FEATURE(ON)
+DX_INIT_DOXYGEN($PACKAGE_NAME, doxygen.cfg)
+
+# Checks for programs.
+AC_PROG_CC
+AM_PROG_CC_C_O
+AM_INIT_AUTOMAKE([subdir-objects])
+
+AC_PROG_INSTALL
+AC_PROG_MAKE_SET
+
+#Use libtool
+LT_INIT([disable-shared static])
+AC_SUBST([LIBTOOL_DEPS])
+AM_PROG_LIBTOOL
+
+# Checks for header files.
+AC_HEADER_RESOLV
+AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h limits.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_HEADER_STDBOOL
+AC_C_INLINE
+AC_TYPE_SIZE_T
+AC_TYPE_SSIZE_T
+AC_TYPE_UINT8_T
+AC_TYPE_UINT16_T
+AC_TYPE_INT32_T
+AC_TYPE_UINT32_T
+AC_TYPE_UINT64_T
+
+##########################################################################
+# Determine which platform to build for
+##########################################################################
+AC_ARG_WITH([platform],
+ [AS_HELP_STRING([--with-platform=prefix],
+ [Select platform to be used, default linux-generic])],
+ [],
+ [with_platform=linux-generic])
+
+AM_CONDITIONAL([ODP_PLATFORM_GENERIC], [test "x$with_platform" = xlinux-generic])
+AM_CONDITIONAL([ODP_PLATFORM_KEYSTONE2], [test "x$with_platform" = xlinux-keystone2])
+
+AC_SUBST([with_platform])
+
+##########################################################################
+# Enable/disable netmap support
+##########################################################################
+AC_ARG_ENABLE([netmap],
+ [ --enable-netmap Enable/disable netmap],
+ [if test x$enableval = xyes; then
+ netmap_support=yes
+ ODP_CFLAGS="$ODP_CFLAGS -DODP_HAVE_NETMAP=1"
+ fi])
+
+AM_CONDITIONAL([ODP_NETMAP_ENABLED], [test x$netmap_support = xyes ])
+
+##########################################################################
+# Enable/disable ODP_DEBUG_PRINT
+##########################################################################
+ODP_DEBUG=1
+AC_ARG_ENABLE([debug],
+ [ --enable-debug Enable/disable debug],
+ [if ! test "x$enableval" = "xyes"; then
+ ODP_DEBUG=0
+ fi])
+ODP_CFLAGS="$ODP_CFLAGS -DODP_DEBUG_PRINT=$ODP_DEBUG"
+
+##########################################################################
+# Check for pthreads availability
+##########################################################################
+
+AX_PTHREAD([CC="$PTHREAD_CC"], [
+ echo "Error! We require pthreads to be available"
+ exit -1
+ ])
+LIBS="$PTHREAD_LIBS $LIBS"
+AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS"
+AM_LDFLAGS="$AM_LDFLAGS $PTHREAD_LDFLAGS"
+
+##########################################################################
+# Default warning setup
+##########################################################################
+ODP_CFLAGS="$ODP_CFLAGS -W -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes"
+ODP_CFLAGS="$ODP_CFLAGS -Wmissing-declarations -Wold-style-definition -Wpointer-arith"
+ODP_CFLAGS="$ODP_CFLAGS -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral"
+ODP_CFLAGS="$ODP_CFLAGS -Wformat-security -Wundef -Wwrite-strings"
+
+##########################################################################
+# Default include setup
+##########################################################################
+AM_CFLAGS="$AM_CFLAGS $ODP_CFLAGS"
+
+# Checks for library functions.
+AC_FUNC_MALLOC
+AC_FUNC_MMAP
+AC_CHECK_FUNCS([bzero clock_gettime gethostbyname getpagesize gettimeofday memset munmap socket strchr strerror strrchr strstr strtoull])
+
+AC_CONFIG_FILES([Makefile
+ platform/Makefile
+ platform/linux-generic/Makefile
+ platform/linux-keystone2/Makefile
+ test/Makefile
+ test/api_test/Makefile
+ test/example/Makefile
+ test/generator/Makefile
+ test/l2fwd/Makefile
+ test/packet/Makefile
+ test/packet_netmap/Makefile
+ test/timer/Makefile
+ pkgconfig/libodp.pc])
+
+AC_SEARCH_LIBS([timer_create],[rt posix4])
+
+##########################################################################
+# distribute the changed variables among the Makefiles
+
+AM_LDFLAGS="$AM_LDFLAGS -pthread -lrt"
+
+AC_SUBST([LIBS])
+AC_SUBST([AM_CFLAGS])
+AC_SUBST([CFLAGS])
+AC_SUBST([AM_LDFLAGS])
+
+AC_OUTPUT
+AC_MSG_RESULT([
+ $PACKAGE $VERSION
+ ========
+
+ prefix: ${prefix}
+ sysconfdir: ${sysconfdir}
+ libdir: ${libdir}
+ includedir: ${includedir}
+
+ compiler: ${CC}
+ cflags: ${CFLAGS}
+ am_cflags: ${AM_CFLAGS}
+ ldflags: ${LDFLAGS}
+ am_ldflags: ${AM_LDFLAGS}
+])
diff --git a/platform/linux-generic/Doxyfile.in b/doxygen.cfg
index 572a3dd7f..6c787129d 100644
--- a/platform/linux-generic/Doxyfile.in
+++ b/doxygen.cfg
@@ -1,7 +1,7 @@
PROJECT_NAME = "API Reference Manual"
-PROJECT_LOGO = ../../doc/images/ODP-Logo-HQ.png
+PROJECT_LOGO = $(SRCDIR)/doc/images/ODP-Logo-HQ.png
QUIET = YES
-OUTPUT_DIRECTORY = ./doc
+OUTPUT_DIRECTORY = $(DOCDIR)
FULL_PATH_NAMES = NO
JAVADOC_AUTOBRIEF = YES
OPTIMIZE_OUTPUT_FOR_C = YES
@@ -9,7 +9,7 @@ TYPEDEF_HIDES_STRUCT = YES
EXTRACT_STATIC = YES
SORT_MEMBER_DOCS = NO
WARN_NO_PARAMDOC = YES
-INPUT = ../../doc ../../include ../../test
+INPUT = $(SRCDIR)/doc $(SRCDIR)/include $(SRCDIR)/test
FILE_PATTERNS = odp*.h odp*.c *.dox
RECURSIVE = YES
SOURCE_BROWSER = YES
@@ -23,10 +23,10 @@ CLASS_DIAGRAMS = NO
HAVE_DOT = YES
CALL_GRAPH = YES
DOT_MULTI_TARGETS = NO
-EXAMPLE_PATH = ../../test
+EXAMPLE_PATH = $(SRCDIR)/test
EXAMPLE_PATTERNS = *.c
EXAMPLE_RECURSIVE = YES
-IMAGE_PATH = ../../doc/images
-HTML_EXTRA_STYLESHEET = ../../doc/odpdoxygen.css
+IMAGE_PATH = $(SRCDIR)/doc/images
+HTML_EXTRA_STYLESHEET = $(SRCDIR)/doc/odpdoxygen.css
PREDEFINED = __GNUC__
INTERNAL_DOCS = YES
diff --git a/m4/ax_prog_doxygen.m4 b/m4/ax_prog_doxygen.m4
new file mode 100644
index 000000000..44b22b00a
--- /dev/null
+++ b/m4/ax_prog_doxygen.m4
@@ -0,0 +1,532 @@
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_prog_doxygen.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# DX_INIT_DOXYGEN(PROJECT-NAME, DOXYFILE-PATH, [OUTPUT-DIR])
+# DX_DOXYGEN_FEATURE(ON|OFF)
+# DX_DOT_FEATURE(ON|OFF)
+# DX_HTML_FEATURE(ON|OFF)
+# DX_CHM_FEATURE(ON|OFF)
+# DX_CHI_FEATURE(ON|OFF)
+# DX_MAN_FEATURE(ON|OFF)
+# DX_RTF_FEATURE(ON|OFF)
+# DX_XML_FEATURE(ON|OFF)
+# DX_PDF_FEATURE(ON|OFF)
+# DX_PS_FEATURE(ON|OFF)
+#
+# DESCRIPTION
+#
+# The DX_*_FEATURE macros control the default setting for the given
+# Doxygen feature. Supported features are 'DOXYGEN' itself, 'DOT' for
+# generating graphics, 'HTML' for plain HTML, 'CHM' for compressed HTML
+# help (for MS users), 'CHI' for generating a seperate .chi file by the
+# .chm file, and 'MAN', 'RTF', 'XML', 'PDF' and 'PS' for the appropriate
+# output formats. The environment variable DOXYGEN_PAPER_SIZE may be
+# specified to override the default 'a4wide' paper size.
+#
+# By default, HTML, PDF and PS documentation is generated as this seems to
+# be the most popular and portable combination. MAN pages created by
+# Doxygen are usually problematic, though by picking an appropriate subset
+# and doing some massaging they might be better than nothing. CHM and RTF
+# are specific for MS (note that you can't generate both HTML and CHM at
+# the same time). The XML is rather useless unless you apply specialized
+# post-processing to it.
+#
+# The macros mainly control the default state of the feature. The use can
+# override the default by specifying --enable or --disable. The macros
+# ensure that contradictory flags are not given (e.g.,
+# --enable-doxygen-html and --enable-doxygen-chm,
+# --enable-doxygen-anything with --disable-doxygen, etc.) Finally, each
+# feature will be automatically disabled (with a warning) if the required
+# programs are missing.
+#
+# Once all the feature defaults have been specified, call DX_INIT_DOXYGEN
+# with the following parameters: a one-word name for the project for use
+# as a filename base etc., an optional configuration file name (the
+# default is 'Doxyfile', the same as Doxygen's default), and an optional
+# output directory name (the default is 'doxygen-doc').
+#
+# Automake Support
+#
+# The following is a template aminclude.am file for use with Automake.
+# Make targets and variables values are controlled by the various
+# DX_COND_* conditionals set by autoconf.
+#
+# The provided targets are:
+#
+# doxygen-doc: Generate all doxygen documentation.
+#
+# doxygen-run: Run doxygen, which will generate some of the
+# documentation (HTML, CHM, CHI, MAN, RTF, XML)
+# but will not do the post processing required
+# for the rest of it (PS, PDF, and some MAN).
+#
+# doxygen-man: Rename some doxygen generated man pages.
+#
+# doxygen-ps: Generate doxygen PostScript documentation.
+#
+# doxygen-pdf: Generate doxygen PDF documentation.
+#
+# Note that by default these are not integrated into the automake targets.
+# If doxygen is used to generate man pages, you can achieve this
+# integration by setting man3_MANS to the list of man pages generated and
+# then adding the dependency:
+#
+# $(man3_MANS): doxygen-doc
+#
+# This will cause make to run doxygen and generate all the documentation.
+#
+# The following variable is intended for use in Makefile.am:
+#
+# DX_CLEANFILES = everything to clean.
+#
+# Then add this variable to MOSTLYCLEANFILES.
+#
+# ----- begin aminclude.am -------------------------------------
+#
+# ## --------------------------------- ##
+# ## Format-independent Doxygen rules. ##
+# ## --------------------------------- ##
+#
+# if DX_COND_doc
+#
+# ## ------------------------------- ##
+# ## Rules specific for HTML output. ##
+# ## ------------------------------- ##
+#
+# if DX_COND_html
+#
+# DX_CLEAN_HTML = @DX_DOCDIR@/html
+#
+# endif DX_COND_html
+#
+# ## ------------------------------ ##
+# ## Rules specific for CHM output. ##
+# ## ------------------------------ ##
+#
+# if DX_COND_chm
+#
+# DX_CLEAN_CHM = @DX_DOCDIR@/chm
+#
+# if DX_COND_chi
+#
+# DX_CLEAN_CHI = @DX_DOCDIR@/@PACKAGE@.chi
+#
+# endif DX_COND_chi
+#
+# endif DX_COND_chm
+#
+# ## ------------------------------ ##
+# ## Rules specific for MAN output. ##
+# ## ------------------------------ ##
+#
+# if DX_COND_man
+#
+# DX_CLEAN_MAN = @DX_DOCDIR@/man
+#
+# endif DX_COND_man
+#
+# ## ------------------------------ ##
+# ## Rules specific for RTF output. ##
+# ## ------------------------------ ##
+#
+# if DX_COND_rtf
+#
+# DX_CLEAN_RTF = @DX_DOCDIR@/rtf
+#
+# endif DX_COND_rtf
+#
+# ## ------------------------------ ##
+# ## Rules specific for XML output. ##
+# ## ------------------------------ ##
+#
+# if DX_COND_xml
+#
+# DX_CLEAN_XML = @DX_DOCDIR@/xml
+#
+# endif DX_COND_xml
+#
+# ## ----------------------------- ##
+# ## Rules specific for PS output. ##
+# ## ----------------------------- ##
+#
+# if DX_COND_ps
+#
+# DX_CLEAN_PS = @DX_DOCDIR@/@PACKAGE@.ps
+#
+# DX_PS_GOAL = doxygen-ps
+#
+# doxygen-ps: @DX_DOCDIR@/@PACKAGE@.ps
+#
+# @DX_DOCDIR@/@PACKAGE@.ps: @DX_DOCDIR@/@PACKAGE@.tag
+# cd @DX_DOCDIR@/latex; \
+# rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
+# $(DX_LATEX) refman.tex; \
+# $(MAKEINDEX_PATH) refman.idx; \
+# $(DX_LATEX) refman.tex; \
+# countdown=5; \
+# while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
+# refman.log > /dev/null 2>&1 \
+# && test $$countdown -gt 0; do \
+# $(DX_LATEX) refman.tex; \
+# countdown=`expr $$countdown - 1`; \
+# done; \
+# $(DX_DVIPS) -o ../@PACKAGE@.ps refman.dvi
+#
+# endif DX_COND_ps
+#
+# ## ------------------------------ ##
+# ## Rules specific for PDF output. ##
+# ## ------------------------------ ##
+#
+# if DX_COND_pdf
+#
+# DX_CLEAN_PDF = @DX_DOCDIR@/@PACKAGE@.pdf
+#
+# DX_PDF_GOAL = doxygen-pdf
+#
+# doxygen-pdf: @DX_DOCDIR@/@PACKAGE@.pdf
+#
+# @DX_DOCDIR@/@PACKAGE@.pdf: @DX_DOCDIR@/@PACKAGE@.tag
+# cd @DX_DOCDIR@/latex; \
+# rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
+# $(DX_PDFLATEX) refman.tex; \
+# $(DX_MAKEINDEX) refman.idx; \
+# $(DX_PDFLATEX) refman.tex; \
+# countdown=5; \
+# while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
+# refman.log > /dev/null 2>&1 \
+# && test $$countdown -gt 0; do \
+# $(DX_PDFLATEX) refman.tex; \
+# countdown=`expr $$countdown - 1`; \
+# done; \
+# mv refman.pdf ../@PACKAGE@.pdf
+#
+# endif DX_COND_pdf
+#
+# ## ------------------------------------------------- ##
+# ## Rules specific for LaTeX (shared for PS and PDF). ##
+# ## ------------------------------------------------- ##
+#
+# if DX_COND_latex
+#
+# DX_CLEAN_LATEX = @DX_DOCDIR@/latex
+#
+# endif DX_COND_latex
+#
+# .PHONY: doxygen-run doxygen-doc $(DX_PS_GOAL) $(DX_PDF_GOAL)
+#
+# .INTERMEDIATE: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
+#
+# doxygen-run: @DX_DOCDIR@/@PACKAGE@.tag
+#
+# doxygen-doc: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
+#
+# @DX_DOCDIR@/@PACKAGE@.tag: $(DX_CONFIG) $(pkginclude_HEADERS)
+# rm -rf @DX_DOCDIR@
+# $(DX_ENV) $(DX_DOXYGEN) $(srcdir)/$(DX_CONFIG)
+#
+# DX_CLEANFILES = \
+# @DX_DOCDIR@/@PACKAGE@.tag \
+# -r \
+# $(DX_CLEAN_HTML) \
+# $(DX_CLEAN_CHM) \
+# $(DX_CLEAN_CHI) \
+# $(DX_CLEAN_MAN) \
+# $(DX_CLEAN_RTF) \
+# $(DX_CLEAN_XML) \
+# $(DX_CLEAN_PS) \
+# $(DX_CLEAN_PDF) \
+# $(DX_CLEAN_LATEX)
+#
+# endif DX_COND_doc
+#
+# ----- end aminclude.am ---------------------------------------
+#
+# LICENSE
+#
+# Copyright (c) 2009 Oren Ben-Kiki <oren@ben-kiki.org>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 12
+
+## ----------##
+## Defaults. ##
+## ----------##
+
+DX_ENV=""
+AC_DEFUN([DX_FEATURE_doc], ON)
+AC_DEFUN([DX_FEATURE_dot], OFF)
+AC_DEFUN([DX_FEATURE_man], OFF)
+AC_DEFUN([DX_FEATURE_html], ON)
+AC_DEFUN([DX_FEATURE_chm], OFF)
+AC_DEFUN([DX_FEATURE_chi], OFF)
+AC_DEFUN([DX_FEATURE_rtf], OFF)
+AC_DEFUN([DX_FEATURE_xml], OFF)
+AC_DEFUN([DX_FEATURE_pdf], ON)
+AC_DEFUN([DX_FEATURE_ps], ON)
+
+## --------------- ##
+## Private macros. ##
+## --------------- ##
+
+# DX_ENV_APPEND(VARIABLE, VALUE)
+# ------------------------------
+# Append VARIABLE="VALUE" to DX_ENV for invoking doxygen.
+AC_DEFUN([DX_ENV_APPEND], [AC_SUBST([DX_ENV], ["$DX_ENV $1='$2'"])])
+
+# DX_DIRNAME_EXPR
+# ---------------
+# Expand into a shell expression prints the directory part of a path.
+AC_DEFUN([DX_DIRNAME_EXPR],
+ [[expr ".$1" : '\(\.\)[^/]*$' \| "x$1" : 'x\(.*\)/[^/]*$']])
+
+# DX_IF_FEATURE(FEATURE, IF-ON, IF-OFF)
+# -------------------------------------
+# Expands according to the M4 (static) status of the feature.
+AC_DEFUN([DX_IF_FEATURE], [ifelse(DX_FEATURE_$1, ON, [$2], [$3])])
+
+# DX_REQUIRE_PROG(VARIABLE, PROGRAM)
+# ----------------------------------
+# Require the specified program to be found for the DX_CURRENT_FEATURE to work.
+AC_DEFUN([DX_REQUIRE_PROG], [
+AC_PATH_TOOL([$1], [$2])
+if test "$DX_FLAG_[]DX_CURRENT_FEATURE$$1" = 1; then
+ AC_MSG_WARN([$2 not found - will not DX_CURRENT_DESCRIPTION])
+ AC_SUBST(DX_FLAG_[]DX_CURRENT_FEATURE, 0)
+fi
+])
+
+# DX_TEST_FEATURE(FEATURE)
+# ------------------------
+# Expand to a shell expression testing whether the feature is active.
+AC_DEFUN([DX_TEST_FEATURE], [test "$DX_FLAG_$1" = 1])
+
+# DX_CHECK_DEPEND(REQUIRED_FEATURE, REQUIRED_STATE)
+# -------------------------------------------------
+# Verify that a required features has the right state before trying to turn on
+# the DX_CURRENT_FEATURE.
+AC_DEFUN([DX_CHECK_DEPEND], [
+test "$DX_FLAG_$1" = "$2" \
+|| AC_MSG_ERROR([doxygen-DX_CURRENT_FEATURE ifelse([$2], 1,
+ requires, contradicts) doxygen-DX_CURRENT_FEATURE])
+])
+
+# DX_CLEAR_DEPEND(FEATURE, REQUIRED_FEATURE, REQUIRED_STATE)
+# ----------------------------------------------------------
+# Turn off the DX_CURRENT_FEATURE if the required feature is off.
+AC_DEFUN([DX_CLEAR_DEPEND], [
+test "$DX_FLAG_$1" = "$2" || AC_SUBST(DX_FLAG_[]DX_CURRENT_FEATURE, 0)
+])
+
+# DX_FEATURE_ARG(FEATURE, DESCRIPTION,
+# CHECK_DEPEND, CLEAR_DEPEND,
+# REQUIRE, DO-IF-ON, DO-IF-OFF)
+# --------------------------------------------
+# Parse the command-line option controlling a feature. CHECK_DEPEND is called
+# if the user explicitly turns the feature on (and invokes DX_CHECK_DEPEND),
+# otherwise CLEAR_DEPEND is called to turn off the default state if a required
+# feature is disabled (using DX_CLEAR_DEPEND). REQUIRE performs additional
+# requirement tests (DX_REQUIRE_PROG). Finally, an automake flag is set and
+# DO-IF-ON or DO-IF-OFF are called according to the final state of the feature.
+AC_DEFUN([DX_ARG_ABLE], [
+ AC_DEFUN([DX_CURRENT_FEATURE], [$1])
+ AC_DEFUN([DX_CURRENT_DESCRIPTION], [$2])
+ AC_ARG_ENABLE(doxygen-$1,
+ [AS_HELP_STRING(DX_IF_FEATURE([$1], [--disable-doxygen-$1],
+ [--enable-doxygen-$1]),
+ DX_IF_FEATURE([$1], [don't $2], [$2]))],
+ [
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+ AC_SUBST([DX_FLAG_$1], 1)
+ $3
+;; #(
+n|N|no|No|NO)
+ AC_SUBST([DX_FLAG_$1], 0)
+;; #(
+*)
+ AC_MSG_ERROR([invalid value '$enableval' given to doxygen-$1])
+;;
+esac
+], [
+AC_SUBST([DX_FLAG_$1], [DX_IF_FEATURE([$1], 1, 0)])
+$4
+])
+if DX_TEST_FEATURE([$1]); then
+ $5
+ :
+fi
+AM_CONDITIONAL(DX_COND_$1, DX_TEST_FEATURE([$1]))
+if DX_TEST_FEATURE([$1]); then
+ $6
+ :
+else
+ $7
+ :
+fi
+])
+
+## -------------- ##
+## Public macros. ##
+## -------------- ##
+
+# DX_XXX_FEATURE(DEFAULT_STATE)
+# -----------------------------
+AC_DEFUN([DX_DOXYGEN_FEATURE], [AC_DEFUN([DX_FEATURE_doc], [$1])])
+AC_DEFUN([DX_DOT_FEATURE], [AC_DEFUN([DX_FEATURE_dot], [$1])])
+AC_DEFUN([DX_MAN_FEATURE], [AC_DEFUN([DX_FEATURE_man], [$1])])
+AC_DEFUN([DX_HTML_FEATURE], [AC_DEFUN([DX_FEATURE_html], [$1])])
+AC_DEFUN([DX_CHM_FEATURE], [AC_DEFUN([DX_FEATURE_chm], [$1])])
+AC_DEFUN([DX_CHI_FEATURE], [AC_DEFUN([DX_FEATURE_chi], [$1])])
+AC_DEFUN([DX_RTF_FEATURE], [AC_DEFUN([DX_FEATURE_rtf], [$1])])
+AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])])
+AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])])
+AC_DEFUN([DX_PDF_FEATURE], [AC_DEFUN([DX_FEATURE_pdf], [$1])])
+AC_DEFUN([DX_PS_FEATURE], [AC_DEFUN([DX_FEATURE_ps], [$1])])
+
+# DX_INIT_DOXYGEN(PROJECT, [CONFIG-FILE], [OUTPUT-DOC-DIR])
+# ---------------------------------------------------------
+# PROJECT also serves as the base name for the documentation files.
+# The default CONFIG-FILE is "Doxyfile" and OUTPUT-DOC-DIR is "doxygen-doc".
+AC_DEFUN([DX_INIT_DOXYGEN], [
+
+# Files:
+AC_SUBST([DX_PROJECT], [$1])
+AC_SUBST([DX_CONFIG], [ifelse([$2], [], Doxyfile, [$2])])
+AC_SUBST([DX_DOCDIR], [ifelse([$3], [], doxygen-doc, [$3])])
+
+# Environment variables used inside doxygen.cfg:
+DX_ENV_APPEND(SRCDIR, $srcdir)
+DX_ENV_APPEND(PROJECT, $DX_PROJECT)
+DX_ENV_APPEND(DOCDIR, $DX_DOCDIR)
+DX_ENV_APPEND(VERSION, $PACKAGE_VERSION)
+
+# Doxygen itself:
+DX_ARG_ABLE(doc, [generate any doxygen documentation],
+ [],
+ [],
+ [DX_REQUIRE_PROG([DX_DOXYGEN], doxygen)
+ DX_REQUIRE_PROG([DX_PERL], perl)],
+ [DX_ENV_APPEND(PERL_PATH, $DX_PERL)])
+
+# Dot for graphics:
+DX_ARG_ABLE(dot, [generate graphics for doxygen documentation],
+ [DX_CHECK_DEPEND(doc, 1)],
+ [DX_CLEAR_DEPEND(doc, 1)],
+ [DX_REQUIRE_PROG([DX_DOT], dot)],
+ [DX_ENV_APPEND(HAVE_DOT, YES)
+ DX_ENV_APPEND(DOT_PATH, [`DX_DIRNAME_EXPR($DX_DOT)`])],
+ [DX_ENV_APPEND(HAVE_DOT, NO)])
+
+# Man pages generation:
+DX_ARG_ABLE(man, [generate doxygen manual pages],
+ [DX_CHECK_DEPEND(doc, 1)],
+ [DX_CLEAR_DEPEND(doc, 1)],
+ [],
+ [DX_ENV_APPEND(GENERATE_MAN, YES)],
+ [DX_ENV_APPEND(GENERATE_MAN, NO)])
+
+# RTF file generation:
+DX_ARG_ABLE(rtf, [generate doxygen RTF documentation],
+ [DX_CHECK_DEPEND(doc, 1)],
+ [DX_CLEAR_DEPEND(doc, 1)],
+ [],
+ [DX_ENV_APPEND(GENERATE_RTF, YES)],
+ [DX_ENV_APPEND(GENERATE_RTF, NO)])
+
+# XML file generation:
+DX_ARG_ABLE(xml, [generate doxygen XML documentation],
+ [DX_CHECK_DEPEND(doc, 1)],
+ [DX_CLEAR_DEPEND(doc, 1)],
+ [],
+ [DX_ENV_APPEND(GENERATE_XML, YES)],
+ [DX_ENV_APPEND(GENERATE_XML, NO)])
+
+# (Compressed) HTML help generation:
+DX_ARG_ABLE(chm, [generate doxygen compressed HTML help documentation],
+ [DX_CHECK_DEPEND(doc, 1)],
+ [DX_CLEAR_DEPEND(doc, 1)],
+ [DX_REQUIRE_PROG([DX_HHC], hhc)],
+ [DX_ENV_APPEND(HHC_PATH, $DX_HHC)
+ DX_ENV_APPEND(GENERATE_HTML, YES)
+ DX_ENV_APPEND(GENERATE_HTMLHELP, YES)],
+ [DX_ENV_APPEND(GENERATE_HTMLHELP, NO)])
+
+# Seperate CHI file generation.
+DX_ARG_ABLE(chi, [generate doxygen seperate compressed HTML help index file],
+ [DX_CHECK_DEPEND(chm, 1)],
+ [DX_CLEAR_DEPEND(chm, 1)],
+ [],
+ [DX_ENV_APPEND(GENERATE_CHI, YES)],
+ [DX_ENV_APPEND(GENERATE_CHI, NO)])
+
+# Plain HTML pages generation:
+DX_ARG_ABLE(html, [generate doxygen plain HTML documentation],
+ [DX_CHECK_DEPEND(doc, 1) DX_CHECK_DEPEND(chm, 0)],
+ [DX_CLEAR_DEPEND(doc, 1) DX_CLEAR_DEPEND(chm, 0)],
+ [],
+ [DX_ENV_APPEND(GENERATE_HTML, YES)],
+ [DX_TEST_FEATURE(chm) || DX_ENV_APPEND(GENERATE_HTML, NO)])
+
+# PostScript file generation:
+DX_ARG_ABLE(ps, [generate doxygen PostScript documentation],
+ [DX_CHECK_DEPEND(doc, 1)],
+ [DX_CLEAR_DEPEND(doc, 1)],
+ [DX_REQUIRE_PROG([DX_LATEX], latex)
+ DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex)
+ DX_REQUIRE_PROG([DX_DVIPS], dvips)
+ DX_REQUIRE_PROG([DX_EGREP], egrep)])
+
+# PDF file generation:
+DX_ARG_ABLE(pdf, [generate doxygen PDF documentation],
+ [DX_CHECK_DEPEND(doc, 1)],
+ [DX_CLEAR_DEPEND(doc, 1)],
+ [DX_REQUIRE_PROG([DX_PDFLATEX], pdflatex)
+ DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex)
+ DX_REQUIRE_PROG([DX_EGREP], egrep)])
+
+# LaTeX generation for PS and/or PDF:
+AM_CONDITIONAL(DX_COND_latex, DX_TEST_FEATURE(ps) || DX_TEST_FEATURE(pdf))
+if DX_TEST_FEATURE(ps) || DX_TEST_FEATURE(pdf); then
+ DX_ENV_APPEND(GENERATE_LATEX, YES)
+else
+ DX_ENV_APPEND(GENERATE_LATEX, NO)
+fi
+
+# Paper size for PS and/or PDF:
+AC_ARG_VAR(DOXYGEN_PAPER_SIZE,
+ [a4wide (default), a4, letter, legal or executive])
+case "$DOXYGEN_PAPER_SIZE" in
+#(
+"")
+ AC_SUBST(DOXYGEN_PAPER_SIZE, "")
+;; #(
+a4wide|a4|letter|legal|executive)
+ DX_ENV_APPEND(PAPER_SIZE, $DOXYGEN_PAPER_SIZE)
+;; #(
+*)
+ AC_MSG_ERROR([unknown DOXYGEN_PAPER_SIZE='$DOXYGEN_PAPER_SIZE'])
+;;
+esac
+
+#For debugging:
+#echo DX_FLAG_doc=$DX_FLAG_doc
+#echo DX_FLAG_dot=$DX_FLAG_dot
+#echo DX_FLAG_man=$DX_FLAG_man
+#echo DX_FLAG_html=$DX_FLAG_html
+#echo DX_FLAG_chm=$DX_FLAG_chm
+#echo DX_FLAG_chi=$DX_FLAG_chi
+#echo DX_FLAG_rtf=$DX_FLAG_rtf
+#echo DX_FLAG_xml=$DX_FLAG_xml
+#echo DX_FLAG_pdf=$DX_FLAG_pdf
+#echo DX_FLAG_ps=$DX_FLAG_ps
+#echo DX_ENV=$DX_ENV
+])
diff --git a/m4/ax_pthread.m4 b/m4/ax_pthread.m4
new file mode 100644
index 000000000..d383ad5c6
--- /dev/null
+++ b/m4/ax_pthread.m4
@@ -0,0 +1,332 @@
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_pthread.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+#
+# DESCRIPTION
+#
+# This macro figures out how to build C programs using POSIX threads. It
+# sets the PTHREAD_LIBS output variable to the threads library and linker
+# flags, and the PTHREAD_CFLAGS output variable to any special C compiler
+# flags that are needed. (The user can also force certain compiler
+# flags/libs to be tested by setting these environment variables.)
+#
+# Also sets PTHREAD_CC to any special C compiler that is needed for
+# multi-threaded programs (defaults to the value of CC otherwise). (This
+# is necessary on AIX to use the special cc_r compiler alias.)
+#
+# NOTE: You are assumed to not only compile your program with these flags,
+# but also link it with them as well. e.g. you should link with
+# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
+#
+# If you are only building threads programs, you may wish to use these
+# variables in your default LIBS, CFLAGS, and CC:
+#
+# LIBS="$PTHREAD_LIBS $LIBS"
+# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+# CC="$PTHREAD_CC"
+#
+# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
+# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
+# (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
+#
+# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
+# PTHREAD_PRIO_INHERIT symbol is defined when compiling with
+# PTHREAD_CFLAGS.
+#
+# ACTION-IF-FOUND is a list of shell commands to run if a threads library
+# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
+# is not found. If ACTION-IF-FOUND is not specified, the default action
+# will define HAVE_PTHREAD.
+#
+# Please let the authors know if this macro fails on any platform, or if
+# you have any other suggestions or comments. This macro was based on work
+# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
+# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
+# Alejandro Forero Cuervo to the autoconf macro repository. We are also
+# grateful for the helpful feedback of numerous users.
+#
+# Updated for Autoconf 2.68 by Daniel Richard G.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
+# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program 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 General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+
+#serial 21
+
+AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
+AC_DEFUN([AX_PTHREAD], [
+AC_REQUIRE([AC_CANONICAL_HOST])
+AC_LANG_PUSH([C])
+ax_pthread_ok=no
+
+# We used to check for pthread.h first, but this fails if pthread.h
+# requires special compiler flags (e.g. on True64 or Sequent).
+# It gets checked for in the link test anyway.
+
+# First of all, check if the user has set any of the PTHREAD_LIBS,
+# etcetera environment variables, and if threads linking works using
+# them:
+if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+ save_LIBS="$LIBS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
+ AC_TRY_LINK_FUNC([pthread_join], [ax_pthread_ok=yes])
+ AC_MSG_RESULT([$ax_pthread_ok])
+ if test x"$ax_pthread_ok" = xno; then
+ PTHREAD_LIBS=""
+ PTHREAD_CFLAGS=""
+ fi
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+fi
+
+# We must check for the threads library under a number of different
+# names; the ordering is very important because some systems
+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
+# libraries is broken (non-POSIX).
+
+# Create a list of thread flags to try. Items starting with a "-" are
+# C compiler flags, and other items are library names, except for "none"
+# which indicates that we try without any flags at all, and "pthread-config"
+# which is a program returning the flags for the Pth emulation library.
+
+ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
+
+# The ordering *is* (sometimes) important. Some notes on the
+# individual items follow:
+
+# pthreads: AIX (must check this before -lpthread)
+# none: in case threads are in libc; should be tried before -Kthread and
+# other compiler flags to prevent continual compiler warnings
+# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
+# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
+# -pthreads: Solaris/gcc
+# -mthreads: Mingw32/gcc, Lynx/gcc
+# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
+# doesn't hurt to check since this sometimes defines pthreads too;
+# also defines -D_REENTRANT)
+# ... -mt is also the pthreads flag for HP/aCC
+# pthread: Linux, etcetera
+# --thread-safe: KAI C++
+# pthread-config: use pthread-config program (for GNU Pth library)
+
+case ${host_os} in
+ solaris*)
+
+ # On Solaris (at least, for some versions), libc contains stubbed
+ # (non-functional) versions of the pthreads routines, so link-based
+ # tests will erroneously succeed. (We need to link with -pthreads/-mt/
+ # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
+ # a function called by this macro, so we could check for that, but
+ # who knows whether they'll stub that too in a future libc.) So,
+ # we'll just look for -pthreads and -lpthread first:
+
+ ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
+ ;;
+
+ darwin*)
+ ax_pthread_flags="-pthread $ax_pthread_flags"
+ ;;
+esac
+
+# Clang doesn't consider unrecognized options an error unless we specify
+# -Werror. We throw in some extra Clang-specific options to ensure that
+# this doesn't happen for GCC, which also accepts -Werror.
+
+AC_MSG_CHECKING([if compiler needs -Werror to reject unknown flags])
+save_CFLAGS="$CFLAGS"
+ax_pthread_extra_flags="-Werror"
+CFLAGS="$CFLAGS $ax_pthread_extra_flags -Wunknown-warning-option -Wsizeof-array-argument"
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int foo(void);],[foo()])],
+ [AC_MSG_RESULT([yes])],
+ [ax_pthread_extra_flags=
+ AC_MSG_RESULT([no])])
+CFLAGS="$save_CFLAGS"
+
+if test x"$ax_pthread_ok" = xno; then
+for flag in $ax_pthread_flags; do
+
+ case $flag in
+ none)
+ AC_MSG_CHECKING([whether pthreads work without any flags])
+ ;;
+
+ -*)
+ AC_MSG_CHECKING([whether pthreads work with $flag])
+ PTHREAD_CFLAGS="$flag"
+ ;;
+
+ pthread-config)
+ AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no])
+ if test x"$ax_pthread_config" = xno; then continue; fi
+ PTHREAD_CFLAGS="`pthread-config --cflags`"
+ PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
+ ;;
+
+ *)
+ AC_MSG_CHECKING([for the pthreads library -l$flag])
+ PTHREAD_LIBS="-l$flag"
+ ;;
+ esac
+
+ save_LIBS="$LIBS"
+ save_CFLAGS="$CFLAGS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS $ax_pthread_extra_flags"
+
+ # Check for various functions. We must include pthread.h,
+ # since some functions may be macros. (On the Sequent, we
+ # need a special flag -Kthread to make this header compile.)
+ # We check for pthread_join because it is in -lpthread on IRIX
+ # while pthread_create is in libc. We check for pthread_attr_init
+ # due to DEC craziness with -lpthreads. We check for
+ # pthread_cleanup_push because it is one of the few pthread
+ # functions on Solaris that doesn't have a non-functional libc stub.
+ # We try pthread_create on general principles.
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
+ static void routine(void *a) { a = 0; }
+ static void *start_routine(void *a) { return a; }],
+ [pthread_t th; pthread_attr_t attr;
+ pthread_create(&th, 0, start_routine, 0);
+ pthread_join(th, 0);
+ pthread_attr_init(&attr);
+ pthread_cleanup_push(routine, 0);
+ pthread_cleanup_pop(0) /* ; */])],
+ [ax_pthread_ok=yes],
+ [])
+
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+
+ AC_MSG_RESULT([$ax_pthread_ok])
+ if test "x$ax_pthread_ok" = xyes; then
+ break;
+ fi
+
+ PTHREAD_LIBS=""
+ PTHREAD_CFLAGS=""
+done
+fi
+
+# Various other checks:
+if test "x$ax_pthread_ok" = xyes; then
+ save_LIBS="$LIBS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+ # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
+ AC_MSG_CHECKING([for joinable pthread attribute])
+ attr_name=unknown
+ for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
+ [int attr = $attr; return attr /* ; */])],
+ [attr_name=$attr; break],
+ [])
+ done
+ AC_MSG_RESULT([$attr_name])
+ if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
+ AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], [$attr_name],
+ [Define to necessary symbol if this constant
+ uses a non-standard name on your system.])
+ fi
+
+ AC_MSG_CHECKING([if more special flags are required for pthreads])
+ flag=no
+ case ${host_os} in
+ aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";;
+ osf* | hpux*) flag="-D_REENTRANT";;
+ solaris*)
+ if test "$GCC" = "yes"; then
+ flag="-D_REENTRANT"
+ else
+ # TODO: What about Clang on Solaris?
+ flag="-mt -D_REENTRANT"
+ fi
+ ;;
+ esac
+ AC_MSG_RESULT([$flag])
+ if test "x$flag" != xno; then
+ PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
+ fi
+
+ AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
+ [ax_cv_PTHREAD_PRIO_INHERIT], [
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
+ [[int i = PTHREAD_PRIO_INHERIT;]])],
+ [ax_cv_PTHREAD_PRIO_INHERIT=yes],
+ [ax_cv_PTHREAD_PRIO_INHERIT=no])
+ ])
+ AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"],
+ [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])])
+
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+
+ # More AIX lossage: compile with *_r variant
+ if test "x$GCC" != xyes; then
+ case $host_os in
+ aix*)
+ AS_CASE(["x/$CC"],
+ [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
+ [#handle absolute path differently from PATH based program lookup
+ AS_CASE(["x$CC"],
+ [x/*],
+ [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])],
+ [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])])
+ ;;
+ esac
+ fi
+fi
+
+test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
+
+AC_SUBST([PTHREAD_LIBS])
+AC_SUBST([PTHREAD_CFLAGS])
+AC_SUBST([PTHREAD_CC])
+
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+if test x"$ax_pthread_ok" = xyes; then
+ ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1])
+ :
+else
+ ax_pthread_ok=no
+ $2
+fi
+AC_LANG_POP
+])dnl AX_PTHREAD
diff --git a/pkgconfig/libodp.pc.in b/pkgconfig/libodp.pc.in
new file mode 100644
index 000000000..7cdf9ea38
--- /dev/null
+++ b/pkgconfig/libodp.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libodp
+Description: The ODP packet processing engine
+Version: @VERSION@
+Libs: -L${libdir} -lodp
+Libs.private:
+Cflags: -I${includedir}
diff --git a/platform/Makefile.am b/platform/Makefile.am
new file mode 100644
index 000000000..e618747b5
--- /dev/null
+++ b/platform/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = @with_platform@
diff --git a/platform/linux-generic/Makefile b/platform/linux-generic/Makefile
deleted file mode 100644
index 073765668..000000000
--- a/platform/linux-generic/Makefile
+++ /dev/null
@@ -1,142 +0,0 @@
-## Copyright (c) 2013, Linaro Limited
-## All rights reserved.
-##
-## Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are met:
-##
-## * Redistributions of source code must retain the above copyright notice, this
-## list of conditions and the following disclaimer.
-##
-## * Redistributions in binary form must reproduce the above copyright notice, this
-## list of conditions and the following disclaimer in the documentation and/or
-## other materials provided with the distribution.
-##
-## * Neither the name of Linaro Limited nor the names of its contributors may be
-## used to endorse or promote products derived from this software without specific
-## prior written permission.
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-## ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-## WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-## DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-## FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-## DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-## SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-## CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-.DEFAULT_GOAL := libs
-
-ODP_ROOT = ../..
-LIB_DIR = ./lib
-DOC_DIR = ./doc
-
-EXTRA_CFLAGS += -I$(ODP_ROOT)/include
-EXTRA_CFLAGS += -I./include
-EXTRA_CFLAGS += -I./include/api
-
-# Option for shared libraries.
-# Decreases performance with static libraries.
-ifeq ($(ODP_RELOC),yes)
-EXTRA_CFLAGS += -fpic
-endif
-
-ifeq ($(ODP_HAVE_NETMAP),yes)
-EXTRA_CFLAGS += -DODP_HAVE_NETMAP
-endif
-
-include $(ODP_ROOT)/Makefile.inc
-STATIC_LIB = ./lib/libodp.a
-
-#
-# Object files
-#
-OBJS =
-OBJS += $(OBJ_DIR)/odp_barrier.o
-OBJS += $(OBJ_DIR)/odp_buffer.o
-OBJS += $(OBJ_DIR)/odp_buffer_pool.o
-OBJS += $(OBJ_DIR)/odp_coremask.o
-OBJS += $(OBJ_DIR)/odp_init.o
-OBJS += $(OBJ_DIR)/odp_linux.o
-OBJS += $(OBJ_DIR)/odp_packet.o
-OBJS += $(OBJ_DIR)/odp_packet_flags.o
-OBJS += $(OBJ_DIR)/odp_packet_io.o
-OBJS += $(OBJ_DIR)/odp_packet_socket.o
-OBJS += $(OBJ_DIR)/odp_queue.o
-OBJS += $(OBJ_DIR)/odp_schedule.o
-OBJS += $(OBJ_DIR)/odp_shared_memory.o
-OBJS += $(OBJ_DIR)/odp_spinlock.o
-OBJS += $(OBJ_DIR)/odp_system_info.o
-OBJS += $(OBJ_DIR)/odp_thread.o
-OBJS += $(OBJ_DIR)/odp_ticketlock.o
-OBJS += $(OBJ_DIR)/odp_time.o
-OBJS += $(OBJ_DIR)/odp_timer.o
-OBJS += $(OBJ_DIR)/odp_ring.o
-OBJS += $(OBJ_DIR)/odp_rwlock.o
-ifeq ($(ODP_HAVE_NETMAP),yes)
-OBJS += $(OBJ_DIR)/odp_packet_netmap.o
-endif
-
-DEPS = $(OBJS:.o=.d)
-
-.PHONY: all
-all: libs docs
-
--include $(DEPS)
-
-$(LIB_DIR):
- $(Q)$(MKDIR) $(LIB_DIR)
-
-$(DOC_DIR):
- $(Q)$(MKDIR) $(DOC_DIR)/html
- $(Q)$(MKDIR) $(DOC_DIR)/latex
-
-#
-# Compile rules
-#
-$(OBJ_DIR)/%.o: ./source/%.c
- $(QUIET_CC)$(CC) -c -MD $(EXTRA_CFLAGS) $(CFLAGS) -o $@ $<
-
-#
-# Lib rule
-#
-$(STATIC_LIB): $(OBJS)
- $(QUIET_AR)$(AR) -cr $@ $(OBJS)
-
-clean:
- $(Q)$(RMDIR) $(OBJ_DIR)
- $(Q)$(RMDIR) $(LIB_DIR)
- $(Q)$(RMDIR) $(DOC_DIR)
- $(Q)$(RM) Doxyfile
-
-Doxyfile: Doxyfile.in
- doxygen -u - < $< > $@
-
-.PHONY: docs
-docs: $(DOC_DIR) Doxyfile ./include/odp*.h
- doxygen
-
-.PHONY: docs_install
-docs_install: docs
- $(SYNC) doc $(DESTDIR)
-
-.PHONY: pdf
-pdf: docs
- make --directory doc/latex refman.pdf 1> /dev/null
-
-.PHONY: libs
-libs: $(OBJ_DIR) $(LIB_DIR) $(STATIC_LIB)
-
-.PHONY: lib_install
-lib_install: libs
- $(Q)install -d $(DESTDIR)/lib
- $(Q)install -m 0644 ${STATIC_LIB} $(DESTDIR)/lib/
-
-.PHONY: headers_install
-headers_install: libs
- $(ECHO) Installing headers to $(DESTDIR)/include
- $(Q)$(SYNC) $(ODP_ROOT)/include $(DESTDIR)
- $(Q)$(SYNC) include/api/* $(DESTDIR)/include/
-
-install: lib_install headers_install
diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am
new file mode 100644
index 000000000..34b13d31b
--- /dev/null
+++ b/platform/linux-generic/Makefile.am
@@ -0,0 +1,84 @@
+LIB = $(top_builddir)/lib
+
+dist_pkgdata_DATA = $(LIB)/libodp.la
+
+pkgconfigdir = pkgconfig
+nodist_pkgconfig_DATA = $(top_builddir)/pkgconfig/libodp.pc
+
+.PHONY: pkgconfig/libodp.pc
+
+AM_CFLAGS += -I$(srcdir)/include
+AM_CFLAGS += -I$(srcdir)/include/api
+AM_CFLAGS += -I$(top_srcdir)/include
+VPATH = $(srcdir) $(builddir)
+if ODP_PLATFORM_GENERIC
+lib_LTLIBRARIES = $(LIB)/libodp.la
+
+include_HEADERS = \
+ $(top_srcdir)/include/odp.h \
+ $(top_srcdir)/include/odp_align.h \
+ $(top_srcdir)/include/odp_atomic.h \
+ $(top_srcdir)/include/odp_barrier.h \
+ $(top_srcdir)/include/odp_buffer.h \
+ $(top_srcdir)/include/odp_buffer_pool.h \
+ $(top_srcdir)/include/odp_byteorder.h \
+ $(top_srcdir)/include/odp_compiler.h \
+ $(top_srcdir)/include/odp_config.h \
+ $(top_srcdir)/include/odp_coremask.h \
+ $(top_srcdir)/include/odp_debug.h \
+ $(top_srcdir)/include/odp_hints.h \
+ $(top_srcdir)/include/odp_init.h \
+ $(top_srcdir)/include/odp_packet_flags.h \
+ $(top_srcdir)/include/odp_packet.h \
+ $(top_srcdir)/include/odp_packet_io.h \
+ $(top_srcdir)/include/odp_queue.h \
+ $(top_srcdir)/include/odp_rwlock.h \
+ $(top_srcdir)/include/odp_schedule.h \
+ $(top_srcdir)/include/odp_shared_memory.h \
+ $(top_srcdir)/include/odp_spinlock.h \
+ $(top_srcdir)/include/odp_std_types.h \
+ $(top_srcdir)/include/odp_sync.h \
+ $(top_srcdir)/include/odp_system_info.h \
+ $(top_srcdir)/include/odp_thread.h \
+ $(top_srcdir)/include/odp_ticketlock.h \
+ $(top_srcdir)/include/odp_time.h \
+ $(top_srcdir)/include/odp_timer.h \
+ $(top_srcdir)/include/odp_version.h \
+ $(top_srcdir)/platform/linux-generic/include/api/odp_pktio_types.h \
+ $(top_srcdir)/platform/linux-generic/include/api/odp_pktio_netmap.h \
+ $(top_srcdir)/platform/linux-generic/include/api/odp_pktio_socket.h
+
+subdirheadersdir = $(includedir)/helper
+subdirheaders_HEADERS = \
+ $(top_srcdir)/include/helper/odp_chksum.h \
+ $(top_srcdir)/include/helper/odp_eth.h \
+ $(top_srcdir)/include/helper/odp_ip.h \
+ $(top_srcdir)/include/helper/odp_linux.h \
+ $(top_srcdir)/include/helper/odp_packet_helper.h \
+ $(top_srcdir)/include/helper/odp_ring.h \
+ $(top_srcdir)/include/helper/odp_udp.h
+
+__LIB__libodp_la_SOURCES = \
+ odp_barrier.c \
+ odp_buffer.c \
+ odp_buffer_pool.c \
+ odp_coremask.c \
+ odp_init.c \
+ odp_linux.c \
+ odp_packet.c \
+ odp_packet_flags.c \
+ odp_packet_io.c \
+ odp_packet_socket.c \
+ odp_queue.c \
+ odp_ring.c \
+ odp_rwlock.c \
+ odp_schedule.c \
+ odp_shared_memory.c \
+ odp_spinlock.c \
+ odp_system_info.c \
+ odp_thread.c \
+ odp_ticketlock.c \
+ odp_time.c \
+ odp_timer.c
+
+endif
diff --git a/platform/linux-generic/source/odp_barrier.c b/platform/linux-generic/odp_barrier.c
index a82b2947c..a82b2947c 100644
--- a/platform/linux-generic/source/odp_barrier.c
+++ b/platform/linux-generic/odp_barrier.c
diff --git a/platform/linux-generic/source/odp_buffer.c b/platform/linux-generic/odp_buffer.c
index 0169eec71..0169eec71 100644
--- a/platform/linux-generic/source/odp_buffer.c
+++ b/platform/linux-generic/odp_buffer.c
diff --git a/platform/linux-generic/source/odp_buffer_pool.c b/platform/linux-generic/odp_buffer_pool.c
index b73cbb2af..b73cbb2af 100644
--- a/platform/linux-generic/source/odp_buffer_pool.c
+++ b/platform/linux-generic/odp_buffer_pool.c
diff --git a/platform/linux-generic/source/odp_coremask.c b/platform/linux-generic/odp_coremask.c
index c55eb7203..c55eb7203 100644
--- a/platform/linux-generic/source/odp_coremask.c
+++ b/platform/linux-generic/odp_coremask.c
diff --git a/platform/linux-generic/source/odp_init.c b/platform/linux-generic/odp_init.c
index d4c2eb8b2..d4c2eb8b2 100644
--- a/platform/linux-generic/source/odp_init.c
+++ b/platform/linux-generic/odp_init.c
diff --git a/platform/linux-generic/source/odp_linux.c b/platform/linux-generic/odp_linux.c
index 10fdf44a0..10fdf44a0 100644
--- a/platform/linux-generic/source/odp_linux.c
+++ b/platform/linux-generic/odp_linux.c
diff --git a/platform/linux-generic/source/odp_packet.c b/platform/linux-generic/odp_packet.c
index 13e247175..13e247175 100644
--- a/platform/linux-generic/source/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
diff --git a/platform/linux-generic/source/odp_packet_flags.c b/platform/linux-generic/odp_packet_flags.c
index 992b94b41..992b94b41 100644
--- a/platform/linux-generic/source/odp_packet_flags.c
+++ b/platform/linux-generic/odp_packet_flags.c
diff --git a/platform/linux-generic/source/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c
index 33ade1031..33ade1031 100644
--- a/platform/linux-generic/source/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
diff --git a/platform/linux-generic/source/odp_packet_netmap.c b/platform/linux-generic/odp_packet_netmap.c
index e2215ab97..e2215ab97 100644
--- a/platform/linux-generic/source/odp_packet_netmap.c
+++ b/platform/linux-generic/odp_packet_netmap.c
diff --git a/platform/linux-generic/source/odp_packet_socket.c b/platform/linux-generic/odp_packet_socket.c
index fbdc7e462..fbdc7e462 100644
--- a/platform/linux-generic/source/odp_packet_socket.c
+++ b/platform/linux-generic/odp_packet_socket.c
diff --git a/platform/linux-generic/source/odp_queue.c b/platform/linux-generic/odp_queue.c
index c637bdff4..c637bdff4 100644
--- a/platform/linux-generic/source/odp_queue.c
+++ b/platform/linux-generic/odp_queue.c
diff --git a/platform/linux-generic/source/odp_ring.c b/platform/linux-generic/odp_ring.c
index 25ff66a0f..25ff66a0f 100644
--- a/platform/linux-generic/source/odp_ring.c
+++ b/platform/linux-generic/odp_ring.c
diff --git a/platform/linux-generic/source/odp_rwlock.c b/platform/linux-generic/odp_rwlock.c
index 11c8dd772..11c8dd772 100644
--- a/platform/linux-generic/source/odp_rwlock.c
+++ b/platform/linux-generic/odp_rwlock.c
diff --git a/platform/linux-generic/source/odp_schedule.c b/platform/linux-generic/odp_schedule.c
index 12f192b99..12f192b99 100644
--- a/platform/linux-generic/source/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
diff --git a/platform/linux-generic/source/odp_shared_memory.c b/platform/linux-generic/odp_shared_memory.c
index 784f42b8d..784f42b8d 100644
--- a/platform/linux-generic/source/odp_shared_memory.c
+++ b/platform/linux-generic/odp_shared_memory.c
diff --git a/platform/linux-generic/source/odp_spinlock.c b/platform/linux-generic/odp_spinlock.c
index 4eba0152f..4eba0152f 100644
--- a/platform/linux-generic/source/odp_spinlock.c
+++ b/platform/linux-generic/odp_spinlock.c
diff --git a/platform/linux-generic/source/odp_system_info.c b/platform/linux-generic/odp_system_info.c
index f78b746dc..f78b746dc 100644
--- a/platform/linux-generic/source/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
diff --git a/platform/linux-generic/source/odp_thread.c b/platform/linux-generic/odp_thread.c
index eaa480ec8..eaa480ec8 100644
--- a/platform/linux-generic/source/odp_thread.c
+++ b/platform/linux-generic/odp_thread.c
diff --git a/platform/linux-generic/source/odp_ticketlock.c b/platform/linux-generic/odp_ticketlock.c
index be5b88511..be5b88511 100644
--- a/platform/linux-generic/source/odp_ticketlock.c
+++ b/platform/linux-generic/odp_ticketlock.c
diff --git a/platform/linux-generic/source/odp_time.c b/platform/linux-generic/odp_time.c
index 181294a95..181294a95 100644
--- a/platform/linux-generic/source/odp_time.c
+++ b/platform/linux-generic/odp_time.c
diff --git a/platform/linux-generic/source/odp_timer.c b/platform/linux-generic/odp_timer.c
index 5a88c543b..5a88c543b 100644
--- a/platform/linux-generic/source/odp_timer.c
+++ b/platform/linux-generic/odp_timer.c
diff --git a/platform/linux-keystone2/Makefile b/platform/linux-keystone2/Makefile
deleted file mode 100644
index a0e2922d4..000000000
--- a/platform/linux-keystone2/Makefile
+++ /dev/null
@@ -1,118 +0,0 @@
-##
-## Copyright (c) 2013, Linaro Limited
-## All rights reserved.
-##
-## SPDX-License-Identifier: BSD-3-Clause
-##
-
-.DEFAULT_GOAL := libs
-
-ODP_ROOT = ../..
-LIB_DIR = ./lib
-DOC_DIR = ./doc
-
-LINUX_GENERIC_DIR = ../linux-generic
-
-# Option for shared libraries.
-# Decreases performance with static libraries.
-ifeq ($(ODP_RELOC),yes)
-EXTRA_CFLAGS += -fpic
-endif
-
-MY_PLATFORM = DEVICE_K2K
-
-PLAT_CFLAGS = -D$(MY_PLATFORM)
-PLAT_CFLAGS += -D_GNU_SOURCE -DEM_32_BIT -DTI_EM_CENTRAL_SCHED
-PLAT_CFLAGS += -DTI_EM_TRACE_LEVEL=3 -DEM_CHECK_LEVEL=1
-PLAT_CFLAGS += -DTI_EM_LINUX -DTI_EM_GCC -DTI_EM_ARM_A15 -DTI_EM_C6638
-PLAT_CFLAGS += -D_LITTLE_ENDIAN -DTI_EM_USE_MSM -DTI_EM_XGE_LOOPBACK
-PLAT_CFLAGS += -DTI_ODP
-
-EXTRA_CFLAGS += $(PLAT_CFLAGS)
-EXTRA_CFLAGS += -I./include
-EXTRA_CFLAGS += -I./include/api
-EXTRA_CFLAGS += -I$(LINUX_GENERIC_DIR)/include
-EXTRA_CFLAGS += -I$(LINUX_GENERIC_DIR)/include/api
-EXTRA_CFLAGS += -I$(ODP_ROOT)/include
-
-include $(ODP_ROOT)/Makefile.inc
-STATIC_LIB = ./lib/libodp.a
-
-#
-# Object files
-#
-OBJS =
-OBJS += $(OBJ_DIR)/odp_barrier.o
-OBJS += $(OBJ_DIR)/odp_buffer.o
-OBJS += $(OBJ_DIR)/odp_buffer_pool.o
-OBJS += $(OBJ_DIR)/odp_coremask.o
-OBJS += $(OBJ_DIR)/odp_init.o
-OBJS += $(OBJ_DIR)/odp_linux.o
-OBJS += $(OBJ_DIR)/odp_packet.o
-OBJS += $(OBJ_DIR)/odp_packet_flags.o
-OBJS += $(OBJ_DIR)/odp_packet_io.o
-OBJS += $(OBJ_DIR)/odp_packet_socket.o
-OBJS += $(OBJ_DIR)/odp_queue.o
-OBJS += $(OBJ_DIR)/odp_schedule.o
-OBJS += $(OBJ_DIR)/odp_shared_memory.o
-OBJS += $(OBJ_DIR)/odp_spinlock.o
-OBJS += $(OBJ_DIR)/odp_system_info.o
-OBJS += $(OBJ_DIR)/odp_thread.o
-OBJS += $(OBJ_DIR)/odp_ticketlock.o
-OBJS += $(OBJ_DIR)/odp_time.o
-OBJS += $(OBJ_DIR)/odp_timer.o
-OBJS += $(OBJ_DIR)/odp_ring.o
-OBJS += $(OBJ_DIR)/odp_rwlock.o
-
-DEPS = $(OBJS:.o=.d)
-
-.PHONY: all
-all: libs
-
--include $(DEPS)
-
-$(LIB_DIR):
- $(Q)$(MKDIR) $(LIB_DIR)
-
-#
-# Compile rules
-#
-vpath %.c source:$(LINUX_GENERIC_DIR)/source
-
-$(OBJ_DIR)/%.o: %.c
- $(QUIET_CC)$(CC) -c -MD $(EXTRA_CFLAGS) $(CFLAGS) -o $@ $<
-
-#
-# Lib rule
-#
-$(OBJ_DIR)/libodp.o: $(OBJS)
- $(QUIET_LD)$(LD) -r -o $@ $(OBJS) $(LDFLAGS) -lopenem_rh -lopenem_osal
-
-$(STATIC_LIB): $(OBJ_DIR)/libodp.o
- $(QUIET_AR)$(AR) -cr $@ $(OBJ_DIR)/libodp.o
-
-clean:
- $(Q)$(RMDIR) $(OBJ_DIR)
- $(Q)$(RMDIR) $(LIB_DIR)
-
-.PHONY: docs
-docs:
- $(ECHO) "Documenation is not yet available"
- @false
-
-.PHONY: libs
-libs: $(OBJ_DIR) $(LIB_DIR) $(STATIC_LIB)
-
-.PHONY: lib_install
-lib_install: libs
- $(Q)install -d $(DESTDIR)/lib
- $(Q)install -m 0644 ${STATIC_LIB} $(DESTDIR)/lib/
-
-.PHONY: headers_install
-headers_install: libs
- $(ECHO) Installing headers to $(DESTDIR)/include
- $(Q)$(SYNC) $(ODP_ROOT)/include $(DESTDIR)
- $(Q)$(SYNC) $(LINUX_GENERIC_DIR)/include/api/* $(DESTDIR)/include/
- $(Q)-$(SYNC) include/api/* $(DESTDIR)/include/
-
-install: lib_install headers_install
diff --git a/platform/linux-keystone2/Makefile.am b/platform/linux-keystone2/Makefile.am
new file mode 100644
index 000000000..e9713b25d
--- /dev/null
+++ b/platform/linux-keystone2/Makefile.am
@@ -0,0 +1,95 @@
+LIB = $(top_builddir)/lib
+
+dist_pkgdata_DATA = $(LIB)/libodp.la
+
+pkgconfigdir = pkgconfig
+nodist_pkgconfig_DATA = $(top_builddir)/pkgconfig/libodp.pc
+
+.PHONY: pkgconfig/libodp.pc
+
+KS2_PLATFORM = DEVICE_K2K
+
+PLAT_CFLAGS = -D$(KS2_PLATFORM)
+PLAT_CFLAGS += -D_GNU_SOURCE -DEM_32_BIT -DTI_EM_CENTRAL_SCHED
+PLAT_CFLAGS += -DTI_EM_TRACE_LEVEL=3 -DEM_CHECK_LEVEL=1
+PLAT_CFLAGS += -DTI_EM_LINUX -DTI_EM_GCC -DTI_EM_ARM_A15 -DTI_EM_C6638
+PLAT_CFLAGS += -D_LITTLE_ENDIAN -DTI_EM_USE_MSM -DTI_EM_XGE_LOOPBACK
+PLAT_CFLAGS += -DTI_ODP
+
+AM_CFLAGS += $(PLAT_CFLAGS)
+AM_CFLAGS += -I$(srcdir)/include
+AM_CFLAGS += -I$(srcdir)/include/api
+AM_CFLAGS += -I$(top_srcdir)/platform/linux-generic/include
+AM_CFLAGS += -I$(top_srcdir)/platform/linux-generic/include/api
+AM_CFLAGS += -I$(top_srcdir)/include
+VPATH = $(srcdir) $(builddir)
+#if ODP_PLATFORM_KEYSTONE2
+lib_LTLIBRARIES = $(LIB)/libodp.la
+KS2_LIBS="-lopenem_rh -lopenem_osal"
+LIBS += $(KS2_LIBS)
+
+include_HEADERS = \
+ $(top_srcdir)/platform/linux-keystone2/include/api/odp_buffer.h \
+ $(top_srcdir)/include/odp.h \
+ $(top_srcdir)/include/odp_align.h \
+ $(top_srcdir)/include/odp_atomic.h \
+ $(top_srcdir)/include/odp_barrier.h \
+ $(top_srcdir)/include/odp_buffer_pool.h \
+ $(top_srcdir)/include/odp_byteorder.h \
+ $(top_srcdir)/include/odp_compiler.h \
+ $(top_srcdir)/include/odp_config.h \
+ $(top_srcdir)/include/odp_coremask.h \
+ $(top_srcdir)/include/odp_debug.h \
+ $(top_srcdir)/include/odp_hints.h \
+ $(top_srcdir)/include/odp_init.h \
+ $(top_srcdir)/include/odp_packet_flags.h \
+ $(top_srcdir)/include/odp_packet.h \
+ $(top_srcdir)/include/odp_packet_io.h \
+ $(top_srcdir)/include/odp_queue.h \
+ $(top_srcdir)/include/odp_rwlock.h \
+ $(top_srcdir)/include/odp_schedule.h \
+ $(top_srcdir)/include/odp_shared_memory.h \
+ $(top_srcdir)/include/odp_spinlock.h \
+ $(top_srcdir)/include/odp_std_types.h \
+ $(top_srcdir)/include/odp_sync.h \
+ $(top_srcdir)/include/odp_system_info.h \
+ $(top_srcdir)/include/odp_thread.h \
+ $(top_srcdir)/include/odp_ticketlock.h \
+ $(top_srcdir)/include/odp_time.h \
+ $(top_srcdir)/include/odp_timer.h \
+ $(top_srcdir)/include/odp_version.h
+
+subdirheadersdir = $(includedir)/helper
+subdirheaders_HEADERS = \
+ $(top_srcdir)/include/helper/odp_chksum.h \
+ $(top_srcdir)/include/helper/odp_eth.h \
+ $(top_srcdir)/include/helper/odp_ip.h \
+ $(top_srcdir)/include/helper/odp_linux.h \
+ $(top_srcdir)/include/helper/odp_packet_helper.h \
+ $(top_srcdir)/include/helper/odp_ring.h \
+ $(top_srcdir)/include/helper/odp_udp.h
+
+__LIB__libodp_la_SOURCES = \
+ ../linux-generic/odp_barrier.c \
+ odp_buffer.c \
+ odp_buffer_pool.c \
+ ../linux-generic/odp_coremask.c \
+ odp_init.c \
+ ../linux-generic/odp_linux.c \
+ odp_packet.c \
+ ../linux-generic/odp_packet_flags.c \
+ odp_packet_io.c \
+ ../linux-generic/odp_packet_socket.c \
+ odp_queue.c \
+ ../linux-generic/odp_ring.c \
+ ../linux-generic/odp_rwlock.c \
+ ../linux-generic/odp_schedule.c \
+ odp_shared_memory.c \
+ ../linux-generic/odp_spinlock.c \
+ ../linux-generic/odp_system_info.c \
+ ../linux-generic/odp_thread.c \
+ ../linux-generic/odp_ticketlock.c \
+ ../linux-generic/odp_time.c \
+ ../linux-generic/odp_timer.c
+
+#endif
diff --git a/platform/linux-keystone2/README b/platform/linux-keystone2/README
index 01b61e227..2f95b9856 100644
--- a/platform/linux-keystone2/README
+++ b/platform/linux-keystone2/README
@@ -32,10 +32,6 @@ Check README file in OpenEM root directory for build instructions.
3. Keystone2 ODP build
-Keystone implementation uses partial linking (ld -r) to link external
-static libraries into libodp. During partial linking ld searches for libraries
-only in path specified explicitly (via -L), but not in standard paths. I'm not
-sure whether it is gcc bug or feature, but until fix is found a path should be
-passed explicitly. If helper libraries installed into /usr/lib, then:
-
-make PLATFORM=linux-keystone2 LD='ld -L/usr/lib' <target>
+./bootstrap
+./configure --host=arm-linux-gnueabihf --with-platform=linux-keystone2 LDFLAGS=-L<oem-install-path>/usr/lib CFLAGS=-I<oem-install-path>/usr/include
+make
diff --git a/platform/linux-keystone2/source/odp_buffer.c b/platform/linux-keystone2/odp_buffer.c
index d4c7cfef7..d4c7cfef7 100644
--- a/platform/linux-keystone2/source/odp_buffer.c
+++ b/platform/linux-keystone2/odp_buffer.c
diff --git a/platform/linux-keystone2/source/odp_buffer_pool.c b/platform/linux-keystone2/odp_buffer_pool.c
index 6ce02d411..6ce02d411 100644
--- a/platform/linux-keystone2/source/odp_buffer_pool.c
+++ b/platform/linux-keystone2/odp_buffer_pool.c
diff --git a/platform/linux-keystone2/source/odp_init.c b/platform/linux-keystone2/odp_init.c
index f83255161..f83255161 100644
--- a/platform/linux-keystone2/source/odp_init.c
+++ b/platform/linux-keystone2/odp_init.c
diff --git a/platform/linux-keystone2/source/odp_packet.c b/platform/linux-keystone2/odp_packet.c
index 271d66bb5..271d66bb5 100644
--- a/platform/linux-keystone2/source/odp_packet.c
+++ b/platform/linux-keystone2/odp_packet.c
diff --git a/platform/linux-keystone2/source/odp_packet_io.c b/platform/linux-keystone2/odp_packet_io.c
index 1ded021a8..1ded021a8 100644
--- a/platform/linux-keystone2/source/odp_packet_io.c
+++ b/platform/linux-keystone2/odp_packet_io.c
diff --git a/platform/linux-keystone2/source/odp_queue.c b/platform/linux-keystone2/odp_queue.c
index 031eeffdb..031eeffdb 100644
--- a/platform/linux-keystone2/source/odp_queue.c
+++ b/platform/linux-keystone2/odp_queue.c
diff --git a/platform/linux-keystone2/source/odp_shared_memory.c b/platform/linux-keystone2/odp_shared_memory.c
index e59511146..e59511146 100644
--- a/platform/linux-keystone2/source/odp_shared_memory.c
+++ b/platform/linux-keystone2/odp_shared_memory.c
diff --git a/test/Makefile b/test/Makefile
deleted file mode 100644
index 879d775c8..000000000
--- a/test/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright (c) 2013, Linaro Limited
-# All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-
-TESTS=$(filter %, $(wildcard */))
-
-.PHONY: all clean install
-
-all: $(TESTS)
- $(Q)for T in $(TESTS); do $(MAKE) -C $$T || exit 1; done
-
-clean:
- $(Q)for T in $(TESTS); do $(MAKE) -C $$T clean || true; done
-
-install:
- $(Q)for T in $(TESTS); do $(MAKE) -C $$T install ||exit 1; done
diff --git a/test/Makefile.am b/test/Makefile.am
new file mode 100644
index 000000000..bae381e17
--- /dev/null
+++ b/test/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = api_test example generator l2fwd packet packet_netmap timer
diff --git a/test/Makefile.inc b/test/Makefile.inc
index 8536402c8..1884d16f2 100644
--- a/test/Makefile.inc
+++ b/test/Makefile.inc
@@ -1,7 +1,5 @@
-# Copyright (c) 2013, Linaro Limited
-# All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
+LIB = $(top_builddir)/lib
+LDADD = $(LIB)/libodp.la
+AM_CFLAGS += -I$(top_srcdir)/platform/@with_platform@/include/api -I$(top_srcdir)/platform/linux-generic/include/api -I$(top_srcdir)/include
-ODP_LIB = $(DESTDIR)/lib/libodp.a
-EXTRA_CFLAGS += -I$(DESTDIR)/include
+AM_LDFLAGS += -L$(LIB)
diff --git a/test/api_test/Makefile b/test/api_test/Makefile
deleted file mode 100644
index 55a81edb2..000000000
--- a/test/api_test/Makefile
+++ /dev/null
@@ -1,87 +0,0 @@
-# Copyright (c) 2013, Linaro Limited
-# All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-
-ODP_ROOT = ../..
-
-#
-# API testing stuffs
-#
-ODP_ATOMIC = odp_atomic
-ODP_SHM = odp_shm
-ODP_RING = odp_ring
-ODP_TIM = odp_timer
-
-include $(ODP_ROOT)/Makefile.inc
-include ../Makefile.inc
-
-.PHONY: default
-default: all
-
-EXTRA_CFLAGS += -I.
-
-ATOMIC_OBJS =
-ATOMIC_OBJS += $(OBJ_DIR)/odp_common.o
-ATOMIC_OBJS += $(OBJ_DIR)/odp_atomic_test.o
-
-SHM_OBJS =
-SHM_OBJS += $(OBJ_DIR)/odp_common.o
-SHM_OBJS += $(OBJ_DIR)/odp_shm_test.o
-
-RING_OBJS =
-RING_OBJS += $(OBJ_DIR)/odp_common.o
-RING_OBJS += $(OBJ_DIR)/odp_ring_test.o
-
-TIM_OBJS =
-TIM_OBJS += $(OBJ_DIR)/odp_common.o
-TIM_OBJS += $(OBJ_DIR)/odp_timer_ping.o
-
-DEPS = $(ATOMIC_OBJS:.o=.d) $(SHM_OBJS:.o=.d) $(RING_OBJS:.o=.d) $(TIM_OBJS:.o=.d)
-
-.PHONY: all
-all: $(OBJ_DIR) $(ODP_ATOMIC) $(ODP_SHM) $(ODP_RING) $(ODP_TIM)
-atomic: $(OBJ_DIR) $(ODP_ATOMIC)
-shm: $(OBJ_DIR) $(ODP_SHM)
-ring: $(OBJ_DIR) $(ODP_RING)
-timer: $(OBJ_DIR) $(ODP_TIM)
-
--include $(DEPS)
-
-#
-# Compile rules
-#
-$(OBJ_DIR)/%.o: %.c
- $(QUIET_CC)$(CC) -c -MD $(EXTRA_CFLAGS) $(CFLAGS) -o $@ $<
-
-#
-# Link rule
-#
-$(ODP_ATOMIC): $(ODP_LIB) $(ATOMIC_OBJS)
- $(QUIET_LD)$(CC) $(LDFLAGS) $(ATOMIC_OBJS) $(ODP_LIB) $(STD_LIBS) -o $@
-
-$(ODP_SHM): $(ODP_LIB) $(SHM_OBJS)
- $(QUIET_LD)$(CC) $(LDFLAGS) $(SHM_OBJS) $(ODP_LIB) $(STD_LIBS) -o $@
-
-$(ODP_RING): $(ODP_LIB) $(RING_OBJS)
- $(QUIET_LD)$(CC) $(LDFLAGS) $(RING_OBJS) $(ODP_LIB) $(STD_LIBS) -o $@
-
-$(ODP_TIM): $(ODP_LIB) $(TIM_OBJS)
- $(QUIET_LD)$(CC) $(LDFLAGS) $(TIM_OBJS) $(ODP_LIB) $(STD_LIBS) -o $@
-
-.PHONY: clean
-clean:
- $(Q)$(RMDIR) $(OBJ_DIR)
- $(Q)$(RM) $(ODP_ATOMIC)
- $(Q)$(RM) $(ODP_SHM)
- $(Q)$(RM) $(ODP_RING)
- $(Q)$(RM) $(ODP_TIM)
- $(MAKE) -C $(ODP_DIR) clean
-
-.PHONY: install
-install:
- install -d $(DESTDIR)/share/odp
- install -m 0755 $(ODP_ATOMIC) $(DESTDIR)/share/odp/
- install -m 0755 $(ODP_SHM) $(DESTDIR)/share/odp/
- install -m 0755 $(ODP_RING) $(DESTDIR)/share/odp/
- install -m 0755 $(ODP_TIM) $(DESTDIR)/share/odp/
diff --git a/test/api_test/Makefile.am b/test/api_test/Makefile.am
new file mode 100644
index 000000000..e58a27825
--- /dev/null
+++ b/test/api_test/Makefile.am
@@ -0,0 +1,8 @@
+include $(top_srcdir)/test/Makefile.inc
+
+bin_PROGRAMS = odp_atomic odp_shm odp_ring odp_timer
+
+dist_odp_atomic_SOURCES = odp_atomic_test.c odp_common.c
+dist_odp_shm_SOURCES = odp_shm_test.c odp_common.c
+dist_odp_ring_SOURCES = odp_ring_test.c odp_common.c
+dist_odp_timer_SOURCES = odp_timer_ping.c odp_common.c
diff --git a/test/example/Makefile b/test/example/Makefile
deleted file mode 100644
index 266de6f4f..000000000
--- a/test/example/Makefile
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright (c) 2013, Linaro Limited
-# All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-
-ODP_ROOT = ../..
-ODP_APP = odp_example
-
-include $(ODP_ROOT)/Makefile.inc
-include ../Makefile.inc
-
-.PHONY: default
-default: $(OBJ_DIR) $(ODP_APP)
-
-OBJS =
-OBJS += $(OBJ_DIR)/odp_example.o
-
-DEPS = $(OBJS:.o=.d)
-
--include $(DEPS)
-
-
-#
-# Compile rules
-#
-$(OBJ_DIR)/%.o: %.c
- $(QUIET_CC)$(CC) -c -MD $(EXTRA_CFLAGS) $(CFLAGS) -o $@ $<
-
-#
-# Link rule
-#
-$(ODP_APP): $(ODP_LIB) $(OBJS)
- $(QUIET_LD)$(CC) $(LDFLAGS) $(OBJS) $(ODP_LIB) $(STD_LIBS) -o $@
-
-.PHONY: clean
-clean:
- $(Q)$(RMDIR) $(OBJ_DIR)
- $(Q)$(RM) $(ODP_APP)
- $(MAKE) -C $(ODP_DIR) clean
-
-.PHONY: install
-install:
- install -d $(DESTDIR)/share/odp
- install -m 0755 $(ODP_APP) $(DESTDIR)/share/odp/
diff --git a/test/example/Makefile.am b/test/example/Makefile.am
new file mode 100644
index 000000000..aeee0e981
--- /dev/null
+++ b/test/example/Makefile.am
@@ -0,0 +1,5 @@
+include $(top_srcdir)/test/Makefile.inc
+
+bin_PROGRAMS = odp_example
+
+dist_odp_example_SOURCES = odp_example.c
diff --git a/test/generator/Makefile b/test/generator/Makefile
deleted file mode 100644
index 11ab30f0e..000000000
--- a/test/generator/Makefile
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright (c) 2014, Linaro Limited
-# All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-
-ODP_ROOT = ../..
-ODP_APP = odp_generator
-
-include $(ODP_ROOT)/Makefile.inc
-include ../Makefile.inc
-
-.PHONY: default
-default: $(OBJ_DIR) $(ODP_APP)
-
-OBJS =
-OBJS += $(OBJ_DIR)/odp_generator.o
-
-DEPS = $(OBJS:.o=.d)
-
--include $(DEPS)
-
-
-#
-# Compile rules
-#
-$(OBJ_DIR)/%.o: %.c
- $(QUIET_CC)$(CC) -c -MD $(EXTRA_CFLAGS) $(CFLAGS) -o $@ $<
-
-#
-# Link rule
-#
-$(ODP_APP): $(ODP_LIB) $(OBJS)
- $(QUIET_LD)$(CC) $(LDFLAGS) $(OBJS) $(ODP_LIB) $(STD_LIBS) -o $@
-
-.PHONY: clean
-clean:
- $(Q)$(RMDIR) $(OBJ_DIR)
- $(Q)$(RM) $(ODP_APP)
- $(MAKE) -C $(ODP_DIR) clean
-
-.PHONY: install
-install:
- install -d $(DESTDIR)/share/odp
- install -m 0755 $(ODP_APP) $(DESTDIR)/share/odp/
diff --git a/test/generator/Makefile.am b/test/generator/Makefile.am
new file mode 100644
index 000000000..bd6f2005d
--- /dev/null
+++ b/test/generator/Makefile.am
@@ -0,0 +1,5 @@
+include $(top_srcdir)/test/Makefile.inc
+
+bin_PROGRAMS = odp_generator
+
+dist_odp_generator_SOURCES = odp_generator.c
diff --git a/test/l2fwd/Makefile b/test/l2fwd/Makefile
deleted file mode 100644
index 9b956e976..000000000
--- a/test/l2fwd/Makefile
+++ /dev/null
@@ -1,43 +0,0 @@
-# Copyright (c) 2014, Linaro Limited
-# All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-
-ODP_ROOT = ../..
-ODP_APP = odp_l2fwd
-
-include $(ODP_ROOT)/Makefile.inc
-include ../Makefile.inc
-
-OBJS =
-OBJS += $(OBJ_DIR)/l2fwd.o
-
-DEPS = $(OBJS:.o=.d)
-
-.PHONY: default
-default: $(OBJ_DIR) $(ODP_APP)
-
--include $(DEPS)
-
-#
-# Compile rules
-#
-$(OBJ_DIR)/%.o: %.c
- $(QUIET_CC)$(CC) -c -MD $(EXTRA_CFLAGS) $(CFLAGS) -o $@ $<
-
-#
-# Link rule
-#
-$(ODP_APP): $(ODP_LIB) $(OBJS)
- $(QUIET_LD)$(CC) $(LDFLAGS) $(OBJS) $(ODP_LIB) $(STD_LIBS) -o $@
-
-.PHONY: clean
-clean:
- $(Q)$(RMDIR) $(OBJ_DIR)
- $(Q)$(RM) $(ODP_APP)
- $(MAKE) -C $(ODP_DIR) clean
-
-.PHONY: install
-install:
- install -d $(DESTDIR)/share/odp
- install -m 0755 $(ODP_APP) $(DESTDIR)/share/odp/
diff --git a/test/l2fwd/Makefile.am b/test/l2fwd/Makefile.am
new file mode 100644
index 000000000..a29bd5a5f
--- /dev/null
+++ b/test/l2fwd/Makefile.am
@@ -0,0 +1,5 @@
+include $(top_srcdir)/test/Makefile.inc
+
+bin_PROGRAMS = odp_l2fwd
+
+dist_odp_l2fwd_SOURCES = l2fwd.c
diff --git a/test/packet/Makefile b/test/packet/Makefile
deleted file mode 100644
index d3c3e027b..000000000
--- a/test/packet/Makefile
+++ /dev/null
@@ -1,43 +0,0 @@
-# Copyright (c) 2013, Linaro Limited
-# All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-
-ODP_ROOT = ../..
-ODP_APP = odp_packet
-
-include $(ODP_ROOT)/Makefile.inc
-include ../Makefile.inc
-
-OBJS =
-OBJS += $(OBJ_DIR)/odp_example_pktio.o
-
-DEPS = $(OBJS:.o=.d)
-
-.PHONY: default
-default: $(OBJ_DIR) $(ODP_APP)
-
--include $(DEPS)
-
-#
-# Compile rules
-#
-$(OBJ_DIR)/%.o: %.c
- $(QUIET_CC)$(CC) -c -MD $(EXTRA_CFLAGS) $(CFLAGS) -o $@ $<
-
-#
-# Link rule
-#
-$(ODP_APP): $(ODP_LIB) $(OBJS)
- $(QUIET_LD)$(CC) $(LDFLAGS) $(OBJS) $(ODP_LIB) $(STD_LIBS) -o $@
-
-.PHONY: clean
-clean:
- $(Q)$(RMDIR) $(OBJ_DIR)
- $(Q)$(RM) $(ODP_APP)
- $(MAKE) -C $(ODP_DIR) clean
-
-.PHONY: install
-install:
- install -d $(DESTDIR)/share/odp
- install -m 0755 $(ODP_APP) $(DESTDIR)/share/odp/
diff --git a/test/packet/Makefile.am b/test/packet/Makefile.am
new file mode 100644
index 000000000..3cbdaac78
--- /dev/null
+++ b/test/packet/Makefile.am
@@ -0,0 +1,5 @@
+include $(top_srcdir)/test/Makefile.inc
+
+bin_PROGRAMS = odp_pktio
+
+dist_odp_pktio_SOURCES = odp_example_pktio.c
diff --git a/test/packet_netmap/Makefile b/test/packet_netmap/Makefile
deleted file mode 100644
index 1e5cfa5dd..000000000
--- a/test/packet_netmap/Makefile
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright (c) 2013, Linaro Limited
-# All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-
-ODP_ROOT = ../..
-ODP_APP = odp_packet_netmap
-
-EXTRA_CFLAGS += -DODP_HAVE_NETMAP
-
-include $(ODP_ROOT)/Makefile.inc
-include ../Makefile.inc
-
-OBJS =
-OBJS += $(OBJ_DIR)/odp_example_pktio_netmap.o
-
-DEPS = $(OBJS:.o=.d)
-
-.PHONY: default
-default: $(OBJ_DIR) $(ODP_APP)
-
--include $(DEPS)
-
-#
-# Compile rules
-#
-$(OBJ_DIR)/%.o: %.c
- $(QUIET_CC)$(CC) -c -MD $(EXTRA_CFLAGS) $(CFLAGS) -o $@ $<
-
-#
-# Link rule
-#
-$(ODP_APP): $(ODP_LIB) $(OBJS)
- $(QUIET_LD)$(CC) $(LDFLAGS) $(OBJS) $(ODP_LIB) $(STD_LIBS) -o $@
-
-.PHONY: clean
-clean:
- $(Q)$(RMDIR) $(OBJ_DIR)
- $(Q)$(RM) $(ODP_APP)
- $(MAKE) -C $(ODP_DIR) clean
-
-.PHONY: install
-install:
- install -d $(DESTDIR)/share/odp
- install -m 0755 $(ODP_APP) $(DESTDIR)/share/odp/
diff --git a/test/packet_netmap/Makefile.am b/test/packet_netmap/Makefile.am
new file mode 100644
index 000000000..fd54eb374
--- /dev/null
+++ b/test/packet_netmap/Makefile.am
@@ -0,0 +1,7 @@
+include $(top_srcdir)/test/Makefile.inc
+
+if ODP_NETMAP_ENABLED
+bin_PROGRAMS = odp_pktio_netmap
+endif
+
+dist_odp_pktio_netmap_SOURCES = odp_example_pktio_netmap.c
diff --git a/test/timer/Makefile b/test/timer/Makefile
deleted file mode 100644
index effaf54b9..000000000
--- a/test/timer/Makefile
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright (c) 2013, Linaro Limited
-# All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-
-ODP_ROOT = ../..
-ODP_APP = odp_timer_test
-
-include $(ODP_ROOT)/Makefile.inc
-include ../Makefile.inc
-
-.PHONY: default
-default: $(OBJ_DIR) $(ODP_APP)
-
-OBJS =
-OBJS += $(OBJ_DIR)/odp_timer_test.o
-
-DEPS = $(OBJS:.o=.d)
-
--include $(DEPS)
-
-
-#
-# Compile rules
-#
-$(OBJ_DIR)/%.o: %.c
- $(QUIET_CC)$(CC) -c -MD $(EXTRA_CFLAGS) $(CFLAGS) -o $@ $<
-
-#
-# Link rule
-#
-$(ODP_APP): $(ODP_LIB) $(OBJS)
- $(QUIET_LD)$(CC) $(LDFLAGS) $(OBJS) $(ODP_LIB) $(STD_LIBS) -o $@
-
-.PHONY: clean
-clean:
- $(Q)$(RMDIR) $(OBJ_DIR)
- $(Q)$(RM) $(ODP_APP)
- $(MAKE) -C $(ODP_DIR) clean
-
-.PHONY: install
-install:
- install -d $(DESTDIR)/share/odp
- install -m 0755 $(ODP_APP) $(DESTDIR)/share/odp/
diff --git a/test/timer/Makefile.am b/test/timer/Makefile.am
new file mode 100644
index 000000000..096ff49de
--- /dev/null
+++ b/test/timer/Makefile.am
@@ -0,0 +1,5 @@
+include $(top_srcdir)/test/Makefile.inc
+
+bin_PROGRAMS = odp_timer_test
+
+dist_odp_timer_test_SOURCES = odp_timer_test.c