Skip to content

Use pkg-config to detect iodbc #411

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 18, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 27 additions & 12 deletions ext/odbc/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -365,22 +365,37 @@ fi

if test -z "$ODBC_TYPE"; then
PHP_ARG_WITH(iodbc,,
[ --with-iodbc[=DIR] Include iODBC support [/usr/local]])
[ --with-iodbc[=DIR] Include iODBC support])

if test "$PHP_IODBC" != "no"; then
AC_MSG_CHECKING(for iODBC support)
if test "$PHP_IODBC" = "yes"; then
PHP_IODBC=/usr/local
if test -z "$PKG_CONFIG"; then
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
fi
if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libiodbc ; then
PHP_ADD_LIBRARY_WITH_PATH(iodbc, $PHP_IODBC/$PHP_LIBDIR)
ODBC_TYPE=iodbc
ODBC_INCLUDE=`$PKG_CONFIG --cflags-only-I libiodbc`
ODBC_LFLAGS=`$PKG_CONFIG --libs-only-L libiodbc`
ODBC_LIBS=`$PKG_CONFIG --libs-only-l libiodbc`
PHP_EVAL_INCLINE($ODBC_INCLUDE)
AC_DEFINE(HAVE_IODBC,1,[ ])
AC_DEFINE(HAVE_ODBC2,1,[ ])
AC_MSG_RESULT([$ext_output])
else
if test "$PHP_IODBC" = "yes"; then
PHP_IODBC=/usr/local
fi
PHP_ADD_LIBRARY_WITH_PATH(iodbc, $PHP_IODBC/$PHP_LIBDIR)
PHP_ADD_INCLUDE($PHP_IODBC/include, 1)
ODBC_TYPE=iodbc
ODBC_INCLUDE=-I$PHP_IODBC/include
ODBC_LFLAGS=-L$PHP_IODBC/$PHP_LIBDIR
ODBC_LIBS=-liodbc
AC_DEFINE(HAVE_IODBC,1,[ ])
AC_DEFINE(HAVE_ODBC2,1,[ ])
AC_MSG_RESULT([$ext_output])
fi
PHP_ADD_LIBRARY_WITH_PATH(iodbc, $PHP_IODBC/$PHP_LIBDIR)
PHP_ADD_INCLUDE($PHP_IODBC/include, 1)
ODBC_TYPE=iodbc
ODBC_INCLUDE=-I$PHP_IODBC/include
ODBC_LFLAGS=-L$PHP_IODBC/$PHP_LIBDIR
ODBC_LIBS=-liodbc
AC_DEFINE(HAVE_IODBC,1,[ ])
AC_DEFINE(HAVE_ODBC2,1,[ ])
AC_MSG_RESULT([$ext_output])
fi
fi

Expand Down