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: Fri, 20 Jul 2007 23:42:04 +0200

On Jul 20, 2007, at 9:33 PM, Damian Montaldo wrote:

On 7/17/07, Benoit SIGOURE <address@hidden> wrote:
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:

Yes, you're right. Now I understand why.
May be you want to compile different source files with different
include using different macros.

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 `='.

Thanks this really help me but I have another question about it:
I choose the first option because it looks more declarative and i have
this other problem.

Makefile.am:
bin_PROGRAMS = clumon
clumon_SOURCES = clumon.c

# set the include path found by configure
INCLUDES= $(all_includes)

# the library search path.
clumon_LDFLAGS = $(all_libraries) $(MYSQL_LDFLAGS)
clumon_CFLAGS = $(MYSQL_CFLAGS)

clumon_DEPENDENCIES = -I/usr/local/include -I/usr/include/mysql

I don't quite see what you're trying to achieve with INCLUDES and _DEPENDENCIES, I don't think this is correct.


Error:
src/Makefile.am: required file `./compile' not found

I can't find any similar problem in the history of the mailing list.
With the second choice I replace
clumon_CFLAGS = $(MYSQL_CFLAGS)
for this
AM_CFLAGS = $(MYSQL_CFLAGS)
and it's working.

Any idea?


Nope, not right now, sorry. You forgot to reply with "reply all" so I'm forwarding this question back to the mailing list, hopefully someone will be able to help you out :)

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]