perl 5.0 alpha 9
[p5sagit/p5-mst-13.2.git] / writemain.SH
1 case $CONFIG in
2 '')
3         if test -f config.sh; then TOP=.;
4         elif test -f ../config.sh; then TOP=..;
5         elif test -f ../../config.sh; then TOP=../..;
6         elif test -f ../../../config.sh; then TOP=../../..;
7         elif test -f ../../../../config.sh; then TOP=../../../..;
8         else
9                 echo "Can't find config.sh."; exit 1
10         fi
11         . $TOP/config.sh
12         ;;
13 esac
14 : This forces SH files to create target in same directory as SH file.
15 : This is so that make depend always knows where to find SH derivatives.
16 case "$0" in
17 */*) cd `expr X$0 : 'X\(.*\)/'` ;;
18 esac
19 echo "Extracting writemain (with variable substitutions)"
20 : This section of the file will have variable substitutions done on it.
21 : Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!.
22 : Protect any dollar signs and backticks that you do not want interpreted
23 : by putting a backslash in front.  You may delete these comments.
24 $spitshell >writemain <<!GROK!THIS!
25 $startsh
26 !GROK!THIS!
27
28 : In the following dollars and backticks do not need the extra backslash.
29 $spitshell >>writemain <<'!NO!SUBS!'
30 : This script takes the plain miniperlmain.c and writes out perlmain.c
31 : which includes all the extensions.
32 : The command line arguments name extensions to be used.
33 :  E.g.:  sh writemain SDBM_File POSIX > perlmain.c
34 :
35 args="$*"
36 if test X"$args" = "X" ; then
37     cat miniperlmain.c
38 else
39     sed '/Do not delete this line--writemain depends on it/q' miniperlmain.c
40     cat << 'EOP'
41
42 #ifdef USE_DYNAMIC_LOADING
43     boot_DynamicLoader();
44 #endif
45
46 EOP
47     for ext in $args; do
48         echo "    newXSUB(\"${ext}::bootstrap\", 0, boot_${ext}, file);"
49     done
50     echo '}'
51 fi
52
53 !NO!SUBS!
54 chmod 755 writemain
55 $eunicefix writemain