AC_TRY_LINK with static libraries (*.a)

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

 



When I try to compile some prog with some lib, generally it's unknown
whether it is static or dynamic library.
Compile with dynamic libraries hasn't problems, but with static - it is.
e.g.
AC_TRY_LINK(
    [ #include <mysql.h> ],
    [ mysql_shutdown(0, 0); ],
    AC_DEFINE(HAVE_MYSQL_SHUTDOWN_LEVEL_ARG, 1, [ Define if
mysql_shutdown() has a second 'level' argument ])
)
this generates "compile string" like:
gcc -o conftest -march=pentium4 -O3
-I/usr/local/mysql-4.1.12/include/mysql -mcpu=athlon-xp 
-I/usr/local/include  -L/usr/local/lib
-L/usr/local/mysql-4.1.12/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm
-L/usr/lib -lssl -lcrypto conftest.c
With shared mysql libs this will compile correctly, but with static - not.

The simplest solution is to change "-o conftest" and "conftest.c" to take:
gcc conftest.c -march=pentium4 -O3
-I/usr/local/mysql-4.1.12/include/mysql -mcpu=athlon-xp 
-I/usr/local/include  -L/usr/local/lib
-L/usr/local/mysql-4.1.12/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm
-L/usr/lib -lssl -lcrypto -o conftest
This breakes not anything, but resolves the problem.

Or, anybody knows another way to handle the subj.
Plz, advise.



_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux