[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/1] configure.ac: attempt mysql_config to find the MySQL hea

From: Heinrich Schuchardt
Subject: Re: [PATCH 1/1] configure.ac: attempt mysql_config to find the MySQL headers.
Date: Fri, 6 Mar 2020 23:39:53 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0

On 3/6/20 10:38 PM, Michael Orlitzky wrote:
When building with MySQL support, the configure script guesses that
the path to the MySQL headers is /usr/include/mysql. That is usually
correct, but when people install MySQL to a nonstandard location such
as /home/mjo/usr, it falls over. Fortunately, MySQL usually provides
an executable called "mysql_config" that can output the location of
its headers.

In such a "local" installation, if I prepend /home/mjo/usr/bin to my
PATH, then running "mysql_config" will execute the mysql_config from
/home/mjo/usr/bin and will therefore output -I/home/mjo/usr/include as
the preprocessor flag that glpk needs. That's the right thing to do,
and it works just as well for a system install under /usr or

This commit attempts to find the headers using mysql_config first,
and falls back to the location /usr/include/mysql.

Gentoo-bug: https://bugs.gentoo.org/597620
  configure.ac | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 96c4cc5..d20a6ef 100644
--- a/configure.ac
+++ b/configure.ac
@@ -145,7 +145,10 @@ if test "$enable_mysql" = "yes"; then
        AC_MSG_ERROR([--enable-mysql requires --enable-dl])
-   CPPFLAGS="-I/usr/include/mysql $CPPFLAGS"
+   # Guess at the include directory if mysql_config isn't in our PATH.
+   MYSQL_INCLUDE=$(mysql_config --include 2>/dev/null)
+   test -z "${MYSQL_INCLUDE}" && MYSQL_INCLUDE="-I/usr/include/mysql"

Thanks for your suggestion.

Should we only use 'mysql_config --include' or the more comprehensive
'mysql_config --cflags'?

In the scenario that you describe wouldn't the library also be installed
in a user path. So would we have to consider 'mysql_config --libs'?

Of cause you already can pass CPPFLAGS and LDFLAGS to ./configure to
specify your special directories.

On my computer I get:

$ mysql_config --include

$ mysql_config --cflags
-I/usr/include/mysql -g -g -fabi-version=2 -fno-omit-frame-pointer

$ mysql_config --libs
-L/usr/lib/arm-linux-gnueabihf -lmysqlclient -lpthread -lz -lm -ldl

Best regards



reply via email to

[Prev in Thread] Current Thread [Next in Thread]