Hey there everyone. I have a perl module up on CPAN right now, that is an XS module written in C++. It works great for me and anyone of the Unixy persuasion (save cygwin for some reason). My problem is, I don't know how to tell ExtUtils::MakeMaker to simply use "any c++ compiler". Right now it's hardcoded to use g++, but I know that kills win32 users of the module. (There's also a CPAN tester failure saying as much).

The module is here, IP::Unique. The Makefile.PL script is:
use 5.005; use ExtUtils::MakeMaker; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. my $mod = my $pm = "IP::Unique"; $pm =~ s/::/\//g; $pm = "lib/$pm.pm"; + unless(-e "CHANGES") { open CHANGES,">>CHANGES"; print CHANGES "Temp CHANGES file\n"; close CHANGES; } my $CC = "g++"; WriteMakefile( NAME => $mod, VERSION_FROM => $pm, # finds $VERSION PREREQ_PM => {}, # e.g., Module::Name => 1.1 ($] >= 5.005 ? ## Add these new keywords supported since 5.005 (ABSTRACT_FROM => $pm, # retrieve abstract from module AUTHOR => 'Jay Bonci <jaybonci@cpan.org>') : ()), CC => $CC, CCFLAGS => "-Wall", LD => '$(CC)', LIBS => [''], # e.g., '-lm' DEFINE => '', # e.g., '-DHAVE_SOMETHING' INC => '-I.', XSOPT => '-C++', OBJECT => '$(O_FILES)', # link all the C files too 'dist' => { #Auto-generate the CHANGES file PREOP => "podselect $pm -section CHANGES | pod2text -w 1000 -i + 5 | perl -pe \"s/^\s+(Version.*)/\$1/g;\" > CHANGES", }, );
Basically, I wish XSOPTS was smarter, or 'CC' was a smarter variable. Is there an Win32 or general $ENV thing I can pull for this, or is there a good c++ xs module that would serve as an example. Thanks.


    --jaybonci

In reply to Makefile.pl for a C++ XS module... How to make windows happy? by JayBonci

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.