Mailing List Archive

Patch 1 to my Jumbo Configure patch vs. 1m.
# This is patch 1 to my Jumbo Configure patch for perl5.001m.
# See description below.
# Andy Dougherty doughera@lafcol.lafayette.edu
#
exit 0

This patch 1 to my Jumbo Configure patch for perl5.001m of September 27,
1995. You have to apply my Jumbo Configure patch before you can apply
this.

Contents of this patch are:

Changes.Conf

Mention the new INSTALL file and Configure's better detection of
local library files.

Configure

Results for the byteorder and intsize tests are printed even when
the user isn't going to be prompted for them.

I tricked metaconfig into including Non-blocking I/O tests.

INSTALL

Two new sections: How to change the installation directory and
how to create an installable tar archive.

Other minor clarifications.

Makefile.SH
Delete one line that contained only a single tab.

config_H
Updated to match new Configure.

ext/Fcntl/Fcntl.xs
Add comment about VAL_O_NONBLOCK.

Patch and Enjoy,

Andy Dougherty doughera@lafcol.lafayette.edu
Dept. of Physics
Lafayette College, Easton PA 18042


Index: Changes.Conf
*** perl5.001m+/Changes.Conf Sat Oct 14 16:00:39 1995
--- perl5.001n/Changes.Conf Sat Oct 14 15:25:08 1995
***************
*** 22,27 ****
--- 22,31 ----

Many hint file updates.

+ Improve and simplify detection of local libraries and header files.
+
+ Expand documentation of installation process in new INSTALL file.
+
Upgrade Traps and Pitfalls:

Since a lot has changed in the build process, you are probably best off
Index: Configure
Prereq: 3.0.1.8
*** perl5.001m+/Configure Sat Oct 14 16:00:41 1995
--- perl5.001n/Configure Sat Oct 14 15:57:15 1995
***************
*** 20,26 ****

# $Id: Head.U,v 3.0.1.8 1995/07/25 13:40:02 ram Exp $
#

cat >/tmp/c1$$ <<EOF
ARGGGHHHH!!!!!
--- 20,26 ----

# $Id: Head.U,v 3.0.1.8 1995/07/25 13:40:02 ram Exp $
#
! # Generated on Sat Oct 14 15:53:33 EDT 1995 [metaconfig 3.0 PL58]

cat >/tmp/c1$$ <<EOF
ARGGGHHHH!!!!!
***************
*** 509,514 ****
--- 509,518 ----
phostname=''
c=''
n=''
+ d_eofnblk=''
+ eagain=''
+ o_nonblock=''
+ rd_nodata=''
groupcat=''
hostcat=''
passcat=''
***************
*** 4502,4507 ****
--- 4506,4512 ----
EOCP
if $cc $ccflags try.c -o try >/dev/null 2>&1 && ./try > /dev/null; then
intsize=`./try`
+ echo "Your integers are $intsize bytes long."
else
dflt='4'
echo "(I can't seem to compile the test program. Guessing...)"
***************
*** 6777,6782 ****
--- 6782,6788 ----
case "$dflt" in
[1-4][1-4][1-4][1-4]|12345678|87654321)
echo "(The test program ran ok.)"
+ echo "byteorder=$dflt"
xxx_prompt=n
;;
????|????????) echo "(The test program ran ok.)" ;;
***************
*** 7296,7301 ****
--- 7302,7476 ----
. ./myread
modetype="$ans"

