This is an automated email from the git hooks/post-receive script.

glondu pushed a commit to branch master
in repository findlib.

commit e4dcf2ccca8e31d5e94513d5e2556b3dab6fe393
Author: Stephane Glondu <st...@glondu.net>
Date:   Tue Feb 17 16:44:56 2015 +0100

    Imported Upstream version 1.5.4
---
 configure                                 | 24 +++++++++++--
 doc/README                                |  3 ++
 doc/README.xml                            |  6 ++++
 doc/ref-html/{c1045.html => c1054.html}   | 12 +++----
 doc/ref-html/index.html                   |  8 ++---
 doc/ref-html/{p1043.html => p1052.html}   | 16 ++++-----
 doc/ref-html/p698.html                    |  4 +--
 doc/ref-html/r17.html                     | 14 ++++----
 doc/ref-html/r700.html                    | 26 ++++++++++----
 doc/ref-html/{r796.html => r798.html}     | 38 ++++++++++++++++----
 doc/ref-html/{r985.html => r994.html}     | 22 ++++++------
 doc/ref-man/META.5                        | 28 ++++++++++++++-
 doc/ref-man/findlib.conf.5                | 23 ++++++++++++
 doc/src/findlib_conf.mod                  | 12 +++++++
 doc/src/findlib_meta.mod                  | 17 ++++++++-
 doc/src/findlib_reference.xml             | 27 +++++++++++++-
 itest-aux/ppx.ml                          |  1 +
 src/findlib/Makefile                      | 16 +++++++--
 src/findlib/findlib.ml                    |  4 +--
 src/findlib/frontend.ml                   | 51 ++++++++++++++++++++++-----
 src/findlib/{topfind.ml => topfind.ml.in} | 58 ++++++++++++++++++++++++++++---
 21 files changed, 336 insertions(+), 74 deletions(-)

diff --git a/configure b/configure
index ed92e18..2c7ef6f 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $Id: configure 237 2014-09-16 11:21:09Z gerd $
+# $Id: configure 244 2014-10-15 11:06:21Z gerd $
 # ----------------------------------------------------------------------
 #
 
@@ -7,7 +7,7 @@
 
 #set -x
 
-version="1.5.3"
+version="1.5.4"
 
 # Remember the old IFS value:
 oldifs="$IFS"
@@ -382,6 +382,19 @@ have_dlls="yes"
 ocaml unix.cma itest-aux/simple.ml >/dev/null || have_dlls="no"
 
 ######################################################################
+# Does this version of OCaml support extension points?
+
+echo "Testing whether ppxopt can be supported..."
+
+with_ppxopt=1
+enable_topfind_ppxopt=true
+
+ocaml -I +compiler-libs itest-aux/ppx.ml >/dev/null || {
+    with_ppxopt=0
+    enable_topfind_ppxopt=false
+}
+
+######################################################################
 # Configure libraries
 
 echo "Configuring libraries..."
@@ -583,6 +596,7 @@ echo "INSTALL_CAMLP4=${with_camlp4}" >>Makefile.config
 echo "USE_CYGPATH=${use_cygpath}" >>Makefile.config
 echo "HAVE_NATDYNLINK=${have_natdynlink}" >>Makefile.config
 echo "VERSION=${version}" >>Makefile.config
+echo "ENABLE_TOPFIND_PPXOPT=${enable_topfind_ppxopt}" >>Makefile.config
 echo "SYSTEM=${system}" >>Makefile.config
 if [ "$mingw_lib" != "" ]; then
     echo "OCAMLC_FLAGS=-I \"${mingw_lib}\"" >>Makefile.config
@@ -611,6 +625,12 @@ else
     echo "    topfind script:        omitted"
 fi
 
+if [ $with_ppxopt -gt 0 ]; then
+    echo "Topfind ppxopt support:    yes"
+else
+    echo "Topfind ppxopt support:    no"
+fi
+
 if [ $with_toolbox -gt 0 ]; then
     echo "Toolbox:                   yes"
 else
diff --git a/doc/README b/doc/README
index 7a2e526..4a5a31a 100644
--- a/doc/README
+++ b/doc/README
@@ -85,6 +85,9 @@ of questions.
 List of Changes
 ==============================================================================
 
+-  1.5.4: New ppxopt META variables (Peter Zotov).
+   Support for OCAMLFIND_TOOLCHAIN environment variable (Peter Zotov).  
+   
 -  1.5.3: The installation of "bytes" respects now $prefix and  the configured 
    destination.
    New option -pp for "ocamlfind query", to get preprocessor packages.
diff --git a/doc/README.xml b/doc/README.xml
index 746eeb0..de6c1a5 100644
--- a/doc/README.xml
+++ b/doc/README.xml
@@ -110,6 +110,12 @@ configuration files, and library routines in detail.</p>
     <ul>
 
     <li>
