From de38b807952a868b2c5dc0071ed6342604db559f Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 25 Apr 2016 11:54:17 -0500 Subject: [PATCH] Apply partial solution for Windows builds of Cap5 --- src/ca/client/perl/Cap5.xs | 18 ++++++++++++++---- src/ca/client/perl/perlConfig.pl | 9 +++++++-- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/ca/client/perl/Cap5.xs b/src/ca/client/perl/Cap5.xs index 287c1826c..e519198ec 100644 --- a/src/ca/client/perl/Cap5.xs +++ b/src/ca/client/perl/Cap5.xs @@ -1138,6 +1138,20 @@ void CA_add_exception_event(const char *class, SV *sub) { static SV * printf_sub = NULL; +#ifndef va_copy +# ifdef __GNUC__ +# define va_copy(d, s) __va_copy(d, s) +# else +# define va_copy(d, s) ((d) = (s)) +/* The above macro is NOT PORTABLE but works on Windows when + * stdarg.h doesn't provide va_copy(). Some architectures need + * define va_copy(d, s) ((*d) = (*s)) + * while others may be even more complicated, but hopefully the + * system stdarg.h header defines va_copy() in those cases. + */ +# endif +#endif + static int printf_handler(const char *format, va_list args) { if (! printf_sub) @@ -1152,11 +1166,7 @@ int printf_handler(const char *format, va_list args) { ENTER; SAVETMPS; -#ifdef __GNUC__ - __va_copy(argcopy, args); -#else va_copy(argcopy, args); -#endif printf_str = NEWSV(0, strlen(format) + 32); sv_vsetpvf(printf_str, format, &argcopy); diff --git a/src/ca/client/perl/perlConfig.pl b/src/ca/client/perl/perlConfig.pl index 01b9b9fdd..21d444049 100644 --- a/src/ca/client/perl/perlConfig.pl +++ b/src/ca/client/perl/perlConfig.pl @@ -3,7 +3,12 @@ # This script is used to extract information about the Perl build # configuration, so the EPICS build system uses the same settings. +use strict; use Config; -my $arg = shift; -print $Config{$arg}; +my $val = $Config{shift}; + +$val =~ s{\\}{/}go + if $^O eq 'MSWin32'; + +print $val;