From nobody Tue Apr 16 11:03:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1539612372165440.3332026580921; Mon, 15 Oct 2018 07:06:12 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0E3043091746; Mon, 15 Oct 2018 14:06:09 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3112510694CE; Mon, 15 Oct 2018 14:06:07 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8802618005B1; Mon, 15 Oct 2018 14:06:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w9FE2f7Y003990 for ; Mon, 15 Oct 2018 10:02:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 63AB3100164E; Mon, 15 Oct 2018 14:02:41 +0000 (UTC) Received: from thyrus.usersys.redhat.com (unknown [10.34.246.230]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8C89A1064257; Mon, 15 Oct 2018 14:02:40 +0000 (UTC) From: Pino Toscano To: libvir-list@redhat.com Date: Mon, 15 Oct 2018 16:02:32 +0200 Message-Id: <20181015140235.29263-2-ptoscano@redhat.com> In-Reply-To: <20181015140235.29263-1-ptoscano@redhat.com> References: <20181015140235.29263-1-ptoscano@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [ocaml PATCH 1/4] build: move OCaml macros to a m4 subdir X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Mon, 15 Oct 2018 14:06:10 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This way they will not be overwritten when aclocal.m4 is changed. Signed-off-by: Pino Toscano --- .gitignore | 1 + configure.ac | 1 + aclocal.m4 =3D> m4/ocaml.m4 | 0 3 files changed, 2 insertions(+) rename aclocal.m4 =3D> m4/ocaml.m4 (100%) diff --git a/.gitignore b/.gitignore index 32409ae..1d9fc14 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ Makefile core core.* /META +/aclocal.m4 /autom4te.cache /config.cache /config.h diff --git a/configure.ac b/configure.ac index 66f0cf2..dcb4ae7 100644 --- a/configure.ac +++ b/configure.ac @@ -18,6 +18,7 @@ dnl Process this file with autoconf to produce a configure script. =20 AC_INIT(ocaml-libvirt,0.6.1.4) +AC_CONFIG_MACRO_DIRS([m4]) =20 dnl Check for basic C environment. AC_PROG_CC diff --git a/aclocal.m4 b/m4/ocaml.m4 similarity index 100% rename from aclocal.m4 rename to m4/ocaml.m4 --=20 2.17.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 16 11:03:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1539612395332169.09830669650864; Mon, 15 Oct 2018 07:06:35 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C650230B9318; Mon, 15 Oct 2018 14:06:32 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7C0E28AB40; Mon, 15 Oct 2018 14:06:32 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 218C04BB79; Mon, 15 Oct 2018 14:06:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w9FE2gtL003998 for ; Mon, 15 Oct 2018 10:02:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id D517C1062254; Mon, 15 Oct 2018 14:02:42 +0000 (UTC) Received: from thyrus.usersys.redhat.com (unknown [10.34.246.230]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CABA11057075; Mon, 15 Oct 2018 14:02:41 +0000 (UTC) From: Pino Toscano To: libvir-list@redhat.com Date: Mon, 15 Oct 2018 16:02:33 +0200 Message-Id: <20181015140235.29263-3-ptoscano@redhat.com> In-Reply-To: <20181015140235.29263-1-ptoscano@redhat.com> References: <20181015140235.29263-1-ptoscano@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [ocaml PATCH 2/4] build: sync OCaml macros from libguestfs X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============5005525502465548981==" Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 15 Oct 2018 14:06:33 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 --===============5005525502465548981== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Less old version, and work better with newer versions of autoconf. Adapt configure.ac to it: - use the different variable names set by AC_CHECK_OCAML_PKG - remove the comment about using ocamlfind, as it is what the new macros do already Signed-off-by: Pino Toscano --- configure.ac | 5 +- m4/ocaml.m4 | 331 +++++++++++++++++++++++++++++---------------------- 2 files changed, 191 insertions(+), 145 deletions(-) diff --git a/configure.ac b/configure.ac index dcb4ae7..11ff2bf 100644 --- a/configure.ac +++ b/configure.ac @@ -82,11 +82,10 @@ if test "x$OCAMLFIND" =3D "x"; then AC_MSG_ERROR([OCaml findlib is required]) fi =20 -dnl Use ocamlfind to find the required packages ... - dnl Check for required OCaml packages. +OCAML_PKG_unix=3Dno AC_CHECK_OCAML_PKG(unix) -if test "x$pkg_unix" !=3D "xyes"; then +if test "x$OCAML_PKG_unix" =3D "xno"; then AC_MSG_ERROR([Cannot find required OCaml package 'unix']) fi =20 diff --git a/m4/ocaml.m4 b/m4/ocaml.m4 index 38ad15f..fddd6a0 100644 --- a/m4/ocaml.m4 +++ b/m4/ocaml.m4 @@ -1,170 +1,217 @@ dnl autoconf macros for OCaml -dnl by Olivier Andrieu -dnl modified by Richard W.M. Jones -dnl from a configure.in by Jean-Christophe Filli=EF=BF=BDtre, -dnl from a first script by Georges Mariano dnl -dnl defines AC_PROG_OCAML that will check the OCaml compiler -dnl and set the following variables : -dnl OCAMLC "ocamlc" if present in the path, or a failure -dnl or "ocamlc.opt" if present with same version number as= ocamlc -dnl OCAMLOPT "ocamlopt" (or "ocamlopt.opt" if present), or "no" -dnl OCAMLBEST either "byte" if no native compiler was found,=20 -dnl or "opt" otherwise -dnl OCAMLDEP "ocamldep" -dnl OCAMLLIB the path to the ocaml standard library -dnl OCAMLVERSION the ocaml version number -AC_DEFUN(AC_PROG_OCAML, +dnl Copyright =C2=A9 2009 Richard W.M. Jones +dnl Copyright =C2=A9 2009 Stefano Zacchiroli +dnl Copyright =C2=A9 2000-2005 Olivier Andrieu +dnl Copyright =C2=A9 2000-2005 Jean-Christophe Filli=C3=A2tre +dnl Copyright =C2=A9 2000-2005 Georges Mariano +dnl +dnl For documentation, please read the ocaml.m4 man page. + +AC_DEFUN([AC_PROG_OCAML], [dnl -# checking for ocamlc -AC_CHECK_PROG(OCAMLC,ocamlc,ocamlc,AC_MSG_ERROR(Cannot find ocamlc.)) -OCAMLVERSION=3D`$OCAMLC -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' ` -AC_MSG_RESULT(OCaml version is $OCAMLVERSION) -OCAMLLIB=3D`$OCAMLC -where 2>/dev/null || $OCAMLC -v|tail -1|cut -d ' ' -f= 4` -AC_MSG_RESULT(OCaml library path is $OCAMLLIB) -# checking for ocamlopt -AC_CHECK_PROG(OCAMLOPT,ocamlopt,ocamlopt) -OCAMLBEST=3Dbyte -if test -z "$OCAMLOPT"; then - AC_MSG_WARN(Cannot find ocamlopt; bytecode compilation only.) -else - TMPVERSION=3D`$OCAMLOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' ` - if test "$TMPVERSION" !=3D "$OCAMLVERSION" ; then - AC_MSG_RESULT(versions differs from ocamlc; ocamlopt discarded.) - unset OCAMLOPT - else - OCAMLBEST=3Dopt - fi -fi -# checking for ocamlc.opt -AC_CHECK_PROG(OCAMLCDOTOPT,ocamlc.opt,ocamlc.opt) -if test -z "$OCAMLCDOTOPT"; then - TMPVERSION=3D`$OCAMLCDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' ` - if test "$TMPVERSION" !=3D "$OCAMLVERSION" ; then - AC_MSG_RESULT(versions differs from ocamlc; ocamlc.opt discarded.) - else - OCAMLC=3D$OCAMLCDOTOPT - fi -fi -# checking for ocamlopt.opt -if test "$OCAMLOPT" ; then - AC_CHECK_PROG(OCAMLOPTDOTOPT,ocamlopt.opt,ocamlopt.opt) - if test "$OCAMLOPTDOTOPT"; then - TMPVER=3D`$OCAMLOPTDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' ` - if test "$TMPVER" !=3D "$OCAMLVERSION" ; then - AC_MSG_RESULT(version differs from ocamlc; ocamlopt.opt discarded.) - else - OCAMLOPT=3D$OCAMLOPTDOTOPT - fi - fi -fi -# checking for ocamldep -AC_CHECK_PROG(OCAMLDEP,ocamldep,ocamldep,AC_MSG_ERROR(Cannot find ocamldep= .)) - -#checking for ocamlmktop -AC_CHECK_PROG(OCAMLMKTOP,ocamlmktop,ocamlmktop, AC_MSG_WARN(Cannot find oc= amlmktop.)) -#checking for ocamlmklib -AC_CHECK_PROG(OCAMLMKLIB,ocamlmklib,ocamlmklib, AC_MSG_WARN(Cannot find oc= amlmklib.)) -# checking for ocamldoc -AC_CHECK_PROG(OCAMLDOC,ocamldoc,ocamldoc, AC_MSG_WARN(Cannot find ocamldoc= .)) - - -AC_SUBST(OCAMLC) -AC_SUBST(OCAMLOPT) -AC_SUBST(OCAMLDEP) -AC_SUBST(OCAMLBEST) -AC_SUBST(OCAMLVERSION) -AC_SUBST(OCAMLLIB) -AC_SUBST(OCAMLMKLIB) -AC_SUBST(OCAMLDOC) + # checking for ocamlc + AC_CHECK_TOOL([OCAMLC],[ocamlc],[no]) + + if test "$OCAMLC" !=3D "no"; then + OCAMLVERSION=3D`$OCAMLC -v | sed -n -e 's|.*version* *\(.*\)$|\1|p'` + AC_MSG_RESULT([OCaml version is $OCAMLVERSION]) + OCAMLLIB=3D`$OCAMLC -where 2>/dev/null || $OCAMLC -v|tail -1|cut -d '= ' -f 4` + AC_MSG_RESULT([OCaml library path is $OCAMLLIB]) + + AC_SUBST([OCAMLVERSION]) + AC_SUBST([OCAMLLIB]) + + # checking for ocamlopt + AC_CHECK_TOOL([OCAMLOPT],[ocamlopt],[no]) + OCAMLBEST=3Dbyte + if test "$OCAMLOPT" =3D "no"; then + AC_MSG_WARN([Cannot find ocamlopt; bytecode compilation only.]) + else + TMPVERSION=3D`$OCAMLOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p= ' ` + if test "$TMPVERSION" !=3D "$OCAMLVERSION" ; then + AC_MSG_RESULT([versions differs from ocamlc; ocamlopt discarde= d.]) + OCAMLOPT=3Dno + else + OCAMLBEST=3Dopt + fi + fi + + AC_SUBST([OCAMLBEST]) + + # checking for ocamlc.opt + AC_CHECK_TOOL([OCAMLCDOTOPT],[ocamlc.opt],[no]) + if test "$OCAMLCDOTOPT" !=3D "no"; then + TMPVERSION=3D`$OCAMLCDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|= \1|p' ` + if test "$TMPVERSION" !=3D "$OCAMLVERSION" ; then + AC_MSG_RESULT([versions differs from ocamlc; ocamlc.opt discar= ded.]) + else + OCAMLC=3D$OCAMLCDOTOPT + fi + fi + + # checking for ocamlopt.opt + if test "$OCAMLOPT" !=3D "no" ; then + AC_CHECK_TOOL([OCAMLOPTDOTOPT],[ocamlopt.opt],[no]) + if test "$OCAMLOPTDOTOPT" !=3D "no"; then + TMPVERSION=3D`$OCAMLOPTDOTOPT -v | sed -n -e 's|.*version* *\(.= *\)$|\1|p' ` + if test "$TMPVERSION" !=3D "$OCAMLVERSION" ; then + AC_MSG_RESULT([version differs from ocamlc; ocamlopt.opt dis= carded.]) + else + OCAMLOPT=3D$OCAMLOPTDOTOPT + fi + fi + fi + + AC_SUBST([OCAMLOPT]) + fi + + AC_SUBST([OCAMLC]) + + # checking for ocamldep + AC_CHECK_TOOL([OCAMLDEP],[ocamldep],[no]) + + # checking for ocamlmktop + AC_CHECK_TOOL([OCAMLMKTOP],[ocamlmktop],[no]) + + # checking for ocamlmklib + AC_CHECK_TOOL([OCAMLMKLIB],[ocamlmklib],[no]) + + # checking for ocamldoc + AC_CHECK_TOOL([OCAMLDOC],[ocamldoc],[no]) + + # checking for ocamlbuild + AC_CHECK_TOOL([OCAMLBUILD],[ocamlbuild],[no]) ]) =20 =20 -dnl macro AC_PROG_OCAML_TOOLS will check OCamllex and OCamlyacc : -dnl OCAMLLEX "ocamllex" or "ocamllex.opt" if present -dnl OCAMLYACC "ocamlyac" -AC_DEFUN(AC_PROG_OCAML_TOOLS, +AC_DEFUN([AC_PROG_OCAMLLEX], [dnl -# checking for ocamllex and ocamlyacc -AC_CHECK_PROG(OCAMLLEX,ocamllex,ocamllex) -if test "$OCAMLLEX"; then - AC_CHECK_PROG(OCAMLLEXDOTOPT,ocamllex.opt,ocamllex.opt) - if test "$OCAMLLEXDOTOPT"; then - OCAMLLEX=3D$OCAMLLEXDOTOPT + # checking for ocamllex + AC_CHECK_TOOL([OCAMLLEX],[ocamllex],[no]) + if test "$OCAMLLEX" !=3D "no"; then + AC_CHECK_TOOL([OCAMLLEXDOTOPT],[ocamllex.opt],[no]) + if test "$OCAMLLEXDOTOPT" !=3D "no"; then + OCAMLLEX=3D$OCAMLLEXDOTOPT fi -else - AC_MSG_ERROR(Cannot find ocamllex.) -fi -AC_CHECK_PROG(OCAMLYACC,ocamlyacc,ocamlyacc,AC_MSG_ERROR(Cannot find ocaml= yacc.)) -AC_SUBST(OCAMLLEX) -AC_SUBST(OCAMLYACC) + fi + AC_SUBST([OCAMLLEX]) +]) + +AC_DEFUN([AC_PROG_OCAMLYACC], +[dnl + AC_CHECK_TOOL([OCAMLYACC],[ocamlyacc],[no]) + AC_SUBST([OCAMLYACC]) ]) =20 =20 -dnl AC_PROG_CAMLP4 checks for Camlp4 -AC_DEFUN(AC_PROG_CAMLP4, +AC_DEFUN([AC_PROG_CAMLP4], [dnl -AC_REQUIRE([AC_PROG_OCAML]) -# checking for camlp4 -AC_CHECK_PROG(CAMLP4,camlp4,camlp4) -if test "$CAMLP4"; then - TMPVERSION=3D`$CAMLP4 -v 2>&1| sed -n -e 's|.*version *\(.*\)$|\1|p'` - if test "$TMPVERSION" !=3D "$OCAMLVERSION" ; then - AC_MSG_RESULT(versions differs from ocamlc) - fi -fi + AC_REQUIRE([AC_PROG_OCAML])dnl + + # checking for camlp4 + AC_CHECK_TOOL([CAMLP4],[camlp4],[no]) + if test "$CAMLP4" !=3D "no"; then + TMPVERSION=3D`$CAMLP4 -v 2>&1| sed -n -e 's|.*version *\(.*\)$|\1|p'` + if test "$TMPVERSION" !=3D "$OCAMLVERSION" ; then + AC_MSG_RESULT([versions differs from ocamlc]) + CAMLP4=3Dno + fi + fi + AC_SUBST([CAMLP4]) + + # checking for companion tools + AC_CHECK_TOOL([CAMLP4BOOT],[camlp4boot],[no]) + AC_CHECK_TOOL([CAMLP4O],[camlp4o],[no]) + AC_CHECK_TOOL([CAMLP4OF],[camlp4of],[no]) + AC_CHECK_TOOL([CAMLP4OOF],[camlp4oof],[no]) + AC_CHECK_TOOL([CAMLP4ORF],[camlp4orf],[no]) + AC_CHECK_TOOL([CAMLP4PROF],[camlp4prof],[no]) + AC_CHECK_TOOL([CAMLP4R],[camlp4r],[no]) + AC_CHECK_TOOL([CAMLP4RF],[camlp4rf],[no]) + AC_SUBST([CAMLP4BOOT]) + AC_SUBST([CAMLP4O]) + AC_SUBST([CAMLP4OF]) + AC_SUBST([CAMLP4OOF]) + AC_SUBST([CAMLP4ORF]) + AC_SUBST([CAMLP4PROF]) + AC_SUBST([CAMLP4R]) + AC_SUBST([CAMLP4RF]) ]) =20 =20 -dnl macro AC_PROG_FINDLIB will check for the presence of -dnl ocamlfind -AC_DEFUN(AC_PROG_FINDLIB, +AC_DEFUN([AC_PROG_FINDLIB], [dnl -# checking for ocamlfind -AC_CHECK_PROG(OCAMLFIND,ocamlfind,ocamlfind, - AC_MSG_WARN([ocamlfind not found])) -AC_SUBST(OCAMLFIND) + AC_REQUIRE([AC_PROG_OCAML])dnl + + # checking for ocamlfind + AC_CHECK_TOOL([OCAMLFIND],[ocamlfind],[no]) + AC_SUBST([OCAMLFIND]) ]) =20 =20 -dnl AC_CHECK_OCAML_PKG checks wether a findlib package is present -dnl defines pkg_name to "yes" -AC_DEFUN(AC_CHECK_OCAML_PKG, +dnl Thanks to Jim Meyering for working this next bit out for us. +dnl XXX We should define AS_TR_SH if it's not defined already +dnl (eg. for old autoconf). +AC_DEFUN([AC_CHECK_OCAML_PKG], [dnl -AC_REQUIRE([AC_PROG_FINDLIB]) -AC_MSG_CHECKING(findlib package $1) -if $OCAMLFIND query $1 >/dev/null 2>/dev/null; then -AC_MSG_RESULT(found) -eval "pkg_`echo $1 | tr - _`=3Dyes" -else -AC_MSG_RESULT(not found) -eval "pkg_`echo $1 | tr - _`=3Dno" -fi + AC_REQUIRE([AC_PROG_FINDLIB])dnl + + AC_MSG_CHECKING([for OCaml findlib package $1]) + + unset found + unset pkg + found=3Dno + for pkg in $1 $2 ; do + if $OCAMLFIND query $pkg >/dev/null 2>/dev/null; then + AC_MSG_RESULT([found]) + AS_TR_SH([OCAML_PKG_$1])=3D$pkg + found=3Dyes + break + fi + done + if test "$found" =3D "no" ; then + AC_MSG_RESULT([not found]) + AS_TR_SH([OCAML_PKG_$1])=3Dno + fi + + AC_SUBST(AS_TR_SH([OCAML_PKG_$1])) ]) =20 =20 -dnl AC_CHECK_OCAML_MODULE looks for a module in a given path -dnl 1st arg -> name (just for printing messages) -dnl 2nd arg -> env var name (set to include path, or "no" if not found) -dnl 3rd arg -> module to check -dnl 4th arg -> default include dirs to check AC_DEFUN([AC_CHECK_OCAML_MODULE], [dnl -AC_MSG_CHECKING(for module $1) -cat > conftest.ml < conftest.ml <&5 2>&5 ; then - found=3Dyes - break + unset found + for $1 in $$1 $4 ; do + if $OCAMLC -c -I "$$1" conftest.ml >&5 2>&5 ; then + found=3Dyes + break + fi + done + + if test "$found" ; then + AC_MSG_RESULT([$$1]) + else + AC_MSG_RESULT([not found]) + $1=3Dno fi -done -if test "$found" ; then - AC_MSG_RESULT($$2) -else - AC_MSG_RESULT(not found) - $2=3Dno -fi -AC_SUBST($2)]) + AC_SUBST([$1]) +]) + + +dnl XXX Cross-compiling +AC_DEFUN([AC_CHECK_OCAML_WORD_SIZE], +[dnl + AC_MSG_CHECKING([for OCaml compiler word size]) + cat > conftest.ml < Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1539613499959340.2831917477853; Mon, 15 Oct 2018 07:24:59 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C3B7D88312; Mon, 15 Oct 2018 14:24:57 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8F39E5D76E; Mon, 15 Oct 2018 14:24:57 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 468EC4BB79; Mon, 15 Oct 2018 14:24:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w9FE2i77004007 for ; Mon, 15 Oct 2018 10:02:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1E27C1057075; Mon, 15 Oct 2018 14:02:44 +0000 (UTC) Received: from thyrus.usersys.redhat.com (unknown [10.34.246.230]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4470E100164E; Mon, 15 Oct 2018 14:02:43 +0000 (UTC) From: Pino Toscano To: libvir-list@redhat.com Date: Mon, 15 Oct 2018 16:02:34 +0200 Message-Id: <20181015140235.29263-4-ptoscano@redhat.com> In-Reply-To: <20181015140235.29263-1-ptoscano@redhat.com> References: <20181015140235.29263-1-ptoscano@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [ocaml PATCH 3/4] build: remove config.h.in X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 15 Oct 2018 14:24:58 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" It is generated by autoheader, no need to keep it in the sources. Signed-off-by: Pino Toscano --- .gitignore | 1 + config.h.in | 61 ----------------------------------------------------- 2 files changed, 1 insertion(+), 61 deletions(-) delete mode 100644 config.h.in diff --git a/.gitignore b/.gitignore index 1d9fc14..67f9134 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ core.* /autom4te.cache /config.cache /config.h +/config.h.in /config.log /config.status /configure diff --git a/config.h.in b/config.h.in deleted file mode 100644 index c0bd102..0000000 --- a/config.h.in +++ /dev/null @@ -1,61 +0,0 @@ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the `virt' library (-lvirt). */ -#undef HAVE_LIBVIRT - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if your C compiler doesn't accept -c and -o together. */ -#undef NO_MINUS_C_MINUS_O - -/* Define to the address where bug reports for this package should be sent= . */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if the C compiler supports function prototypes. */ -#undef PROTOTYPES - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define like PROTOTYPES; this can be used by system headers. */ -#undef __PROTOTYPES --=20 2.17.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 16 11:03:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1539612407926162.8457866864112; Mon, 15 Oct 2018 07:06:47 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6F35830B477C; Mon, 15 Oct 2018 14:06:45 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 372DA2BE7C; Mon, 15 Oct 2018 14:06:45 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id AAAD8180B5B7; Mon, 15 Oct 2018 14:06:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w9FE2j3R004017 for ; Mon, 15 Oct 2018 10:02:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5C80E1064257; Mon, 15 Oct 2018 14:02:45 +0000 (UTC) Received: from thyrus.usersys.redhat.com (unknown [10.34.246.230]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 82669100164E; Mon, 15 Oct 2018 14:02:44 +0000 (UTC) From: Pino Toscano To: libvir-list@redhat.com Date: Mon, 15 Oct 2018 16:02:35 +0200 Message-Id: <20181015140235.29263-5-ptoscano@redhat.com> In-Reply-To: <20181015140235.29263-1-ptoscano@redhat.com> References: <20181015140235.29263-1-ptoscano@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [ocaml PATCH 4/4] build: use pkg-config to find libvirt X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Mon, 15 Oct 2018 14:06:46 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Rely on pkg-config to detect libvirt, and use its variables to locate it. The version required is taken from the API documentation. Signed-off-by: Pino Toscano --- configure.ac | 20 ++------------------ libvirt/Makefile.in | 14 ++++++++------ 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/configure.ac b/configure.ac index 11ff2bf..7d923bf 100644 --- a/configure.ac +++ b/configure.ac @@ -55,24 +55,8 @@ if test "x$PERL" =3D "xno"; then fi =20 dnl Check for libvirt development environment. -AC_ARG_WITH(libvirt, - AC_HELP_STRING([--with-libvirt=3DPATH],[Set path to installed libvirt]), - [if test "x$withval" !=3D "x"; then - CFLAGS=3D"$CFLAGS -I$withval/include" - LDFLAGS=3D"$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])) +PKG_PROG_PKG_CONFIG +PKG_CHECK_MODULES([LIBVIRT], [libvirt >=3D 1.0.2]) =20 dnl Check for basic OCaml environment & findlib. AC_PROG_OCAML diff --git a/libvirt/Makefile.in b/libvirt/Makefile.in index faca5ee..3a68aed 100644 --- a/libvirt/Makefile.in +++ b/libvirt/Makefile.in @@ -18,10 +18,12 @@ WIN32 =3D @WIN32@ =20 CFLAGS =3D @CFLAGS@ \ + @LIBVIRT_CFLAGS@ \ -I.. \ -I"$(shell ocamlc -where)" \ @DEBUG@ @WARNINGS@ @CFLAGS_FPIC@ -LDFLAGS =3D @LDFLAGS@ +LDFLAGS =3D @LDFLAGS@ \ + @LIBVIRT_LIBS@ # -L"$(shell ocamlc -where)" =20 OCAMLC =3D @OCAMLC@ @@ -62,10 +64,10 @@ OPTOBJS :=3D libvirt.cmx libvirt_version.cmx ifneq ($(OCAMLMKLIB),) # Good, we can just use ocamlmklib mllibvirt.cma: libvirt_c.o $(COBJS) - $(OCAMLMKLIB) -o mllibvirt $^ $(LDFLAGS) -lvirt + $(OCAMLMKLIB) -o mllibvirt $^ $(LDFLAGS) =20 mllibvirt.cmxa: libvirt_c.o $(OPTOBJS) - $(OCAMLMKLIB) -o mllibvirt $^ $(LDFLAGS) -lvirt + $(OCAMLMKLIB) -o mllibvirt $^ $(LDFLAGS) =20 else ifeq ($(WIN32),yes) @@ -74,15 +76,15 @@ ifeq ($(WIN32),yes) =20 mllibvirt.cma: dllmllibvirt.dll libmllibvirt.a $(COBJS) $(OCAMLC) -a -linkall -o $@ $(COBJS) \ - -dllib -lmllibvirt -cclib -lmllibvirt -cclib "$(LDFLAGS) -lvirt" + -dllib -lmllibvirt -cclib -lmllibvirt -cclib "$(LDFLAGS)" =20 mllibvirt.cmxa: libmllibvirt.a $(OPTOBJS) $(OCAMLOPT) -a -linkall -o $@ $(OPTOBJS) \ - -cclib -lmllibvirt -cclib "$(LDFLAGS) -lvirt" + -cclib -lmllibvirt -cclib "$(LDFLAGS)" =20 dllmllibvirt.dll: libvirt_c.o $(CC) -shared -o $@ $^ \ - $(LDFLAGS) "$(shell ocamlc -where)"/ocamlrun.a -lvirt + $(LDFLAGS) "$(shell ocamlc -where)"/ocamlrun.a =20 libmllibvirt.a: libvirt_c.o ar rc $@ $^ --=20 2.17.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list