autoconf
[Top][All Lists]
Advanced

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

AC_TRY_LINK with static libraries (*.a)


From: Roman Rybalko
Subject: AC_TRY_LINK with static libraries (*.a)
Date: Mon, 27 Aug 2007 13:39:01 +0400
User-agent: Thunderbird 2.0.0.6 (X11/20070728)

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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]