dnl dnl $Id$ dnl AC_INIT(xosview.1) CF_TOP_SRCDIR AC_CONFIG_AUX_DIR(config) AC_CANONICAL_HOST AC_PROG_CXX ICE_CXX_BOOL ICE_CXX_LONG_LONG AC_PATH_X CXXFLAGS="$CXXFLAGS -I$x_includes" case $host_os in linux*) LIBS="-L$x_libraries $LIBS" ELF_LINK_FLAGS="" ;; *) LIBS="-L$x_libraries -R$x_libraries $LIBS" ELF_LINK_FLAGS="-Wl,-R$x_libraries" ;; esac dnl AC_PREFIX_DEFAULT(/usr/X11) dnl No longer needed with our dnl x_includes magic in Makefile.top.in. dnl Check for /usr/X11R6. If it exists, make that the default prefix. dnl Otherwise, use /usr/X11. I believe most sane places have /usr/X11R6. dnl dnl This is _very_ ugly. First, we set it to /usr/X11, and then dnl if /usr/X11R6 exists, we change ac_default_prefix BEHIND dnl autoconf's BACK! AC_PREFIX_DEFAULT(/usr/X11) dnl For Solaris, simply test for it being readable, and not dnl merely existence. if test -r /usr/X11R6 ; then dnl echo "Using /usr/X11R6 as default base for install." ac_default_prefix=/usr/X11R6 fi dnl Ack. It is needed again, after all. By default, we dnl want to stuff things into /usr/X11. If we don't specify this, dnl configure will shove things into /usr/local by default. dnl AC_PREFIX_PROGRAM(X) AC_SUBST(x_includes) AC_SUBST(x_libraries) AC_PROG_INSTALL AC_PROG_AWK AC_PROG_RANLIB dnl dnl Add an option which will enable or disable automatic dependencies. dnl AC_ARG_ENABLE([auto-depend], [ --enable-auto-depend enable automatic dependencies], CPP_DEP="" dnl Check to see if we are using a gcc which dnl can make dependencies as a side effect of compilation. MY_CXX_SWITCH([[-Wp,-MD,depfile]]) rm -f depfile if test "$my_cxx_switch" = "yes" then CPP_DEP=['-Wp,-MD,.$@.d'] fi if test "$enableval" = "no" then AUTODEPEND="" AUTODEPRULE='\ ## Autodepend rule defaults to disabled.\ #-include Makefile.GNU.autodep' AUTODEPRULE_SUBDIR='\ ## Autodepend rule defaults to disabled.\ #-include ../Makefile.GNU.autodep' echo "disabled automatic dependencies" else AUTODEPEND='-include $(DEPFILES)' if test "$my_cxx_switch" = "no" then AUTODEPRULE='-include Makefile.GNU.autodep' AUTODEPRULE_SUBDIR='-include ../Makefile.GNU.autodep' echo "enabled automatic dependencies" else AUTODEPRULE="" AUTODEPRULE_SUBDIR="" echo "enabled automatic dependencies" fi fi , AUTODEPEND= AUTODEPRULE='\ ## Autodepend rule defaults to disabled.\ #-include Makefile.GNU.autodep' AUTODEPRULE_SUBDIR='\ ## Autodepend rule defaults to disabled.\ #-include ../Makefile.GNU.autodep' echo "disabled automatic dependencies by default" ) AC_SUBST(AUTODEPRULE) AC_SUBST(AUTODEPRULE_SUBDIR) AC_SUBST(AUTODEPEND) AC_SUBST(CPP_DEP) AC_CHECK_FUNCS(snprintf) AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_CHECK_HEADERS([iostream]) AC_CHECK_HEADERS([fstream]) AC_LANG_RESTORE CPPFLAGS='-I /usr/X11R6/include' AC_CHECK_HEADER(X11/xpm.h, AC_CHECK_LIB(Xpm, XpmCreateImageFromData, AC_DEFINE(HAVE_XPM) XPMLIB=-lXpm,, -lX11)) dnl For FreeBSD, see if libdevstat exists. case $host_os in freebsd*) AC_CHECK_LIB(devstat, main, AC_DEFINE(HAVE_DEVSTAT) DEVSTATLIB=-ldevstat) ;; esac dnl dnl Call each ports macro so that it can set up its own dnl options / configuration. dnl case $host_os in linux*) AC_XOSV_LINUX AC_GCC_EXTRA_CXXFLAGS host_dir=linux host_os=linux ;; ## Check for known versions of NetBSD... dnl Notice that we need to use [] to 'quote' the brackets -- dnl according to GNU m4 and autoconf, [ and ] are the dnl quote characters. dnl This check is ugly. Maybe it should be hidden away in aclocal? dnl bgrayson 9/96 netbsd1.[[0123456]]*|netbsdelf1.[[56]]*) ## Pull in NetBSD stuff: set of host_os, EXTRALIBS, INSTALL_ARGS, etc. AC_XOSV_NETBSD AC_GCC_EXTRA_CXXFLAGS ## Check if the network interface supports 64-bit counters. This ## support was committed around 11/19/1999, for 1.4P. if test $host_os_full '>' netbsd1.4O -o $host_os_full '>' netbsdelf1.4O ; then AC_DEFINE(NETBSD_64BIT_IFACE_CTRS) fi ## We'll assume the existence of UVM now -- it's been around a long time. AC_DEFINE(UVM) host_dir=bsd ;; ## Also check for versions that have not been tested. netbsd*) AC_MSG_WARN([ *************** Warning ***************** xosview has not been tested on $host_os. So far, it is known to work on the following NetBSD versions: netbsd1.0 netbsd1.1 netbsd1.2 netbsd1.3 netbsd1.4 netbsd1.5 / netbsdelf1.5 If it works for version $host_os, please send mail to: bgrayson@netbsd.org If this message is in error, also notify bgrayson -- we're new to autoconf! Thanks! ******************************************* ]); AC_XOSV_NETBSD host_dir=bsd echo host_dir is $host_dir host_os=netbsd ;; freebsd[[0123]]*) AC_XOSV_FREEBSD AC_GCC_EXTRA_CXXFLAGS dnl AC_MSG_WARN([ dnl ]) host_dir=bsd host_os=freebsd ;; freebsd[[4]]*) AC_XOSV_FREEBSD AC_GCC_EXTRA_CXXFLAGS AC_DEFINE(USE_KVM_GETSWAPINFO) dnl AC_MSG_WARN([ dnl ]) host_dir=bsd host_os=freebsd ;; openbsd2.[[0-5]]*) AC_XOSV_OPENBSD AC_GCC_EXTRA_CXXFLAGS host_dir=bsd host_os=openbsd ;; openbsd2.[[6-9]]*) AC_XOSV_OPENBSD cat >> confdefs.h <<\EOF #define HAVE_SWAPCTL 1 EOF ## Also check for the existence of UVM. This is a nasty, ## complicated check. This could be avoided by having the *BSD ## platform-specific Makefiles include on their own. cat > confmkfile <<\EOF .include all: .if defined(UVM) && ${UVM:U} == YES @echo UVMyes .endif EOF uvmstring=`make -f confmkfile` rm -f confmkfile if test ! x$uvmstring = x ; then cat >> confdefs.h <<\EOF #define UVM 1 EOF fi AC_GCC_EXTRA_CXXFLAGS host_dir=bsd host_os=openbsd ;; openbsd2.[[6-9]]*) AC_XOSV_OPENBSD cat >> confdefs.h <<\EOF #define HAVE_SWAPCTL 1 EOF ## Also check for the existence of UVM. This is a nasty, ## complicated check. This could be avoided by having the *BSD ## platform-specific Makefiles include on their own. cat > confmkfile <<\EOF .include all: .if defined(UVM) && ${UVM:U} == YES @echo UVMyes .endif EOF uvmstring=`make -f confmkfile` rm -f confmkfile if test ! x$uvmstring = x ; then cat >> confdefs.h <<\EOF #define UVM 1 EOF fi AC_GCC_EXTRA_CXXFLAGS host_dir=bsd host_os=openbsd ;; openbsd*) AC_XOSV_OPENBSD BTRYMETER=btrymeter.o cat >> confdefs.h <<\EOF #define HAVE_SWAPCTL 1 #define UVM 1 #define HAVE_BATTERY_METER 1 #define APM_BATT_ABSENT APM_BATTERY_ABSENT EOF AC_GCC_EXTRA_CXXFLAGS host_dir=bsd host_os=openbsd ;; bsdi*) AC_XOSV_BSDI AC_GCC_EXTRA_CXXFLAGS host_dir=bsd host_os=bsdi ;; hpux*) AC_XOSV_HPUX AC_GCC_EXTRA_CXXFLAGS host_dir=hpux host_os=hpux ;; irix6.5*) AC_XOSV_IRIX65 EXTRA_CXXFLAGS=-O2 host_dir=irix65 host_os=irix65 ;; solaris2*) AC_GCC_EXTRA_CXXFLAGS EXTRALIBS="-R$x_libraries -lsocket -lnsl -lkstat $XPMLIB" host_dir=sunos5 host_os=sunos5 ;; *) AC_MSG_ERROR([xosview has not been ported to $host_os :(. Sorry.]) ;; esac dnl dnl Now check all the NetBSD ones for the new swapctl() function. dnl I don't know what the status of this is for OpenBSD folks. Anyone? dnl Also look for battery-meter support. dnl case $host_os in netbsd) AC_CHECK_FUNCS(swapctl) # Only enable the battery meter if it appears we support it. if test -e /dev/apm ; then BTRYMETER=btrymeter.o AC_DEFINE(HAVE_BATTERY_METER) fi ;; esac dnl dnl The netbsd and linux ports modify these variables which dnl are exported by AC_OUTPUT. dnl AC_SUBST(BTRYMETER) AC_SUBST(EXTRA_CXXFLAGS) AC_SUBST(EXTRALIBS) AC_SUBST(ELF_LINK_FLAGS) AC_SUBST(INSTALL_ARGS) AC_SUBST(MEMSTAT) AC_SUBST(LVERSION) AC_SUBST(USE_MOD_VERSIONS) dnl Check for usleep(). Currently, only HP-UX doesn't have it. AC_CHECK_FUNCS(usleep) # # On hpux10 both x_includes and x_libraries seem to be set to "" # This causes compiler options like '-I' and '-L', which break # the build. So, we avoid empty strings here. # if test -z "$x_includes" then x_includes=. fi if test -z "$x_libraries" then x_libraries=. fi AC_SUBST(host_dir) AC_SUBST(NetMeter_Default_Setting) AC_OUTPUT(\ Makefile:config/Makefile.top.in \ $host_dir/Makefile:config/Makefile.$host_dir.in \ Makefile.config:config/Makefile.config.in \ Makefile.GNU.autodep:config/Makefile.GNU.autodep.in \ Xdefaults:Xdefaults.in \ $EXTRA_OUT_FILES)