MYSQL was also made me confused when I began to compile it.Actually, the Linux operating system was designed by the best hackers in the world. So it designed by a purpose that is user are best programmer.
That means users must configure everything themselves. So you find many errors when using the linux OS, but please don't scare because it can make become a good hacker.
OK, we turn back. In order to compile the programs contained mysql functions, just add the parameter$(mysql_config --cflags --libs). This is a environment variable, you can use command "echo $(mysql_config --cflags --libs)" to check what it is.eg: $: gcc filename.c $(mysql_config --cflags --libs) -o filename
As a Linux programmer, what you do is doing everything yourself. But I don't say Linux is hard to learn.In fact, it is easy to learn.