LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Impossible to use autotools to compile a MySQL client program? (https://www.linuxquestions.org/questions/linux-software-2/impossible-to-use-autotools-to-compile-a-mysql-client-program-370911/)

rylan76 10-08-2005 08:34 AM

Impossible to use autotools to compile a MySQL client program?
 
Hi all,

I have the following Makefile.am:

bin_PROGRAMS = editor
editor_SUBDIRS = . src/editor
editor_SOURCES = editor.c editor.h
editor_LDFLAGS = `allegro-config --libs` `mysql_config --libs`
editor_CFLAGS = `allegro-config --cflags` `mysql_config --cflags`

This absolutely refuses to compile - running the eventually resulting makefile results in

If gcc -DHAVE_CONFIG_H -I. -I. -I../.. `allegro-config --cflags` `mysql_config --cflags` -g -O2 -MT editor-editor.o -MD -MP -MF ".deps/editor-editor.Tpo" -c -o editor-editor.o `test -f 'editor.c' || echo './'`editor.c; \
then mv -f ".deps/editor-editor.Tpo" ".deps/editor-editor.Po"; else rm -f ".deps/editor-editor.Tpo"; exit 1; fi
gcc -g -O2 -o editor `allegro-config --libs` `mysql_config --libs` editor-editor.o
editor-editor.o(.text+0xaa): In function `main':
/home/rylan/c/supreme-1.0/src/editor/editor.c:14: undefined reference to `mysql_init'
editor-editor.o(.text+0x165):/home/rylan/c/supreme-1.0/src/editor/editor.c:27: undefined reference to `mysql_close'
collect2: ld returned 1 exit status
make[2]: *** [editor] Error 1

However, doing

gcc -o editor editor.c `allegro-config --cflags` `mysql_config --cflags` `allegro-config --libs` `mysql_config --libs`

works perfectly...

How can I get autotools to allow projects to be compiled with the MySQL client library? Why does `allegro-config --libs` work, but NOT `mysql_config --libs`?

Why does autotools create an editor-editor.o file, instead of an editor.o file (like when you run gcc -o editor editor.c `allegro-config --cflags` `mysql_config --cflags` `allegro-config --libs` `mysql_config --libs` manually?)

Is there any way to force autotools to link and compile in one step, instead of two, since it somehow seems that the editor-editor.o file produced in autofools two-step approach is unlinkable with libmysqlclient.a???

ANY help appreciated - hours and hours spent on this with zero results...

Thanks!


All times are GMT -5. The time now is 07:56 AM.