[perl-5.005.02] detect lack of /dev/tty
[p5sagit/p5-mst-13.2.git] / Makefile.SH
index 6c8cfce..206514e 100644 (file)
@@ -1,5 +1,5 @@
 #! /bin/sh
-case $CONFIG in
+case $CONFIGDOTSH in
 '')
        if test -f config.sh; then TOP=.;
        elif test -f ../config.sh; then TOP=..;
@@ -43,12 +43,18 @@ true)
                # NeXT uses a different name.
                ldlibpth="DYLD_LIBRARY_PATH=`pwd`:$DYLD_LIBRARY_PATH"
                ;;
+       rhapsody*)
+               ldlibpth="DYLD_LIBRARY_PATH=`pwd`/Perl:$DYLD_LIBRARY_PATH"
+               ;;
        os2*)   # OS/2 doesn't need anything special for LD_LIBRARY_PATH.
                ldlibpth=''
                ;;
-       sunos*|freebsd[23]*|netbsd*)
+       sunos*)
                linklibperl="-lperl"
                ;;
+       netbsd*|freebsd[234]*)
+               linklibperl="-L. -lperl"
+               ;;
        aix*)
                shrpldflags="-H512 -T512 -bhalt:4 -bM:SRE -bE:perl.exp"
                case "$osvers" in
@@ -62,9 +68,11 @@ true)
                aixinstdir=`pwd | sed 's/\/UU$//'`
                linklibperl="-L $archlibexp/CORE -L $aixinstdir -lperl"
                ;;
-       hpux10*)
+       hpux10*|hpux11*)
                linklibperl="-L `pwd | sed 's/\/UU$//'` -Wl,+b$archlibexp/CORE -lperl"
                ;;
+       beos*)  ldlibpth="LIBRARY_PATH=`pwd`:$LIBRARY_PATH"
+               ;;
        esac
        ;;
 *)     pldlflags=''
@@ -161,7 +169,7 @@ shellflags = $shellflags
 $make_set_make
 
 # These variables may need to be manually set for non-Unix systems.
-AR = $ar
+AR = $full_ar
 EXE_EXT = $_exe
 LIB_EXT = $_a
 OBJ_EXT = $_o
@@ -200,9 +208,11 @@ shextract = Makefile cflags config.h makeaperl makedepend \
 # Files to be built with variable substitution after miniperl is
 # available.  Dependencies handled manually below (for now).
 
-pl = pod/pod2html.PL pod/pod2latex.PL pod/pod2man.PL pod/pod2text.PL
+pl = pod/pod2html.PL pod/pod2latex.PL pod/pod2man.PL pod/pod2text.PL \
+       pod/pod2usage.PL pod/podchecker.PL pod/podselect.PL
 
-plextract = pod/pod2html pod/pod2latex pod/pod2man pod/pod2text
+plextract = pod/pod2html pod/pod2latex pod/pod2man pod/pod2text \
+       pod/pod2usage pod/podchecker pod/podselect
 
 addedbyconf = UU $(shextract) $(plextract) pstruct
 
@@ -435,7 +445,7 @@ run_byacc:  FORCE
        sh $(shellflags) ./perly.fixer y.tab.c perly.c
        sed -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
            -e 's/y\.tab/perly/g' perly.c >perly.tmp && mv perly.tmp perly.c
-       echo 'extern YYSTYPE yylval;' >>y.tab.h
+       sed -e '/^extern YYSTYPE yy/D' y.tab.h >yh.tmp && mv yh.tmp y.tab.h
        cmp -s y.tab.h perly.h && rm -f y.tab.h || mv y.tab.h perly.h
        chmod 664 vms/perly_c.vms vms/perly_h.vms
        perl vms/vms_yfix.pl perly.c perly.h vms/perly_c.vms vms/perly_h.vms
@@ -451,14 +461,17 @@ perly.h: perly.y
 
 # No compat3.sym here since and including the 5.004_50.
 # No interp.sym since 5.005_03.
-SYM  = global.sym interp.sym perlio.sym thread.sym
+SYM  = global.sym globvar.sym perlio.sym pp.sym
 
-SYMH = perlvars.h thrdvar.h
+SYMH = perlvars.h intrpvar.h thrdvar.h
 
 # The following files are generated automatically
 #      keywords.h:     keywords.pl
 #      opcode.h:       opcode.pl
