---
title: "MySQL/MariaDB autoconf macros"
publish_date: 2014-04-14
updated_date: 2019-08-20
author: "Hartmut Holzgraefe"
---

# MySQL/MariaDB autoconf macros

I’ve had my own set of autotool macros for building against different MySQL client and server APIs for quite a while. Originally created as part of my code generator projects ([CodeGen\_MySQL\_UDF](http://pear.php.net/package/CodeGen_MySQL_UDF) and [CodeGen\_MySQL\_Plugin](http://pear.php.net/package/CodeGen_MySQL_Plugin)) I ended up having diverging copies in a few other projects, too (my [ and my autotools branch of ](https://github.com/hholzgra/connector-c-examples)[). So I’ve finally taken the time to merge the differnet copies into a single standalone project on ](https://github.com/hholzgra/MaxScale/tree/devel-autotools)[GitHUB](https://github.com/hholzgra/mysql-m4).  The set of autoconf macros supports in this project supports:

- building against the various MySQL APIs: 
    - regular client library API
    - embedded server library API
    - User Defined Function (UDF) API
    - Plugin API
    - NDBAPI
- check for minimum required version
- check for a specifc fork (MySQL, MariaDB, …)
- building against files from a server source dir

E.g. an autotools project building against the embedded server library and requiring a certain minimal version of MariaDB could use the following configure.ac snippet to support this: ` [...] WITH_MYSQL_SRC() WITH_MYSQL() MYSQL_NEED_VERSION([5.5.34]) MYSQL_NEED_FORK([mariadb]) MYSQL_USE_EMBEDDED_API() MYSQL_SUBST() [...] ` For more detailed information check the [README on GitHUB](https://github.com/hholzgra/mysql-m4/blob/master/README.md)