autoconf
[Top][All Lists]
Advanced

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

Re: AC_CHECK_LIB: Library is found on build host but is not on a target


From: Sergio Belkin
Subject: Re: AC_CHECK_LIB: Library is found on build host but is not on a target host
Date: Tue, 19 Oct 2010 14:10:53 -0300

2010/9/28 Luke Mewburn <address@hidden>:
> On Mon, Sep 27, 2010 at 10:30:49AM -0300, Sergio Belkin wrote:
>  | Hi, I've added
>  |
>  | LDFLAGS="-L/usr/lib/mysql $LDFLAGS"
>  |
>  | and it worked. I wonder if the proper way to do it.
>
> I've used the following:
>
> ----
>
> # Look for mysql via the presence of 'mysql_config' or 'mysql_config5'
> #
> AC_PATH_PROGS([TOOL_MYSQL_CONFIG], [mysql_config mysql_config5], [],
>              [$PATH:/opt/local/bin])AS_IF([test -n "$TOOL_MYSQL_CONFIG"],
>      [MYSQL_CFLAGS=`$TOOL_MYSQL_CONFIG --cflags`
>       MYSQL_LIBS=`$TOOL_MYSQL_CONFIG --libs_r`],
>      [AC_MSG_ERROR([missing program 'mysql_config'; is 'mysql' or 
> 'MySQL-devel'
>  installed?])])
> AC_SUBST([MYSQL_CFLAGS])
> AC_SUBST([MYSQL_LIBS])
> AC_PATH_PROGS([TOOL_MYSQL], [mysql mysql5], [],
>              [$PATH:/opt/local/bin])
>
> ----
>
> Use @MYSQL_LIBS@ and @MYSQL_CFLAGS@ in Makefile.am as appropriate.
>
> It works on CentOS and Fedora with the MySQL packages provided by
> either the distribution or from mysql.com, and also for Macports
> on Mac OS X (mysql5_config in /opt/local/bin).
>
>
> Luke.
>

The problem with this approach is that it adds linking against
libraries that perhaps one doesn't want.

mysql_config on CentOS
-L/usr/lib64/mysql -lmysqclient -lz -lcrypt -lnsl -lm -L/usr/lib64
-lssl -lcrypto


-- 
--
Sergio Belkin http://www.sergiobelkin.com
Watch More TV http://sebelk.blogspot.com
Sergio Belkin -



reply via email to

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