Skip to content

Commit

Permalink
Added project skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
hintjens committed Mar 12, 2014
1 parent 1a1ab72 commit 7e9657a
Show file tree
Hide file tree
Showing 25 changed files with 2,537 additions and 0 deletions.
28 changes: 28 additions & 0 deletions skeleton/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
*.o
*.a
*.so
Makefile
Makefile.in
aclocal.m4
autom4te.cache/
config.log
config.status
config/
configure
doc/Makefile
doc/Makefile.in
doc/zproto.7
doc/zproto_example.3
libtool
src/.deps/
src/.libs/
src/Makefile
src/Makefile.in
src/core
src/libzproto.la
src/libzproto.pc
src/platform.h
src/platform.h.in
src/stamp-h1
src/zproto_example.lo
src/zproto_selftest
4 changes: 4 additions & 0 deletions skeleton/AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Contributors
============

Pieter Hintjens <[email protected]>
20 changes: 20 additions & 0 deletions skeleton/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
MIT License

Copyright (C) 2014 the Authors

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.
7 changes: 7 additions & 0 deletions skeleton/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ACLOCAL_AMFLAGS = -I config

SUBDIRS = src doc

DIST_SUBDIRS = src doc

EXTRA_DIST =
7 changes: 7 additions & 0 deletions skeleton/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Your Project

## Overview

## License and Contribution Policy


27 changes: 27 additions & 0 deletions skeleton/autogen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh
#
# Script to generate all required files from fresh git checkout.

command -v libtool >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "autogen.sh: error: could not find libtool. libtool is required to run autogen.sh." 1>&2
exit 1
fi

command -v autoreconf >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "autogen.sh: error: could not find autoreconf. autoconf and automake are required to run autogen.sh." 1>&2
exit 1
fi

mkdir -p ./config
if [ $? -ne 0 ]; then
echo "autogen.sh: error: could not create directory: ./config." 1>&2
exit 1
fi