+      <p><em>1.5.4:</em> New ppxopt META variables (Peter Zotov).</p>
+      <p>Support for OCAMLFIND_TOOLCHAIN environment variable (Peter Zotov).
+         </p>
+    </li>
+
+    <li>
       <p><em>1.5.3:</em> The installation of "bytes" respects now $prefix and
         the configured destination.</p>
       <p>New option -pp for "ocamlfind query", to get preprocessor 
packages.</p>
diff --git a/doc/ref-html/c1045.html b/doc/ref-html/c1054.html
similarity index 93%
rename from doc/ref-html/c1045.html
rename to doc/ref-html/c1054.html
index 0bf3111..f79da7a 100644
--- a/doc/ref-html/c1045.html
+++ b/doc/ref-html/c1054.html
@@ -11,10 +11,10 @@ TITLE="The findlib Reference Manual"
 HREF="index.html"><LINK
 REL="UP"
 TITLE="Library"
-HREF="p1043.html"><LINK
+HREF="p1052.html"><LINK
 REL="PREVIOUS"
 TITLE="Library"
-HREF="p1043.html"></HEAD
+HREF="p1052.html"></HEAD
 ><BODY
 CLASS="CHAPTER"
 BGCOLOR="#FFFFFF"
@@ -42,7 +42,7 @@ WIDTH="10%"
 ALIGN="left"
 VALIGN="bottom"
 ><A
-HREF="p1043.html"
+HREF="p1052.html"
 ACCESSKEY="P"
 >Prev</A
 ></TD
@@ -65,7 +65,7 @@ WIDTH="100%"></DIV
 CLASS="CHAPTER"
 ><H1
 ><A
-NAME="AEN1045"
+NAME="AEN1054"
 ></A
 >Chapter 1. The findlib library</H1
 ><P
@@ -92,7 +92,7 @@ WIDTH="33%"
 ALIGN="left"
 VALIGN="top"
 ><A
-HREF="p1043.html"
+HREF="p1052.html"
 ACCESSKEY="P"
 >Prev</A
 ></TD
@@ -122,7 +122,7 @@ WIDTH="34%"
 ALIGN="center"
 VALIGN="top"
 ><A
-HREF="p1043.html"
+HREF="p1052.html"
 ACCESSKEY="U"
 >Up</A
 ></TD
diff --git a/doc/ref-html/index.html b/doc/ref-html/index.html
index ee1251f..02d3606 100644
--- a/doc/ref-html/index.html
+++ b/doc/ref-html/index.html
@@ -74,26 +74,26 @@ HREF="r700.html"
 >&nbsp;--&nbsp;[File that specifies metainformation of OCaml packages]</DT
 ><DT
 ><A
-HREF="r796.html"
+HREF="r798.html"
 >findlib.conf</A
 >&nbsp;--&nbsp;[Configuration of findlib/ocamlfind]</DT
 ><DT
 ><A
-HREF="r985.html"
+HREF="r994.html"
 >site-lib</A
 >&nbsp;--&nbsp;[Location of package directories]</DT
 ></DL
 ></DD
 ><DT
 >III. <A
-HREF="p1043.html"
+HREF="p1052.html"
 >Library</A
 ></DT
 ><DD
 ><DL
 ><DT
 >1. <A
-HREF="c1045.html"
+HREF="c1054.html"
 >The findlib library</A
 ></DT
 ></DL
diff --git a/doc/ref-html/p1043.html b/doc/ref-html/p1052.html
similarity index 92%
rename from doc/ref-html/p1043.html
rename to doc/ref-html/p1052.html
index 66f684d..7d4fcf7 100644
--- a/doc/ref-html/p1043.html
+++ b/doc/ref-html/p1052.html
@@ -11,10 +11,10 @@ TITLE="The findlib Reference Manual"
 HREF="index.html"><LINK
 REL="PREVIOUS"
 TITLE="site-lib"
-HREF="r985.html"><LINK
+HREF="r994.html"><LINK
 REL="NEXT"
 TITLE="The findlib library"
-HREF="c1045.html"></HEAD
+HREF="c1054.html"></HEAD
 ><BODY
 CLASS="PART"
 BGCOLOR="#FFFFFF"
@@ -42,7 +42,7 @@ WIDTH="10%"
 ALIGN="left"
 VALIGN="bottom"
 ><A
-HREF="r985.html"
+HREF="r994.html"
 ACCESSKEY="P"
 >Prev</A
 ></TD
@@ -56,7 +56,7 @@ WIDTH="10%"
 ALIGN="right"
 VALIGN="bottom"
 ><A
-HREF="c1045.html"
+HREF="c1054.html"
 ACCESSKEY="N"
 >Next</A
 ></TD
@@ -68,7 +68,7 @@ WIDTH="100%"></DIV
 ><DIV
 CLASS="PART"
 ><A
-NAME="AEN1043"
+NAME="AEN1052"
 ></A
 ><DIV
 CLASS="TITLEPAGE"
@@ -84,7 +84,7 @@ CLASS="TOC"
 ></DT
 ><DT
 >1. <A
