diff options
author | Yorhel <git@yorhel.nl> | 2015-12-12 13:27:11 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2015-12-12 13:33:26 +0100 |
commit | 18701a88de97acb966973c3c84eed2b96fdea1ed (patch) | |
tree | e4d1a33282660dbd1a59be633adc4c96a2cbc234 |
Initial commit with a C skeleton
(most parts stolen from Globster)
-rw-r--r-- | .gitignore | 7 | ||||
-rw-r--r-- | Makefile.am | 53 | ||||
-rw-r--r-- | configure.ac | 70 | ||||
-rwxr-xr-x | init-from-git.sh | 49 | ||||
-rw-r--r-- | src/main.c | 10 |
5 files changed, 189 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..09858b0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +Makefile.in +aclocal.m4 +autom4te.cache/ +build-aux/ +config.h.in +configure +deps/ diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..49e9a59 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,53 @@ +EXTRA_DIST= +noinst_LIBRARIES= +noinst_PROGRAMS= +MOSTLYCLEANFILES= +AM_CPPFLAGS=-I$(srcdir)/src -Isrc -I$(srcdir)/deps/klib -I$(srcdir)/deps/ylib + +# deps/ stuff +noinst_LIBRARIES+=libdeps.a +libdeps_a_CFLAGS=-w +libdeps_a_SOURCES= + +# libev +if HAVE_SYSEV +EV_LIBS=-lev +else +EV_LIBS= +libdeps_a_SOURCES+=deps/ev/ev.c +AM_CPPFLAGS+=-I$(srcdir)/deps/ev +endif +EXTRA_DIST+=\ + deps/ev/LICENSE\ + deps/ev/ev_epoll.c\ + deps/ev/ev.h\ + deps/ev/ev_kqueue.c\ + deps/ev/ev_poll.c\ + deps/ev/ev_port.c\ + deps/ev/ev_select.c\ + deps/ev/ev_vars.h\ + deps/ev/ev_wrap.h + +# klib +EXTRA_DIST+=deps/klib/khash.h + +# ylib +EXTRA_DIST+=deps/ylib/yuri.h + +# fcgy +bin_PROGRAMS=fcgy +fcgy_LDADD=libdeps.a -lm -lpthread $(EV_LIBS) +fcgy_SOURCES=\ + src/main.c + +nodist_fcgy_SOURCES=version.c + +MOSTLYCLEANFILES+=version.c + +if USE_GIT_VERSION +version.c: $(srcdir)/.git/logs/HEAD + $(AM_V_GEN)echo 'const char *fcgy_version = "'"`git describe --abbrev=8 --dirty=-d`"'";' >version.c +else +version.c: Makefile + $(AM_V_GEN)echo 'const char *fcgy_version = "'"@VERSION@"'";' >version.c +endif diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..07c1aac --- /dev/null +++ b/configure.ac @@ -0,0 +1,70 @@ + +AC_INIT([fcgy],[0.0],[projects@yorhel.nl]) +AC_CONFIG_SRCDIR([.]) +AC_CONFIG_HEADER([config.h]) +AC_CONFIG_AUX_DIR([build-aux]) +m4_include([deps/lean.m4]) +AM_INIT_AUTOMAKE([foreign subdir-objects]) +PKG_PROG_PKG_CONFIG([0.18]) + +AC_PROG_CC +AC_PROG_INSTALL +AC_PROG_RANLIB + +# Don't use AC_GNU_SOURCE, it pulls in a lot of pointless header file checks. +AC_DEFINE(_GNU_SOURCE, 1, [Expose some potentially-unportable symbols]) + +AC_SYS_LARGEFILE + +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) + +# Check for pod2man +AC_CHECK_PROG([have_pod2man],[pod2man],[yes],[no]) +AM_CONDITIONAL([USE_POD2MAN], [test "x$have_pod2man" = "xyes"]) + + +AC_SEARCH_LIBS([clock_gettime],[rt]) +AC_SEARCH_LIBS([inet_ntop], [nsl]) +AC_SEARCH_LIBS([socket], [socket], [], [ + AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"], [], [-lnsl])]) + + +# Libev (4.0+) can either be provided by the system or by using the version in deps/. +AC_ARG_WITH(system-libev, + AS_HELP_STRING([--with-system-libev], [Use the system-provided libev instead of the embedded version.]), + [usesysev=$withval], [usesysev=auto]) +if test "x$usesysev" != "xno"; then + havesysev=no + AC_CHECK_LIB([ev], + [ev_depth], + [AC_CHECK_HEADERS([ev.h],[havesysev=yes],[])], + []) + if test "x$havesysev" = "xno" -a "x$usesysev" = "xyes"; then + AC_MSG_ERROR([System-provided libev requested, but library or header could not be found.]) + fi + usesysev=$havesysev +fi +if test "x$usesysev" = "xno"; then + # Since we have our own libev, let's disable EV_MULTIPLICITY. Decreases + # binary size a bit. + AC_DEFINE(EV_MULTIPLICITY, 0, [Define to disable support for multiple event loops.]) + m4_include([deps/ev/libev.m4]) +fi +AM_CONDITIONAL([HAVE_SYSEV], [test "x$usesysev" = "xyes"]) +# We require 4.0+ and don't want the compatibility macros +AC_DEFINE(EV_COMPAT3, 0, [Define to disable compatibility with pre-4.0 libev.]) + + +AC_ARG_ENABLE(git-version, + AS_HELP_STRING([--enable-git-version], [enable use of git version if available]), + [wantgitver=$enableval], [wantgitver=yes]) + +usegitver=no +if test "x$wantgitver" = "xyes" ; then + AC_CHECK_PROGS([GIT], [git], [no]) + test "x$GIT" != "xno" -a -d "$srcdir/.git" && usegitver=yes +fi +AM_CONDITIONAL(USE_GIT_VERSION, test "x$usegitver" = "xyes") + + +AC_OUTPUT([Makefile]) diff --git a/init-from-git.sh b/init-from-git.sh new file mode 100755 index 0000000..6e3c3f1 --- /dev/null +++ b/init-from-git.sh @@ -0,0 +1,49 @@ +#!/bin/sh + +set -x + + +aclean() { + rm -f lean.m4 + hg clone https://bitbucket.org/GregorR/autoconf-lean + make -C autoconf-lean\ + && mv autoconf-lean/lean.m4 .\ + && rm -rf autoconf-lean +} + + +ev() { + d=libev-4.20 + rm -rf ev + wget -q http://dist.schmorp.de/libev/Attic/$d.tar.gz\ + && tar -xzf $d.tar.gz\ + && rm -f $d.tar.gz\ + && mv $d ev +} + + +ylib() { + U=http://g.blicky.net/ylib.git/plain + rm -rf ylib + mkdir -p ylib\ + && wget -q $U/yopt.h -O ylib/yopt.h\ + && wget -q $U/yuri.c -O ylib/yuri.c\ + && wget -q $U/yuri.h -O ylib/yuri.h +} + + +klib() { + U=https://raw.github.com/attractivechaos/klib/master + rm -rf klib + mkdir -p klib\ + && wget -q $U/khash.h -O klib/khash.h +} + + +mkdir -p deps +cd deps + +aclean +ev +ylib +klib diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..493bd59 --- /dev/null +++ b/src/main.c @@ -0,0 +1,10 @@ +#include <stdio.h> + +#include "config.h" + +extern char *fcgy_version; + +int main(int argc, char **argv) { + printf("Version: %s\n", fcgy_version); + return 0; +} |