dnl dnl Configure script for LibGTop dnl AC_INIT(copyright.txt) AM_CONFIG_HEADER(config.h) AC_CANONICAL_SYSTEM dnl This is required at several places AC_CHECK_PROG(ac_dc_found, dc, yes, no) if test x$ac_dc_found != xyes ; then AC_MSG_ERROR([ *** The "dc" utility was not found on your system. *** *** When using RedHat Linux, you need to install the "bc" package. *** *** It is now part of the "bc" package, so you should look at *** ftp://ftp.gnu.org/pub/gnu/bc/ if you want to compile it yourself. *** *** Other systems and distributions may also have it in their "bc" package, *** so if there's no "dc" one, please look for "bc". ***]) fi . $srcdir/LIBGTOP-VERSION AM_INIT_AUTOMAKE($PACKAGE, $VERSION) AC_SUBST(LIBGTOP_MAJOR_VERSION) AC_SUBST(LIBGTOP_MINOR_VERSION) AC_SUBST(LIBGTOP_MICRO_VERSION) AC_SUBST(LIBGTOP_INTERFACE_AGE) AC_SUBST(LIBGTOP_BINARY_AGE) AC_SUBST(LIBGTOP_SERVER_VERSION) AC_SUBST(LIBGTOP_VERSION) AC_SUBST(LIBGTOP_VERSION_CODE) # libtool versioning LT_RELEASE=$LIBGTOP_MAJOR_VERSION.$LIBGTOP_MINOR_VERSION LT_CURRENT=`expr $LIBGTOP_MICRO_VERSION - $LIBGTOP_INTERFACE_AGE` LT_REVISION=$LIBGTOP_INTERFACE_AGE LT_AGE=`expr $LIBGTOP_BINARY_AGE - $LIBGTOP_INTERFACE_AGE` LT_VERSION_INFO='-version-info ${LT_CURRENT}:${LT_REVISION}:${LT_AGE} -release ${LT_RELEASE}' AC_SUBST(LT_VERSION_INFO) AC_SUBST(LT_RELEASE) AC_SUBST(LT_CURRENT) AC_SUBST(LT_REVISION) AC_SUBST(LT_AGE) AM_ACLOCAL_INCLUDE(. macros) AC_ISC_POSIX AC_PROG_CC AC_STDC_HEADERS AC_ARG_PROGRAM dnl We need this at some places. libgtop_top_builddir=`pwd` AC_SUBST(libgtop_top_builddir) dnl We don't use `AC_PROG_AWK' since it checks for mawk first which dnl does not work for libgtop. AC_CHECK_PROGS(AWK, gawk awk, ) test -z "$AWK" && AC_MSG_ERROR([Sorry, you need a working awk interpreter.]) dnl Most people should have a working perl interpreter on their system AC_CHECK_PROGS(PERL, perl5 perl) test -z "$PERL" && AC_MSG_ERROR([You need to have a working perl interpreter.]) AC_CHECK_TOOL(CC,gcc) AC_CHECK_TOOL(RANLIB,ranlib) AC_CHECK_TOOL(AS,as) AC_CHECK_TOOL(AR,ar) AC_CHECK_TOOL(NM,nm) NM=`which $NM` export CC CXX RANLIB LD AS AR NM AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET export cross_compiling AM_PROG_LIBTOOL dnl Let the user enable compiler warnings GNOME_COMPILE_WARNINGS GNOME_INIT_HOOK(gnome_found=yes) if test "x$gnome_found" != xyes; then if test "x$want_gnome" != xno ; then AC_MSG_ERROR([ *** GNOME was not found on this system. *** *** If you want to use LibGTop without GNOME, you need *** to give configure the --without-gnome parameter. ]) else AC_DEFINE(WITHOUT_GNOME) fi GNOME_SUPPORT_CHECKS else if test "x$want_gnome" != xno ; then AM_CONDITIONAL(BUILD_GNOME_SUPPORT, false) else GNOME_SUPPORT_CHECKS fi fi AM_CONDITIONAL(CROSS_COMPILING, test "x$cross_compiling" = xyes) GNOME_LIBGTOP_SYSDEPS GNOME_LIBGTOP_TYPES AC_ARG_WITH(libgtop-inodedb, [ --with-libgtop-inodedb Build the inodedb stuff (default=no)], [build_inodedb="$withval"], [build_inodedb=no]) LIBGTOP_EXTRA_LIBS= if test x$build_inodedb = xyes ; then AC_CHECK_LIB(gdbm, gdbm_open, LIBGTOP_EXTRA_LIBS='-lgdbm', build_inodedb=no) fi AM_CONDITIONAL(INODEDB, test x$build_inodedb = xyes) if test x$build_inodedb = xyes ; then AC_DEFINE(GLIBTOP_INODEDB) fi AC_DEFINE(GLIBTOP_NAMES) AM_CONDITIONAL(ENABLE_STATIC, test x$enable_static = xyes) AM_CONDITIONAL(ENABLE_SHARED, test x$enable_static = xyes) AM_PROG_LIBTOOL AM_PATH_GLIB(1.2.0,,AC_MSG_ERROR(GLIB >= 1.2.0 is required for LibGTop)) dnl You need to uncomment the following line if you want to use dnl libGTop without Gnome. dnl GNOME_SUPPORT_CHECKS dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE AC_TYPE_OFF_T AC_TYPE_PID_T AC_TYPE_SIZE_T AC_STRUCT_ST_RDEV AC_HEADER_TIME AC_STRUCT_TM AC_TYPE_UID_T dnl For SunOS AC_CHECK_TYPE(ssize_t, int) AC_CHECK_HEADERS(memory.h) AC_CHECK_HEADERS(string.h strings.h, break) AC_REPLACE_FUNCS(strerror) dnl dlopen() and dlsym() DL_LIB= AC_CHECK_FUNCS(dlopen,,[ AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", [ AC_CHECK_LIB(dld, shl_load, DL_LIB="-ldld", [ AC_CHECK_FUNCS(dlopen, DL_LIB="", DL_LIB="") ]) ]) ]) oLIBS="$LIBS" LIBS="$LIBS $DL_LIB" AC_CHECK_FUNCS(dlerror,,) LIBS="$oLIBS" AC_SUBST(DL_LIB) dnl Solaris AC_CHECK_LIB(kstat, kstat_open) AC_CHECK_FUNCS(getloadavg swapctl) AC_CHECK_HEADERS(procfs.h sys/procfs.h, break) dnl Some versions of Solaris require -lelf for -lkvm AC_CHECK_LIB(kvm, kvm_open,[ LIBS="-lkvm $LIBS" ],[AC_MSG_CHECKING(for kvm_open in -lkvm with -lelf) AC_CACHE_VAL(ac_cv_lib_kvm_with_elf, [ac_save_LIBS="$LIBS" LIBS="-lkvm -lelf $LIBS" AC_TRY_LINK([char kvm_open();], [kvm_open()], ac_cv_lib_kvm_with_elf=yes, ac_cv_lib_kvm_with_elf=no) LIBS="$ac_save_LIBS" ]) if test "$ac_cv_lib_kvm_with_elf" = "yes"; then AC_MSG_RESULT(yes) LIBS="-lkvm -lelf $LIBS" else AC_MSG_RESULT(no) fi ]) dnl For DEC OSF1 AC_CHECK_LIB(mach, vm_statistics) dnl For some broken libc5 systems (Debian 1.3) saved_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -D_GNU_SOURCE" GCC_NEED_DECLARATION(program_invocation_name, [ #include #include #include #include ]) CFLAGS=$saved_CFLAGS dnl Check for Internet sockets. AC_CHECK_FUNC(socket, [AC_CHECK_HEADER(netinet/in.h, [AC_CHECK_HEADER(arpa/inet.h, [ AC_DEFINE(HAVE_SOCKETS) AC_MSG_CHECKING("for sun_len member in struct sockaddr_un") AC_TRY_LINK([ #include #include #include ], [static struct sockaddr_un x; x.sun_len = 1;], [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOCKADDR_SUN_LEN)], [AC_MSG_RESULT(no)])])])]) dnl Checks for library functions. AC_FUNC_ALLOCA AC_FUNC_MMAP AC_TYPE_SIGNAL AC_FUNC_STRFTIME AC_CHECK_FUNCS(getcwd gettimeofday getwd putenv strdup strtoul uname) dnl ## all 'es_??' are only needed for format numbers different of 'es' ALL_LINGUAS="da de es es_DO es_GT es_HN es_MX es_PA es_PE es_SV fi fr gl ja ko nl no pl pt_BR sv tr" AM_GNOME_GETTEXT AC_PATH_XTRA dnl For Solaris dnl Please don't move this before AC_PATH_XTRA AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)]) AC_CHECK_FUNC(connect,,[AC_CHECK_LIB(socket,connect)]) AC_CHECK_FUNC(inet_aton,,[AC_CHECK_LIB(resolv,inet_aton)]) dnl The construct foo=`echo $w1 $w2 $w3` fails on some systems if $w1 = -e or -n dnl So we use the following instead. dnl XE_SPACE(var, words) define([XE_SPACE],[ T="" for W in $2; do if test -z "$T"; then T="$W"; else T="$T $W"; fi; done $1="$T" ])dnl dnl Autodetect Xauth dnl -lXau is only used by gnuclient, so use a special variable for Xauth X libs saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $X_CFLAGS" test -z "$with_xauth" && { AC_CHECK_HEADER(X11/Xauth.h, ,with_xauth=no) } test -z "$with_xauth" && { AC_CHECK_LIB(Xau, XauGetAuthByAddr,[:],with_xauth=no, $X_LIBS) } test -z "$with_xauth" && with_xauth=yes if test "$with_xauth" = "yes"; then AC_DEFINE(HAVE_XAUTH) XE_SPACE(libs_xauth, $X_LIBS -lXau) fi CPPFLAGS="$saved_CPPFLAGS" AC_SUBST(libs_xauth) dnl For diskusage stuff GNOME_FILEUTILS_CHECKS dnl Debugging AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]], libgtop_enable_debug=yes, libgtop_enable_debug=no) AC_ARG_ENABLE(fatal-warnings, [ --enable-fatal-warnings make all warnings fatal [debug=no]],AC_DEFINE(LIBGTOP_FATAL_WARNINGS),) AC_ARG_ENABLE(glib-malloc, [ --enable-glib-malloc use glib's malloc [default=auto]], libgtop_enable_glib_malloc=yes,) if test "x$libgtop_enable_glib_malloc" != xyes ; then if test "x$libgtop_enable_debug" = xyes ; then libgtop_enable_glib_malloc=yes else libgtop_enable_glib_malloc=no fi fi if test "x$libgtop_enable_glib_malloc" = xyes ; then AC_DEFINE(LIBGTOP_USE_GLIB_MALLOC) fi if test "x$libgtop_enable_debug" = xyes ; then AC_DEFINE(LIBGTOP_ENABLE_DEBUG) fi if test "x$gnome_found" = xyes ; then LIBSUPPORT="$GNOME_LIBDIR -lgnomesupport" SUPPORTINCS="$GNOME_INCLUDEDIR" else LIBSUPPORT='$(top_builddir)/support/libgnomesupport.la' SUPPORTINCS='-DNEED_GNOMESUPPORT_H -I$(top_builddir)/support -I$(top_srcdir)/support' fi dnl Some ugly hack; if '-lgnomesupport' is part of $GNOME_LIBS, dnl we include it here. case "$GNOME_LIBS" in '*-lgnomesupport*' ) LIBSUPPORT="$GNOME_LIBDIR -lgnomesupport" SUPPORTINCS="$GNOME_INCLUDEDIR" ;; esac AC_SUBST(LIBSUPPORT) AC_SUBST(SUPPORTINCS) dnl These definitions are expanded in make. LIBGTOP_LIBS='-L$(libdir)' LIBGTOP_INCS='-I$(includedir) -I$(pkglibdir)/include' if test x$libgtop_use_machine_h = xyes ; then LIBGTOP_INCS="$LIBGTOP_INCS -DHAVE_GLIBTOP_MACHINE_H" fi if test x$build_inodedb = xyes ; then LIBGTOP_INCS="$LIBGTOP_INCS -DGLIBTOP_INODEDB" fi if test x$libgtop_smp = xyes ; then LIBGTOP_INCS="$LIBGTOP_INCS -DHAVE_LIBGTOP_SMP" fi if test x$libgtop_have_sysinfo = xyes ; then LIBGTOP_INCS="$LIBGTOP_INCS -DHAVE_LIBGTOP_SYSINFO" fi LIBGTOP_INCS="$LIBGTOP_INCS $SUPPORTINCS $GLIB_CFLAGS" LIBGTOP_BINDIR='$(bindir)' LIBGTOP_SERVER='$(bindir)/libgtop_server' sysdeps_dir="$libgtop_sysdeps_dir" AC_SUBST(sysdeps_dir) if test -z "$LIBGTOP_EXTRA_LIBS" ; then LIBGTOP_EXTRA_LIBS="$libs_xauth" else LIBGTOP_EXTRA_LIBS="$LIBGTOP_EXTRA_LIBS $libs_xauth" fi LIBGTOP_EXTRA_LIBS="$LIBGTOP_EXTRA_LIBS $GLIB_LIBS" LIBGTOP_LIBS="$LIBGTOP_LIBS -lgtop_sysdeps -lgtop_common -lgtop -lgtop_backend_server -lgtop_backend_sysdeps" LIBGTOP_NAMES_LIBS="$LIBGTOP_LIBS -lgtop_names" LIBGTOP_LIBS="$LIBGTOP_LIBS" LIBGTOP_NAMES_LIBS="$LIBGTOP_NAMES_LIBS" LIBGTOP_NAMES_INCS="$LIBGTOP_INCS -DGLIBTOP_NAMES" machine_incs="-I\$(top_srcdir)/sysdeps/$sysdeps_dir" AC_SUBST(machine_incs) INCLUDES="-D_IN_LIBGTOP -D_GNU_SOURCE -DGLIBTOP_NAMES -I\$(top_builddir) -I\$(top_srcdir) -I\$(top_srcdir)/sysdeps/$sysdeps_dir -I\$(top_srcdir)/include -I\$(top_srcdir)/intl $SUPPORTINCS $GLIB_CFLAGS $CFLAGS $X_CFLAGS "'-DGTOPLOCALEDIR=\"$(datadir)/locale\" -DLIBGTOP_VERSION=\"'"$LIBGTOP_VERSION"'\" -DLIBGTOP_SERVER_VERSION=\"'"$LIBGTOP_SERVER_VERSION"'\" -DLIBGTOP_VERSION_CODE='$LIBGTOP_VERSION_CODE' -DLIBGTOP_SERVER=\"'"$LIBGTOP_SERVER"'\"' AC_SUBST(INCLUDES) AC_SUBST(LIBGTOP_EXTRA_LIBS) AC_SUBST(LIBGTOP_LIBS) AC_SUBST(LIBGTOP_INCS) AC_SUBST(LIBGTOP_NAMES_LIBS) AC_SUBST(LIBGTOP_NAMES_INCS) AC_SUBST(LIBGTOP_BINDIR) AC_SUBST(LIBGTOP_SERVER) if test x$libgtop_need_server = xyes ; then sysdeps_suid_lib="\$(top_builddir)/sysdeps/\$(sysdeps_dir)/libgtop_sysdeps_suid.la" server_programs='libgtop_server' else sysdeps_suid_lib= server_programs= 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 #ifndef u_int64_t typedef unsigned long long int u_int64_t; #endif _______EOF fi if test x$glibtop_int64_t != xyes ; then did_typedefs=yes cat >> $outfile <<\_______EOF #ifndef int64_t typedef signed long long int int64_t; #endif _______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 po/Makefile.in intl/Makefile misc/Makefile include/Makefile include/glibtop/Makefile sysdeps/Makefile sysdeps/common/Makefile sysdeps/names/Makefile sysdeps/stub/Makefile sysdeps/stub_suid/Makefile sysdeps/sun4/Makefile sysdeps/osf1/Makefile sysdeps/linux/Makefile sysdeps/kernel/Makefile sysdeps/freebsd/Makefile sysdeps/solaris/Makefile src/Makefile src/daemon/Makefile src/inodedb/Makefile scripts/Makefile backends/Makefile backends/server/Makefile backends/sysdeps/Makefile lib/Makefile doc/Makefile support/Makefile macros/Makefile])