+ : check for non-blocking I/O stuff
+ case "$h_sysfile" in
+ true) echo "#include <sys/file.h>" > head.c;;
+ *)
+ case "$h_fcntl" in
+ true) echo "#include <fcntl.h>" > head.c;;
+ *) echo "#include <sys/fcntl.h>" > head.c;;
+ esac
+ ;;
+ esac
+ echo " "
+ echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
+ case "$o_nonblock" in
+ '')
+ $cat head.c > try.c
+ $cat >>try.c <<'EOCP'
+ main() {
+ #ifdef O_NONBLOCK
+ printf("O_NONBLOCK\n");
+ exit(0);
+ #endif
+ #ifdef O_NDELAY
+ printf("O_NDELAY\n");
+ exit(0);
+ #endif
+ #ifdef FNDELAY
+ printf("FNDELAY\n");
+ exit(0);
+ #endif
+ exit(0);
+ }
+ EOCP
+ if $cc $ccflags $ldflags try.c -o try >/dev/null 2>&1; then
+ o_nonblock=`./try`
+ case "$o_nonblock" in
+ '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
+ *) echo "Seems like we can use $o_nonblock.";;
+ esac
+ else
+ echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
+ fi
+ ;;
+ *) echo "Using $hint value $o_nonblock.";;
+ esac
+ $rm -f try try.* .out core
+
+ echo " "
+ echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
+ case "$eagain" in
+ '')
+ $cat head.c > try.c
+ $cat >>try.c <<EOCP
+ #include <errno.h>
+ #include <sys/types.h>
+ #include <signal.h>
+ extern int errno;
+ $signal_t blech(x) int x; { exit(3); }
+ main()
+ {
+ int pd[2];
+ int pu[2];
+ char buf[1];
+ char string[100];
+
+ pipe(pd); /* Down: child -> parent */
+ pipe(pu); /* Up: parent -> child */
+ if (0 != fork()) {
+ int ret;
+ close(pd[1]); /* Parent reads from pd[0] */
+ close(pu[0]); /* Parent writes (blocking) to pu[1] */
+ if (-1 == fcntl(pd[0], F_SETFL, $o_nonblock))
+ exit(1);
+ signal(SIGALRM, blech);
+ alarm(5);
+ if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
+ exit(2);
+ sprintf(string, "%d\n", ret);
+ write(2, string, strlen(string));
+ alarm(0);
+ #ifdef EAGAIN
+ if (errno == EAGAIN) {
+ printf("EAGAIN\n");
+ goto ok;
+ }
+ #endif
+ #ifdef EWOULDBLOCK
+ if (errno == EWOULDBLOCK)
+ printf("EWOULDBLOCK\n");
+ #endif
+ ok:
+ write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
+ sleep(2); /* Give it time to close our pipe */
+ alarm(5);
+ ret = read(pd[0], buf, 1); /* Should read EOF */
+ alarm(0);
+ sprintf(string, "%d\n", ret);
+ write(3, string, strlen(string));
+ exit(0);
+ }
+
+ close(pd[0]); /* We write to pd[1] */
+ close(pu[1]); /* We read from pu[0] */
+ read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
+ close(pd[1]); /* Pipe pd is now fully closed! */
+ exit(0); /* Bye bye, thank you for playing! */
+ }
+ EOCP
+ if $cc $ccflags $ldflags try.c -o try >/dev/null; 2>&1; then
+ echo "./try >try.out 2>try.ret 3>try.err || exit 4" >mtry
+ chmod +x mtry
+ ./mtry >/dev/null 2>&1
+ case $? in
+ 0) eagain=`$cat try.out`;;
+ 1) echo "Could not perform non-blocking setting!";;
+ 2) echo "I did a successful read() for something that was not there!";;
+ 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
+ *) echo "Something terribly wrong happened during testing.";;
+ esac
+ rd_nodata=`$cat try.ret`
+ echo "A read() system call with no data present returns $rd_nodata."
+ case "$rd_nodata" in
+ 0|-1) ;;
+ *)
+ echo "(That's peculiar, fixing that to be -1.)"
+ rd_nodata=-1
+ ;;
+ esac
+ case "$eagain" in
+ '')
+ echo "Forcing errno EAGAIN on read() with no data available."
+ eagain=EAGAIN
+ ;;
+ *)
+ echo "Your read() sets errno to $eagain when no data is available."
+ ;;
+ esac
+ status=`$cat try.err`
+ case "$status" in
+ 0) echo "And it correctly returns 0 to signal EOF.";;
+ -1) echo "But it also returns -1 to signal EOF, so be careful!";;
+ *) echo "However, your read() returns '$status' on EOF??";;
+ esac
+ val="$define"
+ if test "$status" -eq "$rd_nodata"; then
+ echo "WARNING: you can't distinguish between EOF and no data!"
+ val="$undef"
+ fi
+ else
+ echo "I can't compile the test program--assuming errno EAGAIN will do."
+ eagain=EAGAIN
+ fi
+ set d_eofnblk
+ eval $setvar
+ ;;
+ *)
+ echo "Using $hint value $eagain."
+ echo "Your read() returns $rd_nodata when no data is present."
+ case "$d_eofnblk" in
+ "$define") echo "And you can see EOF because read() returns 0.";;
+ "$undef") echo "But you can't see EOF status from read() returned value.";;
+ *)
+ echo "(Assuming you can't see EOF status from read anyway.)"
+ d_eofnblk=$undef
+ ;;
+ esac
+ ;;
+ esac
+ $rm -f try try.* .out core head.c mtry
+
: set the base revision
baserev=5.0

