[R] RODBC installation: error message

gregory benison gbenison at gmail.com
Fri Jan 6 23:51:11 CET 2012


>
> 1. If you do not have unixODBC installed, you will get an error message regarding a missing ODBC driver manager, if as you have done here, that test is first rather than second.

If the test for the headers comes first, and no driver manager is
installed, configure exits with an error before the library test is
run (hence the error message regarding a missing driver manager is not
displayed).

> I cannot speak for Prof. Ripley here, but since you seem to have the requisite skills, he may be open to accepting a patch against his package that would narrowly address the issue that you raise.
>

OK, here's my shot at such a patch (below), together with the
resulting configure output in cases where the library or the headers
are missing.  I realize that there are matters of style preference
here, that this approach errs on the side of verbosity rather than
terseness, and that it's entirely up to the R package maintainers
which style to adopt.

Thanks for the replies!

Greg

==== Case 1, no ODBC driver manager installed =====

checking for stdint.h... yes
checking for unistd.h... yes
checking sql.h usability... no
checking sql.h presence... no
checking for sql.h... no
checking sqlext.h usability... no
checking sqlext.h presence... no
checking for sqlext.h... no
checking for library containing SQLTables... no
configure: error:
No ODBC driver manager found;
see section "Installation" in inst/doc/RODBC.pdf
(also at http://cran.r-project.org/web/packages/RODBC/vignettes/RODBC.pdf)
ERROR: configuration failed for package 'RODBC'

====== Case 2, driver manager installed but no headers ========

checking for unistd.h... yes
checking sql.h usability... no
checking sql.h presence... no
checking for sql.h... no
checking sqlext.h usability... no
checking sqlext.h presence... no
checking for sqlext.h... no
checking for library containing SQLTables... -lodbc
configure: error:
Found ODBC driver manager library (-lodbc),
but not required ODBC headers sql.h and sqlext.h.
(Need -devel version of ODBC driver manager?)

ERROR: configuration failed for package 'RODBC'

========= patch follows ============

diff --git a/configure.ac b/configure.ac
index 8f9fc6a..8661e8f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -64,10 +64,6 @@ CPPFLAGS="${CPPFLAGS} ${RODBC_CPPFLAGS}"

 dnl Check the headers can be found
 AC_CHECK_HEADERS(sql.h sqlext.h)
-if test "${ac_cv_header_sql_h}" = no ||
-   test "${ac_cv_header_sqlext_h}" = no; then
-   AC_MSG_ERROR("ODBC headers sql.h and sqlext.h not found")
-fi

 dnl search for a library containing an ODBC function
 if test [ -n "${odbc_mgr}" ] ; then
@@ -75,9 +71,23 @@ if test [ -n "${odbc_mgr}" ] ; then
                 AC_MSG_ERROR("ODBC driver manager '${odbc_mgr}' not found"))
 else
   AC_SEARCH_LIBS(SQLTables, odbc odbc32 iodbc, ,
-                AC_MSG_ERROR("no ODBC driver manager found"))
+                AC_MSG_ERROR([
+No ODBC driver manager found;
+see section "Installation" in inst/doc/RODBC.pdf
+(also at http://cran.r-project.org/web/packages/RODBC/vignettes/RODBC.pdf)]))
+fi
+
+dnl Exit with error if ODBC headers were not found
+if test "${ac_cv_header_sql_h}" = no ||
+   test "${ac_cv_header_sqlext_h}" = no; then
+   AC_MSG_ERROR([
+Found ODBC driver manager library ($ac_cv_search_SQLTables),
+but not required ODBC headers sql.h and sqlext.h.
+(Need -devel version of ODBC driver manager?)
+])
 fi

+
 dnl for 64-bit ODBC need SQL[U]LEN, and it is unclear where they are defined.
 AC_CHECK_TYPES([SQLLEN, SQLULEN], , , [# include <sql.h>])
 dnl for unixODBC header



More information about the R-help mailing list