-HREF="c1045.html"
+HREF="c1054.html"
 >The findlib library</A
 ></DT
 ></DL
@@ -107,7 +107,7 @@ WIDTH="33%"
 ALIGN="left"
 VALIGN="top"
 ><A
-HREF="r985.html"
+HREF="r994.html"
 ACCESSKEY="P"
 >Prev</A
 ></TD
@@ -125,7 +125,7 @@ WIDTH="33%"
 ALIGN="right"
 VALIGN="top"
 ><A
-HREF="c1045.html"
+HREF="c1054.html"
 ACCESSKEY="N"
 >Next</A
 ></TD
diff --git a/doc/ref-html/p698.html b/doc/ref-html/p698.html
index 7eb0818..19b9773 100644
--- a/doc/ref-html/p698.html
+++ b/doc/ref-html/p698.html
@@ -89,12 +89,12 @@ HREF="r700.html"
 >&nbsp;--&nbsp;[File that specifies metainformation of OCaml packages]</DT
 ><DT
 ><A
-HREF="r796.html"
+HREF="r798.html"
 >findlib.conf</A
 >&nbsp;--&nbsp;[Configuration of findlib/ocamlfind]</DT
 ><DT
 ><A
-HREF="r985.html"
+HREF="r994.html"
 >site-lib</A
 >&nbsp;--&nbsp;[Location of package directories]</DT
 ></DL
diff --git a/doc/ref-html/r17.html b/doc/ref-html/r17.html
index 3c99b5b..9577ec2 100644
--- a/doc/ref-html/r17.html
+++ b/doc/ref-html/r17.html
@@ -1290,7 +1290,7 @@ export OCAMLFIND_COMMANDS</PRE
 ><P
 >Alternatively, you can change the configuration file
 <A
-HREF="r796.html#FINDLIB.CONF"
+HREF="r798.html#FINDLIB.CONF"
 >findlib.conf</A
 >.</P
 ></DIV
@@ -1892,7 +1892,7 @@ CLASS="LITERAL"
 >destdir</TT
 > of
 <A
-HREF="r796.html#FINDLIB.CONF"
+HREF="r798.html#FINDLIB.CONF"
 >findlib.conf</A
 >), or in the directory
 specified by the -destdir option. This
@@ -1914,7 +1914,7 @@ CLASS="LITERAL"
 >metadir</TT
 > of 
 <A
-HREF="r796.html#FINDLIB.CONF"
+HREF="r798.html#FINDLIB.CONF"
 >findlib.conf</A
 >, or to specify the
 -metadir option. In this case, the file called META is copied to the
@@ -2048,7 +2048,7 @@ CLASS="LITERAL"
 >destdir</TT
 > of
 <A
-HREF="r796.html#FINDLIB.CONF"
+HREF="r798.html#FINDLIB.CONF"
 >findlib.conf</A
 >). If the package
 resides at a different location, it will not be removed by default;
@@ -2065,7 +2065,7 @@ CLASS="LITERAL"
 >metadir</TT
 > variable
 of <A
-HREF="r796.html#FINDLIB.CONF"
+HREF="r798.html#FINDLIB.CONF"
 >findlib.conf</A
 >, or by specifying
 the -metadir option.</P
@@ -2308,7 +2308,7 @@ NAME="AEN682"
 > The configuration file and environment variables are documented
 in the manual page for
  <A
-HREF="r796.html#FINDLIB.CONF"
+HREF="r798.html#FINDLIB.CONF"
 >findlib.conf</A
 >.</P
 ></DIV
@@ -2357,7 +2357,7 @@ compiles file.ml with toolchain "foo". By selecting 
toolchains one
 can switch to different command sets. For instance, the toolchain
 "foo" may consist of a patched ocamlc compiler. 
 See <A
-HREF="r796.html#FINDLIB.CONF"
+HREF="r798.html#FINDLIB.CONF"
 >findlib.conf</A
 > how to
 configure toolchains.</P
diff --git a/doc/ref-html/r700.html b/doc/ref-html/r700.html
index 58e17d8..d36e193 100644
--- a/doc/ref-html/r700.html
+++ b/doc/ref-html/r700.html
@@ -17,7 +17,7 @@ TITLE="Files"
 HREF="p698.html"><LINK
 REL="NEXT"
 TITLE="findlib.conf"
-HREF="r796.html"></HEAD
+HREF="r798.html"></HEAD
 ><BODY
 CLASS="REFENTRY"
 BGCOLOR="#FFFFFF"
@@ -59,7 +59,7 @@ WIDTH="10%"
 ALIGN="right"
 VALIGN="bottom"
 ><A
-HREF="r796.html"
+HREF="r798.html"
 ACCESSKEY="N"
 >Next</A
 ></TD
@@ -281,7 +281,7 @@ name (without special syntax). In the latter case, the 
interpretation
 depends on whether it is contained in a main or sub package, and
 whether the standard repository layout or the alternate layout is in
 effect (see <A
-HREF="r985.html#SITE-LIB"
+HREF="r994.html#SITE-LIB"
 >site-lib</A
 > for these terms).
 For a main package in standard layout the base directory is the
