Skip to content

Commit

Permalink
initial import with Ecelerity bits removed and some autoconf glue add…
Browse files Browse the repository at this point in the history
…ed in. Could certainly use some work on the build/install. Needs shared lib support for multiple platforms
  • Loading branch information
postwait committed Sep 27, 2007
1 parent 5229b0a commit 81ac86a
Show file tree
Hide file tree
Showing 33 changed files with 7,292 additions and 0 deletions.
53 changes: 53 additions & 0 deletions Makefile.in
@@ -0,0 +1,53 @@
CC=@CC@
CPPFLAGS=@CPPFLAGS@
CFLAGS=@CFLAGS@
LDFLAGS=@LDFLAGS@
AR=@AR@
RANLIB=@RANLIB@
LIBS=@LIBS@
INSTALL=@INSTALL@

prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
sbindir=@sbindir@
libdir=@libdir@
includedir=${prefix}/include
libexecdir=@libexecdir@
mandir=@mandir@
mansubdir=@mansubdir@
docdir=${prefix}/@docdir@
sysconfdir=@sysconfdir@
srcdir=@srcdir@
top_srcdir=@top_srcdir@

LIBOBJS= \
jlog.o jlog_hash.o jlog_io.o

all: libjlog.a jlogctl test

test: jthreadtest

jlogctl: libjlog.a jlogctl.o
$(CC) $(CFLAGS) -o jlogctl jlogctl.o libjlog.a $(LIBS)

jthreadtest: libjlog.a jthreadtest.o
$(CC) $(CFLAGS) -o jthreadtest jthreadtest.o libjlog.a $(LIBS)

libjlog.a: $(LIBOBJS)
$(AR) cq libjlog.a $(LIBOBJS)
$(RANLIB) libjlog.a

.c.o:
$(CC) $(CPPFLAGS) $(CFLAGS) -c $<

install:
$(srcdir)/mkinstalldirs $(DESTDIR)$(bindir)
$(srcdir)/mkinstalldirs $(DESTDIR)$(libdir)
$(srcdir)/mkinstalldirs $(DESTDIR)$(includedir)
$(INSTALL) -m 0755 jlogctl $(DESTDIR)$(bindir)/jlogctl
$(INSTALL) -m 0755 libjlog.a $(DESTDIR)$(libdir)/libjlog.a
$(INSTALL) -m 0644 jlog.h $(DESTDIR)$(includedir)/jlog.h

clean:
rm -f *.o libjlog.a jthreadtest
201 changes: 201 additions & 0 deletions configure.in
@@ -0,0 +1,201 @@
AC_INIT(jlog.c)
AC_CONFIG_HEADER(jlog_config.h)

AC_PROG_CC
AC_C_INLINE
AC_C_BIGENDIAN
AC_PROG_CPP
AC_PROG_RANLIB
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PATH_PROG(AR, ar)
AC_PATH_PROGS(PERL, perl)
AC_SUBST(PERL)

# Checks for data types
AC_CHECK_SIZEOF(char, 1)
AC_CHECK_SIZEOF(short int, 2)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long int, 4)
AC_CHECK_SIZEOF(long long int, 8)
AC_CHECK_SIZEOF(void *, 1)

AC_CHECK_LIB(rt, sem_init, , )
AC_CHECK_LIB(posix4, sem_wait, , )