-#      embed.h:        embed.pl global.sym interp.sym
+#      pp_proto.h:     opcode.pl
+#      pp.sym:         opcode.pl
+#      embed.h:        embed.pl  [* needs pp.sym generated by opcode.pl! *]
+#      embedvar.h:     embed.pl  [* needs pp.sym generated by opcode.pl! *]
 #      byterun.h:      bytecode.pl
 #      byterun.c:      bytecode.pl
 #      lib/B/Asmdata.pm:       bytecode.pl
@@ -513,33 +526,34 @@ _mopup:
        rm -f *$(OBJ_EXT) *$(LIB_EXT) all perlmain.c
        rm -f perl.exp ext.libs
        -rm -f perl.export perl.dll perl.libexp perl.map perl.def
+       -rm -f perl.loadmap miniperl.loadmap perl.prelmap miniperl.prelmap
        rm -f perl suidperl miniperl $(LIBPERL)
 
 # Do not 'make _tidy' directly.
 _tidy:
-       -cd pod; $(MAKE) clean
-       -cd utils; $(MAKE) clean
-       -cd x2p; $(MAKE) clean
+       -cd pod; $(LDLIBPTH) $(MAKE) clean
+       -cd utils; $(LDLIBPTH) $(MAKE) clean
+       -cd x2p; $(LDLIBPTH) $(MAKE) clean
        -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
-       sh ext/util/make_ext clean $$x MAKE=$(MAKE) ; \
+       $(LDLIBPTH) sh ext/util/make_ext clean $$x MAKE=$(MAKE) ; \
        done
        rm -f testcompile compilelog
 
 # Do not 'make _cleaner' directly.
 _cleaner:
        -cd os2; rm -f Makefile
-       -cd pod; $(MAKE) realclean
-       -cd utils; $(MAKE) realclean
-       -cd x2p; $(MAKE) realclean
+       -cd pod; $(LDLIBPTH) $(MAKE) realclean
+       -cd utils; $(LDLIBPTH) $(MAKE) realclean
+       -cd x2p; $(LDLIBPTH) $(MAKE) realclean
        -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
-       sh ext/util/make_ext realclean $$x MAKE=$(MAKE) ; \
+       $(LDLIBPTH) sh ext/util/make_ext realclean $$x MAKE=$(MAKE) ; \
        done
-       rm -f *.orig */*.orig *~ */*~ core t/core t/c t/perl
+       rm -f *.orig */*.orig *~ */*~ core core.perl.*.? core.miniperl.*.? perl.core miniperl.core t/core t/core.perl.*.? t/perl.core t/tmp???? t/c t/perl so_locations t/nonexistent1
        rm -rf $(addedbyconf)
        rm -f $(FIRSTMAKEFILE) $(FIRSTMAKEFILE).old
        rm -f $(private)
        rm -rf lib/auto