@@ -369,7 +369,21 @@ via the -ppx option (available since OCaml-4.01). If the 
command is
 relative to the current directory (e.g. ./cmd), the command is expected
 in the package directory. The special forms as defined for "archive"
 are also available (e.g. @otherpkg/cmd). Additional arguments can be
-specified on the ocamlfind command line with the -ppxopt option.</P
+specified on the ocamlfind command line with the -ppxopt option
+or the "ppxopt" variable.</P
+></LI
+><LI
+STYLE="list-style-type: disc"
+><P
+>The variable "ppxopt" is a set of options that are added to the ppx
+rewriter invocation. The contents of the variable consists of one or
+several whitespace-separated parts. Every part consists of several
+comma-separated subparts; the first subpart indicates the package
+that contains the ppx rewriter invocation, the rest contain the options
+to be appended. If the option is a path relative to the current directory
+(e.g. ./foo.cma), the path is expanded relative to the package directory.
+The special forms as defined for "archive" are also available
+(e.g. @otherpkg/foo.cma).</P
 ></LI
 ></UL
 ><P
@@ -379,7 +393,7 @@ no software interpreting them.</P
 ><DIV
 CLASS="REFSECT1"
 ><A
-NAME="AEN769"
+NAME="AEN771"
 ></A
 ><H2
 >PREDICATES</H2
@@ -495,7 +509,7 @@ WIDTH="33%"
 ALIGN="right"
 VALIGN="top"
 ><A
-HREF="r796.html"
+HREF="r798.html"
 ACCESSKEY="N"
 >Next</A
 ></TD
diff --git a/doc/ref-html/r796.html b/doc/ref-html/r798.html
similarity index 96%
rename from doc/ref-html/r796.html
rename to doc/ref-html/r798.html
index f8c2520..9611b2d 100644
--- a/doc/ref-html/r796.html
+++ b/doc/ref-html/r798.html
@@ -17,7 +17,7 @@ TITLE="META"
 HREF="r700.html"><LINK
 REL="NEXT"
 TITLE="site-lib"
-HREF="r985.html"></HEAD
+HREF="r994.html"></HEAD
 ><BODY
 CLASS="REFENTRY"
 BGCOLOR="#FFFFFF"
@@ -59,7 +59,7 @@ WIDTH="10%"
 ALIGN="right"
 VALIGN="bottom"
 ><A
-HREF="r985.html"
+HREF="r994.html"
 ACCESSKEY="N"
 >Next</A
 ></TD
@@ -70,7 +70,7 @@ ALIGN="LEFT"
 WIDTH="100%"></DIV
 ><H1
 ><A
-NAME="AEN796"
+NAME="AEN798"
 ></A
 >findlib.conf</H1
 ><DIV
@@ -84,7 +84,7 @@ NAME="FINDLIB.CONF"
 ><DIV
 CLASS="REFSECT1"
 ><A
-NAME="AEN804"
+NAME="AEN806"
 ></A
 ><H2
 >GENERAL</H2
@@ -163,7 +163,7 @@ CLASS="LITERAL"
 ><DIV
 CLASS="REFSECT1"
 ><A
-NAME="AEN828"
+NAME="AEN830"
 ></A
 ><H2
 >findlib.conf</H2
@@ -491,7 +491,7 @@ HREF="r17.html#OCAMLFIND"
 ><DIV
 CLASS="REFSECT1"
 ><A
-NAME="AEN911"
+NAME="AEN913"
 ></A
 ><H2
 >Environment</H2
@@ -527,6 +527,30 @@ CLASS="VARIABLELIST"
 ><DT
 ><TT
 CLASS="LITERAL"
+>OCAMLFIND_TOOLCHAIN</TT
+></DT
+><DD
+><P
+>    This variable sets the currently selected toolchain when
+    a <TT
+CLASS="LITERAL"
+>-toolchain</TT
+> option is not passed
+    on the command line.
+  </P
+></DD
+></DL
+></DIV
+>
+
+<P
+></P
+><DIV
+CLASS="VARIABLELIST"
+><DL
+><DT
+><TT
+CLASS="LITERAL"
 >OCAMLPATH</TT
 ></DT
 ><DD
@@ -787,7 +811,7 @@ WIDTH="33%"
 ALIGN="right"
 VALIGN="top"
 ><A
-HREF="r985.html"
+HREF="r994.html"
 ACCESSKEY="N"
 >Next</A
 ></TD
diff --git a/doc/ref-html/r985.html b/doc/ref-html/r994.html
similarity index 96%
rename from doc/ref-html/r985.html
rename to doc/ref-html/r994.html
index 75135bd..c9d57cf 100644
--- a/doc/ref-html/r985.html
+++ b/doc/ref-html/r994.html
@@ -14,10 +14,10 @@ TITLE="Files"
 HREF="p698.html"><LINK
 REL="PREVIOUS"
 TITLE="findlib.conf"
