On 02/12/2009 23:38, Howard B. Golden wrote:
On Wednesday December 2, 2009, I wrote:
On Wednesday December 2, 2009, Simon Marlow wrote:

Can we rely on the availability of regex.h and POSIX regexes?  Does
  this need a configure test?

I don't know the answer to this. Isn't POSIX part of the baseline
assumption? If not, I would need some help with the autoconf changes,
since I haven't done any before.

Googling this subject, I came across Jan Wolter's "Unix Incompatibility
Notes: Regular Expression Libraries" (see
http://unixpapa.com/incnote/regex.html). Wolter's advice is:

"All Unix systems seem to have some form of regular expression parsing
library that can be invoked from C programs, however they are not very
compatible with each other. Both the regular expression syntax and C-
language API vary considerably.

"The best solution for programmers wishing to use regular expression
routines in portable C programs is probably not to depend on the regular
expression libraries that may be found on the host computer, but to
include a copy of Henry Spencer's implementation of the POSIX 1003.2
standard (http://arglist.com/regex/) or Philip Hazel's Perl-Compatible
Regular Expression Library (http://arglist.com/regex/) in your
distribution. This is what Apache, MSQL and many other packages do. The
copyright terms on for these libraries are liberal enough so that almost
anyone should be able to make use of them, and both packages work well."

This advice seems reasonable to me. (Perhaps one of these libraries is
already being included in GHC? If so, that is what I will use.)
Otherwise, I think either would work fine for my minimal use.

Please give me feedback on how to deal with this. Thanks.

We don't have a regex library included with GHC, and I think adding one would be overkill just to solve this problem. Regex support is part of POSIX (1003.1-2001), but you should be careful to stick to the POSIX parts of the spec and not use e.g. GNU extensions (I haven't checked whether your patch does this or not).

http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap09.html

Note that this won't be available on Windows, but since the linker script support is inside #ifdef OBJFORMAT_ELF that shouldn't be a problem.

It would be good to add tests to the autoconf script too, but it's not absolutely necessary. We do assume POSIX on non-Windows systems.

Cheers,
        Simon

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to