AC_MSG_CHECKING([whether sem_init works])
AC_TRY_RUN(
[
#include <semaphore.h>
int main(void){sem_t s;return (0 != sem_init(&s,0,0));}
],
[AC_MSG_RESULT(yes)],
[
AC_MSG_RESULT(no)
AC_DEFINE(BROKEN_SEM_INIT)
AC_MSG_WARN([****** sem_init() is broken, I'll implement one myself.])
]
)

AC_CHECK_LIB(rt, sem_init, , )
AC_FUNC_STRFTIME

# Checks for header files.
AC_CHECK_HEADERS(sys/file.h sys/types.h dirent.h sys/param.h fcntl.h errno.h limits.h \
sys/resource.h pthread.h semaphore.h pwd.h stdio.h stdlib.h string.h \
ctype.h unistd.h time.h sys/stat.h)

AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
AC_TRY_COMPILE(
[ #include <sys/types.h> ],
[ u_int a; a = 1;],
[ ac_cv_have_u_int="yes" ],
[ ac_cv_have_u_int="no" ]
)
])
if test "x$ac_cv_have_u_int" = "xyes" ; then
AC_DEFINE(HAVE_U_INT)
have_u_int=1
fi

AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
AC_TRY_COMPILE(
[ #include <sys/types.h> ],
[ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
[ ac_cv_have_intxx_t="yes" ],
[ ac_cv_have_intxx_t="no" ]
)
])
if test "x$ac_cv_have_intxx_t" = "xyes" ; then
AC_DEFINE(HAVE_INTXX_T)
have_intxx_t=1
fi

AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
AC_TRY_COMPILE(
[ #include <sys/types.h> ],
[ int64_t a; a = 1;],
[ ac_cv_have_int64_t="yes" ],
[ ac_cv_have_int64_t="no" ]
)
])
if test "x$ac_cv_have_int64_t" = "xyes" ; then
AC_DEFINE(HAVE_INT64_T)
have_int64_t=1
fi

AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
AC_TRY_COMPILE(
[ #include <sys/types.h> ],
[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
[ ac_cv_have_u_intxx_t="yes" ],
[ ac_cv_have_u_intxx_t="no" ]
)
])
if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
AC_DEFINE(HAVE_U_INTXX_T)
have_u_intxx_t=1
fi

AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
AC_TRY_COMPILE(
[ #include <sys/types.h> ],
[ u_int64_t a; a = 1;],
[ ac_cv_have_u_int64_t="yes" ],
[ ac_cv_have_u_int64_t="no" ]
)
])
if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
AC_DEFINE(HAVE_U_INT64_T)
have_u_int64_t=1
fi

if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
test "x$ac_cv_header_sys_bitypes_h" = "xyes")
then
AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
AC_TRY_COMPILE(
[
#include <sys/bitypes.h>
],
[
int8_t a; int16_t b; int32_t c;
u_int8_t e; u_int16_t f; u_int32_t g;
a = b = c = e = f = g = 1;
],
[
AC_DEFINE(HAVE_U_INTXX_T)
AC_DEFINE(HAVE_INTXX_T)
AC_MSG_RESULT(yes)
],
[AC_MSG_RESULT(no)]
)
fi

if test -z "$have_u_intxx_t" ; then
AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
AC_TRY_COMPILE(
[
#include <sys/types.h>
],
[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
[ ac_cv_have_uintxx_t="yes" ],
[ ac_cv_have_uintxx_t="no" ]
)
])
if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
AC_DEFINE(HAVE_UINTXX_T)
fi
fi

AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [
AC_TRY_COMPILE(
[
#include <sys/types.h>
#include <sys/socket.h>
],
[socklen_t foo; foo = 1235;],
[ ac_cv_have_socklen_t="yes" ],
[ ac_cv_have_socklen_t="no" ]
)
])
if test "x$ac_cv_have_socklen_t" = "xyes" ; then
AC_DEFINE(HAVE_SOCKLEN_T)
fi

AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
AC_TRY_COMPILE(
[
#include <sys/types.h>
],
[ size_t foo; foo = 1235; ],
[ ac_cv_have_size_t="yes" ],
[ ac_cv_have_size_t="no" ]
)
])
if test "x$ac_cv_have_size_t" = "xyes" ; then
AC_DEFINE(HAVE_SIZE_T)
fi

AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
AC_TRY_COMPILE(
[
#include <sys/types.h>
],
[ ssize_t foo; foo = 1235; ],
[ ac_cv_have_ssize_t="yes" ],
[ ac_cv_have_ssize_t="no" ]
)
])
if test "x$ac_cv_have_ssize_t" = "xyes" ; then
AC_DEFINE(HAVE_SSIZE_T)
fi

docdir="docs"
mansubdir="man"
AC_SUBST(docdir)
AC_SUBST(mansubdir)

AC_OUTPUT([
Makefile
])

0 comments on commit 81ac86a

Please sign in to comment.