How to build: Configure and make

If you've built other GNU projects, building FreeTDS is a fairly straightforward process. We have a terse and verbose description.

Note

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.

For Experts

$ ./configure --prefix=/usr/local/freetds
$ make
$ su root
Password: 
$ make install

Building from CVS is described in the file INSTALL.CVS.

For Everyone Else

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.

The simplest form of running configure is:

	$ ./configure
and sometimes that's enough. configure accepts some command-line arguments, too, and you may need to provide some, depending on what your environment looks like.

There are a few optional arguments to configure that may be important to you. For a complete list, see configure --help.

configure options

Directories and TDS version

--prefix=PREFIX

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.

--sysconfdir=DIR

read-only single-machine data in DIR

The default is PREFIX/etc (PREFIX being the value of --prefix=PREFIX, above) if this argument is not passed to configure.

--with-libiconv-prefix=DIR

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 --disable-libiconv, below.

--with-odbc-nodm=DIR

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.

--with-tdsver=VER

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 4.2, 4.6, 5.0, 7.0, and 8.0.

The default is 5.0 if this argument is not passed to configure.

ODBC Driver Managers

--with-iodbc=DIR , --with-unixodbc=DIR

Specify directory of iODBC or unixODBC support, and use it as the Driver Manager. As of version 0.62, the ODBC Driver Manager is detected by configure, so use this parameter only if yours is installed in a nonstandard path. (Requires iODBC or unixODBC to have already been installed.)

Things you can turn off

--disable-odbc

Do not attempt to detect ODBC, and do not build the ODBC driver. In case you don't care about ODBC.

--disable-libiconv

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.

--disable-threadsafe

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, and HP-UX. It should work on Solaris, Tru64, and (reportedly) IRIX. Not expected to work on non-unixy systems. It is a good idea to enable threadsafe operation if you configure Apache with multi-threading support.

--disable-debug

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.

Things you can turn on

--enable-msdblib

Enable Microsoft behavior in the db-lib API where it diverges from Sybase's. (For instance, Microsoft uses different names for the members of its date structure.) Typically needed only for porting Win32 applications to Unix.

As of version 0.63, this option specifies just the default behavior. Programs can change the default at compile time by defining MSDBLIB or SYBDBLIB (for Microsoft or Sybase behavior, respectively) .

--enable-sybase-compat

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-lib, which may clash with the DBM function with the same name. Absolutely not required for use with other free software.

--enable-extra-checks

Intended for debugging purposes, enables certain internal consistency checks against problems like memory corruption and buffer exhaustion.

--enable-developing

Enable some code still in development. Should be used only by a developer or a brave user :)

SSL support

--with-gnutls

Enable SSL using GnuTLS. Use version 1.2.3 or newer.

--with-openssl=DIR

Enable SSL using OpenSSL. Unlike FreeTDS, OpenSSL does not use the LGPL. Please read the OpenSSL license before distributing binaries compiled with this option.

Make

Now you're ready to build. Follow these easy steps.

  1. Download the tarball and unpack it.

    Alternatively, get the latest build from CVS [1] .

  2. Change to the freetds directory.

  3. run ./configure with any options you need.

  4. 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.

Notes

[1]

CVS users will need the GNU autotools: Autoconf, Automake, and libtool.