Permalink
Browse files

created initial autotools project

  • Loading branch information...
0 parents commit 7a611f3d6f6900126c5404d0514df948c72037b2 Aliaksey Kandratsenka committed Feb 26, 2011
Showing with 109 additions and 0 deletions.
  1. +26 −0 .gitignore
  2. 0 AUTHORS
  3. 0 COPYING
  4. +13 −0 Makefile.am
  5. 0 NEWS
  6. 0 README
  7. +7 −0 bootstrap
  8. +32 −0 configure.ac
  9. +31 −0 sigar_port.c
26 .gitignore
@@ -0,0 +1,26 @@
+*.gcda
+*.o
+.deps
+/ChangeLog
+/GPATH
+/GRTAGS
+/GSYMS
+/GTAGS
+/ID
+/INSTALL
+/TAGS
+/config.guess
+/config.sub
+/configure.ac
+Makefile
+Makefile.in
+aclocal.m4
+autom4te.cache
+config.log
+config.status
+configure
+depcomp
+install-sh
+missing
+compile
+sigar_port
0 AUTHORS
No changes.
0 COPYING
No changes.
13 Makefile.am
@@ -0,0 +1,13 @@
+ACLOCAL_AMFLAGS = -I m4
+
+AM_CPPFLAGS = $(SIGAR_CPPFLAGS)
+AM_LDFLAGS = $(SIGAR_LDFLAGS)
+
+bin_PROGRAMS = sigar_port
+sigar_port_SOURCES = sigar_port.c
+
+check-syntax:
+ $(COMPILE) -o /dev/null -S ${CHK_SOURCES}
+
+%.s : %.c
+ $(COMPILE) -S -fverbose-asm -o $@ $<
0 NEWS
No changes.
0 README
No changes.
7 bootstrap
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+git log >ChangeLog
+
+mkdir m4
+
+autoreconf -i --force --verbose
32 configure.ac
@@ -0,0 +1,32 @@
+AC_INIT([sigar_port], 1.0)
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+AM_PROG_CC_C_O
+
+AC_SEARCH_LIBS([sigar_open], [sigar], [], [
+ AC_MSG_NOTICE([will check for libsigar in ${prefix}/lib])
+ unset ac_cv_search_sigar_open
+ AC_SEARCH_LIBS([sigar_open], [sigar], [
+ SIGAR_LDFLAGS="-L${prefix}/lib"
+ ], [
+ AC_MSG_ERROR([need libsigar. Consider passing -L<path> in LDFLAGS])
+ ], [-L${prefix}/lib])
+])
+
+AC_CHECK_HEADER([sigar.h], [], [
+ AC_MSG_NOTICE([will check for sigar.h in ${prefix}/include])
+ unset ac_cv_header_sigar_h
+ ac_func_search_save_CPPFLAGS=$CPPFLAGS
+ CPPFLAGS="$CPPFLAGS -I${prefix}/include"
+ AC_CHECK_HEADER([sigar.h], [
+ SIGAR_CPPFLAGS="-I${prefix}/include"
+ ], [
+ AC_MSG_ERROR([need sigar.h. Consider passing -I<path> in CPPFLAGS])
+ ])
+ CPPFLAGS=$ac_func_search_save_CPPFLAGS
+])
+
+AC_SUBST(SIGAR_CPPFLAGS)
+AC_SUBST(SIGAR_LDFLAGS)
+
+AC_OUTPUT
31 sigar_port.c
@@ -0,0 +1,31 @@
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+#include <sigar.h>
+
+struct system_stats {
+ uint32_t version;
+ uint32_t struct_size;
+ uint32_t cpu_something;
+ uint32_t memory_something;
+};
+
+int main(void)
+{
+ struct system_stats reply;
+
+ while (!feof(stdin)) {
+ int req;
+ int rv = fread(&req, sizeof(req), 1, stdin);
+ if (rv < 1)
+ continue;
+ if (req != 0)
+ break;
+ memset(&reply, 0, sizeof(reply));
+ reply.version = (uint32_t)-1;
+ reply.struct_size = sizeof(reply);
+ fwrite(&reply, sizeof(reply), 1, stdout);
+ }
+
+ return 0;
+}

0 comments on commit 7a611f3

Please sign in to comment.