start an autotools based build

This commit is contained in:
Doug MacEachern 2008-11-26 23:27:32 +00:00
parent ef907e95b6
commit 08ed781e71
11 changed files with 206 additions and 0 deletions

49
autoclean.sh Executable file
View File

@ -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 <examples/*.c>'

10
autogen.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
set -x
touch INSTALL NEWS AUTHORS
autoheader \
&& aclocal \
&& libtoolize --ltdl --copy --force \
&& automake --add-missing --copy \
&& autoconf

67
configure.ac Normal file
View File

@ -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

11
examples/Makefile.am Normal file
View File

@ -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

33
src/Makefile.am Normal file
View File

@ -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

1
src/os/Makefile.am Normal file
View File

@ -0,0 +1 @@
SUBDIRS = @SRC_OS@

7
src/os/aix/Makefile.am Normal file
View File

@ -0,0 +1,7 @@
INCLUDES = @INCLUDES@
noinst_LTLIBRARIES = libsigar_os.la
libsigar_os_la_SOURCES = aix_sigar.c
noinst_HEADERS = sigar_os.h

View File

@ -0,0 +1,7 @@
INCLUDES = @INCLUDES@
noinst_LTLIBRARIES = libsigar_os.la
libsigar_os_la_SOURCES = darwin_sigar.c
noinst_HEADERS = sigar_os.h

7
src/os/hpux/Makefile.am Normal file
View File

@ -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

7
src/os/linux/Makefile.am Normal file
View File

@ -0,0 +1,7 @@
INCLUDES = @INCLUDES@
noinst_LTLIBRARIES = libsigar_os.la
libsigar_os_la_SOURCES = linux_sigar.c
noinst_HEADERS = sigar_os.h

View File

@ -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