Full_Name: Christoph Hannebauer Version: 2.4.16 OS: Windows/cygwin URL: www.hannebauer.name/openldap-sql/configure.in.patch Submission from: (NULL) (77.189.227.183)
I wasn't able to build slapd with back-sql in cygwin, because libodbc32 is not detected by configure. The console prints the error
configure: error: could not locate suitable ODBC library
and config.log contains:
configure:31357: mgcc -o conftest.exe -g -O2 -I/usr/local/mingw/include -L/usr/local/mingw/lib conftest.c -lodbc32 >&5 /cygdrive/c/Users/CHANNE~1/AppData/Local/Temp/ccy74wDp.o: In function `main': /cygdrive/d/TestProgs/openldap-2.4.16/conftest.c:81: undefined reference to `_SQLDriverConnect'
This means there is a library libodbc32, but it doesn't define SQLDriverConnect as a _cdecl function. When the current configure script searches for an ODBC library, it only checks whether one of the libraries iodbc, odbc, or odbc32 has SQLDriverConnect defined as _cdecl, which is not the case if odbc32 provides its functions as _stdcall. All Windows API functions are mangled as _stdcall functions, so I assume this error occurs on most MSYS and cygwin systems.
With the attached patch, configure uses windows.h and sqlext.h to compile SQLDriverConnect and then tries to link it with -lodbc32 if no other ODBC library can be linked. This way, SQLDriverConnect is compiled the way sqlext.h defines it, which is _stdcall in case of cygwin.
I have tested the patch in my environment: slapd with back-sql builds successfully.
Glueck & Kanja Consulting AG (www.glueckkanja.com) hereby places the following modifications to OpenLDAP Software (and only these modifications) into the public domain. Hence, these modifications may be freely used and/or redistributed for any purpose with or without attribution and/or other notice.