Permalink
Browse files

added a few more missing files

  • Loading branch information...
1 parent d651775 commit 99d73258a97ba52262236c9cc84d5c675ed9a72c @weigon weigon committed Aug 12, 2009
Showing with 223 additions and 43 deletions.
  1. +4 −1 Makefile.am
  2. +92 −11 autogen.sh
  3. +108 −16 configure.ac
  4. +8 −14 src/Makefile.am
  5. +11 −1 src/os/Makefile.am
View
@@ -1,2 +1,5 @@
-SUBDIRS = src examples
+SUBDIRS = include src bindings examples tests
+EXTRA_DIST=\
+ CMakeLists.txt \
+ winbuild.bat
View
@@ -1,15 +1,96 @@
#!/bin/sh
-set -x
+# Run this to generate all the initial makefiles, etc.
-touch INSTALL NEWS AUTHORS
-libtoolize="libtoolize"
-if which glibtoolize >/dev/null 2>&1
-then
- libtoolize=glibtoolize
+# LIBTOOLIZE=${LIBTOOLIZE:-libtoolize}
+LIBTOOLIZE_FLAGS="--copy --force"
+# ACLOCAL=${ACLOCAL:-aclocal}
+# AUTOHEADER=${AUTOHEADER:-autoheader}
+# AUTOMAKE=${AUTOMAKE:-automake}
+AUTOMAKE_FLAGS="--add-missing --copy"
+# AUTOCONF=${AUTOCONF:-autoconf}
+
+ARGV0=$0
+ARGS="$@"
+
+
+run() {
+ echo "$ARGV0: running \`$@' $ARGS"
+ $@ $ARGS
+}
+
+## jump out if one of the programs returns 'false'
+set -e
+
+## on macosx glibtoolize, others have libtool
+if test x$LIBTOOLIZE = x; then
+ if test \! "x`which glibtoolize 2> /dev/null | grep -v '^no'`" = x; then
+ LIBTOOLIZE=glibtoolize
+ elif test \! "x`which libtoolize-1.5 2> /dev/null | grep -v '^no'`" = x; then
+ LIBTOOLIZE=libtoolize-1.5
+ elif test \! "x`which libtoolize 2> /dev/null | grep -v '^no'`" = x; then
+ LIBTOOLIZE=libtoolize
+ else
+ echo "libtoolize 1.5.x wasn't found, exiting"; exit 0
+ fi
+fi
+
+## suse has aclocal and aclocal-1.9
+if test x$ACLOCAL = x; then
+ if test \! "x`which aclocal-1.9 2> /dev/null | grep -v '^no'`" = x; then
+ ACLOCAL=aclocal-1.9
+ elif test \! "x`which aclocal19 2> /dev/null | grep -v '^no'`" = x; then
+ ACLOCAL=aclocal19
+ elif test \! "x`which aclocal 2> /dev/null | grep -v '^no'`" = x; then
+ ACLOCAL=aclocal
+ else
+ echo "automake 1.9.x (aclocal) wasn't found, exiting"; exit 0
+ fi
+fi
+
+if test x$AUTOMAKE = x; then
+ if test \! "x`which automake-1.9 2> /dev/null | grep -v '^no'`" = x; then
+ AUTOMAKE=automake-1.9
+ elif test \! "x`which automake19 2> /dev/null | grep -v '^no'`" = x; then
+ AUTOMAKE=automake19
+ elif test \! "x`which automake 2> /dev/null | grep -v '^no'`" = x; then
+ AUTOMAKE=automake
+ else
+ echo "automake 1.9.x wasn't found, exiting"; exit 0
+ fi
+fi
+
+
+## macosx has autoconf-2.59 and autoconf-2.60
+if test x$AUTOCONF = x; then
+ if test \! "x`which autoconf-2.59 2> /dev/null | grep -v '^no'`" = x; then
+ AUTOCONF=autoconf-2.59
+ elif test \! "x`which autoconf259 2> /dev/null | grep -v '^no'`" = x; then
+ AUTOCONF=autoconf259
+ elif test \! "x`which autoconf 2> /dev/null | grep -v '^no'`" = x; then
+ AUTOCONF=autoconf
+ else
+ echo "autoconf 2.59+ wasn't found, exiting"; exit 0
+ fi
fi
-autoheader \
-&& aclocal \
-&& $libtoolize --copy --force \
-&& automake --add-missing --copy \
-&& autoconf
+if test x$AUTOHEADER = x; then
+ if test \! "x`which autoheader-2.59 2> /dev/null | grep -v '^no'`" = x; then
+ AUTOHEADER=autoheader-2.59
+ elif test \! "x`which autoheader259 2> /dev/null | grep -v '^no'`" = x; then
+ AUTOHEADER=autoheader259
+ elif test \! "x`which autoheader 2> /dev/null | grep -v '^no'`" = x; then
+ AUTOHEADER=autoheader
+ else
+ echo "autoconf 2.59+ (autoheader) wasn't found, exiting"; exit 0
+ fi
+fi
+
+
+run $LIBTOOLIZE $LIBTOOLIZE_FLAGS
+run $ACLOCAL $ACLOCAL_FLAGS
+# we don't need autoheader as we don't have a config.h
+# run $AUTOHEADER
+run $AUTOMAKE $AUTOMAKE_FLAGS
+run $AUTOCONF
+test "$ARGS" = "" && echo "Now type './configure --enable-maintainer-mode ...' and 'make' to compile."
+
View
@@ -1,67 +1,159 @@
+dnl ... hmm ... we have to duplicate the data below again
AC_INIT(libsigar, 1.6.2)
AC_CONFIG_SRCDIR(src/sigar.c)
-AC_CONFIG_HEADERS(src/config.h)
-AM_INIT_AUTOMAKE
+dnl AC_CONFIG_HEADERS(src/config.h)
+AM_INIT_AUTOMAKE([foreign])
AC_CANONICAL_HOST
+dnl for sigar_version_autoconf.c.in
+VERSION_MAJOR=1
+VERSION_MINOR=6
+VERSION_MAINT=2
+VERSION_BUILD=0
+
+AC_SUBST(VERSION_MAJOR)
+AC_SUBST(VERSION_MINOR)
+AC_SUBST(VERSION_MAINT)
+AC_SUBST(VERSION_BUILD)
+
AC_PROG_CC
AC_PROG_LN_S
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
AC_MSG_CHECKING([for os type ($host_os)])
+FRAMEWORK=
case $host_os in
*aix*)
SRC_OS="aix"
+ AC_DEFINE(SIGAR_TEST_OS_AIX, [1], [for the tests])
+ LIBS="-lodm -lcfg -lperfstat -lpthreads"
;;
*darwin*)
SRC_OS="darwin"
+ AC_DEFINE(DARWIN,[],[running on MacOS X])
+ AC_DEFINE(SIGAR_TEST_OS_DARWIN, [1], [for the tests])
+ SIGAR_INCLUDES="-I /Developer/Headers/FlatCarbon/"
+ SIGAR_LIBS="-framework IOKit -framework CoreServices"
+ ;;
+ *netbsd*)
+ SRC_OS="darwin"
+ AC_DEFINE(SIGAR_TEST_OS_DARWIN, [1], [for the tests])
+ SIGAR_LIBS="-lkvm"
+ ;;
+ *openbsd*)
+ SRC_OS="darwin"
+ AC_DEFINE(SIGAR_TEST_OS_DARWIN, [1], [for the tests])
+ SIGAR_LIBS="-lkvm"
;;
*freebsd*)
SRC_OS="darwin"
- LIBS="-lkvm"
+ AC_DEFINE(SIGAR_TEST_OS_DARWIN, [1], [for the tests])
+ SIGAR_LIBS="-lkvm"
;;
*hpux*)
+ AC_DEFINE(SIGAR_HPUX,[],[running on HPUX])
SRC_OS="hpux"
+ AC_DEFINE(SIGAR_TEST_OS_HPUX, [1], [for the tests])
+ SIGAR_LIBS="-lnm -lnsl"
;;
*linux*)
SRC_OS="linux"
- ;;
- *openbsd*)
- SRC_OS="darwin"
- LIBS="-lkvm"
- ;;
- *netbsd*)
- SRC_OS="darwin"
- LIBS="-lkvm"
+ AC_DEFINE(SIGAR_TEST_OS_LINUX, [1], [for the tests])
;;
*solaris*)
+ AC_DEFINE(SOLARIS,[],[running on Solaris])
SRC_OS="solaris"
- LIBS="-lkstat -lsocket"
+ AC_DEFINE(SIGAR_TEST_OS_SOLARIS, [1], [for the tests])
+ SIGAR_LIBS="-lkstat -lsocket"
;;
*)
ac_system="unknown"
esac
-AC_MSG_RESULT([$ac_system])
AC_MSG_RESULT([$SRC_OS])
-INCLUDES="-I\$(top_builddir)/include -I\$(srcdir)/os/$SRC_OS"
+AC_CHECK_HEADERS(libproc.h valgrind/valgrind.h)
+if test $ac_cv_header_libproc_h = yes; then
+ AC_DEFINE(DARWIN_HAS_LIBPROC_H, [1], [sigar named them DARWIN_HAS_... instead of HAVE_])
+fi
+
+INCLUDES="-I\$(top_srcdir)/include -I\$(top_srcdir)/src/os/$SRC_OS $SIGAR_INCLUDES"
AC_SUBST(SRC_OS)
AC_SUBST(INCLUDES)
-AC_SUBST(LIBS)
+AC_SUBST(SIGAR_LIBS)
+
+AM_CONDITIONAL(OS_WIN32, test x$SRC_OS = xwin32)
+AM_CONDITIONAL(OS_MACOSX, test x$SRC_OS = xdarwin)
+AM_CONDITIONAL(OS_LINUX, test x$SRC_OS = xlinux)
+AM_CONDITIONAL(OS_HPUX, test x$SRC_OS = xhpux)
+AM_CONDITIONAL(OS_AIX, test x$SRC_OS = xaix)
+AM_CONDITIONAL(OS_SOLARIS, test x$SRC_OS = xsolaris)
+
+AC_ARG_WITH(valgrind, [AC_HELP_STRING(
+ [--with-valgrind[=binary]],
+ [run the tests in valgrind to check for mem-leaks]
+ )],
+ [],
+ [with_valgrind=no])
+AS_IF([test "x$with_valgrind" != xno],
+ [AS_IF([test "x$with_valgrind" = xyes],
+ [AC_CHECK_PROG(VALGRIND, valgrind)
+ AS_IF([test "x$VALGRIND" = x],
+ [AC_MSG_ERROR("--with-valgrind ... but no valgrind found")])
+ ],
+ [VALGRIND="$with_valgrind"
+ AC_SUBST(VALGRIND)])
+ ])
+AM_CONDITIONAL(USE_VALGRIND, test "x$VALGRIND" != x)
+
+dnl Check for lua
+AC_MSG_CHECKING(if with lua)
+AC_ARG_WITH(lua, AC_HELP_STRING([--with-lua],[lua]),
+[WITH_LUA=$withval],[WITH_LUA=yes])
+
+if test "$WITH_LUA" != "no"; then
+ AC_MSG_RESULT($WITH_LUA)
+ # try pkgconfig
+ if test "$WITH_LUA" = "yes"; then
+ LUAPC=lua
+ else
+ LUAPC=$WITH_LUA
+ fi
+
+ PKG_CHECK_MODULES(LUA, $LUAPC >= 5.1, [
+ AC_DEFINE([HAVE_LUA], [1], [liblua])
+ AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
+ ],[
+ PKG_CHECK_MODULES(LUA, lua5.1 >= 5.1, [
+ AC_DEFINE([HAVE_LUA], [1], [liblua])
+ AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
+ ])
+ ])
+
+ AC_SUBST(LUA_CFLAGS)
+ AC_SUBST(LUA_LIBS)
+fi
AC_CONFIG_FILES([
Makefile
+include/Makefile
src/Makefile
src/os/Makefile
src/os/aix/Makefile
src/os/darwin/Makefile
-src/os/linux/Makefile
+src/os/freebsd/Makefile
src/os/hpux/Makefile
+src/os/linux/Makefile
+src/os/netware/Makefile
+src/os/osf1/Makefile
src/os/solaris/Makefile
+src/os/stub/Makefile
+src/os/win32/Makefile
examples/Makefile
+src/sigar_version_autoconf.c
+tests/Makefile
])
AC_OUTPUT
View
@@ -2,32 +2,26 @@ SUBDIRS = os
INCLUDES = @INCLUDES@
-include_HEADERS = \
- $(top_builddir)/include/sigar.h \
- $(top_builddir)/include/sigar_log.h \
- $(top_builddir)/include/sigar_format.h \
- $(top_builddir)/include/sigar_fileinfo.h \
- $(top_builddir)/include/sigar_ptql.h
-
lib_LTLIBRARIES = libsigar.la
-libsigar_la_LDFLAGS =
+libsigar_la_LDFLAGS = $(SIGAR_LIBS)
libsigar_la_LIBADD = $(top_builddir)/src/os/@SRC_OS@/libsigar_os.la
-libsigar_la_CFLAGS =
+libsigar_la_CFLAGS = -I$(top_srcdir)/include
libsigar_la_SOURCES = \
- $(include_HEADERS) \
- $(top_builddir)/include/sigar_private.h \
- $(top_builddir)/include/sigar_util.h \
- $(top_builddir)/include/sigar_getline.h \
sigar.c \
sigar_cache.c \
sigar_fileinfo.c \
sigar_format.c \
sigar_getline.c \
sigar_ptql.c \
sigar_signal.c \
- sigar_util.c
+ sigar_util.c \
+ sigar_version_autoconf.c
+
+EXTRA_DIST=\
+ sigar_version.c.in \
+ CMakeLists.txt
View
@@ -1 +1,11 @@
-SUBDIRS = @SRC_OS@
+SUBDIRS = \
+ aix \
+ darwin \
+ freebsd \
+ hpux \
+ linux \
+ netware \
+ osf1 \
+ solaris \
+ stub \
+ win32

0 comments on commit 99d7325

Please sign in to comment.