From 8ca6b0c72b6b933642ec7c4ebb83734244fec46f Mon Sep 17 00:00:00 2001
From: "Song.Li" <Song.Li@windriver.com>
Date: Tue, 5 Sep 2017 10:24:10 +0800
Subject: [PATCH] remove some checks for cross-compiling

some lib check is not suitable for
cross-compiling, so remove them.

Upstream-Status: Inappropriate [not a real bug,just for cross-compiling]

Signed-off-by: Song.Li <Song.Li@windriver.com>
Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>

---
 configure.ac | 80 +++++-----------------------------------------------
 1 file changed, 7 insertions(+), 73 deletions(-)

diff --git a/configure.ac b/configure.ac
index 7f79563..00b359e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -57,71 +57,20 @@ AC_ARG_WITH(iodbc, [  --with-iodbc[[=DIR]]	  [[default=no]] DIR is the iODBC bas
 if test "$with_iodbc" != no; then
 	with_unixodbc=no
 	AC_DEFINE(WITH_IODBC, 1, [Define to 1 to build with iODBC support])
-	if test "$with_iodbc" = yes; then
-		AC_PATH_PROGS(ODBC_CONFIG, iodbc-config)
-	else
-		ODBC_CONFIG=$with_iodbc
-	fi
-	if test ! -x "${ODBC_CONFIG}/bin/iodbc-config"; then
-		if test ! -x "${ODBC_CONFIG}"; then
-			AC_MSG_ERROR([iodbc-config not found (required for iODBC build)])
-		fi
-	else
-		ODBC_CONFIG=${ODBC_CONFIG}/bin/iodbc-config
-	fi
 fi
 
 wo_odbc_config=__without_odbc_config
 if test "$with_unixodbc" != no; then
 	AC_DEFINE(WITH_UNIXODBC, 1,
             [Define to 1 to build with unixODBC support])
-	if test "$with_unixodbc" = yes; then
-		AC_PATH_PROGS(ODBC_CONFIG, odbc_config)
-	else
-		ODBC_CONFIG=$with_unixodbc
-	fi
-	if test "${ODBC_CONFIG}" = "${wo_odbc_config}"; then
-		:
-	elif test ! -x "${ODBC_CONFIG}/bin/odbc_config"; then
-		if test ! -x "${ODBC_CONFIG}"; then
-			AC_MSG_ERROR([odbc_config not found (required for unixODBC build)])
-		fi
-	else
-		ODBC_CONFIG=${ODBC_CONFIG}/bin/odbc_config
-	fi
 fi
 
 #
 # ODBC include and library
 #
-
-if test "$ODBC_CONFIG" != ""; then
-	if test "$with_iodbc" != no; then
-		ODBC_INCLUDE=`${ODBC_CONFIG} --cflags`
-		CPPFLAGS="$CPPFLAGS ${ODBC_INCLUDE}"
-		# Linking libiodoc is rather problematic
-		[ODBC_LIBDIR=`${ODBC_CONFIG} --libs | sed -e "s/^\(-L\|.*[ \t]-L\)\([^ \n\r\f\t]*\).*$/-L\2/"`]
-		LDFLAGS="$LDFLAGS ${ODBC_LIBDIR}"
-		LIBODBC=`${ODBC_CONFIG} --libs`	# for regression test
-	elif test "${ODBC_CONFIG}" = "${wo_odbc_config}"; then
-		ODBC_INCLUDE=/usr/include
-		CPPFLAGS="$CPPFLAGS -I${ODBC_INCLUDE}"
-		ODBC_LIBDiR=""
-		LIBODBC="-lodbc"	# for regression test
-	else
-		ODBC_INCLUDE=`${ODBC_CONFIG} --include-prefix`
-		CPPFLAGS="$CPPFLAGS -I${ODBC_INCLUDE}"
-		# Linking libodbc is rather problematic
-		ODBC_LIBDIR=`${ODBC_CONFIG} --lib-prefix`
-		if test "${ODBC_LIBDIR}" != ""; then
-			LDFLAGS="$LDFLAGS -L${ODBC_LIBDIR}"
-		fi
-		LIBODBC=`${ODBC_CONFIG} --libs`	# for regression test
-	fi
-	AC_MSG_NOTICE([using $ODBC_INCLUDE $ODBC_LIBDIR])
-	AC_MSG_NOTICE([using $LIBODBC for regression test])
-fi
-AC_SUBST(LIBODBC)
+ODBC_LIBS="-lodbcinst"
+LIBS="$LIBS ${ODBC_LIBS}"
+AC_MSG_NOTICE([using $ODBC_INCLUDE $ODBC_LIBS])
 
 #
 # SQLCOLATTRIBUTE_SQLLEN check
@@ -190,19 +139,10 @@ PGAC_ARG_BOOL(enable, pthreads, yes,
 # Find libpq headers and libraries
 #
 
-if test -z "$PG_CONFIG"; then
-  AC_PATH_PROGS(PG_CONFIG, pg_config)
-fi
-
-if test -n "$PG_CONFIG"; then
-  pg_includedir=`"$PG_CONFIG" --includedir`
-  pg_pkg_includedir=`"$PG_CONFIG" --pkgincludedir`
-  pg_libdir=`"$PG_CONFIG" --libdir`
-  CPPFLAGS="$CPPFLAGS -I$pg_includedir -I$pg_pkg_includedir/internal"
-  LDFLAGS="$LDFLAGS -L$pg_libdir"
-fi
-
-
+pg_includedir=""
+pg_libdir=""
+CPPFLAGS="$CPPFLAGS"
+LDFLAGS="$LDFLAGS"
 
 # 1. Programs
 
@@ -226,12 +166,6 @@ if test "$with_iodbc" != no; then
                  [AC_MSG_ERROR([iODBC library "iodbcinst" not found])])
 fi
 
-if test "$enable_pthreads" = yes; then
-  AC_CHECK_LIB(pthreads, pthread_create,
-               [],
-	       [AC_CHECK_LIB(pthread, pthread_create)])
-fi
-
 AC_CHECK_LIB(pq, PQsetSingleRowMode, [],
 	      [AC_MSG_ERROR([libpq library version >= 9.2 is required])])
 
