diff --git a/autoclean.sh b/autoclean.sh new file mode 100755 index 00000000..1d08c97e --- /dev/null +++ b/autoclean.sh @@ -0,0 +1,49 @@ +#!/bin/sh + +set -x + +rm -f INSTALL NEWS AUTHORS \ +&& rm -f aclocal.m4 \ +&& rm -f -r autom4te.cache \ +&& rm -f compile \ +&& rm -f config.guess \ +&& rm -f config.log \ +&& rm -f config.status \ +&& rm -f config.sub \ +&& rm -f configure \ +&& rm -f depcomp \ +&& rm -f src/config.h \ +&& rm -f src/config.h.in \ +&& rm -f install-sh \ +&& rm -f -r libltdl \ +&& rm -f libtool \ +&& rm -f ltmain.sh \ +&& rm -f Makefile \ +&& rm -f Makefile.in \ +&& rm -f missing \ +&& rm -f src/*.la \ +&& rm -f src/*.lo \ +&& rm -f src/*.o \ +&& rm -f -r src/.libs \ +&& rm -f -r src/.deps \ +&& rm -f src/os/Makefile \ +&& rm -f src/os/Makefile.in \ +&& rm -f src/os/*/Makefile \ +&& rm -f src/os/*/Makefile.in \ +&& rm -f src/os/*/*.la \ +&& rm -f src/os/*/*.lo \ +&& rm -f src/os/*/*.o \ +&& rm -f -r src/os/*/.libs \ +&& rm -f -r src/os/*/.deps \ +&& rm -f src/Makefile \ +&& rm -f src/Makefile.in \ +&& rm -f src/stamp-h1 \ +&& rm -f src/stamp-h1.in \ +&& rm -f examples/Makefile \ +&& rm -f examples/Makefile.in \ +&& rm -f examples/*.o \ +&& rm -f -r examples/.libs \ +&& rm -f -r examples/.deps \ +&& perl -le 's/\.c$// && unlink && print "rm $_" for ' + + diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 00000000..296f4d50 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,10 @@ +#!/bin/sh +set -x + +touch INSTALL NEWS AUTHORS + +autoheader \ +&& aclocal \ +&& libtoolize --ltdl --copy --force \ +&& automake --add-missing --copy \ +&& autoconf diff --git a/configure.ac b/configure.ac new file mode 100644 index 00000000..42613400 --- /dev/null +++ b/configure.ac @@ -0,0 +1,67 @@ +AC_INIT(libsigar, 1.6.2) +AC_CONFIG_SRCDIR(src/sigar.c) +AC_CONFIG_HEADERS(src/config.h) +AM_INIT_AUTOMAKE +AC_CANONICAL_HOST + +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)]) +case $host_os in + *aix*) + SRC_OS="aix" + ;; + *darwin*) + SRC_OS="darwin" + ;; + *freebsd*) + SRC_OS="darwin" + LIBS="-lkvm" + ;; + *hpux*) + SRC_OS="hpux" + ;; + *linux*) + SRC_OS="linux" + ;; + *openbsd*) + SRC_OS="darwin" + LIBS="-lkvm" + ;; + *netbsd*) + SRC_OS="darwin" + LIBS="-lkvm" + ;; + *solaris*) + SRC_OS="solaris" + 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_SUBST(SRC_OS) +AC_SUBST(INCLUDES) +AC_SUBST(LIBS) + +AC_CONFIG_FILES([ +Makefile +src/Makefile +src/os/Makefile +src/os/aix/Makefile +src/os/darwin/Makefile +src/os/linux/Makefile +src/os/hpux/Makefile +src/os/solaris/Makefile +examples/Makefile +]) + +AC_OUTPUT diff --git a/examples/Makefile.am b/examples/Makefile.am new file mode 100644 index 00000000..2ce3a935 --- /dev/null +++ b/examples/Makefile.am @@ -0,0 +1,11 @@ +LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@ + +INCLUDES = @INCLUDES@ + +noinst_PROGRAMS = cpuinfo sigar_ps + +cpuinfo_SOURCES = cpuinfo.c +cpuinfo_LDADD = $(top_builddir)/src/libsigar.la + +sigar_ps_SOURCES = sigar_ps.c +sigar_ps_LDADD = $(top_builddir)/src/libsigar.la diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 00000000..fda8b9d2 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,33 @@ +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_LIBADD = $(top_builddir)/src/os/@SRC_OS@/libsigar_os.la + +libsigar_la_CFLAGS = + +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 + diff --git a/src/os/Makefile.am b/src/os/Makefile.am new file mode 100644 index 00000000..ded6dcbf --- /dev/null +++ b/src/os/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = @SRC_OS@ diff --git a/src/os/aix/Makefile.am b/src/os/aix/Makefile.am new file mode 100644 index 00000000..cad5b699 --- /dev/null +++ b/src/os/aix/Makefile.am @@ -0,0 +1,7 @@ +INCLUDES = @INCLUDES@ + +noinst_LTLIBRARIES = libsigar_os.la + +libsigar_os_la_SOURCES = aix_sigar.c + +noinst_HEADERS = sigar_os.h diff --git a/src/os/darwin/Makefile.am b/src/os/darwin/Makefile.am new file mode 100644 index 00000000..0d27888e --- /dev/null +++ b/src/os/darwin/Makefile.am @@ -0,0 +1,7 @@ +INCLUDES = @INCLUDES@ + +noinst_LTLIBRARIES = libsigar_os.la + +libsigar_os_la_SOURCES = darwin_sigar.c + +noinst_HEADERS = sigar_os.h diff --git a/src/os/hpux/Makefile.am b/src/os/hpux/Makefile.am new file mode 100644 index 00000000..a4502c28 --- /dev/null +++ b/src/os/hpux/Makefile.am @@ -0,0 +1,7 @@ +INCLUDES = @INCLUDES@ + +noinst_LTLIBRARIES = libsigar_os.la + +libsigar_os_la_SOURCES = hpux_sigar.c dlpi.c + +noinst_HEADERS = sigar_os.h diff --git a/src/os/linux/Makefile.am b/src/os/linux/Makefile.am new file mode 100644 index 00000000..abac4b62 --- /dev/null +++ b/src/os/linux/Makefile.am @@ -0,0 +1,7 @@ +INCLUDES = @INCLUDES@ + +noinst_LTLIBRARIES = libsigar_os.la + +libsigar_os_la_SOURCES = linux_sigar.c + +noinst_HEADERS = sigar_os.h diff --git a/src/os/solaris/Makefile.am b/src/os/solaris/Makefile.am new file mode 100644 index 00000000..885ee1b2 --- /dev/null +++ b/src/os/solaris/Makefile.am @@ -0,0 +1,7 @@ +INCLUDES = @INCLUDES@ + +noinst_LTLIBRARIES = libsigar_os.la + +libsigar_os_la_SOURCES = solaris_sigar.c get_mib2.c kstats.c procfs.c + +noinst_HEADERS = sigar_os.h