X-Git-Url: http://git.annexia.org/?p=virt-top.git;a=blobdiff_plain;f=configure.ac;h=b3f7addf24bcf71903bcda09cbb9d4bbfe8cfd59;hp=1d72e758f3b60193688c8d499bca5f594a5b0181;hb=HEAD;hpb=8a2211eb0976db33a6795ee9933bd7e7400c933c diff --git a/configure.ac b/configure.ac index 1d72e75..840eba2 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ -# ocaml-libvirt -# Copyright (C) 2007 Red Hat Inc., Richard W.M. Jones +# virt-top +# Copyright (C) 2007-2021 Red Hat Inc., Richard W.M. Jones # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -17,319 +17,158 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT(ocaml-libvirt,0.4.0.3) +AC_INIT([virt-top],[1.1.1]) +AM_INIT_AUTOMAKE([foreign]) +AC_CONFIG_MACRO_DIR([m4]) -dnl Check for basic C environment. -AC_PROG_CC AC_PROG_INSTALL -AC_PROG_CPP - -AC_C_PROTOTYPES -test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant) - -AC_PROG_CC_C_O - -dnl Select some C flags based on the host type. -AC_CANONICAL_HOST -DEBUG="-g" -WARNINGS="-Wall -Werror" -CFLAGS_FPIC="-fPIC" -WIN32=no -case "$host" in - *-*-mingw*) - WARNINGS="$WARNINGS -Wno-unused" - CFLAGS_FPIC="" - WIN32=yes -esac -AC_SUBST(DEBUG) -AC_SUBST(WARNINGS) -AC_SUBST(CFLAGS_FPIC) -AC_SUBST(WIN32) +dnl Enable GNU stuff. +AC_USE_SYSTEM_EXTENSIONS -dnl Check for libvirt development environment. -AC_ARG_WITH(libvirt, - AC_HELP_STRING([--with-libvirt=PATH],[Set path to installed libvirt]), - [if test "x$withval" != "x"; then - CFLAGS="$CFLAGS -I$withval/include" - LDFLAGS="$LDFLAGS -L$withval/lib" - fi - ]) -AC_CHECK_LIB(virt,virConnectOpen, - [], - AC_MSG_ERROR([You must install libvirt library])) -AC_CHECK_HEADER([libvirt/libvirt.h], - [], - AC_MSG_ERROR([You must install libvirt development package])) - -dnl We also use -AC_CHECK_HEADER([libvirt/virterror.h], - [], - AC_MSG_ERROR([You must install libvirt development package])) - -dnl Check for libvirt >= 0.2.1 (our minimum supported version). -dnl See: http://libvirt.org/hvsupport.html -AC_CHECK_FUNC(virConnectGetCapabilities, - [], - AC_MSG_ERROR([You must have libvirt >= 0.2.1])) - -dnl Check for optional libvirt functions added since 0.2.1. -dnl See: http://libvirt.org/hvsupport.html -AC_CHECK_FUNCS([virConnectGetHostname \ - virConnectGetURI \ - virDomainBlockStats \ - virDomainGetSchedulerParameters \ - virDomainGetSchedulerType \ - virDomainInterfaceStats \ - virDomainMigrate \ - virDomainSetSchedulerParameters \ - virNodeGetFreeMemory \ - virNodeGetCellsFreeMemory \ - virJobGetInfo \ - virJobGetDomain \ - virJobGetNetwork \ - virJobCancel \ - virJobFree \ - virDomainCreateLinuxJob \ - virDomainSaveJob \ - virDomainRestoreJob \ - virDomainCoreDumpJob \ - virDomainCreateJob \ - virNetworkCreateXMLJob \ - virNetworkCreateJob \ - virStoragePoolGetConnect \ - virConnectNumOfStoragePools \ - virConnectListStoragePools \ - virConnectNumOfDefinedStoragePools \ - virConnectListDefinedStoragePools \ - virConnectDiscoverStoragePools \ - virStoragePoolLookupByName \ - virStoragePoolLookupByUUID \ - virStoragePoolLookupByUUIDString \ - virStoragePoolLookupByVolume \ - virStoragePoolCreateXML \ - virStoragePoolDefineXML \ - virStoragePoolUndefine \ - virStoragePoolCreate \ - virStoragePoolDestroy \ - virStoragePoolShutdown \ - virStoragePoolFree \ - virStoragePoolRefresh \ - virStoragePoolGetName \ - virStoragePoolGetUUID \ - virStoragePoolGetUUIDString \ - virStoragePoolGetInfo \ - virStoragePoolGetXMLDesc \ - virStoragePoolGetAutostart \ - virStoragePoolSetAutostart \ - virStoragePoolNumOfVolumes \ - virStoragePoolListVolumes \ - virStorageVolLookupByName \ - virStorageVolLookupByKey \ - virStorageVolLookupByPath \ - virStorageVolGetName \ - virStorageVolGetKey \ - virStorageVolCreateXML \ - virStorageVolDestroy \ - virStorageVolFree \ - virStorageVolGetInfo \ - virStorageVolGetXMLDesc \ - virStorageVolGetPath \ -]) +dnl Check for basic C environment. +AC_PROG_CC_STDC +AC_PROG_CPP +AC_C_PROTOTYPES +test "x$U" != "x" && AC_MSG_ERROR([Compiler not ANSI compliant]) +AM_PROG_CC_C_O -dnl Check for optional types added since 0.2.1. -AC_CHECK_TYPES([virJobPtr, virStoragePoolPtr, virStorageVolPtr],,, - [#include ]) +dnl Check support for 64 bit file offsets. +AC_SYS_LARGEFILE -dnl Check for optional ncurses. -AC_CHECK_LIB(ncurses,initscr) +dnl Check for libxml2 (required). +PKG_CHECK_MODULES([LIBXML2], [libxml-2.0]) dnl Check for basic OCaml environment & findlib. -dnl Note that findlib is not necessary, but things will work better -dnl if it is present. AC_PROG_OCAML -AC_PROG_FINDLIB - -if test "x$OCAMLFIND" != "x"; then - dnl Use ocamlfind to find the required packages ... - - dnl Check for required OCaml packages. - AC_CHECK_OCAML_PKG(unix) - if test "x$pkg_unix" != "xyes"; then - AC_MSG_ERROR([Cannot find required OCaml package 'unix']) - fi +if test "$OCAMLC" = "no"; then + AC_MSG_ERROR([You must install the OCaml compiler]) +fi - dnl Check for optional OCaml packages. - AC_CHECK_OCAML_PKG(extlib) - AC_CHECK_OCAML_PKG(lablgtk2) - AC_CHECK_OCAML_PKG(curses) - AC_CHECK_OCAML_PKG(gettext) - AC_CHECK_OCAML_PKG(xml-light) - AC_CHECK_OCAML_PKG(csv) - AC_CHECK_OCAML_PKG(dbus) +AM_CONDITIONAL([HAVE_OCAMLOPT],[test "$OCAMLBEST" = "opt"]) - dnl Need to check which version of calendar is installed. - AC_CHECK_OCAML_MODULE(calendar,pkg_calendar2,CalendarLib.Date,[+calendar]) - if test "x$pkg_calendar2" = "xno"; then - AC_CHECK_OCAML_PKG(calendar) - fi +AC_PROG_FINDLIB +if test "x$OCAMLFIND" = "xno"; then + AC_MSG_ERROR([OCaml findlib is required]) +fi - AC_SUBST(pkg_unix) - AC_SUBST(pkg_extlib) - AC_SUBST(pkg_lablgtk2) - AC_SUBST(pkg_curses) - AC_SUBST(pkg_gettext) - AC_SUBST(pkg_xml_light) - AC_SUBST(pkg_csv) - AC_SUBST(pkg_dbus) - AC_SUBST(pkg_calendar) - AC_SUBST(pkg_calendar2) -else - dnl Use a basic module test if there is no findlib ... +dnl Use ocamlfind to find the required packages ... - dnl Check for required OCaml modules. - AC_CHECK_OCAML_MODULE(unix,pkg_unix,Unix,[.]) - if test "x$pkg_unix" = "xno"; then - AC_MSG_ERROR([Cannot find required OCaml package 'unix']) - fi - - dnl Check for optional OCaml modules. - AC_CHECK_OCAML_MODULE(extlib,pkg_extlib,ExtString,[+extlib]) - AC_CHECK_OCAML_MODULE(lablgtk2,pkg_lablgtk2,GMain,[+lablgtk2]) - AC_CHECK_OCAML_MODULE(curses,pkg_curses,Curses,[+curses]) - AC_CHECK_OCAML_MODULE(gettext,pkg_gettext,Gettext,[+gettext]) dnl XXX - AC_CHECK_OCAML_MODULE(xml-light,pkg_xml_light,Xml,[+xml-light]) - AC_CHECK_OCAML_MODULE(csv,pkg_csv,Csv,[+csv]) - AC_CHECK_OCAML_MODULE(dbus,pkg_dbus,DBus,[+dbus]) - dnl XXX Version check - see above. - AC_CHECK_OCAML_MODULE(calendar,pkg_calendar,Calendar,[+calendar]) +dnl Check for required OCaml packages. +AC_CHECK_OCAML_PKG(unix) +if test "x$OCAML_PKG_unix" = "xno"; then + AC_MSG_ERROR([Cannot find required OCaml package 'unix']) fi -dnl Which subpackages (== subdirs) will we build? -subdirs="libvirt examples mlvirsh" -if test "x$pkg_lablgtk2" != "xno"; then - subdirs="$subdirs virt-ctrl" -fi -if test "x$pkg_extlib" != "xno" -a "x$pkg_curses" != "xno"; then - subdirs="$subdirs virt-top" -fi -if test "x$pkg_extlib" != "xno" -a "x$pkg_xml_light" != "xno"; then - subdirs="$subdirs virt-df" +AC_CHECK_OCAML_PKG(libvirt) +if test "x$OCAML_PKG_libvirt" = "xno"; then + AC_MSG_ERROR([Cannot find required OCaml package 'libvirt']) fi -AC_SUBST(subdirs) - -dnl Check for optional perldoc (for building manual pages). -AC_CHECK_PROG(HAVE_PERLDOC,perldoc,perldoc) - -dnl Check for optional NSIS (for building a Windows installer). -AC_ARG_WITH([nsis], - [AS_HELP_STRING([--with-nsis], - [use NSIS to build a Windows installer])], - [], - [with_nsis=no]) -MAKENSIS= -LIBVIRT_DLL_PATH= -LIBXDR_DLL_PATH= -LIBXML2_DLL_PATH= -GNUTLS_DLL_PATH= -GTK_PATH= -GTK_DLL_PATH= - -[ -msys_to_win_dir () { - eval pushd "\$$1" > /dev/null - eval $1=`pwd -W` - popd > /dev/null -} -] - -if test "x$with_nsis" != "xno"; then - AC_PATH_PROG(MAKENSIS,makensis,[],[$with_nsis:$PATH]) - if test "x$MAKENSIS" = "x"; then - AC_MSG_FAILURE([--with-nsis was given, but could not find MAKENSIS.EXE]) - fi - - # MAKENSIS is set so we will build a rule for making a Windows - # installer. To support this, generate wininstaller.nsis. - saved_IFS=$IFS - IFS=$PATH_SEPARATOR - for d in $PATH; do - IFS=$saved_IFS - echo Checking $d for DLLs ... >&5 - if test -f "$d/libvirt-0.dll"; then - LIBVIRT_DLL_PATH="$d" - fi - if test -f "$d/libxdr.dll"; then - LIBXDR_DLL_PATH="$d" - fi - if test -f "$d/libxml2-2.dll"; then - LIBXML2_DLL_PATH="$d" - fi - if test -f "$d/libgpg-error-0.dll"; then - GNUTLS_DLL_PATH="$d" - fi - if test -f "$d/libgtk-win32-2.0-0.dll"; then - GTK_DLL_PATH="$d" - GTK_PATH="$d/.." - fi - done - IFS=$saved_IFS +AC_CHECK_OCAML_PKG(curses) +if test "x$OCAML_PKG_curses" = "xno"; then + AC_MSG_ERROR([Cannot find required OCaml package 'curses']) +fi - if test "x$LIBVIRT_DLL_PATH" = "x"; then - AC_MSG_FAILURE([cannot find libvirt-0.dll in PATH]) - fi - if test "x$LIBXDR_DLL_PATH" = "x"; then - AC_MSG_FAILURE([cannot find libxdr.dll in PATH]) - fi - if test "x$LIBXML2_DLL_PATH" = "x"; then - AC_MSG_FAILURE([cannot find libxml2-2.dll in PATH]) - fi - if test "x$GNUTLS_DLL_PATH" = "x"; then - AC_MSG_FAILURE([cannot find GnuTLS DLLs in PATH]) - fi - if test "x$GTK_DLL_PATH" = "x"; then - AC_MSG_WARN([cannot find GTK DLLs in PATH]) +dnl Check for optional OCaml packages. +AC_CHECK_OCAML_PKG(calendar) +AC_CHECK_OCAML_PKG(gettext) + +AM_CONDITIONAL([HAVE_PKG_CALENDAR], [test "x$OCAML_PKG_calendar" != "xno"]) +AM_CONDITIONAL([HAVE_PKG_GETTEXT], [test "x$OCAML_PKG_gettext" != "xno"]) + +dnl Check if ocamlc/ocamlopt -runtime-variant _pic works. It was +dnl added in OCaml >= 4.03, but in theory might be disabled by +dnl downstream distros. +OCAML_RUNTIME_VARIANT_PIC_OPTION="" +if test "x$OCAMLC" != "xno"; then + AC_MSG_CHECKING([if OCaml ‘-runtime-variant _pic’ works]) + rm -f conftest.ml contest + echo 'print_endline "hello world"' > conftest.ml + if $OCAMLOPT conftest.ml -runtime-variant _pic -o conftest >&5 2>&5 ; then + AC_MSG_RESULT([yes]) + OCAML_RUNTIME_VARIANT_PIC_OPTION="-runtime-variant _pic" + else + AC_MSG_RESULT([no]) fi + rm -f conftest.ml contest +fi +AC_SUBST([OCAML_RUNTIME_VARIANT_PIC_OPTION]) - # Change the paths to Windows paths. - msys_to_win_dir LIBVIRT_DLL_PATH - msys_to_win_dir LIBXDR_DLL_PATH - msys_to_win_dir LIBXML2_DLL_PATH - msys_to_win_dir GNUTLS_DLL_PATH - if test "x$GTK_DLL_PATH" != "x"; then - msys_to_win_dir GTK_DLL_PATH - msys_to_win_dir GTK_PATH - fi +dnl Check for optional perldoc (for building manual pages). +AC_CHECK_PROG([HAVE_PERLDOC], perldoc, perldoc) +AM_CONDITIONAL([HAVE_PERLDOC], [test "x$HAVE_PERLDOC" = "xperldoc"]) + +dnl Check for recommended ocaml-gettext tool. +AC_CHECK_PROG([OCAML_GETTEXT], ocaml-gettext, ocaml-gettext) +AM_CONDITIONAL([HAVE_OCAML_GETTEXT],[test "x$OCAML_GETTEXT" = "xocaml-gettext"]) + +dnl Check for GNU gettext tools (optional). +AC_CHECK_PROG([XGETTEXT],[xgettext],[xgettext],[no]) +AC_CHECK_PROG([MSGCAT],[msgcat],[msgcat],[no]) +AC_CHECK_PROG([MSGFMT],[msgfmt],[msgfmt],[no]) +AC_CHECK_PROG([MSGMERGE],[msgmerge],[msgmerge],[no]) + +dnl Check they are the GNU gettext tools. +AC_MSG_CHECKING([msgfmt is GNU tool]) +if $MSGFMT --version >/dev/null 2>&1 && $MSGFMT --version | grep -q 'GNU gettext +'; then + msgfmt_is_gnu=yes +else + msgfmt_is_gnu=no +fi +AC_MSG_RESULT([$msgfmt_is_gnu]) +AM_CONDITIONAL([HAVE_GNU_GETTEXT], + [test "x$XGETTEXT" != "xno" && test "x$MSGCAT" != "xno" && test "x$MSGFMT" != "xno" && test "x$MSGMERGE" != "xno" && test "x$msgfmt_is_gnu" != "xno"]) + +dnl Check for gettext. +AM_GNU_GETTEXT([external]) + +dnl Write gettext modules for the programs. +dnl http://www.le-gall.net/sylvain+violaine/documentation/ocaml-gettext/html/reference-manual/ch03s04.html +AC_MSG_NOTICE([creating src/opt_gettext.ml]) +rm -f src/opt_gettext.ml +echo "(* This file is generated automatically by ./configure. *)" > src/opt_gettext.ml +if test "x$OCAML_PKG_gettext" != "xno"; then + # Gettext module is available, so use it. + cat <>src/opt_gettext.ml +module Gettext = Gettext.Program ( + struct + let textdomain = "virt-top" + let codeset = None + let dir = None + let dependencies = [[]] + end +) (GettextStub.Native) +EOT +else + # No gettext module is available, so fake the translation functions. + cat <>src/opt_gettext.ml +module Gettext = struct + external s_ : string -> string = "%identity" + external f_ : ('a -> 'b, 'c, 'd) format -> ('a -> 'b, 'c, 'd) format + = "%identity" + let sn_ : string -> string -> int -> string + = fun s p n -> if n = 1 then s else p + let fn_ : ('a -> 'b, 'c, 'd) format -> ('a -> 'b, 'c, 'd) format -> int + -> ('a -> 'b, 'c, 'd) format + = fun s p n -> if n = 1 then s else p +end +EOT fi -AC_SUBST(MAKENSIS) -AC_SUBST(LIBVIRT_DLL_PATH) -AC_SUBST(LIBXDR_DLL_PATH) -AC_SUBST(LIBXML2_DLL_PATH) -AC_SUBST(GNUTLS_DLL_PATH) -AC_SUBST(GTK_DLL_PATH) -AC_SUBST(GTK_PATH) dnl Summary. echo "------------------------------------------------------------" echo "Thanks for downloading" $PACKAGE_STRING -echo " subpackages to build : $subdirs" echo "------------------------------------------------------------" dnl Produce output files. AC_CONFIG_HEADERS([config.h]) -AC_CONFIG_FILES([META - libvirt/libvirt_version.ml - Makefile - Make.rules - libvirt/Makefile - examples/Makefile - mlvirsh/Makefile - virt-ctrl/Makefile - virt-top/Makefile - virt-df/Makefile +AC_CONFIG_FILES([ocaml-dep.sh], [chmod +x,-w ocaml-dep.sh]) +AC_CONFIG_FILES([ocaml-link.sh], [chmod +x,-w ocaml-link.sh]) +AC_CONFIG_FILES([Makefile + po/Makefile + src/Makefile + src/version.ml ]) -if test "x$MAKENSIS" != "x"; then - AC_CONFIG_FILES([wininstaller.nsis]) -fi AC_OUTPUT