libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Suggested pathes to CVC libtool: Mingw improvement, .rc support


From: Tor Lillqvist
Subject: Suggested pathes to CVC libtool: Mingw improvement, .rc support
Date: Sat, 15 Sep 2001 05:29:54 +0300 (EEST)

Hi,

Here is a patch to libtool with: 

-- Small improvement for mingw-hosted tool support (while still
running libtool on cygwin). In that case PATH_SEPARATOR is ':', but
gcc -print-search-dirs still prints its search path with ';' as
separator.

-- Add support for .rc files (Windows resource files), compiled by the
resource compiler (windres in mingw) to .o files.

-- Minor bug fix for $PATH elements with spaces in them when looking
for nm.

-- I think there was some confusion with trailing spaces in
$base_compile in ltmain.in?

ChangeLog entry:
2001-09-15  Tor Lillqvist  <address@hidden>

        * libtool.m4: Improve handling of mingw gcc. Improve handling of
        $PATH with entries containing spaces. Add support for .rc files.

        * ltmain.in: Check for .rc files. Add a space to $base_compile in
        the case statement, as the case labels checks for trailing
        spaces, but there aren't necessarily in $base_compile (?).

Index: configure.ac
===================================================================
RCS file: /cvs/libtool/configure.ac,v
retrieving revision 1.4
diff -u -2 -r1.4 configure.ac
--- configure.ac        2001/07/09 22:41:58     1.4
+++ configure.ac        2001/09/15 02:17:38
@@ -49,4 +49,7 @@
 AM_CONDITIONAL(HAVE_GCJ, [test "x$GCJ" != xno])
 
+LT_AC_PROG_RC
+AM_CONDITIONAL(HAVE_RC, [test "x$RC" != xno])
+
 # Declare win32 dll support
 AC_LIBTOOL_WIN32_DLL
Index: libtool.m4
===================================================================
RCS file: /cvs/libtool/libtool.m4,v
retrieving revision 1.231
diff -u -2 -r1.231 libtool.m4
--- libtool.m4  2001/09/11 00:22:48     1.231
+++ libtool.m4  2001/09/15 02:17:41
@@ -1086,5 +1086,16 @@
   yes,mingw*)
     library_names_spec='${libname}`echo ${release} | sed -e 
's/[[.]]/-/g'`${versuffix}.dll'
-    sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | 
sed -e "s/^libraries://" -e "s/$PATH_SEPARATOR/ /g"`
+    sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | 
sed -e "s/^libraries://"`
+    if echo "$sys_lib_search_path_spec" | [egrep ';[C-Z]:/' >/dev/null]; then
+       # It is most probably a Windows format PATH printed by
+       # mingw gcc, but we are running on Cygwin. Gcc prints its search
+       # path with ; separators, and with drive letters. We can handle the
+       # drive letters (cygwin fileutils understands them), so leave them,
+       # especially as we might pass files found there to a mingw objdump,
+       # which wouldn't understand a cygwinified path. Ahh.
+       sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | sed -e 
's/;/ /g'`
+    else
+       sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | sed  -e 
"s/$PATH_SEPARATOR/ /g"`
+    fi
     ;;
   yes,pw32*)
@@ -1408,5 +1419,5 @@
         [include additional configurations @<:@CXX,GCJ@:>@])],
     [tagnames="$withval"],
-    [tagnames="CXX,GCJ"])
+    [tagnames="CXX,GCJ,RC"])
 
 if test -f "$ltmain" && test -n "$tagnames"; then
@@ -1456,4 +1467,8 @@
         ;;
 
+      RC)
+        AC_LIBTOOL_LANG_RC_CONFIG
+        ;;
+
       *)
         AC_MSG_ERROR([Unsupported tag name: $tagname])
@@ -2018,14 +2033,14 @@
     IFS="$lt_save_ifs"
     test -z "$ac_dir" && ac_dir=.
-    tmp_nm=$ac_dir/${ac_tool_prefix}nm
-    if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then
+    tmp_nm="$ac_dir/${ac_tool_prefix}nm"
+    if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
       # Check to see if the nm accepts a BSD-compat flag.
       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
       #   nm: unknown option "B" ignored
       # Tru64's nm complains that /dev/null is an invalid object file
-      if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep 
'(/dev/null|Invalid file or object type)' >/dev/null; then
+      if ("$tmp_nm" -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep 
'(/dev/null|Invalid file or object type)' >/dev/null; then
        lt_cv_path_NM="$tmp_nm -B"
        break
-      elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null 
>/dev/null; then
+      elif ("$tmp_nm" -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null 
>/dev/null; then
        lt_cv_path_NM="$tmp_nm -p"
        break
@@ -2165,4 +2180,19 @@
 
 
+# AC_LIBTOOL_RC
+# --------------
+# enable support for Windows resource files
+AC_DEFUN([AC_LIBTOOL_RC],
+[AC_REQUIRE([_LT_AC_LANG_RC])
+])# AC_LIBTOOL_RC
+
+
+# _LT_AC_LANG_RC
+# ---------------
+AC_DEFUN([_LT_AC_LANG_RC],
+[AC_REQUIRE([AC_PROG_RC])
+])# _LT_AC_LANG_GCJ
+
+
 # AC_LIBTOOL_LANG_C_CONFIG
 # ------------------------
@@ -3158,4 +3188,48 @@
 
 
+# AC_LIBTOOL_LANG_RC_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the Windows resource compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)])
+AC_DEFUN([_LT_AC_LANG_RC_CONFIG],
+[AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${RC-"windres"}
+set dummy $CC
+compiler="[$]2"
+_LT_AC_TAGVAR(compiler, $1)=$CC
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_RC_CONFIG
+
+
 # AC_LIBTOOL_CONFIG([TAGNAME])
 # ----------------------------
@@ -5224,2 +5298,5 @@
   AC_SUBST(GCJFLAGS)
 ])
+
+AC_DEFUN([LT_AC_PROG_RC],
+[AC_CHECK_TOOL(RC, windres, no)])
Index: ltmain.in
===================================================================
RCS file: /cvs/libtool/ltmain.in,v
retrieving revision 1.275
diff -u -2 -r1.275 ltmain.in
--- ltmain.in   2001/09/10 23:33:26     1.275
+++ ltmain.in   2001/09/15 02:17:45
@@ -480,4 +480,5 @@
     *.for) xform=for ;;
     *.java) xform=java ;;
+    *.rc) xform=rc ;;
     esac
 
@@ -497,5 +498,5 @@
     # command doesn't match the default compiler.
     if test -n "$available_tags" && test -z "$tagname"; then
-      case $base_compile in
+      case "$base_compile " in
       "$CC "*) ;;
       # Blanks in the command may have been stripped by the calling shell,
@@ -507,5 +508,5 @@
            # Evaluate the configuration.
            eval "`sed -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### 
END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
-           case $base_compile in
+           case "$base_compile " in
            "$CC "*)
              # The compiler in the base compile command matches




reply via email to

[Prev in Thread] Current Thread [Next in Thread]