This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Backport Configure change #30897
[metaconfig.git] / U / compline / Csym.U
index 0b9f476..cdf45d2 100644 (file)
@@ -27,7 +27,7 @@
 ?RCS: Baseline for dist 3.0 netwide release.
 ?RCS:
 ?MAKE:Csym mistrustnm: Options contains libc libs runnm test \
 ?RCS: Baseline for dist 3.0 netwide release.
 ?RCS:
 ?MAKE:Csym mistrustnm: Options contains libc libs runnm test \
-       +cc +optimize +ccflags +ldflags run rm _exe
+       +cc +optimize +ccflags +ldflags run rm _exe d_cplusplus
 ?MAKE: -pick add $@ %<
 ?LINT:define csym
 ?LINT:use libc
 ?MAKE: -pick add $@ %<
 ?LINT:define csym
 ?LINT:use libc
@@ -53,7 +53,7 @@
 ?S:    "run", the test program will be run as well as being compiled.
 ?S:.
 ?V:csym
 ?S:    "run", the test program will be run as well as being compiled.
 ?S:.
 ?V:csym
-?T:tval tx tlook tf tdc
+?T:tval tx tlook tf tdc extern_C
 : is a C symbol defined?
 csym='tlook=$1;
 case "$3" in
 : is a C symbol defined?
 csym='tlook=$1;
 case "$3" in
@@ -85,17 +85,20 @@ yes)
 ?X: trick is obsoleted by future gcc releases). -- RAM
 ?X:
        tval=false;
 ?X: trick is obsoleted by future gcc releases). -- RAM
 ?X:
        tval=false;
+       case "$d_cplusplus" in
+               $define) extern_C=\"C\";;
+       esac;
        if $test "$runnm" = true; then
                if $contains $tlook $tf >/dev/null 2>&1; then
                        tval=true;
                elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
        if $test "$runnm" = true; then
                if $contains $tlook $tf >/dev/null 2>&1; then
                        tval=true;
                elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
-                       echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
+                       echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
                        $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
                        $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
                        $rm -f try$_exe try.c core core.* try.core;
                fi;
        else
                        $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
                        $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
                        $rm -f try$_exe try.c core core.* try.core;
                fi;
        else
-               echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
+               echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
                $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
                $rm -f try$_exe try.c;
        fi;
                $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
                $rm -f try$_exe try.c;
        fi;