MySQL
See Chapter 15 for information on MySQL and Postfix. This add-on depends on the MySQL client library and the zlib compression library, which you must install first if they’re not already on your system. This example assumes that your MySQL library is installed in /usr/local/lib/mysql with its header files in /usr/local/include/mysql and that the zlib library is in /usr/lib. If your installation differs, adjust the example accordingly. There is a MYSQL_README file that comes with the Postfix distribu- tion with information about building Postfix with support for MySQL.
To build Postfix with MySQL support, you must define the HAS_MYSQL macro and specify the directories for the MySQL library and header files. You must link against the libmysqlclient.so and the libz.so library files. You must also link against the libm. so math library file, which is standard on Unix systems. Run make tidy if necessary.
Build your Makefile with the following options:
$ make makefiles 'CCARGS=-DHAS_MYSQL -I/usr/local/include/mysql' \
'AUXLIBS=-L/usr/local/lib/mysql -lmysqlclient -lz -lm'
Remember that if you must provide the path to your libraries to the runtime linker, include the correct runtime search path argument:
$ make makefiles 'CCARGS=-DHAS_MYSQL -I/usr/local/include/mysql' \
'AUXLIBS=-L/usr/local/lib/mysql -lmysqlclient -lz -lm \
-rpath /usr/local/lib/mysql'
If your linker uses an argument other than rpath , be sure to specify the correct one.