1From 8fe25b30b6fbb3170705f4468eb4c92eef3a968f Mon Sep 17 00:00:00 2001
2From: Jackie Huang <jackie.huang@windriver.com>
3Date: Mon, 4 Jan 2016 01:44:04 -0500
4Subject: [PATCH] Avoid searching host dirs
5
6Don't search the hardcoded host dirs to avoid
7host contamination.
8
9Upstream-Status: Inappropriate [embedded specific]
10
11Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
12Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
13
14Rebased for 3.2.3
15Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
16---
17 m4/fr_smart_check_include.m4                                |    2 +-
18 m4/fr_smart_check_lib.m4                                    |   22 ----------------------
19 src/modules/rlm_sql/drivers/rlm_sql_db2/configure.ac        |    4 ++--
20 src/modules/rlm_sql/drivers/rlm_sql_firebird/configure.ac   |    4 ++--
21 src/modules/rlm_sql/drivers/rlm_sql_iodbc/configure.ac      |    4 ++--
22 src/modules/rlm_sql/drivers/rlm_sql_mysql/configure.ac      |    6 +++---
23 src/modules/rlm_sql/drivers/rlm_sql_oracle/configure.ac     |    2 +-
24 src/modules/rlm_sql/drivers/rlm_sql_postgresql/configure.ac |    4 ++--
25 src/modules/rlm_sql/drivers/rlm_sql_unixodbc/configure.ac   |    4 ++--
26 9 files changed, 15 insertions(+), 37 deletions(-)
27
28diff --git a/m4/fr_smart_check_include.m4 b/m4/fr_smart_check_include.m4
29index e7d4443f9c..2b69704f98 100644
30--- a/m4/fr_smart_check_include.m4
31+++ b/m4/fr_smart_check_include.m4
32@@ -9,7 +9,7 @@ ac_safe=`echo "$1" | sed 'y%./+-%__pm%'`
33 old_CPPFLAGS="$CPPFLAGS"
34 smart_include=
35 dnl #  The default directories we search in (in addition to the compilers search path)
36-smart_include_dir="/usr/local/include /opt/include"
37+smart_include_dir=""
38
39 dnl #  Our local versions
40 _smart_try_dir=
41diff --git a/src/modules/rlm_sql/drivers/rlm_sql_db2/configure.ac b/src/modules/rlm_sql/drivers/rlm_sql_db2/configure.ac
42index 0d94ee9bf6..6108e62054 100644
43--- a/src/modules/rlm_sql/drivers/rlm_sql_db2/configure.ac
44+++ b/src/modules/rlm_sql/drivers/rlm_sql_db2/configure.ac
45@@ -58,14 +58,14 @@ AC_ARG_WITH(ibmdb2-dir,
46 	esac])
47
48 dnl Check for SQLConnect in -ldb2
49-smart_try_dir="$ibmdb2_lib_dir /usr/local/db2/lib /usr/IBMdb2/V7.1/lib"
50+smart_try_dir="$ibmdb2_lib_dir"
51 FR_SMART_CHECK_LIB(db2, SQLConnect)
52 if test "x$ac_cv_lib_db2_SQLConnect" != xyes; then
53 	FR_MODULE_FAIL([libdb2])
54 fi
55
56 dnl Check for sqlcli.h
57-smart_try_dir="$ibmdb2_include_dir /usr/local/db2/include /usr/IBMdb2/V7.1/include"
58+smart_try_dir="$ibmdb2_include_dir"
59 FR_SMART_CHECK_INCLUDE(sqlcli.h)
60 if test "x$ac_cv_header_sqlcli_h" != xyes; then
61 	FR_MODULE_FAIL([sqlcli.h])
62diff --git a/src/modules/rlm_sql/drivers/rlm_sql_firebird/configure.ac b/src/modules/rlm_sql/drivers/rlm_sql_firebird/configure.ac
63index 5aa7b4b6ee..2eda5b6cc5 100644
64--- a/src/modules/rlm_sql/drivers/rlm_sql_firebird/configure.ac
65+++ b/src/modules/rlm_sql/drivers/rlm_sql_firebird/configure.ac
66@@ -58,14 +58,14 @@ AC_ARG_WITH(firebird-dir,
67 	esac])
68
69 dnl Check for isc_attach_database in -lfbclient
70-smart_try_dir="$firebird_lib_dir /usr/lib/firebird2/lib /usr/local/firebird/lib"
71+smart_try_dir="$firebird_lib_dir"
72 FR_SMART_CHECK_LIB(fbclient, isc_attach_database)
73 if test "x$ac_cv_lib_fbclient_isc_attach_database" != xyes; then
74 	FR_MODULE_FAIL([libfbclient])
75 fi
76
77 dnl Check for ibase.h
78-smart_try_dir="$firebird_include_dir /usr/lib/firebird2/include /usr/local/firebird/include"
79+smart_try_dir="$firebird_include_dir"
80 FR_SMART_CHECK_INCLUDE(ibase.h)
81 if test "x$ac_cv_header_ibase_h" != xyes; then
82 	FR_MODULE_FAIL([ibase.h])
83diff --git a/src/modules/rlm_sql/drivers/rlm_sql_iodbc/configure.ac b/src/modules/rlm_sql/drivers/rlm_sql_iodbc/configure.ac
84index d96216aca8..88cbc469f7 100644
85--- a/src/modules/rlm_sql/drivers/rlm_sql_iodbc/configure.ac
86+++ b/src/modules/rlm_sql/drivers/rlm_sql_iodbc/configure.ac
87@@ -58,14 +58,14 @@ AC_ARG_WITH(iodbc-dir,
88 	esac])
89
90 dnl Check for SQLConnect in -liodbc
91-smart_try_dir="$iodbc_lib_dir /usr/lib /usr/lib/iodbc /usr/local/lib/iodbc /usr/local/iodbc/lib/iodbc"
92+smart_try_dir="$iodbc_lib_dir"
93 FR_SMART_CHECK_LIB(iodbc, SQLConnect)
94 if test "x$ac_cv_lib_iodbc_SQLConnect" != xyes; then
95 	FR_MODULE_FAIL([libiodbc])
96 fi
97
98 dnl Check for isql.h
99-smart_try_dir="$iodbc_include_dir /usr/include /usr/include/iodbc /usr/local/iodbc/include"
100+smart_try_dir="$iodbc_include_dir"
101 FR_SMART_CHECK_INCLUDE(isql.h)
102 if test "x$ac_cv_header_isql_h" != xyes; then
103 	FR_MODULE_FAIL([isql.h])
104diff --git a/src/modules/rlm_sql/drivers/rlm_sql_mysql/configure.ac b/src/modules/rlm_sql/drivers/rlm_sql_mysql/configure.ac
105index d36aecbda6..201a623d4e 100644
106--- a/src/modules/rlm_sql/drivers/rlm_sql_mysql/configure.ac
107+++ b/src/modules/rlm_sql/drivers/rlm_sql_mysql/configure.ac
108@@ -138,7 +138,7 @@ fi
109
110 dnl # Check for libmysqlclient_r
111 if test "x$have_a_libmysqlclient" != "xyes"; then
112-    smart_try_dir="$mysql_lib_dir /usr/lib /usr/lib/mysql /usr/local/lib/mysql /usr/local/mysql/lib/mysql"
113+    smart_try_dir="$mysql_lib_dir"
114     FR_SMART_CHECK_LIB(mysqlclient_r, mysql_init)
115     if test "x$ac_cv_lib_mysqlclient_r_mysql_init" = "xyes"; then
116 		have_a_libmysqlclient='yes'
117@@ -147,7 +147,7 @@ fi
118
119 dnl # Check for libmysqlclient
120 if test "x$have_a_libmysqlclient" != "xyes"; then
121-    smart_try_dir="$mysql_lib_dir /usr/lib /usr/lib/mysql /usr/local/lib/mysql /usr/local/mysql/lib/mysql"
122+    smart_try_dir="$mysql_lib_dir"
123     FR_SMART_CHECK_LIB(mysqlclient, mysql_init)
124     if test "x$ac_cv_lib_mysqlclient_mysql_init" = "xyes"; then
125 		have_a_libmysqlclient='yes'
126@@ -242,7 +242,7 @@ if test "x$have_mysql_h" != "xyes"; then
127 fi
128
129 if test "x$have_mysql_h" != "xyes"; then
130-	smart_try_dir="$mysql_include_dir /usr/local/include /usr/local/mysql/include"
131+	smart_try_dir="$mysql_include_dir"
132 	FR_SMART_CHECK_INCLUDE(mysql/mysql.h)
133 	if test "x$ac_cv_header_mysql_mysql_h" = "xyes"; then
134 	AC_DEFINE(HAVE_MYSQL_MYSQL_H, [], [Define if you have <mysql/mysql.h>])
135diff --git a/src/modules/rlm_sql/drivers/rlm_sql_oracle/configure.ac b/src/modules/rlm_sql/drivers/rlm_sql_oracle/configure.ac
136index f31b7d2c5a..67bbf66df5 100644
137--- a/src/modules/rlm_sql/drivers/rlm_sql_oracle/configure.ac
138+++ b/src/modules/rlm_sql/drivers/rlm_sql_oracle/configure.ac
139@@ -66,7 +66,7 @@ dnl ############################################################
140 dnl # Check for header files
141 dnl ############################################################
142
143-smart_try_dir="$oracle_include_dir /usr/local/instaclient/include"
144+smart_try_dir="$oracle_include_dir"
145
146 if test "x$ORACLE_HOME" != "x"; then
147 	smart_try_dir="${smart_try_dir} ${ORACLE_HOME}/include"
148diff --git a/src/modules/rlm_sql/drivers/rlm_sql_postgresql/configure.ac b/src/modules/rlm_sql/drivers/rlm_sql_postgresql/configure.ac
149index 46587e4099..b41c51bda7 100644
150--- a/src/modules/rlm_sql/drivers/rlm_sql_postgresql/configure.ac
151+++ b/src/modules/rlm_sql/drivers/rlm_sql_postgresql/configure.ac
152@@ -43,7 +43,7 @@ AC_ARG_WITH(rlm-sql-postgresql-include-dir,
153 		;;
154 	esac])
155
156-smart_try_dir="$rlm_sql_postgresql_include_dir /usr/include/postgresql /usr/local/pgsql/include /usr/include/pgsql"
157+smart_try_dir="$rlm_sql_postgresql_include_dir"
158 FR_SMART_CHECK_INCLUDE(libpq-fe.h)
159 if test "x$ac_cv_header_libpqmfe_h" != "xyes"; then
160 	FR_MODULE_FAIL([libpq-fe.h])
161@@ -95,7 +95,7 @@ else
162 		])
163 fi
164
165-smart_try_dir="$rlm_sql_postgresql_lib_dir /usr/lib /usr/local/pgsql/lib"
166+smart_try_dir="$rlm_sql_postgresql_lib_dir"
167 FR_SMART_CHECK_LIB(pq, PQconnectdb)
168 if test "x$ac_cv_lib_pq_PQconnectdb" != "xyes"; then
169 	FR_MODULE_FAIL([libpq])
170diff --git a/src/modules/rlm_sql/drivers/rlm_sql_unixodbc/configure.ac b/src/modules/rlm_sql/drivers/rlm_sql_unixodbc/configure.ac
171index 3bdfae6032..ce68c312c6 100644
172--- a/src/modules/rlm_sql/drivers/rlm_sql_unixodbc/configure.ac
173+++ b/src/modules/rlm_sql/drivers/rlm_sql_unixodbc/configure.ac
174@@ -58,14 +58,14 @@ AC_ARG_WITH(unixodbc-dir,
175 	esac])
176
177 dnl Check for SQLConnect in -lodbc
178-smart_try_dir="$unixodbc_lib_dir /usr/local/unixodbc/lib"
179+smart_try_dir="$unixodbc_lib_dir"
180 FR_SMART_CHECK_LIB(odbc, SQLConnect)
181 if test "x$ac_cv_lib_odbc_SQLConnect" != xyes; then
182 	FR_MODULE_FAIL([libodbc])
183 fi
184
185 dnl Check for sql.h
186-smart_try_dir="$unixodbc_include_dir /usr/local/unixodbc/include"
187+smart_try_dir="$unixodbc_include_dir"
188 FR_SMART_CHECK_INCLUDE(sql.h)
189 if test "x$ac_cv_header_sql_h" != xyes; then
190 	FR_MODULE_FAIL([sql.h])
191diff --git a/m4/fr_smart_check_lib.m4 b/m4/fr_smart_check_lib.m4
192index 16ac5b3c5e..0f5e9fc6d6 100644
193--- a/m4/fr_smart_check_lib.m4
194+++ b/m4/fr_smart_check_lib.m4
195@@ -64,28 +64,6 @@ if test "x$smart_lib" = "x"; then
196   LIBS="$old_LIBS"
197 fi
198
199-dnl #
200-dnl #  Try to guess possible locations.
201-dnl #
202-if test "x$smart_lib" = "x"; then
203-  for try in /usr/local/lib /opt/lib; do
204-    AC_MSG_CHECKING([for $2 in -l$1 in $try])
205-    LIBS="-l$1 $old_LIBS"
206-    CPPFLAGS="-L$try -Wl,-rpath,$try $old_CPPFLAGS"
207-    AC_TRY_LINK([extern char $2();],
208-		[$2()],
209-		[
210-		  smart_lib="-l$1"
211-		  smart_ldflags="-L$try -Wl,-rpath,$try"
212-		  AC_MSG_RESULT(yes)
213-		  break
214-		],
215-		[AC_MSG_RESULT(no)])
216-  done
217-  LIBS="$old_LIBS"
218-  CPPFLAGS="$old_CPPFLAGS"
219-fi
220-
221 dnl #
222 dnl #  Found it, set the appropriate variable.
223 dnl #
224