autoreconf --install --force --verbose -I config
if [ $? -ne 0 ]; then
echo "autogen.sh: error: autoreconf exited with status $?" 1>&2
exit 1
fi
232 changes: 232 additions & 0 deletions skeleton/configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
#
# The version number is extracted from include/myproj.h using
# the version.sh script. Hence, it should be updated there.
# The version in git should reflect the *next* version planned.
#
AC_INIT([myproj],[m4_esyscmd([./version.sh myproj])],[[email protected])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_MACRO_DIR(config)
AC_CONFIG_HEADERS([src/platform.h])
AM_INIT_AUTOMAKE([tar-ustar foreign])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
# This defines PACKAGE_VERSION_... in src/platform.h
PV_MAJOR=`echo $PACKAGE_VERSION | cut -d . -f 1`
PV_MINOR=`echo $PACKAGE_VERSION | cut -d . -f 2`
PV_PATCH=`echo $PACKAGE_VERSION | cut -d . -f 3`
AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],[$PV_MAJOR],
[myproj major version])
AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],[$PV_MINOR],
[myproj minor version])
AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCH],[$PV_PATCH],
[myproj patchlevel])
# This lets us use PACKAGE_VERSION in Makefiles
AC_SUBST(PACKAGE_VERSION)
#
# Libtool -version-info (ABI version)
#
# Currently 2.0.1 ("stable"). Don't change this unless you
# know exactly what you're doing and have read and understand
# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
#
# libmyproj -version-info
LTVER="2:0:1"
AC_SUBST(LTVER)
# Capture c flags
MYPROJ_ORIG_CFLAGS="${CFLAGS:-none}"
# Checks for programs
AC_PROG_CC
AC_PROG_CC_C99
AM_PROG_CC_C_O
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
AC_PROG_SED
AC_PROG_AWK
# Code coverage
AC_ARG_WITH(gcov, [AS_HELP_STRING([--with-gcov=yes/no],
[With GCC Code Coverage reporting.])],
[MYPROJ_GCOV="$withval"])
if test "x${MYPROJ_GCOV}" == "xyes"; then
CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
if test "x${MYPROJ_ORIG_CFLAGS}" != "xnone"; then
CFLAGS="${CFLAGS} ${MYPROJ_ORIG_CFLAGS}"
fi
fi
# libzmq integration
AC_ARG_WITH([libzmq],
[AS_HELP_STRING([--with-libzmq],
[Specify libzmq prefix])],
[search_libzmq="yes"],
[])
if test "x$search_libzmq" = "xyes"; then
if test -r "${with_libzmq}/include/zmq.h"; then
CFLAGS="-I${with_libzmq}/include ${CFLAGS}"
LDFLAGS="-L${with_libzmq}/lib ${LDFLAGS}"
else
AC_MSG_ERROR([${with_libzmq}/include/zmq.h not found. Please check libzmq prefix])
fi
fi
AC_CHECK_LIB(zmq, zmq_init,
LIBS="-lzmq $LIBS",
[AC_MSG_ERROR([cannot link with -lzmq, install libzmq.])])
AC_MSG_CHECKING([whether libzmq installation works])
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <zmq.h>],
[zmq_init(1);]) ],
[AC_MSG_RESULT([yes])],
[AC_MSG_ERROR([no. Please specify libzmq installation prefix using --with-libzmq])])
# libczmq integration
AC_ARG_WITH([libczmq],
[AS_HELP_STRING([--with-libczmq],
[Specify libczmq prefix])],
[search_libczmq="yes"], [])
if test "x$search_libczmq" = "xyes"; then
if test -r "${with_libczmq}/include/czmq.h"; then
CFLAGS="-I${with_libczmq}/include ${CFLAGS}"
LDFLAGS="-L${with_libczmq}/lib ${LDFLAGS}"
else
AC_MSG_ERROR([${with_libczmq}/include/czmq.h not found. Please check libczmq prefix])
fi
fi
AC_CHECK_LIB(czmq, zctx_test,
LIBS="-lczmq $LIBS",
[AC_MSG_ERROR([cannot link with -lczmq, install libczmq.])])
AC_MSG_CHECKING([whether libczmq installation works])
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <czmq.h>],
[zctx_test (0);]) ],
[AC_MSG_RESULT([yes])],
[AC_MSG_ERROR([no. Please specify libczmq installation prefix using --with-czmq])])
# Host speciffic checks
AC_CANONICAL_HOST
# Determine whether or not documentation should be built and installed.
myproj_build_doc="yes"
myproj_install_man="yes"
# Check for asciidoc and xmlto and don't build the docs if these are not installed.
AC_CHECK_PROG(myproj_have_asciidoc, asciidoc, yes, no)
AC_CHECK_PROG(myproj_have_xmlto, xmlto, yes, no)
if test "x$myproj_have_asciidoc" = "xno" -o "x$myproj_have_xmlto" = "xno"; then
myproj_build_doc="no"
# Tarballs built with 'make dist' ship with prebuilt documentation.
if ! test -f doc/myproj.7; then
myproj_install_man="no"
AC_MSG_WARN([You are building an unreleased version of libmyproj and asciidoc or xmlto are not installed.])
AC_MSG_WARN([Documentation will not be built and manual pages will not be installed.])
fi
fi
AC_MSG_CHECKING([whether to build documentation])
AC_MSG_RESULT([$myproj_build_doc])
AC_MSG_CHECKING([whether to install manpages])
AC_MSG_RESULT([$myproj_install_man])
# Set some default features required by libmyproj code.
CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE $CPPFLAGS"
# OS-specific tests
case "${host_os}" in
*linux*)
# Define on Linux to enable all library features
CPPFLAGS="-D_GNU_SOURCE -DLINUX $CPPFLAGS"
AC_DEFINE(MYPROJ_HAVE_LINUX, 1, [Have Linux OS])
;;
*solaris*)
# Define on Solaris to enable all library features
CPPFLAGS="-D_PTHREADS $CPPFLAGS"
AC_DEFINE(MYPROJ_HAVE_SOLARIS, 1, [Have Solaris OS])
CFLAGS="${CFLAGS} -lsocket -lssp"
;;
*freebsd*)
# Define on FreeBSD to enable all library features
CPPFLAGS="-D__BSD_VISIBLE $CPPFLAGS"
AC_DEFINE(MYPROJ_HAVE_FREEBSD, 1, [Have FreeBSD OS])
;;
*darwin*)
# Define on Darwin to enable all library features
CPPFLAGS="-D_DARWIN_C_SOURCE $CPPFLAGS"
AC_DEFINE(MYPROJ_HAVE_OSX, 1, [Have DarwinOSX OS])
;;
*netbsd*)
# Define on NetBSD to enable all library features
CPPFLAGS="-D_NETBSD_SOURCE $CPPFLAGS"
AC_DEFINE(MYPROJ_HAVE_NETBSD, 1, [Have NetBSD OS])
;;
*openbsd*)
# Define on OpenBSD to enable all library features
CPPFLAGS="-D_BSD_SOURCE $CPPFLAGS"
AC_DEFINE(MYPROJ_HAVE_OPENBSD, 1, [Have OpenBSD OS])
;;
*nto-qnx*)
AC_DEFINE(MYPROJ_HAVE_QNXNTO, 1, [Have QNX Neutrino OS])
;;
*aix*)
AC_DEFINE(MYPROJ_HAVE_AIX, 1, [Have AIX OS])
;;
*hpux*)
# Define on HP-UX to enable all library features
CPPFLAGS="-D_POSIX_C_SOURCE=200112L"
AC_DEFINE(MYPROJ_HAVE_HPUX, 1, [Have HPUX OS])
;;
*mingw32*)
AC_DEFINE(MYPROJ_HAVE_WINDOWS, 1, [Have Windows OS])
AC_DEFINE(MYPROJ_HAVE_MINGW32, 1, [Have MinGW32])
AC_CHECK_HEADERS(windows.h)
;;
*cygwin*)
# Define on Cygwin to enable all library features
CPPFLAGS="-D_GNU_SOURCE $CPPFLAGS"
AC_DEFINE(MYPROJ_HAVE_CYGWIN, 1, [Have Cygwin])
;;
*)
AC_MSG_ERROR([unsupported system: ${host_os}.])
;;
esac
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(errno.h arpa/inet.h netinet/tcp.h netinet/in.h stddef.h \
stdlib.h string.h sys/socket.h sys/time.h unistd.h limits.h ifaddrs.h)
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_HEADER_TIME
AC_TYPE_UINT32_T
AC_C_VOLATILE
# These options are GNU compiler specific.
if test "x$GCC" = "xyes"; then
CPPFLAGS="-pedantic -Werror -Wall ${CPPFLAGS}"
fi
AM_CONDITIONAL(INSTALL_MAN, test "x$myproj_install_man" = "xyes")
AM_CONDITIONAL(BUILD_DOC, test "x$myproj_build_doc" = "xyes")
# Checks for library functions.
AC_TYPE_SIGNAL
AC_CHECK_FUNCS(perror gettimeofday memset)
# Specify output files
AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile src/libmyproj.pc])
AC_OUTPUT
33 changes: 33 additions & 0 deletions skeleton/doc/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
MAN1 =
MAN3 = myproj_msg.3
MAN7 = myproj.7
MAN_DOC = $(MAN1) $(MAN3) $(MAN7)

MAN_TXT = $(MAN1:%.1=%.txt)
MAN_TXT += $(MAN3:%.3=%.txt)
MAN_TXT += $(MAN7:%.7=%.txt)

if INSTALL_MAN
dist_man_MANS = $(MAN_DOC)
endif

EXTRA_DIST = asciidoc.conf mkman $(MAN_TXT)

MAINTAINERCLEANFILES = $(MAN_DOC)

dist-hook : $(MAN_DOC)

if BUILD_DOC
SUFFIXES=.txt .xml .1 .3 .7

.txt.xml:
$(srcdir)/mkman $<
asciidoc -d manpage -b docbook -f $(srcdir)/asciidoc.conf \
-atsp_version=@PACKAGE_VERSION@ -o$@ $<
.xml.1:
xmlto man $<
.xml.3:
xmlto man $<
.xml.7:
xmlto man $<
endif
Loading

0 comments on commit 7e9657a

Please sign in to comment.