[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
cygwin: need to use the correct 'head.exe'
From: |
Charles Wilson |
Subject: |
cygwin: need to use the correct 'head.exe' |
Date: |
Mon, 10 Mar 2003 03:03:49 -0500 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 |
If one has the perl libwww module installed, then a file 'HEAD' is
installed in /usr/bin. On cygwin, where (a) executables can be called
without a trailing '.exe' -- even though the executable is named thus,
and (b) the file system is case-insensitive but case-preserving, this
leads to a problem:
HEAD is indistinguishable from head.exe -- and in fact, is preferred.
This causes problems in libtool, where 'head' is invoked without the
trailing .exe -- and calling HEAD instead leads to, err, unsatisfactory
results.
This patch adds $HEAD to the list of variables stored in the libtool
script, and during configury hunts for 'head.exe' in preference to
'head' (or HEAD), and invokes the program thru that variable rather than
directly. It should have no impact on other platforms -- beyond adding
another unused variable to the libtool script (like OBJDUMP and DLLTOOL
are now), since nothing but win32_libid() calls 'head' anyway.
--Chuck
2003-03-10 Charles Wilson <address@hidden>
* libtool.m4 (AC_LIBTOOL_SETUP): call AC_PROG_HEAD
(AC_PROG_HEAD): new function
(AC_LIBTOOL_CONFIG([TAGNAME])): add HEAD= to the
variables in the generated libtool.
* ltmain.in (win32_libid): use $HEAD, not head.
Index: libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/libtool.m4,v
retrieving revision 1.308
diff -u -r1.308 libtool.m4
--- libtool.m4 2 Mar 2003 10:13:46 -0000 1.308
+++ libtool.m4 10 Mar 2003 07:23:59 -0000
@@ -103,6 +103,7 @@
AC_REQUIRE([AC_PROG_LD])dnl
AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
AC_REQUIRE([AC_PROG_NM])dnl
+AC_REQUIRE([AC_PROG_HEAD])dnl
AC_REQUIRE([AC_PROG_LN_S])dnl
AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
@@ -177,6 +178,7 @@
test -z "$LN_S" && LN_S="ln -s"
test -z "$MAGIC_CMD" && MAGIC_CMD=file
test -z "$NM" && NM=nm
+test -z "$HEAD" && HEAD=head
test -z "$SED" && SED=sed
test -z "$OBJDUMP" && OBJDUMP=objdump
test -z "$RANLIB" && RANLIB=:
@@ -2257,6 +2259,49 @@
NM="$lt_cv_path_NM"
])# AC_PROG_NM
+# AC_PROG_HEAD
+# ----------
+# find the path to a the 'real' textutils head executable,
+# without being fooled on cygwin (where, for a variety of
+# reasons, perl libwww's HEAD conflicts with head.exe)
+AC_DEFUN([AC_PROG_HEAD],
+[AC_CACHE_CHECK([for the head executable from textutils], lt_cv_path_HEAD,
+[if test -n "$HEAD"; then
+ # Let the user override the test.
+ lt_cv_path_HEAD="$HEAD"
+else
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ # prefer exe
+ for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_head="$ac_dir/head"
+ if test -f "$tmp_head$ac_exeext" ; then
+ if eval $tmp_head$ac_exeext /dev/null > /dev/null 2>&1 ; then
+ lt_cv_path_HEAD="$tmp_head$ac_exeext"
+ break;
+ fi
+ fi
+ done
+ if test -z "$lt_cv_path_HEAD"; then
+ for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_head="$ac_dir/head"
+ if test -f "$tmp_head" ; then
+ if eval $tmp_head /dev/null > /dev/null 2>&1 ; then
+ lt_cv_path_HEAD="$tmp_head"
+ break;
+ fi
+ fi
+ done
+ fi
+ IFS="$lt_save_ifs"
+ test -z "$lt_cv_path_HEAD" && lt_cv_path_HEAD=head
+fi])
+HEAD="$lt_cv_path_HEAD"
+])# AC_PROG_HEAD
+
# AC_CHECK_LIBM
# -------------
@@ -3749,7 +3794,8 @@
# Now quote all the things that may contain metacharacters while being
# careful not to overquote the AC_SUBSTed values. We take copies of the
# variables and quote the copies for generation of the libtool script.
- for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM SED
SHELL \
+ for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC \
+ NM HEAD SED SHELL \
libname_spec library_names_spec soname_spec extract_expsyms_cmds \
old_striplib striplib file_magic_cmd finish_cmds finish_eval \
deplibs_check_method reload_flag reload_cmds need_locks \
@@ -3923,6 +3969,9 @@
# A BSD-compatible nm program.
NM=$lt_NM
+
+# The textutils head executable
+HEAD=$lt_HEAD
# A symbol stripping program
STRIP=$STRIP
Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/ltmain.in,v
retrieving revision 1.326
diff -u -r1.326 ltmain.in
--- ltmain.in 28 Feb 2003 15:27:35 -0000 1.326
+++ ltmain.in 10 Mar 2003 07:25:11 -0000
@@ -129,7 +129,7 @@
win32_libid_type="x86 archive import"
;;
*ar\ archive*) # could be an import, or static
- if eval $OBJDUMP -f $1 | head -n 10 2>/dev/null | \
+ if eval $OBJDUMP -f $1 | $HEAD -n 10 2>/dev/null | \
grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
win32_nmres=`eval $NM -f posix -A $1 | \
sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;}}'`