***************
*** 8375,8380 ****
--- 8550,8556 ----
d_dlsymun='$d_dlsymun'
d_dosuid='$d_dosuid'
d_dup2='$d_dup2'
+ d_eofnblk='$d_eofnblk'
d_eunice='$d_eunice'
d_fchmod='$d_fchmod'
d_fchown='$d_fchown'
***************
*** 8518,8523 ****
--- 8694,8700 ----
dlext='$dlext'
dlsrc='$dlsrc'
dynamic_ext='$dynamic_ext'
+ eagain='$eagain'
echo='$echo'
egrep='$egrep'
emacs='$emacs'
***************
*** 8647,8652 ****
--- 8824,8830 ----
n='$n'
nm_opt='$nm_opt'
nroff='$nroff'
+ o_nonblock='$o_nonblock'
optimize='$optimize'
orderlib='$orderlib'
osname='$osname'
***************
*** 8668,8673 ****
--- 8846,8852 ----
prototype='$prototype'
randbits='$randbits'
ranlib='$ranlib'
+ rd_nodata='$rd_nodata'
rm='$rm'
rmail='$rmail'
runnm='$runnm'
Index: INSTALL
*** perl5.001m+/INSTALL Sat Oct 14 16:00:41 1995
--- perl5.001n/INSTALL Sat Oct 14 15:25:37 1995
***************
*** 18,29 ****

=head1 Start with a Fresh Distribution.

! The results of a Configure run are stored in the config.sh file.
! If you are upgrading from a previous version of perl, or if you
! change compilers or make other significant changes, or if you are
! experiencing difficulties building perl, you should
! probably I<not> re-use your old config.sh. Simply remove it or
! rename it, e.g.

mv config.sh config.sh.old

--- 18,28 ----

=head1 Start with a Fresh Distribution.

! The results of a Configure run are stored in the config.sh file. If
! you are upgrading from a previous version of perl, or if you change
! systems or compilers or make other significant changes, or if you are
! experiencing difficulties building perl, you should probably I<not>
! re-use your old config.sh. Simply remove it or rename it, e.g.

mv config.sh config.sh.old

***************
*** 60,65 ****
--- 59,69 ----

Configure -Dprefix=/opt/local

+ By default, Configure will compile perl to use dynamic loading, if
+ your system supports it. If you want to force perl to be compiled
+ statically, you can either choose this when Configure prompts you or by
+ using the Configure command line option -Uusedl.
+
=head2 GNU-style configure

If you prefer the GNU-style B<configure> command line interface, you can
***************
*** 70,76 ****
The B<configure> script emulates several of the more common configure
options. Try

! configure --help

for a listing.

--- 74,80 ----
The B<configure> script emulates several of the more common configure
options. Try

! ./configure --help

for a listing.

***************
*** 91,101 ****
include the appropriate B<-L/your/directory> option when prompted by
Configure. See the examples below.

- By default, Configure will compile perl to use dynamic loading, if
- your system supports it. If you want to force perl to be compiled
- statically, you can either choose this when Configure prompts you or by
- using the Configure command line option -Uusedl.
-
=head2 Examples

