diff --git a/configure b/configure index e033e059acd..9dfdc0a17df 100755 --- a/configure +++ b/configure @@ -15672,6 +15672,88 @@ esac fi +{ echo "$as_me:$LINENO: checking for -lodbc" >&5 +echo $ECHO_N "checking for -lodbc... $ECHO_C" >&6; } +if test "${ac_cv_lib_soname_odbc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_soname_save_LIBS=$LIBS +LIBS="-lodbc $LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char SQLConnect (); +int +main () +{ +return SQLConnect (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + case "$LIBEXT" in + dll) ;; + dylib) ac_cv_lib_soname_odbc=`otool -L conftest$ac_exeext | grep "libodbc\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libodbc\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; + *) ac_cv_lib_soname_odbc=`$ac_cv_path_LDD conftest$ac_exeext | grep "libodbc\\.$LIBEXT" | sed -e "s/^.*\(libodbc\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` ;; + esac +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + LIBS=$ac_check_soname_save_LIBS +fi +if test "x$ac_cv_lib_soname_odbc" = "x"; then + { echo "$as_me:$LINENO: result: not found" >&5 +echo "${ECHO_T}not found" >&6; } + cat >>confdefs.h <<_ACEOF +#define SONAME_LIBODBC "libodbc.$LIBEXT" +_ACEOF + +else + { echo "$as_me:$LINENO: result: $ac_cv_lib_soname_odbc" >&5 +echo "${ECHO_T}$ac_cv_lib_soname_odbc" >&6; } + +cat >>confdefs.h <<_ACEOF +#define SONAME_LIBODBC "$ac_cv_lib_soname_odbc" +_ACEOF + + +fi + + if test "x$ALSALIBS$AUDIOIOLIBS$COREAUDIO$NASLIBS$ESD_LIBS$ac_cv_lib_soname_jack" = "x" -a \ "$ac_cv_header_sys_soundcard_h" != "yes" -a \ "$ac_cv_header_machine_soundcard_h" != "yes" -a \ diff --git a/configure.ac b/configure.ac index c9036e50213..6aed60b3b2e 100644 --- a/configure.ac +++ b/configure.ac @@ -1167,6 +1167,9 @@ fi WINE_NOTICE_WITH(png,[test "x$ac_cv_lib_soname_png" = "x"], [libpng development files not found, PNG won't be supported.]) +dnl **** Check for libodbc **** +WINE_CHECK_SONAME(odbc,SQLConnect,,[AC_DEFINE_UNQUOTED(SONAME_LIBODBC,["libodbc.$LIBEXT"])]) + dnl **** Check for any sound system **** if test "x$ALSALIBS$AUDIOIOLIBS$COREAUDIO$NASLIBS$ESD_LIBS$ac_cv_lib_soname_jack" = "x" -a \ "$ac_cv_header_sys_soundcard_h" != "yes" -a \ diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c index eeae263c6cc..27941fe07f7 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -518,31 +518,23 @@ static BOOL ODBC_LoadDriverManager(void) TRACE("\n"); gProxyHandle.bFunctionReady = FALSE; - gProxyHandle.nErrorType = ERROR_LIBRARY_NOT_FOUND; - if (s!= NULL && strlen (s) >= sizeof(gProxyHandle.dmLibName)) - { - ERR("Driver name too long (%s)\n",s); - return FALSE; - } - if (s == NULL || strlen(s) == 0) - s = "libodbc.so"; - strcpy(gProxyHandle.dmLibName, s); +#ifdef SONAME_LIBODBC + if (!s || !s[0]) s = SONAME_LIBODBC; +#endif + if (!s || !s[0]) goto failed; - gProxyHandle.dmHandle = wine_dlopen(gProxyHandle.dmLibName, RTLD_LAZY | RTLD_GLOBAL, error, sizeof(error)); + gProxyHandle.dmHandle = wine_dlopen(s, RTLD_LAZY | RTLD_GLOBAL, error, sizeof(error)); - if (gProxyHandle.dmHandle == NULL) /* fail to load unixODBC driver manager */ - { - WARN("failed to open library %s: %s\n", gProxyHandle.dmLibName, error); - gProxyHandle.dmLibName[0] = '\0'; - gProxyHandle.nErrorType = ERROR_LIBRARY_NOT_FOUND; - return FALSE; - } - else + if (gProxyHandle.dmHandle != NULL) { gProxyHandle.nErrorType = ERROR_FREE; return TRUE; } +failed: + WARN("failed to open library %s: %s\n", debugstr_a(s), error); + gProxyHandle.nErrorType = ERROR_LIBRARY_NOT_FOUND; + return FALSE; } diff --git a/dlls/odbc32/proxyodbc.h b/dlls/odbc32/proxyodbc.h index d0f6efe225e..bcd73da9602 100644 --- a/dlls/odbc32/proxyodbc.h +++ b/dlls/odbc32/proxyodbc.h @@ -45,7 +45,6 @@ typedef struct proxyhandle int nErrorType; DM_FUNC functions[NUM_SQLFUNC]; /* entry point for driver manager functions */ char driverLibName[200]; /* ODBC driver SO name */ - char dmLibName[200]; /* driver manager library name */ char ServerName[200]; /* keep server name */ char UserName[50]; /* keep username */ } PROXYHANDLE; diff --git a/include/config.h.in b/include/config.h.in index 75e5d64555a..14a26489601 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -1023,6 +1023,9 @@ /* Define to the soname of the libncurses library. */ #undef SONAME_LIBNCURSES +/* Define to the soname of the libodbc library. */ +#undef SONAME_LIBODBC + /* Define to the soname of the libpng library. */ #undef SONAME_LIBPNG