diff --git a/.cvsignore b/.cvsignore index caa215c1..80d5ee28 100644 --- a/.cvsignore +++ b/.cvsignore @@ -38,3 +38,5 @@ mkinstalldirs missing INSTALL COPYING +glibtop-config.h +stamp-gc-h diff --git a/ChangeLog b/ChangeLog index 09436892..2967dacf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +1999-05-12 Martin Baulig + + * glibtop-config.h: This is a new generated file which will be + included from . We define things like `u_int64_t' and + LIBGTOP_*_VERSION here so we can compile LibGTop applications with + `libgtop-config --cflags`. + + * configure.in: Create glibtop-config.h. + (GLIBTOP_*_INCS): Added `-I $(pkglibdir)/include'. + + * libgtop-config.h.in: Added `--cflags', `--libs' and `--extra-libs' + parameter so you can now use LibGTop even in no-autoconf apps. + + * Makefile.am: Install `glibtop-config.h' in `$(pkglibdir)/include'. + 1999-05-09 Drazen Kacar * configure.in, acconfig.h: Added checks for diff --git a/Makefile.am b/Makefile.am index c11bdd71..06d9fe87 100644 --- a/Makefile.am +++ b/Makefile.am @@ -14,11 +14,22 @@ SUBDIRS = po intl $(support) macros misc include sysdeps lib src \ $(examples_SUBDIRS) doc include_HEADERS = glibtop.h +configincludedir = $(pkglibdir)/include EXTRA_DIST = autogen.sh libgtop.spec.in copyright.txt libgtopConf.sh.in \ LIBGTOP-VERSION features.def libgtop-config.in RELNOTES-0.25 \ RELNOTES-1.0 libgtop-sysdeps.m4 README NEWS.old libgtop-mirror.sh +configinclude_DATA = \ + glibtop-config.h + +BUILT_SOURCES = stamp-gc-h #note: not glibtop-config.h +glibtop-config.h: stamp-gc-h + @: +stamp-gc-h: config.status + CONFIG_FILES= CONFIG_HEADERS= CONFIG_OTHER=glibtop-config.h ./config.status + echo timestamp > stamp-gc-h + dist-hook: cp libgtop.spec $(distdir) diff --git a/configure.in b/configure.in index 15546338..b569f3ad 100644 --- a/configure.in +++ b/configure.in @@ -286,7 +286,7 @@ AC_SUBST(SUPPORTINCS) dnl These definitions are expanded in make. LIBGTOP_LIBS='-L$(libdir)' -LIBGTOP_INCS='-I$(includedir)' +LIBGTOP_INCS='-I$(includedir) -I$(pkglibdir)/include' if test x$libgtop_use_machine_h = xyes ; then LIBGTOP_INCS="$LIBGTOP_INCS -DHAVE_GLIBTOP_MACHINE_H" @@ -386,6 +386,137 @@ fi AC_SUBST(sysdeps_suid_lib) AC_SUBST(server_programs) + +dnl The following one is copied from glib/configure.in + +AC_OUTPUT_COMMANDS([ + +## Generate `glibconfig.h' in two cases +## 1. `config.status' is run either explicitly, or via configure. +## Esp. not when it is run in `Makefile' to generate makefiles and +## config.h +## 2. CONFIG_OTHER is set explicitly +## +## Case 1 is difficult. We know that `automake' sets one of +## CONFIG_FILES or CONFIG_HEADERS to empty. This heuristic works +## only when AM_CONFIG_HEADER is set, however. + +if test -n "${CONFIG_FILES}" && test -n "${CONFIG_HEADERS}"; then + # Both CONFIG_FILES and CONFIG_HEADERS are non-empty ==> Case 1 + CONFIG_OTHER=${CONFIG_OTHER:-glibtop-config.h} +fi +case "$CONFIG_OTHER" in +*glibtop-config.h*) + echo creating glibtop-config.h + outfile=glibtop-config.h-tmp + cat > $outfile <<\_______EOF +/* glibtop-config.h + * + * This is a generated file. Please modify `configure.in' + */ + +#ifndef GLIBTOP_CONFIG_H +#define GLIBTOP_CONFIG_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ +_______EOF + + did_typedefs=no + + if test x$glibtop_uint64_t != xyes ; then + did_typedefs=yes + cat > $outfile <<\_______EOF + +#undef u_int64_t +typedef u_int64_t unsigned long long int +_______EOF + fi + + if test x$glibtop_int64_t != xyes ; then + did_typedefs=yes + cat > $outfile <<\_______EOF + +#undef int64_t +typedef int64_t signed long long int +_______EOF + fi + + if test x$did_typedefs = xyes ; then + cat >>$outfile <<_______EOF + +/* + * NOTE: If your application checks for `u_int64_t' or `int64_t' in its own + * config.h, you must not include it after any of the LibGTop headers. + */ +_______EOF + fi + + cat >>$outfile <<_______EOF + +/* Define if we need the LibGTop server. */ +_______EOF + + if test x$glibtop_need_libgtop = xyes ; then + echo '#define NEED_LIBGTOP 1' >> $outfile + else + echo '#undef NEED_LIBGTOP' >> $outfile + fi + + cat >>$outfile <<_______EOF + +/* Define if LibGTop has support for multiple processors. */ +_______EOF + + if test x$glibtop_have_smp = xyes ; then + echo '#define HAVE_LIBGTOP_SMP 1' >> $outfile + else + echo '#undef HAVE_LIBGTOP_SMP' >> $outfile + fi + + cat >>$outfile <<_______EOF + +/* LibGTop major, minor and micro version. */ +#define LIBGTOP_MAJOR_VERSION $libgtop_major_version +#define LIBGTOP_MINOR_VERSION $libgtop_minor_version +#define LIBGTOP_MICRO_VERSION $libgtop_micro_version + +/* LibGTop version and numerical version code ("1.234.567" -> 1234567). */ +#define LIBGTOP_VERSION "$libgtop_version" +#define LIBGTOP_VERSION_CODE $libgtop_version_code + +/* LibGTop server version, increased each time the protocol changes. */ +#define LIBGTOP_SERVER_VERSION $libgtop_server_version + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* GLIBCONFIG_H */ +_______EOF + + if cmp -s $outfile glibtop-config.h; then + echo glibtop-config.h is unchanged + rm -f $outfile + else + mv $outfile glibtop-config.h + fi ;; +esac +],[ +glibtop_uint64_t=$ac_cv_type_u_int64_t +glibtop_int64_t=$ac_cv_type_int64_t +libgtop_major_version=$LIBGTOP_MAJOR_VERSION +libgtop_minor_version=$LIBGTOP_MINOR_VERSION +libgtop_micro_version=$LIBGTOP_MICRO_VERSION +libgtop_version_code=$LIBGTOP_VERSION_CODE +libgtop_server_version=$LIBGTOP_SERVER_VERSION +libgtop_version=$LIBGTOP_VERSION +glibtop_need_libgtop=$libgtop_need_server +glibtop_have_smp=$libgtop_smp +]) + + AC_OUTPUT([ Makefile libgtop.spec diff --git a/glibtop.h b/glibtop.h index 8ccadbbd..a4d652ef 100644 --- a/glibtop.h +++ b/glibtop.h @@ -24,6 +24,10 @@ #ifndef __GLIBTOP_H__ #define __GLIBTOP_H__ +#ifndef _IN_LIBGTOP +#include +#endif + #include #include diff --git a/libgtop-config.in b/libgtop-config.in index cbd3055a..9f1904f7 100644 --- a/libgtop-config.in +++ b/libgtop-config.in @@ -1,7 +1,7 @@ #!/bin/sh usage="\ - Usage: libgtop-config [--version] [--config] [--features-def-file]" +Usage: libgtop-config [--version] [--config] [--features-def-file] [--cflags] [--libs] [--extra-libs]" config_file="@LIBGTOP_LIBDIR@/libgtopConf.sh" . $config_file @@ -29,6 +29,15 @@ while test $# -gt 0; do --features-def-file) echo $features_def_file ;; + --cflags) + echo $LIBGTOP_INCS + ;; + --libs) + echo $LIBGTOP_LIBS + ;; + --extra-libs) + echo $LIBGTOP_EXTRA_LIBS + ;; *) echo "${usage}" 1>&2 exit 1