automake
[Top][All Lists]
Advanced

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

Re: Problems to include mysql.h in the Makefile


From: Benoit SIGOURE
Subject: Re: Problems to include mysql.h in the Makefile
Date: Tue, 17 Jul 2007 23:52:33 +0200

On Jul 17, 2007, at 8:22 PM, Damian Montaldo wrote:

Hi, i'm having some problems to include mysql.h when i compile C source code.

Hello Damian,


I'm using this macro
http://autoconf-archive.cryp.to/ax_lib_mysql.html
to find the path to mysql.h in a Debian Linux and work fine.

$ ./configure
...
checking for mysql_config... /usr/bin/mysql_config
checking for MySQL libraries... yes
...

When i run configure it generates this line in the Makefile file:

MYSQL_CFLAGS = -I/usr/include/mysql -DBIG_JOINS=1
MYSQL_CONFIG = /usr/bin/mysql_config
MYSQL_LDFLAGS = -L/usr/lib/mysql -lmysqlclient
MYSQL_VERSION = 5.0.32
[...]
But when i run make it doesn't include the MYSQL_CFLAGS so it's
imposible to resolve this #include <mysql.h>

This macro provides you with the flags required to use MySQL in your builds but it does not actually enforce them. And this is a sane behavior. So now, you simply need to use these flags whenever you need them, eg:

bin_PROGRAMS = mysqlcli
mysqlcli_SOURCES = ...
mysqlcli_CFLAGS = $(MYSQL_CFLAGS) $(AM_CFLAGS)
(don't forget to add the AM_*flags in the target-specific_*FLAGS)

Or simply...

bin_PROGRAMS = mysqlcli
mysqlcli_SOURCES = ...
AM_CFLAGS = $(MYSQL_CFLAGS)

... if you don't already use AM_CFLAGS and all the targets of this Makefile.am must use $(MYSQL_CFLAGS). If you already use AM_CFLAGS, then simply use `+=' instead of `='.

Cheers,

--
Benoit Sigoure aka Tsuna
EPITA Research and Development Laboratory


Attachment: PGP.sig
Description: This is a digitally signed message part


reply via email to

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