X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_102,J_CHICKENPOX_92,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: sourceware.org Message-ID: <49C813C6.20808@cwilson.fastmail.fm> Date: Mon, 23 Mar 2009 18:57:10 -0400 From: Charles Wilson User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.6.666 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: _set_fmode? References: <49C04B2D DOT 2090703 AT cwilson DOT fastmail DOT fm> <20090318094323 DOT GA12824 AT calimero DOT vinschen DOT de> <49C0EC08 DOT 8020907 AT cwilson DOT fastmail DOT fm> <20090318144112 DOT GC16595 AT calimero DOT vinschen DOT de> <49C1ABEC DOT 6060604 AT cwilson DOT fastmail DOT fm> In-Reply-To: <49C1ABEC.6060604@cwilson.fastmail.fm> Content-Type: multipart/mixed; boundary="------------020909050201000600040702" Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com --------------020909050201000600040702 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Charles Wilson wrote: > Hmm...that autoconfery might work and be blessed upstream (but I need to > add the value to a custom var, not LIBS, because I don't want the > libarchive dll linked with it; just the bsdtar and bsdcpio apps. But > that should be easy to accomplish. FWIW, the attached is what I ended up doing for libarchive. It should work for cross-compiling to cygwin, as well as native. I borrowed a page from libtool, and extracted the library search path from the compiler -- then manually searched those directories for binmode.o. In Makefile.am: -bsdtar_LDADD= libarchive.la +bsdtar_LDADD= libarchive.la @PROG_LDADD_EXTRA@ (and more like that) In configure.ac: # # Locate some specific link objects for cygwin # LA_SYS_LIB_SEARCH_PATH prog_ldadd_extra= case "$host_os" in *cygwin*) for la_sys_path in $la_sys_lib_search_path_spec; do if test -f $la_sys_path/binmode.o ; then prog_ldadd_extra=$la_sys_path/binmode.o break fi done ;; esac PROG_LDADD_EXTRA=$prog_ldadd_extra AC_SUBST(PROG_LDADD_EXTRA) where LA_SYS_LIB_SEARCH_PATH ("LA" for "libarchive") is attached. -- Chuck --------------020909050201000600040702 Content-Type: text/plain; name="la_syslibsearchpath.m4" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="la_syslibsearchpath.m4" # la_syslibsearchpath.m4 - attempt to determine the compiler's # library search directories. # sets $la_sys_lib_search_path_spec to space-separated list of # directories, specifing the compiler's built-in search path # for libraries. This is used by configure.ac when $host_os is # cygwin, to locate a special *object* we need to link against: # binmode.o. We know this object is located in that search path. # However, because gcc does not search for objects in its # libsearchpath (there is no -l for .o's), we must extract the # path(s) and search manually. # # Adapted from libtool.m4 (_LT_SYS_DYNAMIC_LINKER): # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. AC_DEFUN([LA_SYS_LIB_SEARCH_PATH], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_SED])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_MSG_CHECKING([compiler library search path]) # don't bother with EBCDIC systems here: la_NL2SP="tr \\015\\012 \\040\\040" if test "$GCC" = yes; then case $host_os in darwin*) la_awk_arg="/^libraries:/,/LR/" ;; *) la_awk_arg="/^libraries:/" ;; esac la_search_path_spec=`$CC -print-search-dirs | $AWK $la_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` case $la_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. la_search_path_spec=`echo "$la_search_path_spec" | $SED 's/;/ /g'` ;; *) la_search_path_spec=`echo "$la_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. la_tmp_la_search_path_spec= la_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for la_sys_path in $la_search_path_spec; do if test -d "$la_sys_path/$la_multi_os_dir"; then la_tmp_la_search_path_spec="$la_tmp_la_search_path_spec $la_sys_path/$la_multi_os_dir" else test -d "$la_sys_path" && \ la_tmp_la_search_path_spec="$la_tmp_la_search_path_spec $la_sys_path" fi done la_search_path_spec=`echo "$la_tmp_la_search_path_spec" | $AWK ' BEGIN {RS=" "; FS="/|\n";} { la_foo=""; la_count=0; for (la_i = NF; la_i > 0; la_i--) { if ($la_i != "" && $la_i != ".") { if ($la_i == "..") { la_count++; } else { if (la_count == 0) { la_foo="/" $la_i la_foo; } else { la_count--; } } } } if (la_foo != "") { la_freq[[la_foo]]++; } if (la_freq[[la_foo]] == 1) { print la_foo; } }'` la_sys_lib_search_path_spec=`echo "$la_search_path_spec" | $la_NL2SP` else la_sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi AC_MSG_RESULT($la_sys_lib_search_path_spec)]) --------------020909050201000600040702 Content-Type: text/plain; charset=us-ascii -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ --------------020909050201000600040702--