From c95d0e17d41adab48cd67f4e46a8183fa17438e1 Mon Sep 17 00:00:00 2001
From: Gisle Aas <gisle@activestate.com>
Date: Thu, 30 Mar 2006 12:13:54 +0000
Subject: Introduce d_sitearch and d_inc_version_list config.sh variables.
 These allow me to set sitearch and sitelib to be the same without ending up
 with duplicate entries in @INC.

Basically the same way the old d_archlib variable is used.

p4raw-id: //depot/perl@27632
---
 Configure        | 14 +++++++++++++-
 Porting/Glossary |  9 +++++++++
 config_h.SH      |  6 +++---
 perl.c           |  3 ++-
 4 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/Configure b/Configure
index 374eb392b3..d8c2933d84 100755
--- a/Configure
+++ b/Configure
@@ -921,6 +921,7 @@ i_varhdr=''
 i_vfork=''
 inc_version_list=''
 inc_version_list_init=''
+d_inc_version_list=''
 installprefix=''
 installprefixexp=''
 installstyle=''
@@ -1101,6 +1102,7 @@ sig_size=''
 installsitearch=''
 sitearch=''
 sitearchexp=''
+d_sitearch=''
 installsitebin=''
 sitebin=''
 sitebinexp=''
@@ -6584,6 +6586,11 @@ rp='Pathname for the site-specific architecture-dependent library files?'
 . ./getfile
 prefixvar=sitearch
 . ./setprefixvar
+if $test X"$sitearch" = X"$sitelib"; then
+	d_sitearch="$undef"
+else
+	d_sitearch="$define"
+fi
 
 $cat <<EOM
 
@@ -6984,9 +6991,12 @@ case "$ans" in
 esac
 case "$inc_version_list" in
 ''|' ') 
-	inc_version_list_init='0';;
+	inc_version_list_init='0'
+	d_inc_version_list="$undef"
+	;;
 *)	inc_version_list_init=`echo $inc_version_list |
 		$sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
+	d_inc_version_list="$define"
 	;;
 esac
 $rm -f getverlist
@@ -21342,6 +21352,7 @@ d_grpasswd='$d_grpasswd'
 d_hasmntopt='$d_hasmntopt'
 d_htonl='$d_htonl'
 d_ilogbl='$d_ilogbl'
+d_inc_version_list="$d_inc_version_list"
 d_index='$d_index'
 d_inetaton='$d_inetaton'
 d_int64_t='$d_int64_t'
@@ -21496,6 +21507,7 @@ d_shmget='$d_shmget'
 d_sigaction='$d_sigaction'
 d_sigprocmask='$d_sigprocmask'
 d_sigsetjmp='$d_sigsetjmp'
+d_sitearch='$d_sitearch'
 d_snprintf='$d_snprintf'
 d_sockatmark='$d_sockatmark'
 d_sockatmarkproto='$d_sockatmarkproto'
diff --git a/Porting/Glossary b/Porting/Glossary
index abf9756631..488f28f541 100644
--- a/Porting/Glossary
+++ b/Porting/Glossary
@@ -1151,6 +1151,10 @@ d_ilogbl (d_ilogbl.U):
 	indicates to the C program that the ilogbl() routine is available.
 	If scalbnl is also present we can emulate frexpl.
 
+d_inc_version_list (inc_version_list.U):
+	This variable conditionally defines PERL_INC_VERSION_LIST.
+	It is set to undef when PERL_INC_VERSION_LIST is empty.
+
 d_index (d_strchr.U):
 	This variable conditionally defines HAS_INDEX if index() and
 	rindex() are available for string searching.
@@ -1907,6 +1911,11 @@ d_sigsetjmp (d_sigsetjmp.U):
 	which indicates that the sigsetjmp() routine is available to
 	call setjmp() and optionally save the process's signal mask.
 
+d_sitearch (sitearch.U):
+	This variable conditionally defines SITEARCH to hold the pathname
+	of architecture-dependent library files for $package.  If
+	$sitearch is the same as $archlib, then this is set to undef.
+
 d_sockatmark (d_sockatmark.U):
 	This variable conditionally defines the HAS_SOCKATMARK symbol, which
 	indicates to the C program that the sockatmark() routine is available.
diff --git a/config_h.SH b/config_h.SH
index e76f08ce6b..a0cc5aa892 100644
--- a/config_h.SH
+++ b/config_h.SH
@@ -3041,7 +3041,7 @@ sed <<!GROK!THIS! >$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un
  *	for a C initialization string.  See the inc_version_list entry
  *	in Porting/Glossary for more details.
  */
-#define PERL_INC_VERSION_LIST $inc_version_list_init		/**/
+#$d_inc_version_list PERL_INC_VERSION_LIST $inc_version_list_init		/**/
 
 /* INSTALL_USR_BIN_PERL:
  *	This symbol, if defined, indicates that Perl is to be installed
@@ -3485,8 +3485,8 @@ sed <<!GROK!THIS! >$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un
  *	This symbol contains the ~name expanded version of SITEARCH, to be used
  *	in programs that are not prepared to deal with ~ expansion at run-time.
  */
-#define SITEARCH "$sitearch"		/**/
-#define SITEARCH_EXP "$sitearchexp"		/**/
+#$d_sitearch SITEARCH "$sitearch"		/**/
+#$d_sitearch SITEARCH_EXP "$sitearchexp"		/**/
 
 /* SITELIB:
  *	This symbol contains the name of the private library for this package.
diff --git a/perl.c b/perl.c
index 7e0f842233..9fe9f1e8c6 100644
--- a/perl.c
+++ b/perl.c
@@ -4781,7 +4781,8 @@ S_init_perllib(pTHX)
 #  endif
 #endif
 
-#ifdef SITELIB_STEM /* Search for version-specific dirs below here */
+#if defined(SITELIB_STEM) && defined(PERL_INC_VERSION_LIST)
+    /* Search for version-specific dirs below here */
     incpush(SITELIB_STEM, FALSE, TRUE, TRUE, TRUE);
 #endif
 
-- 
cgit v1.2.1