From 65510afff78d4efa075336929f218c36da39ee25 Mon Sep 17 00:00:00 2001 From: Krisztian Litkey Date: Tue, 13 Mar 2012 16:55:45 +0200 Subject: [PATCH 1/1] Skeleton repo. --- AUTHORS | 1 + COPYING | 1 + ChangeLog | 1 + INSTALL | 1 + Makefile.am | 1 + NEWS | 1 + README | 1 + bootstrap | 19 ++++ build-aux/gen-linker-script | 114 ++++++++++++++++++++++++ build-aux/git-version-gen | 154 ++++++++++++++++++++++++++++++++ build-aux/shave-libtool.in | 109 +++++++++++++++++++++++ build-aux/shave.in | 112 +++++++++++++++++++++++ configure.ac | 208 +++++++++++++++++++++++++++++++++++++++++++ m4/shave.m4 | 105 ++++++++++++++++++++++ src/Makefile.am | 1 + src/common/Makefile.am | 5 ++ src/common/tests/Makefile.am | 1 + src/core/Makefile.am | 5 ++ src/core/tests/Makefile.am | 1 + src/daemon/Makefile.am | 5 ++ src/daemon/tests/Makefile.am | 1 + src/plugins/Makefile.am | 0 22 files changed, 847 insertions(+) create mode 100644 AUTHORS create mode 100644 COPYING create mode 100644 ChangeLog create mode 100644 INSTALL create mode 100644 Makefile.am create mode 100644 NEWS create mode 100644 README create mode 100755 bootstrap create mode 100755 build-aux/gen-linker-script create mode 100755 build-aux/git-version-gen create mode 100644 build-aux/shave-libtool.in create mode 100644 build-aux/shave.in create mode 100644 configure.ac create mode 100644 m4/shave.m4 create mode 100644 src/Makefile.am create mode 100644 src/common/Makefile.am create mode 100644 src/common/tests/Makefile.am create mode 100644 src/core/Makefile.am create mode 100644 src/core/tests/Makefile.am create mode 100644 src/daemon/Makefile.am create mode 100644 src/daemon/tests/Makefile.am create mode 100644 src/plugins/Makefile.am diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/AUTHORS @@ -0,0 +1 @@ + diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..d6459e0 --- /dev/null +++ b/COPYING @@ -0,0 +1 @@ +xxx diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/ChangeLog @@ -0,0 +1 @@ + diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/INSTALL @@ -0,0 +1 @@ + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..af437a6 --- /dev/null +++ b/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = src diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/NEWS @@ -0,0 +1 @@ + diff --git a/README b/README new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/README @@ -0,0 +1 @@ + diff --git a/bootstrap b/bootstrap new file mode 100755 index 0000000..4d66f16 --- /dev/null +++ b/bootstrap @@ -0,0 +1,19 @@ +#!/bin/bash + +aclocal -I m4 && \ + autoheader && \ + libtoolize --copy --force && \ + autoconf && \ + automake --add-missing --copy + +status=$? + +if [ $status == 0 ]; then + if [ "$1" == "configure" ]; then + shift + ./configure $* + status=$? + fi +fi + +exit $status diff --git a/build-aux/gen-linker-script b/build-aux/gen-linker-script new file mode 100755 index 0000000..2f3a3b8 --- /dev/null +++ b/build-aux/gen-linker-script @@ -0,0 +1,114 @@ +#!/bin/bash + +############### +# Generate a linker script for GNU ld. +# +# +# + + + +error () { + echo "error: $*" 1>&2 +} + +info () { + echo "$*" 1>&2 +} + +usage () { + info "usage: $0 [-p ] [-I ] -o " + exit ${1:-1} +} + +emit () { + echo "$*" >> $OUTPUT +} + + +# set up defaults +PATTERN="^mrp_" # export everything prefixed with mrp_ +IGNORE="MRP_PRINTF_LIKE" # ignore these symbols/macros +IT="," # ignore-list is comma-separated +SOURCES="" # no default input, must be specified +OUTPUT="" # no default output, must be specified + +# parse command line +while [ -n "${1#-}" ]; do + case $1 in + -o) + if [ -z "$OUTPUT" ]; then + shift + OUTPUT="$1" + else + error "Multiple output files requested." + usage + fi + ;; + -p) + if [ -z "$PATTERN" ]; then + shift + PATTERN="$1" + else + error "Multiple patterns given ($PATTERN, $1)." + usage + fi + ;; + -I) + shift + IGNORE="$IGNORE$IT$1" + IT="," + ;; + -h) + usage 0 + ;; + -*) + error "Unknown option '$1'." + usage + ;; + *) + SOURCES="$SOURCES $1" + ;; + esac + shift +done + +# check that we've got everything mandatory +if [ -z "$OUTPUT" ]; then + error "No output file specified (use the -o option)." + usage +fi + +if [ -z "$SOURCES" ]; then + error "No input files specified." + usage +fi + +if [ -z "$PATTERN" ]; then + error "Invalid (empty) pattern." + usage +fi + +if [ -n "$IGNORE" ]; then + ignore_opts="-I $IGNORE" +else + ignore_opts="" +fi + +# generate the output +info "Generating linker script $OUTPUT..." +rm -f $OUTPUT +touch $OUTPUT + +emit "{" +emit " global:" +ctags $ignore_opts -f - --c-kinds=p $SOURCES | \ + awk "/$PATTERN/ { print \$1; }" | \ + sort | \ + while read sym; do + emit " $sym;" + done + +emit " local:" +emit " *;" +emit "};" diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen new file mode 100755 index 0000000..f38082d --- /dev/null +++ b/build-aux/git-version-gen @@ -0,0 +1,154 @@ +#!/bin/sh +# Print a version string. +scriptversion=2008-04-08.07 + +# Copyright (C) 2007-2008 Free Software Foundation +# +# 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, 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, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# This script is derived from GIT-VERSION-GEN from GIT: http://git.or.cz/. +# It may be run two ways: +# - from a git repository in which the "git describe" command below +# produces useful output (thus requiring at least one signed tag) +# - from a non-git-repo directory containing a .tarball-version file, which +# presumes this script is invoked like "./git-version-gen .tarball-version". + +# In order to use intra-version strings in your project, you will need two +# separate generated version string files: +# +# .tarball-version - present only in a distribution tarball, and not in +# a checked-out repository. Created with contents that were learned at +# the last time autoconf was run, and used by git-version-gen. Must not +# be present in either $(srcdir) or $(builddir) for git-version-gen to +# give accurate answers during normal development with a checked out tree, +# but must be present in a tarball when there is no version control system. +# Therefore, it cannot be used in any dependencies. GNUmakefile has +# hooks to force a reconfigure at distribution time to get the value +# correct, without penalizing normal development with extra reconfigures. +# +# .version - present in a checked-out repository and in a distribution +# tarball. Usable in dependencies, particularly for files that don't +# want to depend on config.h but do want to track version changes. +# Delete this file prior to any autoconf run where you want to rebuild +# files to pick up a version string change; and leave it stale to +# minimize rebuild time after unrelated changes to configure sources. +# +# It is probably wise to add these two files to .gitignore, so that you +# don't accidentally commit either generated file. +# +# Use the following line in your configure.ac, so that $(VERSION) will +# automatically be up-to-date each time configure is run (and note that +# since configure.ac no longer includes a version string, Makefile rules +# should not depend on configure.ac for version updates). +# +# AC_INIT([GNU project], +# m4_esyscmd([build-aux/git-version-gen .tarball-version]), +# [bug-project@example]) +# +# Then use the following lines in your Makefile.am, so that .version +# will be present for dependencies, and so that .tarball-version will +# exist in distribution tarballs. +# +# BUILT_SOURCES = $(top_srcdir)/.version +# $(top_srcdir)/.version: +# echo $(VERSION) > $@-t && mv $@-t $@ +# dist-hook: +# echo $(VERSION) > $(distdir)/.tarball-version + +case $# in + 1) ;; + *) echo 1>&2 "Usage: $0 \$srcdir/.tarball-version"; exit 1;; +esac + +tarball_version_file=$1 +nl=' +' + +# First see if there is a tarball-only version file. +# then try "git describe", then default. +if test -f $tarball_version_file +then + v=`cat $tarball_version_file` || exit 1 + case $v in + *$nl*) v= ;; # reject multi-line output + [0-9]*) ;; + *) v= ;; + esac + test -z "$v" \ + && echo "$0: WARNING: $tarball_version_file seems to be damaged" 1>&2 +fi + +if test -n "$v" +then + : # use $v +elif test -d .git \ + && v=`git describe --abbrev=4 --match='v*' HEAD 2>/dev/null \ + || git describe --abbrev=4 HEAD 2>/dev/null` \ + && case $v in + v[0-9]*) ;; + *) (exit 1) ;; + esac +then + # Is this a new git that lists number of commits since the last + # tag or the previous older version that did not? + # Newer: v6.10-77-g0f8faeb + # Older: v6.10-g0f8faeb +# case $v in +# *-*-*) : git describe is okay three part flavor ;; +# *-*) +# : git describe is older two part flavor +# # Recreate the number of commits and rewrite such that the +# # result is the same as if we were using the newer version +# # of git describe. +# vtag=`echo "$v" | sed 's/-.*//'` +# numcommits=`git rev-list "$vtag"..HEAD | wc -l` +# v=`echo "$v" | sed "s/\(.*\)-\(.*\)/\1-$numcommits-\2/"`; +# ;; +# esac + + # Change the first '-' to a '.', so version-comparing tools work properly. + # Remove the "g" in git describe's output string, to save a byte. +# v=`echo "$v" | sed 's/-/./;s/\(.*\)-g/\1-/'`; + : +else + #v=UNKNOWN + v="0.0.0" +fi + +v=`echo "$v" |sed 's/^v//'` + +# Don't declare a version "dirty" merely because a time stamp has changed. +git status > /dev/null 2>&1 + +dirty=`sh -c 'git diff-index --name-only HEAD' 2>/dev/null` || dirty= +case "$dirty" in + '') ;; + *) # Append the suffix only if there isn't one already. + case $v in + *-dirty) ;; + *) v="$v-dirty" ;; + esac ;; +esac + +# Omit the trailing newline, so that m4_esyscmd can use the result directly. +echo "$v" | tr -d '\012' + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/build-aux/shave-libtool.in b/build-aux/shave-libtool.in new file mode 100644 index 0000000..0f7fb12 --- /dev/null +++ b/build-aux/shave-libtool.in @@ -0,0 +1,109 @@ +#!/bin/sh +# +# Copyright (c) 2009, Damien Lespiau +# +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following +# conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +# we need sed +SED=@SED@ +if test -z "$SED" ; then +SED=sed +fi + +lt_unmangle () +{ + last_result=`echo $1 | $SED -e 's#.libs/##' -e 's#[0-9a-zA-Z_\-\.]*_la-##'` +} + +# the real libtool to use +LIBTOOL="$1" +shift + +# if 1, don't print anything, the underlaying wrapper will do it +pass_though=0 + +# scan the arguments, keep the right ones for libtool, and discover the mode +preserved_args= + +# have we seen the --tag option of libtool in the command line ? +tag_seen=0 + +while test "$#" -gt 0; do + opt="$1" + shift + + case $opt in + --mode=*) + mode=`echo $opt | $SED -e 's/[-_a-zA-Z0-9]*=//'` + preserved_args="$preserved_args $opt" + ;; + -o) + lt_output="$1" + preserved_args="$preserved_args $opt" + ;; + --tag=*) + tag_seen=1 + preserved_args="$preserved_args $opt" + ;; + *) + preserved_args="$preserved_args '$opt'" + ;; + esac +done + +case "$mode" in +compile) + # shave will be called and print the actual CC/CXX/LINK line + preserved_args="$preserved_args --shave-mode=$mode" + pass_though=1 + ;; +link) + preserved_args="$preserved_args --shave-mode=$mode" + Q=" LINK " + ;; +*) + # let's u + # echo "*** libtool: Unimplemented mode: $mode, fill a bug report" + ;; +esac + +lt_unmangle "$lt_output" +output=$last_result + +# automake does not add a --tag switch to its libtool invocation when +# assembling a .s file and rely on libtool to infer the right action based +# on the compiler name. As shave is using CC to hook a wrapper, libtool gets +# confused. Let's detect these cases and add a --tag=CC option. +tag="" +if test $tag_seen -eq 0 -a x"$mode" = xcompile; then + tag="--tag=CC" +fi + +if test -z $V; then + if test $pass_though -eq 0; then + echo "$Q$output" + fi + eval "$LIBTOOL --silent $tag $preserved_args" +else + echo $LIBTOOL $tag $preserved_args + eval "$LIBTOOL $tag $preserved_args" +fi diff --git a/build-aux/shave.in b/build-aux/shave.in new file mode 100644 index 0000000..461a1bf --- /dev/null +++ b/build-aux/shave.in @@ -0,0 +1,112 @@ +#!/bin/sh +# +# Copyright (c) 2009, Damien Lespiau +# +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following +# conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +# we need sed +SED=@SED@ +if test -z "$SED" ; then +SED=sed +fi + +lt_unmangle () +{ + last_result=`echo $1 | $SED -e 's#.libs/##' -e 's#[0-9a-zA-Z_\-\.]*_la-##'` +} + +# the tool to wrap (cc, cxx, ar, ranlib, ..) +tool="$1" +shift + +# the reel tool (to call) +REEL_TOOL="$1" +shift + +pass_through=0 +preserved_args= +while test "$#" -gt 0; do + opt="$1" + shift + + case $opt in + --shave-mode=*) + mode=`echo $opt | $SED -e 's/[-_a-zA-Z0-9]*=//'` + ;; + -o) + lt_output="$1" + preserved_args="$preserved_args $opt" + ;; + -out:*|/out:*) + lt_output="${opt#-out:}" + preserved_args="$preserved_args $opt" + ;; + *) + preserved_args="$preserved_args '$opt'" + ;; + esac +done + +# mode=link is handled in the libtool wrapper +case "$mode,$tool" in +link,*) + pass_through=1 + ;; +*,cxx) + Q=" CXX " + ;; +*,ccas) + Q=" AS " + ;; +*,cc) + Q=" CC " + ;; +*,fc) + Q=" FC " + ;; +*,f77) + Q=" F77 " + ;; +*,objc) + Q=" OBJC " + ;; +*,mcs) + Q=" MCS " + ;; +*,*) + # should not happen + Q=" CC " + ;; +esac + +lt_unmangle "$lt_output" +output=$last_result + +if test -z $V; then + if test $pass_through -eq 0; then + echo "$Q$output" + fi + eval "$REEL_TOOL $preserved_args" +else + echo $REEL_TOOL $preserved_args + eval "$REEL_TOOL $preserved_args" +fi diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..4c556a8 --- /dev/null +++ b/configure.ac @@ -0,0 +1,208 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.59) + +AC_INIT([murphy], + m4_esyscmd([build-aux/git-version-gen .tarball-version]), + [krisztian.litkey at intel.com]) + +AC_CONFIG_MACRO_DIR([m4]) +AC_CONFIG_SRCDIR([src]) +AC_CONFIG_HEADER([src/config.h]) +AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION) + +AC_SUBST(ACLOCAL_AMFLAGS, "-I m4") + +m4_define(version_major, `echo $VERSION | cut -d. -f1 | cut -d- -f1`) +m4_define(version_minor, `echo $VERSION | cut -d. -f2 | cut -d- -f1`) +m4_define(version_patch, `echo $VERSION | cut -d. -f3 | cut -d- -f1`) + +AC_SUBST(VERSION) +AC_SUBST(VERSION_MAJOR, version_major) +AC_SUBST(VERSION_MINOR, version_minor) +AC_SUBST(VERSION_PATCH, version_patch) +AC_SUBST(VERSION_FULL, version_major.version_minor.version_patch) + +MURPHY_VERSION_INFO="0:0:0" +AC_SUBST(MURPHY_VERSION_INFO) + +# Disable static libraries. +AC_DISABLE_STATIC + +# Checks for programs. +AC_PROG_CC +AC_PROG_CC_C99 +AC_PROG_AWK +AC_PROG_INSTALL +AM_PROG_CC_C_O +AM_PROG_LIBTOOL + +# Checks for libraries. +AC_CHECK_LIB([dl], [dlopen dlclose dlsym dlerror]) + +# Checks for header files. +AC_PATH_X +AC_CHECK_HEADERS([fcntl.h stddef.h stdint.h stdlib.h string.h sys/statvfs.h sys/vfs.h syslog.h unistd.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_HEADER_STDBOOL +AC_C_INLINE +AC_TYPE_INT16_T +AC_TYPE_INT32_T +AC_TYPE_INT64_T +AC_TYPE_MODE_T +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_TYPE_SSIZE_T +AC_CHECK_MEMBERS([struct stat.st_rdev]) +AC_TYPE_UINT16_T +AC_TYPE_UINT32_T +AC_TYPE_UINT64_T +AC_TYPE_UINT8_T +AC_CHECK_TYPES([ptrdiff_t]) + +# Checks for library functions. +AC_FUNC_ERROR_AT_LINE +AC_HEADER_MAJOR +AC_FUNC_MALLOC +AC_FUNC_STRTOD +AC_CHECK_FUNCS([clock_gettime memmove memset regcomp strcasecmp strchr strdup strrchr strtol strtoul]) + +# Check for glib. +PKG_CHECK_MODULES(GLIB, glib-2.0) +AC_SUBST(GLIB_CFLAGS) +AC_SUBST(GLIB_LIBS) + +# Check for low-level DBUS libs. +PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70 dbus-1 >= 0.70) +AC_SUBST(DBUS_CFLAGS) +AC_SUBST(DBUS_LIBS) + +DBUS_SESSION_DIR="`pkg-config --variable session_bus_services_dir dbus-1`" +AC_SUBST(DBUS_SESSION_DIR) + +# Check and enable extra compiler warnings if they are supported. +AC_ARG_ENABLE(extra-warnings, + [ --enable-extra-warnings enable extra compiler warnings], + [extra_warnings=$enableval], [extra_warnings=auto]) + +WARNING_CFLAGS="" +warncflags="-Wall -Wextra" +if test "$extra_warnings" != "no"; then + save_CPPFLAGS="$CPPFLAGS" + for opt in $warncflags; do + AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])], + [WARNING_CFLAGS="$WARNING_CFLAGS $opt"]) + done + CPPFLAGS="$save_CPPFLAGS" +fi + +AC_SUBST(WARNING_CFLAGS) + + +MURPHY_CFLAGS="$GLIB_CFLAGS $DBUS_CFLAGS" +MURPHY_LIBS="$GLIB_LIBS $DBUS_LIBS" +AC_SUBST(MURPHY_CFLAGS) +AC_SUBST(MURPHY_LIBS) + +# Check which plugins should be built in. +AC_ARG_WITH(builtin-plugins, + [ --with-builtin-plugins= specify which plugins to link in], + [builtin_plugins=$withval],[builtin_plugins=all]) + +all_plugins=$(ls src/plugins/*.c 2>/dev/null | \ + sed 's#src/murphy-plugin-##g;s#\.c$##g' | tr '\n' ' ') + +case $builtin_plugins in + all) builtin_plugins="$all_plugins";; + none) builtin_plugins="";; +esac + +internal=""; it="" +external=""; et="" +for plugin in $all_plugins; do + type=external + + for p in ${builtin_plugins//,/ }; do + if test "$plugin" = "$p"; then + internal="$internal$it$plugin" + type=internal + it=" " + fi + done + + if test "$type" = "external"; then + external="$external$et$plugin" + et=" " + fi +done + +INTERNAL_PLUGINS="$internal" +EXTERNAL_PLUGINS="$external" + +function check_if_internal() { + for p in $INTERNAL_PLUGINS; do + if test "$1" = "$p"; then + return 0 + fi + done + + return 1 +} + +AM_CONDITIONAL(BUILTIN_PLUGIN_TEST, [check_if_internal test]) +#AM_CONDITIONAL(BUILTIN_PLUGIN_STORAGE, [check_if_internal storage]) +#AM_CONDITIONAL(BUILTIN_PLUGIN_SYSFS, [check_if_internal sysfs ]) +#AM_CONDITIONAL(BUILTIN_PLUGIN_DISPLAY, [check_if_internal display]) +#AM_CONDITIONAL(BUILTIN_PLUGIN_NETWORK, [check_if_internal network]) +#AM_CONDITIONAL(BUILTIN_PLUGIN_BATTERY, [check_if_internal battery]) +#AM_CONDITIONAL(BUILTIN_PLUGIN_XFS, [check_if_internal xfs]) + +# Check for Check (unit test framework). +PKG_CHECK_MODULES(CHECK, + check >= 0.9.4, + [has_check="yes"], [has_check="no"]) +AM_CONDITIONAL(HAVE_CHECK, test "x$has_check" = "xyes") + +if test "x$has_check" = "xno"; then + AC_MSG_WARN([Check framework not found, unit tests are DISABLED.]) +fi + +# Shave by default. +SHAVE_INIT([build-aux], [enable]) + +# Create murphy symlink to src. +if test ! -L murphy; then + AC_MSG_NOTICE([Symlinking src to murphy...]) + ln -s src murphy +fi + +# Generate output. +AC_CONFIG_FILES([build-aux/shave + build-aux/shave-libtool + Makefile + src/Makefile + src/common/Makefile + src/common/tests/Makefile + src/core/Makefile + src/core/tests/Makefile + src/daemon/Makefile + src/daemon/tests/Makefile + src/plugins/Makefile + ]) +AC_OUTPUT + +# Display the configuration. +echo "----- configuration -----" +echo "Extra C warnings flags: $WARNING_CFLAGS" +echo "Plugins:" +echo " - linked-in:" +for plugin in ${INTERNAL_PLUGINS:-none}; do + echo " $plugin" +done + +echo " - dynamic:" +for plugin in ${EXTERNAL_PLUGINS:-none}; do + echo " $plugin" +done diff --git a/m4/shave.m4 b/m4/shave.m4 new file mode 100644 index 0000000..e468139 --- /dev/null +++ b/m4/shave.m4 @@ -0,0 +1,105 @@ +dnl Make automake/libtool output more friendly to humans +dnl +dnl Copyright (c) 2009, Damien Lespiau +dnl +dnl Permission is hereby granted, free of charge, to any person +dnl obtaining a copy of this software and associated documentation +dnl files (the "Software"), to deal in the Software without +dnl restriction, including without limitation the rights to use, +dnl copy, modify, merge, publish, distribute, sublicense, and/or sell +dnl copies of the Software, and to permit persons to whom the +dnl Software is furnished to do so, subject to the following +dnl conditions: +dnl +dnl The above copyright notice and this permission notice shall be +dnl included in all copies or substantial portions of the Software. +dnl +dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +dnl EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +dnl OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +dnl NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +dnl HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +dnl WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +dnl OTHER DEALINGS IN THE SOFTWARE. +dnl +dnl SHAVE_INIT([shavedir],[default_mode]) +dnl +dnl shavedir: the directory where the shave scripts are, it defaults to +dnl $(top_builddir) +dnl default_mode: (enable|disable) default shave mode. This parameter +dnl controls shave's behaviour when no option has been +dnl given to configure. It defaults to disable. +dnl +dnl * SHAVE_INIT should be called late in your configure.(ac|in) file (just +dnl before AC_CONFIG_FILE/AC_OUTPUT is perfect. This macro rewrites CC and +dnl LIBTOOL, you don't want the configure tests to have these variables +dnl re-defined. +dnl * This macro requires GNU make's -s option. + +AC_DEFUN([_SHAVE_ARG_ENABLE], +[ + AC_ARG_ENABLE([shave], + AS_HELP_STRING( + [--enable-shave], + [use shave to make the build pretty [[default=$1]]]),, + [enable_shave=$1] + ) +]) + +AC_DEFUN([SHAVE_INIT], +[ + dnl you can tweak the default value of enable_shave + m4_if([$2], [enable], [_SHAVE_ARG_ENABLE(yes)], [_SHAVE_ARG_ENABLE(no)]) + + if test x"$enable_shave" = xyes; then + dnl where can we find the shave scripts? + m4_if([$1],, + [shavedir="$ac_pwd"], + [shavedir="$ac_pwd/$1"]) + AC_SUBST(shavedir) + + dnl make is now quiet + AC_SUBST([MAKEFLAGS], [-s]) + AC_SUBST([AM_MAKEFLAGS], ['`test -z $V && echo -s`']) + + dnl we need sed + AC_CHECK_PROG(SED,sed,sed,false) + + dnl substitute libtool + SHAVE_SAVED_LIBTOOL=$LIBTOOL + LIBTOOL="${SHELL} ${shavedir}/shave-libtool '${SHAVE_SAVED_LIBTOOL}'" + AC_SUBST(LIBTOOL) + + dnl substitute cc/cxx + SHAVE_SAVED_CCAS=$CCAS + SHAVE_SAVED_CC=$CC + SHAVE_SAVED_CXX=$CXX + SHAVE_SAVED_FC=$FC + SHAVE_SAVED_F77=$F77 + SHAVE_SAVED_OBJC=$OBJC + SHAVE_SAVED_MCS=$MCS + CCAS="${SHELL} ${shavedir}/shave ccas ${SHAVE_SAVED_CCAS}" + CC="${SHELL} ${shavedir}/shave cc ${SHAVE_SAVED_CC}" + CXX="${SHELL} ${shavedir}/shave cxx ${SHAVE_SAVED_CXX}" + FC="${SHELL} ${shavedir}/shave fc ${SHAVE_SAVED_FC}" + F77="${SHELL} ${shavedir}/shave f77 ${SHAVE_SAVED_F77}" + OBJC="${SHELL} ${shavedir}/shave objc ${SHAVE_SAVED_OBJC}" + MCS="${SHELL} ${shavedir}/shave mcs ${SHAVE_SAVED_MCS}" + AC_SUBST(CCAS) + AC_SUBST(CC) + AC_SUBST(CXX) + AC_SUBST(FC) + AC_SUBST(F77) + AC_SUBST(OBJC) + AC_SUBST(MCS) + + V=@ + else + V=1 + fi + Q='$(V:1=)' + AC_SUBST(V) + AC_SUBST(Q) +]) + diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..3ed62b9 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = common core daemon plugins diff --git a/src/common/Makefile.am b/src/common/Makefile.am new file mode 100644 index 0000000..c02df94 --- /dev/null +++ b/src/common/Makefile.am @@ -0,0 +1,5 @@ +if HAVE_CHECK +SUBDIRS = tests +endif + +AM_CFLAGS = $(WARNING_CFLAGS) -I$(top_builddir) diff --git a/src/common/tests/Makefile.am b/src/common/tests/Makefile.am new file mode 100644 index 0000000..b47500b --- /dev/null +++ b/src/common/tests/Makefile.am @@ -0,0 +1 @@ +AM_CFLAGS = $(WARNING_CFLAGS) -I$(top_builddir) diff --git a/src/core/Makefile.am b/src/core/Makefile.am new file mode 100644 index 0000000..c02df94 --- /dev/null +++ b/src/core/Makefile.am @@ -0,0 +1,5 @@ +if HAVE_CHECK +SUBDIRS = tests +endif + +AM_CFLAGS = $(WARNING_CFLAGS) -I$(top_builddir) diff --git a/src/core/tests/Makefile.am b/src/core/tests/Makefile.am new file mode 100644 index 0000000..b47500b --- /dev/null +++ b/src/core/tests/Makefile.am @@ -0,0 +1 @@ +AM_CFLAGS = $(WARNING_CFLAGS) -I$(top_builddir) diff --git a/src/daemon/Makefile.am b/src/daemon/Makefile.am new file mode 100644 index 0000000..c02df94 --- /dev/null +++ b/src/daemon/Makefile.am @@ -0,0 +1,5 @@ +if HAVE_CHECK +SUBDIRS = tests +endif + +AM_CFLAGS = $(WARNING_CFLAGS) -I$(top_builddir) diff --git a/src/daemon/tests/Makefile.am b/src/daemon/tests/Makefile.am new file mode 100644 index 0000000..b47500b --- /dev/null +++ b/src/daemon/tests/Makefile.am @@ -0,0 +1 @@ +AM_CFLAGS = $(WARNING_CFLAGS) -I$(top_builddir) diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am new file mode 100644 index 0000000..e69de29 -- 2.7.4