[pcre-dev] CMake and sundry updates

Top Pagina
Delete this message
Auteur: Daniel Richard G.
Datum:  
Aan: pcre-dev
Onderwerp: [pcre-dev] CMake and sundry updates
Hello everyone,

Attached are three patches containing several WIP changes (including my
current not-quite-yet-working CMake listfile), and a new config-cmake.h.in
file.

One change I'd like to make is for RunTest and RunGrepTest to not be
instantiated from .in files. Right now, the only value they're taking is
@top_srcdir@, so that they can locate test data in out-of-source-tree
builds. However, this is not the way; the Automake manual section "Simple
Tests" states that

    Programs needing data files should look for them in srcdir (which 
    is both an environment variable and a make variable) so they work 
    when building in a separate directory (see Build Directories), and 
    in particular for the distcheck rule (see Dist).


I've tweaked the scripts accordingly, but now we have the problem that when
pcregrep(1) returns file paths, they are expected to start with
"./testdata/", whereas my changes make the path prefix arbitrary (e.g.
"/var/tmp/pcre-7.1-RC1/testdata/").

One possible way of getting around this is to have pcregrep actually be
invoked in the source directory, and the output redirected back to the
build directory. Something like

    (cd $srcdir && $pcregrep -lr foobaz ./testdata) >>testtry


or perhaps more spread out like

    (cd $srcdir


     echo "---- Test 1 ----"


     $pcregrep -lr foobaz ./testdata


     echo "---- Test 2 ----"


     $pcregrep -lr "^blah" ./testdata


    ) >>testtry


Symlinking the testdata directory, as is currently done inside the scripts
themselves, is elegant but unworkable on non-Unix filesystems. And
ultimately, we'll need a similar solution for the RunTest.bat script, which
doesn't yet support an out-of-source-tree build configuration.


Anyway, a walk-through of the changes:


==== Patch 1 ====

== CMakeLists.txt ==

* First cut of the new listfile. Works on Unix, but not yet there on
Windows. (Linking currently fails because none of the dll{im,ex}port
stuff has been done yet.)

== Makefile.am ==

* Tweaked up the pcre_chartables.c rule again, to use $(LN_S). (Usually is
set to "ln -s", but can be "cp" on Windows, etc.)

* Eliminated the bit that generates config-cmake.h.in. This file is going
to have to be hand-maintained. I've attached a first draft of it.

== configure.ac ==

* Added AC_PROG_LN_S, which sets $(LN_S).

* Fixed a typo: s/ebcdie/ebcdic/

* Made RunTest and RunGrepTest into non-generated files.

* Moved the "rm -f pcre_chartables.c" bit into an AC_CONFIG_COMMANDS call.


==== Patch 2 ====

== Various ==

* Use #include<> instead of #include"" for pcre.h. The latter causes the
compiler to look in the same directory as the calling file (ignoring any
-I... directives, even), which is trouble if the calling file is in
$(srcdir) and pcre.h is in $(builddir). (At least this was the case in
Visual Studio.)

* Changed all the "#if [!] FOO" directives to "#if[n]def". The symbol is
either #define'd or #undef, and the #cmakedefine does not set a value of
1 in the former case.

== pcre_exec.c ==

* The Windows SDK appears to use macros named min() and max(), so we #undef
those to avoid redefinition warnings.

== pcregrep.c ==

* Windows doesn't have unistd.h :-)


==== Patch 3 ====

== RunTest.in ==

* Note: This file should be renamed to "RunTest".

* Added the bit that picks up on $srcdir.

== RunGrepTest.in ==

* Note: This file should be renamed to "RunGrepTest".

* Added the bit that picks up on $srcdir.


Philip, could you add this config-cmake.h.in to the repository?


--Daniel


-- 
NAME   = Daniel Richard G.       ##  Remember, skunks       _\|/_  meef?
EMAIL1 = skunk@???        ##  don't smell bad---    (/o|o\) /
EMAIL2 = skunk@???      ##  it's the people who   < (^),>
WWW    = http://www.******.org/  ##  annoy them that do!    /   \
--
(****** = site not yet online)

/* config.h for CMake builds */

#cmakedefine HAVE_DIRENT_H
#cmakedefine HAVE_UNISTD_H
#cmakedefine HAVE_SYS_STAT_H
#cmakedefine HAVE_SYS_TYPES_H
#cmakedefine HAVE_TYPE_TRAITS_H
#cmakedefine HAVE_BITS_TYPE_TRAITS_H

#cmakedefine HAVE_BCOPY
#cmakedefine HAVE_MEMMOVE
#cmakedefine HAVE_STRERROR

#cmakedefine SUPPORT_UTF8
#cmakedefine SUPPORT_UCP
#cmakedefine EBCDIC
#cmakedefine NO_RECURSE

#define NEWLINE            @NEWLINE@
#define POSIX_MALLOC_THRESHOLD    @PCRE_POSIX_MALLOC_THRESHOLD@
#define LINK_SIZE        @PCRE_LINK_SIZE@
#define MATCH_LIMIT        @PCRE_MATCH_LIMIT@
#define MATCH_LIMIT_RECURSION    @PCRE_MATCH_LIMIT_RECURSION@


#define MAX_NAME_SIZE    32
#define MAX_NAME_COUNT    10000
#define MAX_DUPLENGTH    30000


/* end config.h for CMake builds */