From 30f27bd09a5994529e10058b0448e4db6268de9c Mon Sep 17 00:00:00 2001
From: Jason Parker <jparker@digium.com>
Date: Wed, 22 Aug 2007 18:54:30 +0000
Subject: [PATCH] Merged revisions 80330 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r80330 | qwell | 2007-08-22 13:53:18 -0500 (Wed, 22 Aug 2007) | 7 lines

Fix a few build issues in Solaris (and likely others).

Use GREP and ID variables from autoconf.

Reported to me in #asterisk-dev
I forgot who reported this - sorry. :(

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@80331 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 Makefile                     | 2 ++
 build_tools/make_build_h     | 6 +-----
 build_tools/make_buildopts_h | 6 +++---
 build_tools/mkpkgconfig      | 2 +-
 build_tools/prep_moduledeps  | 2 +-
 build_tools/strip_nonapi     | 4 ++--
 6 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/Makefile b/Makefile
index 1845f3e0a9..a3e7e511b5 100644
--- a/Makefile
+++ b/Makefile
@@ -59,6 +59,8 @@ export PROC
 export SOLINK
 export STRIP
 export DOWNLOAD
+export GREP
+export ID
 export OSARCH
 export CURSES_DIR
 export NCURSES_DIR
diff --git a/build_tools/make_build_h b/build_tools/make_build_h
index 167785340e..b7dadfc338 100755
--- a/build_tools/make_build_h
+++ b/build_tools/make_build_h
@@ -3,11 +3,7 @@ HOSTNAME=`uname -n`
 KERNEL=`uname -r`
 MACHINE=`uname -m`
 OS=`uname -s`
-if [ `uname -s` = "SunOS" ]; then
-  USER=`/usr/xpg4/bin/id -un`
-else
-  USER=`id -un`
-fi
+USER=`${ID} -un`
 DATE=`date -u "+%Y-%m-%d %H:%M:%S"`
 cat << END
 /*
diff --git a/build_tools/make_buildopts_h b/build_tools/make_buildopts_h
index c8249558ce..0be011744c 100755
--- a/build_tools/make_buildopts_h
+++ b/build_tools/make_buildopts_h
@@ -7,16 +7,16 @@ cat << END
  */
 
 END
-TMP=`grep MENUSELECT_CFLAGS menuselect.makeopts | sed 's/MENUSELECT_CFLAGS\=//g' | sed 's/-D//g'`
+TMP=`${GREP} MENUSELECT_CFLAGS menuselect.makeopts | sed 's/MENUSELECT_CFLAGS\=//g' | sed 's/-D//g'`
 for x in ${TMP}; do
 	echo "#define ${x} 1"
 done
-TMP=`grep MENUSELECT_BUILD_DEPS menuselect.makeopts | sed 's/MENUSELECT_BUILD_DEPS\=//g'`
+TMP=`${GREP} MENUSELECT_BUILD_DEPS menuselect.makeopts | sed 's/MENUSELECT_BUILD_DEPS\=//g'`
 for x in ${TMP}; do
 	x2=`echo ${x} | tr a-z A-Z`
 	echo "#define AST_MODULE_${x2} 1"
 done
-if grep AST_DEVMODE makeopts | grep -q yes
+if ${GREP} AST_DEVMODE makeopts | ${GREP} -q yes
 then
 	echo "#define AST_DEVMODE 1"
 fi
diff --git a/build_tools/mkpkgconfig b/build_tools/mkpkgconfig
index f36c380a94..ceea7ebc01 100755
--- a/build_tools/mkpkgconfig
+++ b/build_tools/mkpkgconfig
@@ -14,7 +14,7 @@ if [ ! -d $PPATH ]; then
 fi
 
 #Solaris (and some others) don't have sed -r.  perl -p is equivalent
-if [[ `echo "xxx" | sed -r 's/x/y/g' 2>/dev/null | grep -c "yyy"` != 0 ]]; then
+if [[ `echo "xxx" | sed -r 's/x/y/g' 2>/dev/null | ${GREP} -c "yyy"` != 0 ]]; then
     EXTREGEX="sed -r -e"
 else
     EXTREGEX="perl -pe"
diff --git a/build_tools/prep_moduledeps b/build_tools/prep_moduledeps
index 01aeda6b70..333e8853e8 100755
--- a/build_tools/prep_moduledeps
+++ b/build_tools/prep_moduledeps
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 get_description() {
-	TDESC=`grep -e AST_MODULE_INFO ${1} | head -n 1 | cut -d '"' -f 2`
+	TDESC=`${GREP} -e AST_MODULE_INFO ${1} | head -n 1 | cut -d '"' -f 2`
 }
 
 process_dir() {
diff --git a/build_tools/strip_nonapi b/build_tools/strip_nonapi
index 5fc0ed1146..c2262cafac 100755
--- a/build_tools/strip_nonapi
+++ b/build_tools/strip_nonapi
@@ -15,11 +15,11 @@
 #	astman_
 #	pbx_
 
-FILTER="grep -v -e ^ast_ -e ^_ast_ -e ^__ast_ -e ^astman_ -e ^pbx_"
+FILTER="${GREP} -v -e ^ast_ -e ^_ast_ -e ^__ast_ -e ^astman_ -e ^pbx_"
 
 case "${OSARCH}" in
     linux-gnu)
-	nm ${1} | grep -e " T " | cut -d" " -f3 | ${FILTER} > striplist
+	nm ${1} | ${GREP} -e " T " | cut -d" " -f3 | ${FILTER} > striplist
 	sed -e "s/^/-N /" striplist | xargs ${STRIP} ${1}
 	rm -f striplist
 	;;
-- 
GitLab