-       rm -f lib/.exists
+       rm -f lib/.exists lib/*/.exists
        rm -f h2ph.man pstruct
        rm -rf .config
        rm -f testcompile compilelog
@@ -581,11 +595,21 @@ makedepend: makedepend.SH config.sh
 test-prep: miniperl perl preplibrary utilities $(dynamic_ext) $(nonxs_ext)
        cd t && (rm -f perl$(EXE_EXT); $(LNS) ../perl$(EXE_EXT) perl$(EXE_EXT))
 
+# Second branch is for testing without a tty or controling terminal.
+# See t/op/stat.t
 test check: test-prep
-       cd t && $(LDLIBPTH) ./perl TEST </dev/tty
+       if (true </dev/tty) >/dev/null 2>&1; then \
+         cd t && $(LDLIBPTH) ./perl TEST </dev/tty; \
+       else \
+         cd t && PERL_SKIP_TTY_TEST=1 $(LDLIBPTH) ./perl TEST; \
+       fi
 
 utest ucheck: test-prep
-       cd t && $(LDLIBPTH) ./perl UTEST </dev/tty
+       if (true </dev/tty) >/dev/null 2>&1; then \
+         cd t && $(LDLIBPTH) ./perl UTEST </dev/tty; \
+       else \
+         cd t && PERL_SKIP_TTY_TEST=1 $(LDLIBPTH) ./perl UTEST; \
+       fi
 
 # For testing without a tty or controling terminal. See t/op/stat.t
 test-notty: test-prep
@@ -604,13 +628,13 @@ minitest: miniperl lib/re.pm
 # Please *don't* use this unless all tests pass.
 # If you want to report test failures, use "make nok" instead.
 ok:    utilities
-       $(LBLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)'
+       $(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)'
 
 okfile:        utilities
-       $(LBLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok
+       $(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok
 
 nok:   utilities
-       $(LBLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)'
+       $(LDLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)'
 
 clist: $(c)
        echo $(c) | tr ' ' $(TRNL) >.clist
@@ -637,6 +661,9 @@ emacs/cperl-mode.elc: emacs/cperl-mode.el
 
 etags: emacs/cperl-mode.elc
        sh emacs/ptags
+       perl emacs/e2ctags.pl TAGS > tags
+
+ctags: etags
 
 # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
 # If this runs make out of memory, delete /usr/include lines.
@@ -650,3 +677,96 @@ case `pwd` in
     ;;
 esac
 $rm -f $firstmakefile
+
+# Now do any special processing required before building.
+
+case "$ebcdic" in
+$define)
+    xxx=''
+    echo "This is an EBCDIC system, checking if any parser files need regenerating." >&4
+case "$osname" in
+os390|posix-bc)
+    rm -f y.tab.c y.tab.h
+    # yacc must be a reentrant ("pure") Bison in BS2000 Posix!
+    yacc -d perly.y >/dev/null 2>&1
+    if cmp -s y.tab.c perly.c; then
+        rm -f y.tab.c
+    else
+        echo "perly.y -> perly.c" >&2
+        mv -f y.tab.c perly.c
+        chmod u+w perly.c
+        sed -e '/^#include "perl\.h"/a\
+\
+#define yydebug    PL_yydebug\
+#define yynerrs    PL_yynerrs\
+#define yyerrflag  PL_yyerrflag\
+#define yychar     PL_yychar\
+#define yyval      PL_yyval\
+#define yylval     PL_yylval'                          \
+            -e '/YYSTYPE *yyval;/D'                    \
+            -e '/YYSTYPE *yylval;/D'                   \
+            -e '/int  yychar,/,/yynerrs;/D'            \
+            -e 's/int yydebug = 0;/yydebug = 0;/'      \
+            -e 's/[^_]realloc(/PerlMem_realloc(/g'     \
+            -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
+            -e 's/y\.tab/perly/g' perly.c >perly.tmp && mv perly.tmp perly.c
+        xxx="$xxx perly.c"
+    fi
+    if cmp -s y.tab.h perly.h; then
+        rm -f y.tab.h
+    else
+        echo "perly.y -> perly.h" >&2
+        mv -f y.tab.h perly.h
+        xxx="$xxx perly.h"
+    fi
+    if cd x2p
+    then
+        rm -f y.tab.c y.tab.h
+        case "$osname" in
+        posix-bc)
+           # we are using two different yaccs in BS2000 Posix!
+           byacc a2p.y >/dev/null 2>&1
+           ;;
+        *) # e.g. os390
+           yacc  a2p.y >/dev/null 2>&1
+           ;;
+        esac
+        if cmp -s y.tab.c a2p.c
+        then
+            rm -f y.tab.c
+        else
+            echo "a2p.y -> a2p.c" >&2
+            mv -f y.tab.c a2p.c
+            chmod u+w a2p.c
+            sed -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
+                -e 's/y\.tab/a2p/g' a2p.c >a2p.tmp && mv a2p.tmp a2p.c
+            xxx="$xxx a2p.c"
+        fi
+        # In case somebody yacc -d:ed the a2p.y.
+        if test -f y.tab.h
+        then
+            if cmp -s y.tab.h a2p.h
+            then
+                rm -f y.tab.h
+            else
+                echo "a2p.h -> a2p.h" >&2
+                mv -f y.tab.h a2p.h
+                xxx="$xxx a2p.h"
+            fi
+        fi
+        cd ..
+    fi
+    ;;
+vmesa)
+    # Do nothing in VM/ESA.
+    ;;
+*)
+    echo "'$osname' is an EBCDIC system I don't know that well." >&4
+    ;;
+esac
+    case "$xxx" in
+    '') echo "No parser files were regenerated.  That's okay." >&2 ;;
+    esac
+    ;;
+esac
+