=over 4
--- 95,100 ----
***************
*** 119,133 ****
C<-L/usr/local/lib>.

Again, this should all happen automatically. If you want to accept the
! defaults for all the and have Configure print out only terse messages,
! then you can just run

sh Configure -des

and Configure should include the GDBM_File extension automatically.

This should actually work if you have gdbm installed in any of
! (/usr/local, /opt/local, /usr/gnu, /opt/gnu, /usr/GNU, /opt/GNU).

=item gdbm in /usr/you

--- 118,132 ----
C<-L/usr/local/lib>.

Again, this should all happen automatically. If you want to accept the
! defaults for all the questions and have Configure print out only terse
! messages, then you can just run

sh Configure -des

and Configure should include the GDBM_File extension automatically.

This should actually work if you have gdbm installed in any of
! (/usr/local, /opt/local, /usr/gnu, /opt/gnu, /usr/GNU, or /opt/GNU).

=item gdbm in /usr/you

***************
*** 153,165 ****
Configure will automatically add the appropriate B<-L> directives. If
you have some libraries under F</usr/local/> and others under
F</usr/you>, then you have to include both, namely
!
sh Configure -des \
-Dlocincpth="/usr/you/include /usr/local/include" \
-Dloclibpth="/usr/you/lib /usr/local/lib"

=back

=head2 What if it doesn't work?

=over 4
--- 152,220 ----
Configure will automatically add the appropriate B<-L> directives. If
you have some libraries under F</usr/local/> and others under
F</usr/you>, then you have to include both, namely
!
sh Configure -des \
-Dlocincpth="/usr/you/include /usr/local/include" \
-Dloclibpth="/usr/you/lib /usr/local/lib"

=back

+ =head2 Changing the installation directory
+
+ Configure distinguishes between the directory in which perl (and its
+ associated files) should be installed and the directory in which it
+ will eventually reside. For most sites, these two are the same; for
+ sites that use AFS, this distinction is handled automatically.
+ However, sites that use software such as B<depot> to manage software
+ packages may also wish to install perl into a different directory and
+ use that management software to move perl to its final destination.
+ This section describes how to do this. Someday, Configure may support
+ an option C<-Dinstallprefix=/foo> to simplify this.
+
+ Suppose you want to install perl under the F</tmp/perl5> directory.
+ You can edit F<config.sh> and change all the install* variables to
+ point to F</tmp/perl5> instead of F</usr/local/wherever>. You could
+ also set them all from the Configure command line. Or, you can
+ automate this process by placing the following lines in a file
+ F<config.over> B<before> you run Configure (replace /tmp/perl5 by a
+ directory of your choice):
+
+ installprefix=/tmp/perl5
+ test -d $installprefix || mkdir $installprefix
+ test -d $installprefix/bin || mkdir $installprefix/bin
+ installarchlib=`echo $installarchlib | sed "s!$prefix!$installprefix!"`
+ installbin=`echo $installbin | sed "s!$prefix!$installprefix!"`
+ installman1dir=`echo $installman1dir | sed "s!$prefix!$installprefix!"`
+ installman3dir=`echo $installman3dir | sed "s!$prefix!$installprefix!"`
+ installprivlib=`echo $installprivlib | sed "s!$prefix!$installprefix!"`
+ installscript=`echo $installscript | sed "s!$prefix!$installprefix!"`
+ installsitelib=`echo $installsitelib | sed "s!$prefix!$installprefix!"`
+
+ Then, you can Configure and install in the usual way:
+
+ sh ./Configure -des
+ make
+ make test
+ make install
+
+ =head2 Creating an installable tar archive
+
+ If you need to install perl on many identical systems, it is
+ convenient to compile it once and create an archive that can be
+ installed on multiple systems. Here's one way to do that:
+
+ # Set up config.over to install perl into a different directory,
+ # e.g. /tmp/perl5 (see previous part).
+ sh ./Configure -des
+ make
+ make test
+ make install
+ cd /tmp/perl5
+ tar cvf ../perl5-archive.tar .
+ # Then, on each machine where you want to install perl,
+ cd /usr/local # Or wherever you specified as $prefix
+ tar xvf perl5-archive.tar
+
=head2 What if it doesn't work?