-HREF="r796.html"><LINK
+HREF="r798.html"><LINK
 REL="NEXT"
 TITLE="Library"
-HREF="p1043.html"></HEAD
+HREF="p1052.html"></HEAD
 ><BODY
 CLASS="REFENTRY"
 BGCOLOR="#FFFFFF"
@@ -45,7 +45,7 @@ WIDTH="10%"
 ALIGN="left"
 VALIGN="bottom"
 ><A
-HREF="r796.html"
+HREF="r798.html"
 ACCESSKEY="P"
 >Prev</A
 ></TD
@@ -59,7 +59,7 @@ WIDTH="10%"
 ALIGN="right"
 VALIGN="bottom"
 ><A
-HREF="p1043.html"
+HREF="p1052.html"
 ACCESSKEY="N"
 >Next</A
 ></TD
@@ -70,7 +70,7 @@ ALIGN="LEFT"
 WIDTH="100%"></DIV
 ><H1
 ><A
-NAME="AEN985"
+NAME="AEN994"
 ></A
 >site-lib</H1
 ><DIV
@@ -84,7 +84,7 @@ NAME="SITE-LIB"
 ><DIV
 CLASS="REFSYNOPSISDIV"
 ><A
-NAME="AEN993"
+NAME="AEN1002"
 ></A
 ><H2
 >STANDARD LAYOUT</H2
@@ -140,7 +140,7 @@ CLASS="REPLACEABLE"
 ><DIV
 CLASS="REFSECT1"
 ><A
-NAME="AEN1001"
+NAME="AEN1010"
 ></A
 ><H2
 >DESCRIPTION</H2
@@ -157,7 +157,7 @@ CLASS="LITERAL"
 >destdir</TT
 > (used to install new packages);
 see <A
-HREF="r796.html#FINDLIB.CONF"
+HREF="r798.html#FINDLIB.CONF"
 >findlib.conf</A
 >.</P
 ><P
@@ -212,7 +212,7 @@ installation or removal of a package, respectively.</P
 ><DIV
 CLASS="REFSECT1"
 ><A
-NAME="AEN1018"
+NAME="AEN1027"
 ></A
 ><H2
 >ALTERNATE LAYOUT</H2
@@ -350,7 +350,7 @@ WIDTH="33%"
 ALIGN="left"
 VALIGN="top"
 ><A
-HREF="r796.html"
+HREF="r798.html"
 ACCESSKEY="P"
 >Prev</A
 ></TD
@@ -368,7 +368,7 @@ WIDTH="33%"
 ALIGN="right"
 VALIGN="top"
 ><A
-HREF="p1043.html"
+HREF="p1052.html"
 ACCESSKEY="N"
 >Next</A
 ></TD
diff --git a/doc/ref-man/META.5 b/doc/ref-man/META.5
index 532322b..bb427ac 100644
--- a/doc/ref-man/META.5
+++ b/doc/ref-man/META.5
@@ -409,7 +409,33 @@ in the package directory. The special forms as defined for 
"archive"\c
 \&  
 are also available (e.g. @otherpkg/cmd). Additional arguments can be\c
 \&  
