I’m trying to create a C program that can communicate with MySQL database via these two header files:
mysql.h
my_global.h
MySQL comes with mysql_config script that you can execute to find out where the include files and library files reside in the system. I was wondering how would you define it in the Makefile.am?
I currently have the following:
bin_PROGRAMS = db
db_SOURCES = db.c db.h
db_CFLAGS = -Wall `mysql_config --cflags --libs`
Is this the correct way?
I would search for
mysql_configinconfigure.acusing the AX_WITH_PROG macro:so your users will be able to point the
MYSQL_CONFIGenvironment variable at the program should it be installed in an unexpected location. And if the users haven’t installed it, they will get a nice error message which alerts them to that fact before attempting to build.I’d probably set up the cflags, cppflags, and libs in
configure.acas well, since they shouldn’t change afterconfigureis run:and put them in place in
Makefile.amIf all you need is the header files, you probably won’t need to set up the cflags variable.