|FreeTDS User Guide: A Guide to Installing, Configuring, and Running FreeTDS|
|Prev||Chapter 2. Build FreeTDS||Next|
If you've built other GNU projects, building FreeTDS is a fairly straightforward process. We have a terse and verbose description.
FreeTDS is known to build with GNU and BSD make. If you encounter a large number of build errors, and your operating system's make is not GNU make (as is the case on most non-GNU/Linux systems), you may wish to install GNU make from ftp.gnu.org.
$ ./configure --prefix=/usr/local $ make $ su root Password: $ make install
Building from git is described in the file INSTALL.GIT.
The GNU development system can generate code for a wide variety of hardware architectures and operating systems, virtually all of which can run FreeTDS in consequence. The work of building and installing the FreeTDS libraries begins with the command configure, which generates the Makefile that governs how the code is compiled, linked, and installed. Once you've "configured" the project, make will manage the rest of the build.
If you intend to build the FreeTDS ODBC driver — and want to use a Driver Manager (DM), as most people do — install the Driver Manager before configuring FreeTDS. configure will detect the the DM and use its header (.h) files for ODBC constants and such. If your DM is installed in an unusual directory, you may have to provide the directory name as a parameter to configure.
FreeTDS doesn't require a DM.
You can build the ODBC driver without one, as long as you have the requisite header files: sql.h, sqlext.h and sqltypes.h.
These can be taken from either the iODBC or unixODBC distributions.
Put them wherever you like (e.g., /usr/local/include).
Because FreeTDS won't detect your (missing) DM, it won't automatically build the ODBC driver, so you'll have to tell configure what to do and where to look.
The simplest form of running configure is:
$ ./configureand sometimes that's enough. configure accepts command-line arguments, too, and you may need to provide some, depending on your environment.
There are a few optional arguments to configure that may be important to you. For a complete list, see configure --help.
Directories and TDS version
install architecture-independent files in
PREFIX. When you run make install, libraries will be placed in
PREFIX/lib, executables in
PREFIX/bin, and so on.
The default is /usr/local if this argument is not passed to configure.
read-only single-machine data in
The default is PREFIX/etc (
PREFIX being the value of
--prefix=PREFIX, above) if this argument is not passed to configure.
Specifies the location of the iconv library to use. configure will search for libiconv in the usual places; use
--with-libiconv-prefix if it's unsuccessful (assuming you want to use iconv, of course). Overridden by
Version 0.95 removed support for iconv which cannot convert from any encoding to any encoding. This affect potentially systems like Tru64 and HP-UX were iconv mainly convert from/to ucs2. It's recommended to use GNU libiconv in this case.
Specifies the default TDS version. (There are a couple of ways to set the TDS version at run-time. This parameter takes effect if no run-time settings are provided.) Acceptable values of
VER are 5.0, 7.1, 7.2, 7.3 and 7.4.
The default is auto if this argument is not passed to configure.
ODBC Driver Managers
Specify a particular ODBC driver manager and the directory in which it is installed.
--with-iodbc form chooses iODBC as the driver manager, and
--with-unixodbc specifies unixODBC as the driver manager.
The directory argument is required for
--with-unixodbc, but may be omitted for
--with-iodbc; pkg-config will be used to find your iODBC installation if the directory is omitted.
Typical directory arguments are /usr and /usr/local.
So long as either iODBC or unixODBC are installed, the build system will detect your driver manager by default. As a result, these options are only needed if you wish to override the default behavior.
It is an error to specify both
If you're building the ODBC driver and not using a Driver Manager, use this option to indicate the location of the .h files. configure will not cause the ODBC driver to be built unless this option is used or a DM is detected/specified.
Things you can turn off
Do not attempt to detect ODBC, and do not build the ODBC driver. In case you don't care about ODBC.
Do not attempt to build applications like tsql.
Do not attempt to build server stuff.
Do not attempt to build pool stuff.
By default, configure will search your system for an iconv library for use with Microsoft servers (because TDS 7.0 employs Unicode). This switch prevents that search. If no iconv library is used, FreeTDS relies on its built-in iconv emulation, which is capable of converting ISO-8859-1 to UCS-2, sufficient for many applications.
Force FreeTDS not to use threadsafe versions of functions such as
gethostbyname_r() where available. Rely instead on the older and non-threadsafe ones such as
gethostbyname(). configure tests some of these functions. If the tests are successful, FreeTDS will use threadsafe functions throughout.
Threadsafe operation has been tested on Linux, FreeBSD, HP-UX and Windows. It should work on Solaris, Tru64, and (reportedly) IRIX. Not expected to work on non-unixy systems. Should not be used if your system supports threads. Pool server and MARS won't work if disabled.
Debug-mode compiles are enabled by default, and will remain so at least until version 1.0. You can speed things up ever so slightly by disabling it.
Disable support for wide characaters in ODBC.
Disable SSPI support. SSPI is a Micrsoft library that allows you to use your current logged-in account for authentication. With this option enabled (the default), FreeTDS supports "trusted logins" for Win32/64, just as Microsoft's own implementations do.
Things you can turn on
Enable Microsoft behavior in the DB-Library API where it diverges from Sybase's. Use this option if you are replacing Microsoft's libraries with FreeTDS
This option specifies default behavior. Programs can change the default at compile time by defining MSDBLIB or SYBDBLIB (for Microsoft or Sybase behavior, respectively).
Enable close compatibility with Sybase's ABI, at the expense of other features. Currently, this enables the generation of a dbopen() entry point in DB-Library, which may clash with the DBM function with the same name. Absolutely not required for use with other free software.
Enable Kerberos support. With Kerberos you can connect to server using your stored Kerberos ticket. Obviously requires Kerberos be configured on the machine.
Intended for debugging purposes, enables certain internal consistency checks against problems like memory corruption and buffer exhaustion.
Enable some code still in development. Should be used only by a developer or a brave user :)
Compile ODBC tests to use wide characters. Test will use wide versions.
Enable SSL using GnuTLS.
Enable SSL using OpenSSL. Unlike FreeTDS, OpenSSL does not use the LGPL. Please read the OpenSSL license before distributing binaries compiled with this option.
Now you're ready to build. Follow these easy steps.
Download the tarball and unpack it.
Alternatively, get the latest build from git  .
Change to the freetds directory.
run ./configure with any options you need.
make; make install; make clean
You normally need to be root to make install, unless you used the
--prefix option during configuration to install into your own directory.
With any luck, you've built and installed the FreeTDS libraries.
|Two bits of advice, if you like to keep things tidy and keep track of what you did.|
Create a file to hold your configure options called, say, .build_options.
Create a build directory for the binaries, and invoke ../configure $(cat ../.build_options).
This approach lets you remove the binaries at any time and rebuild from scratch using the same options.
git users will need the GNU autotools: Autoconf, Automake, and libtool.