This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix bug in #7157 (s/cflags/ccflags); moved the -o foo
authorJarkko Hietaniemi <jhi@iki.fi>
Fri, 6 Oct 2000 18:20:35 +0000 (18:20 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Fri, 6 Oct 2000 18:20:35 +0000 (18:20 +0000)
as the first option of cc/ld because of ultrapicky compilers
(e.g. OS/390 R2.5)

p4raw-id: //depot/metaconfig@7160

U/compline/Compile.U
U/compline/Csym.U
U/compline/ccflags.U
U/compline/orderlib.U
U/modified/Cppsym.U
U/modified/d_access.U
U/modified/d_getpgrp.U [new file with mode: 0644]
U/modified/d_setpgrp.U [new file with mode: 0644]
U/perl/Checkcc.U
U/perl/d_dlsymun.U
U/perl/gccvers.U

index 4cbff5c..9464551 100644 (file)
 compile='
 mc_file=$1;
 shift;
-$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
+$cc -o ${mc_file} $optimize $ccflags $ldflags$* ${mc_file}.c $libs > /dev/null 2>&1;'
 : define a shorthand compile call for compilations that should be ok.
 compile_ok='
 mc_file=$1;
 shift;
-$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
+$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
 
index d46c34f..12d0318 100644 (file)
@@ -80,7 +80,7 @@ yes)
 ?X: trick is obsoleted by future gcc releases). -- RAM
 ?X:
                echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
-               if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
+               if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
                then tval=true;
                else tval=false;
                fi;
index 94f404c..4943c58 100644 (file)
@@ -377,7 +377,7 @@ $cat > try.c <<'EOF'
 int main() { printf("Ok\n"); exit(0); }
 EOF
 ?X: Strip extra blanks in case some of the following variables are empty
-set X $cc $optimize $ccflags -o try $ldflags try.c $libs
+set X $cc -o try $optimize $ccflags $ldflags try.c $libs
 shift
 $cat >try.msg <<'EOM'
 I've tried to compile and run the following simple program:
@@ -406,7 +406,7 @@ dflt=y
 ?X: output buffers don't get flushed and we don't see any output
 ?X: when run from within `backticks`.  What fun.  
 ?X: --Andy Dougherty 2/13/1998
-if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
+if sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
        if sh -c './try' >>try.msg 2>&1; then
                xxx=`./try`
                case "$xxx" in
index adfd339..ef51f85 100644 (file)
@@ -56,13 +56,13 @@ $cc $ccflags -c bar1.c >/dev/null 2>&1
 $cc $ccflags -c bar2.c >/dev/null 2>&1
 $cc $ccflags -c foo.c >/dev/null 2>&1
 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
-if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
+if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
        ./foobar >/dev/null 2>&1; then
        echo "$ar appears to generate random libraries itself."
        orderlib=false
        ranlib=":"
 elif $ar ts bar$_a >/dev/null 2>&1 &&
-       $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
+       $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
        ./foobar >/dev/null 2>&1; then
                echo "a table of contents needs to be added with '$ar ts'."
                orderlib=false
index 258c597..242212a 100644 (file)
@@ -203,7 +203,7 @@ case "$osname-$gccversion" in
 irix-) ccflags="\$ccflags -woff 1178" ;;
 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
 esac
-$cc $optimize \$ccflags $ldflags -o try try.c $libs && ./try$exe_ext
+$cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
 EOSH
 chmod +x Cppsym.try
 $eunicefix Cppsym.try
