From xemacs-m  Sat Mar 22 16:27:01 1997
Received: from GS213.SP.CS.CMU.EDU (GS213.SP.CS.CMU.EDU [128.2.209.183])
	by xemacs.org (8.8.5/8.8.5) with SMTP id QAA00622
	for <xemacs-beta@xemacs.org>; Sat, 22 Mar 1997 16:27:00 -0600 (CST)
Received: by GS213.SP.CS.CMU.EDU (AIX 3.2/UCB 5.64/4.03)
          id AA20545; Sat, 22 Mar 1997 17:26:53 -0500
Date: Sat, 22 Mar 1997 17:26:53 -0500
Message-Id: <9703222226.AA20545@GS213.SP.CS.CMU.EDU>
From: Darrell Kindred <dkindred@cmu.edu>
To: xemacs-beta@xemacs.org
Subject: IRIX configure patch
Organization: Carnegie Mellon University School of Computer Science

The patch below adds configure support for the -rpath flag
that the IRIX ld uses to specify directories to search for
shared libs at runtime (analogous to the Solaris "-R").

There are a couple of problems, though:

  1. The ld in IRIX 5.3 ignores all but the last -rpath
     spec, so the patched configure spits out a warning
     if --x-libraries or --site-runtime-libraries are
     specified under irix 5.x, and it only adds -rpath 
     entries for the --site-runtime-libraries.  This bug was
     fixed sometime between 5.3 and 6.2.

  2. IRIX gcc 2.7.2 doesn't accept -rpath directly, so
     it would have to be prefixed by -Xlinker or "-Wl,".
     This would be fine, except that configure compiles with
        ${CC-cc} $CFLAGS $LDFLAGS ...
     rather than quoting $LDFLAGS with prefix-args, like
     src/Makefile does.  So if you specify --x-libraries
     or --site-runtime-libraries, you must use --use-gcc=no,
     or configure will fail.

Because of these problems, and because it's not a completely
trivial patch, I have some reservations about putting this
patch in for 19.15.  Without the patch, configure will work
fine under IRIX as long as you don't need to specify any
extra shared-lib directories.  If you want to just put in
in 20.1, that's okay with me.

It might be worthwhile for someone to look at having
configure do the right thing with $LDFLAGS when gcc is being
used, for future releases.

- Darrell

*** configure.in.orig	Thu Mar 20 22:15:15 1997
--- configure.in	Sat Mar 22 15:59:57 1997
***************
*** 2801,2813 ****
    with_toolbars='yes'
  fi
  
  case "${canonical}" in
!   *-sun-solaris* | *-sun-sunos5* ) add_runtime_flag=yes ;;
  esac
  
  if [ -n "${x_libraries}" ]; then
!     if [ "${add_runtime_flag}" ]; then
! 	LD_SWITCH_X_SITE="-L${x_libraries} -R${dash_r_space}${x_libraries}"
      else
  	LD_SWITCH_X_SITE="-L${x_libraries}"
      fi
--- 2801,2838 ----
    with_toolbars='yes'
  fi
  
+ runtime_arg="-R${dash_r_space}"
+ 
  case "${canonical}" in
!   *-sun-solaris* | *-sun-sunos5* ) 
!     add_runtime_flag=yes ;;
!   *-sgi-irix5.* )
!     # In the IRIX 5.3 ld, only the last -rpath arg has any effect.  This is 
!     # fundamentaly incompatible with having separate LD_SWITCH_X_SITE
!     # and LD_SWITCH_SITE variables.  Fortunately, SGI fixed this by 6.2.
!     if [ -n "${x_libraries}" ] || [ -n "${site_runtime_libraries}" ]; then
!       (echo "WARNING: The IRIX 5 ld ignores all but the last -rpath argument,";
!        echo "         so if you need to specify more than one additional";
!        echo "         runtime library directory, you will have to do so";
!        echo "         manually by setting the environment variable";
!        echo "         LD_SWITCH_SITE to '-rpath <path>' before running";
!        echo "         configure.  If you have only one additional directory,"
!        echo "         you can specify it with --site-runtime-libraries.") >&2
!     fi
!     runtime_arg="-rpath " ;;
!   *-sgi-irix* )
!     # Note that IRIX gcc (as of 2.7.2) doesn't accept -rpath, so
!     # using it can cause trouble.  Specifying --use-gcc=no will work 
!     # around this, but the real problem is that configure uses $LDFLAGS 
!     # as arguments to $(CC), instead of using prefix-args like the
!     # src/Makefile does.
!     add_runtime_flag=yes;
!     runtime_arg="-rpath " ;;
  esac
  
  if [ -n "${x_libraries}" ]; then
!     if [ "${add_runtime_flag}" = "yes" ]; then
! 	LD_SWITCH_X_SITE="-L${x_libraries} ${runtime_arg}${x_libraries}"
      else
  	LD_SWITCH_X_SITE="-L${x_libraries}"
      fi
***************
*** 2826,2832 ****
    for arg in ${site_runtime_libraries}
    do
      LD_SWITCH_SITE="${LD_SWITCH_SITE} -L${arg}"
!     LD_SWITCH_SITE="${LD_SWITCH_SITE} -R${dash_r_space}${arg}"
    done
  fi
  if [ -n "${site_includes}" ]; then
--- 2851,2857 ----
    for arg in ${site_runtime_libraries}
    do
      LD_SWITCH_SITE="${LD_SWITCH_SITE} -L${arg}"
!     LD_SWITCH_SITE="${LD_SWITCH_SITE} ${runtime_arg}${arg}"
    done
  fi
  if [ -n "${site_includes}" ]; then
***************
*** 3917,3924 ****
      case "${arg}" in
  	-L*) if [ -f `echo "${arg}/libtt.a" | sed 's/^\-L//'` ]; then
  		 dash_r=''
! 		 if [ -n "${add_runtime_flag}" ]; then
! 		     dash_r=`echo ${arg} | sed "s/^-L/-R${dash_r_space}/"`
  		 fi
  		 LD_SWITCH_X_SITE="${LD_SWITCH_X_SITE} ${arg} ${dash_r}"
  	     fi
--- 3942,3949 ----
      case "${arg}" in
  	-L*) if [ -f `echo "${arg}/libtt.a" | sed 's/^\-L//'` ]; then
  		 dash_r=''
! 		 if [ "${add_runtime_flag}" = "yes" ]; then
! 		     dash_r=`echo ${arg} | sed "s/^-L */${runtime_arg}/"`
  		 fi
  		 LD_SWITCH_X_SITE="${LD_SWITCH_X_SITE} ${arg} ${dash_r}"
  	     fi