=over 4
***************
*** 210,216 ****
=item cflags

If you have any additional changes to make to the C compiler command
! line, they can be done in F<cflags.SH>. For instance, to turn off the
optimizer on F<toke.c>, find the line in the switch structure for
F<toke.c> and put the command C<optimize='-g'> before the C<;;>. You
can also edit F<cflags> directly, but beware that your changes will be
--- 265,271 ----
=item cflags

If you have any additional changes to make to the C compiler command
! line, they can be made in F<cflags.SH>. For instance, to turn off the
optimizer on F<toke.c>, find the line in the switch structure for
F<toke.c> and put the command C<optimize='-g'> before the C<;;>. You
can also edit F<cflags> directly, but beware that your changes will be
***************
*** 420,423 ****
--- 475,479 ----

Andy Dougherty <doughera@lafcol.lafayette.edu>, borrowing I<very> heavily
from the original README by Larry Wall.
+
27 September 1995
Index: Makefile.SH
*** perl5.001m+/Makefile.SH Sat Oct 14 16:00:42 1995
--- perl5.001n/Makefile.SH Sat Oct 14 16:06:21 1995
***************
*** 180,186 ****

all: makefile miniperl $(private) $(public) $(dynamic_ext)
@echo " "; echo " Making x2p stuff"; cd x2p; $(MAKE) all
!
# This is now done by installman only if you actually want the man pages.
# @echo " "; echo " Making docs"; cd pod; $(MAKE) all;

--- 180,186 ----

all: makefile miniperl $(private) $(public) $(dynamic_ext)
@echo " "; echo " Making x2p stuff"; cd x2p; $(MAKE) all
!
# This is now done by installman only if you actually want the man pages.
# @echo " "; echo " Making docs"; cd pod; $(MAKE) all;

Index: config_h.SH
Prereq: 3.0.1.3
*** perl5.001m+/config_h.SH Sat Oct 14 16:00:44 1995
--- perl5.001n/config_h.SH Sat Oct 14 15:57:15 1995
***************
*** 1266,1271 ****
--- 1266,1280 ----
*/
#define Mode_t $modetype /* file mode parameter for system calls */

+ /* VAL_O_NONBLOCK:
+ * This symbol is to be used during open() or fcntl(F_SETFL) to turn on
+ * non-blocking I/O for the file descriptor. Note that there is no way
+ * back, i.e. you cannot turn it blocking again this way. If you wish to
+ * alternatively switch between blocking and non-blocking, use the
+ * ioctl(FIOSNBIO) call instead, but that is not supported by all devices.
+ */
+ #define VAL_O_NONBLOCK $o_nonblock
+
/* PRIVLIB_EXP:
* This symbol contains the ~name expanded version of PRIVLIB, to be used
* in programs that are not prepared to deal with ~ expansion at run-time.
Index: ext/Fcntl/Fcntl.xs
*** perl5.001m+/ext/Fcntl/Fcntl.xs Fri Mar 31 15:32:00 1995
--- perl5.001n/ext/Fcntl/Fcntl.xs Thu Sep 28 11:49:23 1995
***************
*** 4,9 ****
--- 4,15 ----

#include <fcntl.h>

+ /* This comment is a kludge to get metaconfig to see the
+ symbol VAL_O_NONBLOCK and include the appropriate metaconfig unit
+ so that Configure will test how to turn on non-blocking I/O
+ for a file descriptor. --AD 09/28/95.
+ */
+
static int
not_here(s)
char *s;


End of patch.
Re: Patch 1 to my Jumbo Configure patch vs. 1m. [ In reply to ]
Re: Patch 1 to my Jumbo Configure patch vs. 1m. [ In reply to ]
I've now had a chance to try the patch and it works fine on both SunOS
4.1.3 and Solaris 2.3.

Paul