index 87b0973..8e405c2 100644 (file)
@@ -53,16 +53,16 @@ int main() {
 EOCP
        : check sys/file.h first, no particular reason here
        if $test `./findhdr sys/file.h` && \
-               $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
+               $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
                h_sysfile=true;
                echo "<sys/file.h> defines the *_OK access constants." >&4
        elif $test `./findhdr fcntl.h` && \
-               $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
+               $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
                h_fcntl=true;
                echo "<fcntl.h> defines the *_OK access constants." >&4
 @if I_UNISTD
        elif $test `./findhdr unistd.h` && \
-               $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
+               $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
                echo "<unistd.h> defines the *_OK access constants." >&4
 @end
        else
diff --git a/U/modified/d_getpgrp.U b/U/modified/d_getpgrp.U
new file mode 100644 (file)
index 0000000..5ae7b21
--- /dev/null
@@ -0,0 +1,105 @@
+?RCS: $Id: d_getpgrp.U,v 3.0.1.1 1997/02/28 15:34:28 ram Exp $
+?RCS:
+?RCS: Copyright (c) 1991-1993, Raphael Manfredi
+?RCS: 
+?RCS: You may redistribute only under the terms of the Artistic Licence,
+?RCS: as specified in the README file that comes with the distribution.
+?RCS: You may reuse parts of this distribution only within the terms of
+?RCS: that same Artistic Licence; a copy of which may be found at the root
+?RCS: of the source tree for dist 3.0.
+?RCS:
+?RCS: $Log: d_getpgrp.U,v $
+?RCS: Revision 3.0.1.1  1997/02/28  15:34:28  ram
+?RCS: patch61: new USE_BSD_GETPGRP to detect the getpgrp() flavour
+?RCS:
+?RCS: Revision 3.0  1993/08/18  12:06:15  ram
+?RCS: Baseline for dist 3.0 netwide release.
+?RCS:
+?MAKE:d_getpgrp d_bsdgetpgrp: Guess Inlibc Setvar cat rm \
+       +cc +ccflags +ldflags +libs i_unistd
+?MAKE: -pick add $@ %<
+?S:d_getpgrp:
+?S:    This variable conditionally defines HAS_GETPGRP if getpgrp() is
+?S:    available to get the current process group.
+?S:.
+?S:d_bsdgetpgrp:
+?S:    This variable conditionally defines USE_BSD_GETPGRP if
+?S:    getpgrp needs one arguments whereas USG one needs none.
+?S:.
+?C:HAS_GETPGRP (GETPGRP):
+?C:    This symbol, if defined, indicates that the getpgrp routine is
+?C:    available to get the current process group.
+?C:.
+?C:USE_BSD_GETPGRP:
+?C:    This symbol, if defined, indicates that getpgrp needs one
+?C:    arguments whereas USG one needs none.
+?C:.
+?H:#$d_getpgrp HAS_GETPGRP             /**/
+?H:#$d_bsdgetpgrp USE_BSD_GETPGRP      /**/
+?H:.
+?T:xxx
+?LINT:set d_getpgrp d_bsdgetpgrp
+: see if getpgrp exists
+set getpgrp d_getpgrp
+eval $inlibc
+
+@if USE_BSD_GETPGRP || d_bsdgetpgrp
+case "$d_getpgrp" in
+"$define")
+       echo " "
+       echo "Checking to see which flavor of getpgrp is in use..."
+       $cat >set.c <<EOP
+#$i_unistd I_UNISTD
+#include <sys/types.h>
+#ifdef I_UNISTD
+#  include <unistd.h>
+#endif
+int main()
+{
+       if (getuid() == 0) {
+               printf("(I see you are running Configure as super-user...)\n");
+               setuid(1);
+       }
+#ifdef TRY_BSD_PGRP
+       if (getpgrp(1) == 0)
+               exit(0);
+#else
+       if (getpgrp() > 0)
+               exit(0);
+#endif
+       exit(1);
+}
+EOP
+       if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
+               echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
+               val="$define"
+       elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
+               echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
+               val="$undef"
+       else
+               echo "I can't seem to compile and run the test program."
+               if ./usg; then
+                       xxx="a USG one, i.e. you use getpgrp()."
+               else
+                       # SVR4 systems can appear rather BSD-ish.
+                       case "$i_unistd" in
+                       $undef)
+                               xxx="a BSD one, i.e. you use getpgrp(pid)."
+                               val="$define"
+                               ;;
+                       $define)
+                               xxx="probably a USG one, i.e. you use getpgrp()."
+                               val="$undef"
+                               ;;
+                       esac
+               fi
+               echo "Assuming your getpgrp is $xxx" >&4
+       fi
+       ;;
+*) val="$undef";;
+esac
+set d_bsdgetpgrp
+eval $setvar
+$rm -f set set.c
+@end
+
diff --git a/U/modified/d_setpgrp.U b/U/modified/d_setpgrp.U
new file mode 100644 (file)
index 0000000..dc7a4af
--- /dev/null
@@ -0,0 +1,115 @@
+?RCS: $Id: d_setpgrp.U,v 3.0.1.3 1997/02/28 15:44:16 ram Exp $
+?RCS:
+?RCS: Copyright (c) 1991-1993, Raphael Manfredi
+?RCS: 
+?RCS: You may redistribute only under the terms of the Artistic Licence,
+?RCS: as specified in the README file that comes with the distribution.
+?RCS: You may reuse parts of this distribution only within the terms of
+?RCS: that same Artistic Licence; a copy of which may be found at the root
+?RCS: of the source tree for dist 3.0.
+?RCS:
+?RCS: $Log: d_setpgrp.U,v $
+?RCS: Revision 3.0.1.3  1997/02/28  15:44:16  ram
+?RCS: patch61: obsoleted USE_BSDGRP in favor of USE_BSD_SETPGRP
+?RCS: patch61: another unit now also defines a USE_BSD_GETPGRP
+?RCS: patch61: fallback for test program failure improved
+?RCS:
+?RCS: Revision 3.0.1.2  1995/07/25  13:59:30  ram
+?RCS: patch56: re-arranged compile line to include ldflags before objects
+?RCS:
+?RCS: Revision 3.0.1.1  1994/10/29  16:15:37  ram
+?RCS: patch36: added 'ldflags' to the test compile line (ADO)
+?RCS: patch36: call ./usg explicitely instead of relying on PATH
+?RCS:
+?RCS: Revision 3.0  1993/08/18  12:07:09  ram
+?RCS: Baseline for dist 3.0 netwide release.
+?RCS:
+?MAKE:d_setpgrp d_bsdsetpgrp: cat rm +cc +libs +ccflags \
+       +ldflags Inlibc Guess Setvar i_unistd
+?MAKE: -pick add $@ %<
+?S:d_setpgrp:
+?S:    This variable conditionally defines HAS_SETPGRP if setpgrp() is
+?S:    available to set the current process group.
+?S:.
+?S:d_bsdsetpgrp (d_bsdpgrp):
+?S:    This variable conditionally defines USE_BSD_SETPGRP if
+?S:    setpgrp needs two arguments whereas USG one needs none.
+?S:    See also d_setpgid for a POSIX interface.
+?S:.
+?C:HAS_SETPGRP (SETPGRP):
+?C:    This symbol, if defined, indicates that the setpgrp routine is
+?C:    available to set the current process group.
+?C:.
+?C:USE_BSD_SETPGRP (USE_BSDPGRP BSDPGRP):
+?C:    This symbol, if defined, indicates that setpgrp needs two
+?C:    arguments whereas USG one needs none.  See also HAS_SETPGID
+?C:    for a POSIX interface.
+?C:.
+?H:#$d_setpgrp HAS_SETPGRP             /**/
+?H:#$d_bsdsetpgrp USE_BSD_SETPGRP      /**/
+?H:.
+?T:xxx
+?LINT:set d_setpgrp d_bsdsetpgrp
+: see if setpgrp exists
+set setpgrp d_setpgrp
+eval $inlibc
+
+@if USE_BSD_SETPGRP || d_bsdsetpgrp
+case "$d_setpgrp" in
+"$define")
+       echo " "
+       echo "Checking to see which flavor of setpgrp is in use..."
+       $cat >set.c <<EOP
+#$i_unistd I_UNISTD
+#include <sys/types.h>
+#ifdef I_UNISTD
+#  include <unistd.h>
+#endif
+int main()
+{
+       if (getuid() == 0) {
+               printf("(I see you are running Configure as super-user...)\n");
+               setuid(1);
+       }
+#ifdef TRY_BSD_PGRP
+       if (-1 == setpgrp(1, 1))
+               exit(0);
+#else
+       if (setpgrp() != -1)
+               exit(0);
+#endif
+       exit(1);
+}
+EOP
+       if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
+               echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
+               val="$define"
+       elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
+               echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
+               val="$undef"
+       else
+               echo "(I can't seem to compile and run the test program.)"
+               if ./usg; then
+                       xxx="a USG one, i.e. you use setpgrp()."
+               else
+                       # SVR4 systems can appear rather BSD-ish.
+                       case "$i_unistd" in
+                       $undef)
+                               xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
+                               val="$define"
+                               ;;
+                       $define)
+                               xxx="probably a USG one, i.e. you use setpgrp()."
+                               val="$undef"
+                               ;;
+                       esac
+               fi
+               echo "Assuming your setpgrp is $xxx" >&4
+       fi
+       ;;
+*) val="$undef";;
+esac
+set d_bsdsetpgrp
+eval $setvar
+$rm -f set set.c
+@end
index e7e85a3..504f149 100644 (file)
@@ -41,7 +41,7 @@ int main(int argc, char *argv[]) {
   return 0;
 }
 EOM
-    if $cc $cflags -o try try.c; then
+    if $cc -o try $ccflags try.c; then
        :
     else
         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
index 75f1e72..16b4162 100644 (file)
@@ -88,8 +88,8 @@ EOM
        : Call the object file tmp-dyna.o in case dlext=o.
        if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
                mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
-               $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
-               $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
+               $ld -o dyna.$dlext $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
+               $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
                xxx=`./fred`
                case $xxx in
                1)      echo "Test program failed using dlopen." >&4
index 899abb6..ebdf07b 100644 (file)
@@ -44,7 +44,7 @@ int main() {
        exit(0);
 }
 EOM
-if $cc $ldflags -o gccvers gccvers.c; then
+if $cc -o gccvers $ldflags gccvers.c; then
        gccversion=`./gccvers`
        case "$gccversion" in
        '') echo "You are not using GNU cc." ;;