-specified on the ocamlfind command line with the -ppxopt option.\c
+specified on the ocamlfind command line with the -ppxopt option\c
+\&  
+or the "ppxopt" variable.\c
+.RE
+.ft R
+.sp
+.RS "7m"
+.ft R
+\&\h'-3m'\z\(bu\h'3m'\c
+.ft R
+The variable "ppxopt" is a set of options that are added to the ppx\c
+\&  
+rewriter invocation. The contents of the variable consists of one or\c
+\&  
+several whitespace-separated parts. Every part consists of several\c
+\&  
+comma-separated subparts; the first subpart indicates the package\c
+\&  
+that contains the ppx rewriter invocation, the rest contain the options\c
+\&  
+to be appended. If the option is a path relative to the current directory\c
+\&  
+(e.g. ./foo.cma), the path is expanded relative to the package directory.\c
+\&  
+The special forms as defined for "archive" are also available\c
+\&  
+(e.g. @otherpkg/foo.cma).\c
 .RE
 .ft R
 .PP
diff --git a/doc/ref-man/findlib.conf.5 b/doc/ref-man/findlib.conf.5
index ae15b98..4ecbf5a 100644
--- a/doc/ref-man/findlib.conf.5
+++ b/doc/ref-man/findlib.conf.5
@@ -541,6 +541,29 @@ This variable overrides the location of the configuration 
file\c
 .ft R
 .RS "2m"
 .ft R
+OCAMLFIND_TOOLCHAIN\c
+.RE
+.ft R
+.sp
+.RS "7m"
+.ft R
+.ft R
+This variable sets the currently selected toolchain when\c
+\&  
+\& a 
+-toolchain\c
+\& option is not passed\c
+\&  
+\& on the command line.\c
+\&  
+\&  
+.RE
+.ft R
+.PP
+.ft R
+.ft R
+.RS "2m"
+.ft R
 OCAMLPATH\c
 .RE
 .ft R
diff --git a/doc/src/findlib_conf.mod b/doc/src/findlib_conf.mod
index 14cbd12..2b2fd72 100644
--- a/doc/src/findlib_conf.mod
+++ b/doc/src/findlib_conf.mod
@@ -315,6 +315,18 @@ findlib/ocamlfind:
 
 <variablelist>
 <varlistentry>
+  <term><literal>OCAMLFIND_TOOLCHAIN</literal></term>
+  <listitem><para>
+    This variable sets the currently selected toolchain when
+    a <literal>-toolchain</literal> option is not passed
+    on the command line.
+  </para>
+  </listitem>
+</varlistentry>
+</variablelist>
+
+<variablelist>
+<varlistentry>
   <term><literal>OCAMLPATH</literal></term>
   <listitem><para>
     This variable may contain an additional search path for package
diff --git a/doc/src/findlib_meta.mod b/doc/src/findlib_meta.mod
index 23e0fda..0bc094b 100644
--- a/doc/src/findlib_meta.mod
+++ b/doc/src/findlib_meta.mod
@@ -268,7 +268,22 @@ via the -ppx option (available since OCaml-4.01). If the 
command is
 relative to the current directory (e.g. ./cmd), the command is expected
 in the package directory. The special forms as defined for "archive"
 are also available (e.g. @otherpkg/cmd). Additional arguments can be
-specified on the ocamlfind command line with the -ppxopt option.
+specified on the ocamlfind command line with the -ppxopt option
+or the "ppxopt" variable.
+</para>
+</listitem>
+
+<listitem>
+<para>
+The variable "ppxopt" is a set of options that are added to the ppx
+rewriter invocation. The contents of the variable consists of one or
+several whitespace-separated parts. Every part consists of several
+comma-separated subparts; the first subpart indicates the package
+that contains the ppx rewriter invocation, the rest contain the options
+to be appended. If the option is a path relative to the current directory
+(e.g. ./foo.cma), the path is expanded relative to the package directory.
+The special forms as defined for "archive" are also available
+(e.g. @otherpkg/foo.cma).
 </para>
 </listitem>
 
diff --git a/doc/src/findlib_reference.xml b/doc/src/findlib_reference.xml
index d26fca7..aaa027d 100644
--- a/doc/src/findlib_reference.xml
+++ b/doc/src/findlib_reference.xml
@@ -1386,7 +1386,18 @@ via the -ppx option (available since OCaml-4.01). If the 
command is
 relative to the current directory (e.g. ./cmd), the command is expected
 in the package directory. The special forms as defined for "archive"
 are also available (e.g. @otherpkg/cmd). Additional arguments can be
-specified on the ocamlfind command line with the -ppxopt 
option.</PARA></LISTITEM></ITEMIZEDLIST><PARA
+specified on the ocamlfind command line with the -ppxopt option
+or the "ppxopt" variable.</PARA></LISTITEM><LISTITEM
+><PARA
+>The variable "ppxopt" is a set of options that are added to the ppx
+rewriter invocation. The contents of the variable consists of one or
+several whitespace-separated parts. Every part consists of several
+comma-separated subparts; the first subpart indicates the package
+that contains the ppx rewriter invocation, the rest contain the options
+to be appended. If the option is a path relative to the current directory
+(e.g. ./foo.cma), the path is expanded relative to the package directory.
+The special forms as defined for "archive" are also available
+(e.g. @otherpkg/foo.cma).</PARA></LISTITEM></ITEMIZEDLIST><PARA
 >It is possible to define additional variables but there is currently
 no software interpreting them.</PARA></REFSECT1><REFSECT1
 ><TITLE
@@ -1720,6 +1731,20 @@ MOREINFO="NONE"
 ><TERM
 ><LITERAL
 MOREINFO="NONE"
+>OCAMLFIND_TOOLCHAIN</LITERAL></TERM><LISTITEM
+><PARA
+>    This variable sets the currently selected toolchain when
+    a <LITERAL
+MOREINFO="NONE"
+>-toolchain</LITERAL> option is not passed
+    on the command line.
+  </PARA></LISTITEM></VARLISTENTRY></VARIABLELIST>
+
+<VARIABLELIST
+><VARLISTENTRY
+><TERM
+><LITERAL
+MOREINFO="NONE"
 >OCAMLPATH</LITERAL></TERM><LISTITEM
 ><PARA
 >    This variable may contain an additional search path for package
diff --git a/itest-aux/ppx.ml b/itest-aux/ppx.ml
new file mode 100644
index 0000000..73ce200
--- /dev/null
+++ b/itest-aux/ppx.ml
@@ -0,0 +1 @@
+Toploop.preprocess_phrase;;
diff --git a/src/findlib/Makefile b/src/findlib/Makefile
index 31282e6..5466d95 100644
--- a/src/findlib/Makefile
+++ b/src/findlib/Makefile
@@ -70,6 +70,17 @@ findlib_config.ml: findlib_config.mlp $(TOP)/Makefile.config
                    -e 's;@SYSTEM@;$(SYSTEM);g' \
                     >findlib_config.ml
 
+topfind.ml: topfind.ml.in
+       if [ "$(ENABLE_TOPFIND_PPXOPT)" = "true" ]; then                 \
+               cp topfind.ml.in topfind.ml;                             \
+       else                                                             \
+               sed -e '/PPXOPT_BEGIN/,/PPXOPT_END/{d}' topfind.ml.in    \
+                       > topfind.ml ;                                   \
+       fi
+
+topfind.cmo: topfind.cmi
+topfind.cmx: topfind.cmi
+
 topfind: topfind_rd$(OCAML_REMOVE_DIRECTORY).p
        USE_CYGPATH="$(USE_CYGPATH)"; \
        export USE_CYGPATH; \
@@ -82,9 +93,8 @@ num_top.cma: $(NUMTOP_OBJECTS)
 
 clean:
        rm -f *.cmi *.cmo *.cma *.cmx *.a *.o *.cmxa \
-         fl_meta.ml findlib_config.ml findlib.mml topfind \
+         fl_meta.ml findlib_config.ml findlib.mml topfind.ml topfind \
          ocamlfind$(EXEC_SUFFIX) ocamlfind_opt$(EXEC_SUFFIX)
-       #rm -f ocaml_args.ml
 
 install: all
        mkdir -p "$(prefix)$(OCAML_SITELIB)/$(NAME)"
@@ -118,7 +128,7 @@ depend: *.ml *.mli fl_meta.ml fl_metascanner.ml
 
 # Some 'make' implementations require that .SUFFIXES must occur before
 # the first suffix rule. (E.g. AIX)
-.SUFFIXES: .mll .cmo .cmi .cmx .ml .mli .mml 
+.SUFFIXES: .mll .cmo .cmi .cmx .ml .mli .mml
 # .src
 
 .mml.cmo:
diff --git a/src/findlib/findlib.ml b/src/findlib/findlib.ml
index fd6d0fa..b8fd035 100644
--- a/src/findlib/findlib.ml
+++ b/src/findlib/findlib.ml
@@ -1,4 +1,4 @@
-(* $Id: findlib.ml 225 2014-07-15 22:44:36Z gerd $
+(* $Id: findlib.ml 241 2014-10-14 09:55:08Z gerd $
  * ----------------------------------------------------------------------
  *
  *)
@@ -136,7 +136,7 @@ let init
 
   let config_preds =
     match toolchain with
-      | None -> []
+      | None -> (try [Sys.getenv "OCAMLFIND_TOOLCHAIN"] with Not_found -> [])
       | Some p -> [p] in
 
   let sys_ocamlc, sys_ocamlopt, sys_ocamlcp, sys_ocamloptp, sys_ocamlmklib,
diff --git a/src/findlib/frontend.ml b/src/findlib/frontend.ml
index 2b44f11..3a4094e 100644
--- a/src/findlib/frontend.ml
+++ b/src/findlib/frontend.ml
@@ -1,4 +1,4 @@
-(* $Id: frontend.ml 231 2014-09-06 18:03:16Z gerd $
+(* $Id: frontend.ml 239 2014-10-14 09:39:42Z gerd $
  * ----------------------------------------------------------------------
  *
  *)
@@ -551,7 +551,7 @@ let process_ppx_spec predicates packages ppx_opts =
     package_deep_ancestors predicates packages in
 
   let ppx_opts =
-    List.map 
+    List.map
       (fun opt ->
          match Fl_split.in_words opt with
            | pkg :: ((_ :: _) as opts) ->
@@ -559,25 +559,60 @@ let process_ppx_spec predicates packages ppx_opts =
                  try ignore(package_directory pkg); true
                  with No_such_package _ -> false in
                if not exists then
-                 failwith ("The package named in -ppxopt does not exist: " ^ 
+                 failwith ("The package named in -ppxopt does not exist: " ^
                              pkg);
                pkg, opts
-           | _ -> 
+           | _ ->
                failwith "-ppxopt must include package name, e.g. -ppxopt 
\"foo,-name bar\""
       )
       ppx_opts in
 
+  let meta_ppx_opts =
+    List.concat
+      (List.map
+        (fun pname ->
+          try
+            let opts = package_property predicates pname "ppxopt" in
+            (* Split by whitespace to get (package,options) combinations.
+               Then, split by commas to get individual options. *)
+            List.map
+              (fun opts ->
+                match Fl_split.in_words opts with
+                | pkg :: ((_ :: _) as opts) ->
+                    let exists =
+                      try ignore(package_directory pkg); true
+                      with No_such_package _ -> false in
+                    if not exists then
+                      failwith ("The package named in ppxopt variable does not 
exist: " ^
+                                  pkg ^ " (from " ^ pname ^ ")");
+                    let base = package_directory pname in
+                    pkg, List.map (resolve_path ~base ~explicit:true) opts
+                | _ ->
+                    failwith ("ppxopt variable must include package name, e.g. 
" ^
+                              "ppxopt=\"foo,-name bar\" (from " ^ pname ^ ")")
+              )
+              (Fl_split.in_words_ws opts)
+          with Not_found -> []
+        )
+        ppx_packages
+      ) in
+
   List.flatten
-    (List.map 
+    (List.map
        (fun pname ->
           let base = package_directory pname in
           let options =
-            try  List.assoc pname ppx_opts
-            with Not_found -> [] in
+            try
+              List.concat
+                (List.map (fun (_, opts) -> opts)
+                  (List.filter (fun (pname', _) -> pname' = pname)
+                    (meta_ppx_opts @ ppx_opts)))
+            with Not_found -> []
+          in
           try
             let preprocessor =
               resolve_path
-                ~base ~explicit:true 
+                ~base ~explicit:true
                 (package_property predicates pname "ppx") in
             ["-ppx"; String.concat " " (preprocessor :: options)]
           with Not_found -> []
diff --git a/src/findlib/topfind.ml b/src/findlib/topfind.ml.in
similarity index 78%
rename from src/findlib/topfind.ml
rename to src/findlib/topfind.ml.in
index b96064e..caaabdd 100644
--- a/src/findlib/topfind.ml
+++ b/src/findlib/topfind.ml.in
@@ -1,4 +1,4 @@
-(* $Id: topfind.ml 225 2014-07-15 22:44:36Z gerd $
+(* $Id: topfind.ml.in 239 2014-10-14 09:39:42Z gerd $
  * ----------------------------------------------------------------------
  *
  *)
@@ -47,6 +47,18 @@ let add_dir d =
   end
 ;;
 
+let exec_string s =
+  let l = Lexing.from_string s in
+  let ph = !Toploop.parse_toplevel_phrase l in
+(* PPXOPT_BEGIN *)
+  let ph = Toploop.preprocess_phrase Format.err_formatter ph in
+(* PPXOPT_END *)
+  let fmt = Format.make_formatter (fun _ _ _ -> ()) (fun _ -> ()) in
+  try
+    Toploop.execute_phrase false fmt ph
+  with
+      _ -> false
+;;
 
 let load pkglist =
   List.iter
@@ -81,22 +93,58 @@ let load pkglist =
                      (Findlib.package_property !predicates pkg "ppx")
                   )
             with Not_found -> None
-          in
+          and ppxopts =
+            try
+              List.map
+                (fun opt ->
+                   match Fl_split.in_words opt with
+                     | pkg :: opts ->
+                          pkg, 
+                          List.map
+                            (Findlib.resolve_path ~base:d ~explicit:true) opts
+                     | _ -> assert false)
+                (Fl_split.in_words_ws
+                   (Findlib.package_property !predicates pkg "ppxopt"))
+            with Not_found -> []          in
           (* Feed the 'ppx' property into the toplevel. To remain compatible
              with pre-4.01 OCaml, construct and execute a phrase instead of 
directly
              altering Clflags. *)
-          match ppx with
+          begin match ppx with
             | Some ppx ->
+
+
                  begin try
                      match Hashtbl.find Toploop.directive_table "ppx" with
                        | Toploop.Directive_string fn -> 
                             fn ppx; !log (ppx ^ ": activated")
                        | _ -> assert false
                    with Not_found ->
-                     failwith "Package defines a ppx preprocessor, but OCaml 
does not support \
-                               the #ppx directive. Use OCaml >=4.02."
+                     failwith "Package defines a ppx preprocessor, but OCaml 
is too old. \
+                               Use OCaml >= 4.02.0 for ppx support."
                  end
             | None -> ()
+          end;
+          (* Feed the 'ppxopt' property into the toplevel. *)
+          match ppxopts with
+            | [] -> ()
+            | _ ->
+(* PPXOPT_BEGIN *)
+                 List.iter
+                   (fun (pkg, opts) ->
+                      ignore (exec_string ("[@@@findlib.ppxopt " ^
+                        (String.concat ", "
+                          (List.map (Printf.sprintf "%S") (pkg :: opts))) ^
+                          "];;"));
+                      !log (pkg ^ ": " ^ (String.concat " " opts) ^ 
+                              ": option added"))
+                   ppxopts
+(*
+(* PPXOPT_END *)
+                failwith "Package defines a ppx preprocessor option, but OCaml 
is too old. \
+                          Use OCaml >=4.02.1 for ppxopt support."
+(* PPXOPT_BEGIN *)
+*)
+(* PPXOPT_END *)
         end;
        (* The package is loaded: *)
        loaded := pkg :: !loaded

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-ocaml-maint/packages/findlib.git

_______________________________________________
Pkg-ocaml-maint-commits mailing list
Pkg-ocaml-maint-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-ocaml-maint-commits

Reply via email to