autoconf
[Top][All Lists]
Advanced

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

Re: Check lib on path


From: Andrew W. Nosenko
Subject: Re: Check lib on path
Date: Mon, 10 Aug 2009 12:56:22 +0300

On Mon, Aug 10, 2009 at 12:45, Philip
Herron<address@hidden> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Andrew W. Nosenko wrote:
>> On Mon, Aug 10, 2009 at 12:07, Philip
>> Herron<address@hidden> wrote:
>>> -----BEGIN PGP SIGNED MESSAGE-----
>>> Hash: SHA1
>>>
>>> Andrew W. Nosenko wrote:
>>>> On Mon, Aug 10, 2009 at 03:44, Philip
>>>> Herron<address@hidden> wrote:
>>>>> Hey guys
>>>>>
>>>>> I have a project i am using GNU MP and MPFR for, and i am using:
>>>>>
>>>>> ACX_PTHREAD(,AC_MSG_ERROR(could not find libpthread))
>>>>> LIBS="${PTHREAD_LIBS} ${LIBS}" AM_CFLAGS="${PTHREAD_CFLAGS}
>>>>> ${AM_CFLAGS}" CC="$PTHREAD_CC"
>>>>>
>>>>> AC_CHECK_LIB([gmp], [__gmpz_init], , [AC_MSG_ERROR([GNU MP not
>>>>> found, see http://gmplib.org/])]) AC_CHECK_LIB([mpfr],[mpfr_init]
>>>>> , [AC_MSG_ERROR([MPFR not found, see http://www.mpfr.org/])])
>>>>>
>>>>> The pthreads comes from a macro acx_pthreads.m4 i think, but the
>>>>> gmp and mpfr are the problem, I have on a mac machine the
>>>>> libraries in /usr/local/lib and the headers in
>>>>> /usr/local/include, but on my bsd and linux machines its all in
>>>>> /usr
>>>>>
>>>>> The linux and bsd is ok with ac_check_lib, but on mac no, is
>>>>> there a way to pass the library path and header path? To give -I
>>>>> and -L to gcc or sun compilers ( i have only been using these
>>>>> compilers so far ) or whatever compiler.
>>>>>
>>>>>
>>>>> I can't seem to find anything on this.
>>>>>
>>>> 1. Try to use -pthread compiler option (or analog, depends on
>>>> compiler) instead of linking around libpthread directly.  Sometime
>>>> the true name of thread library may be different.  Sometime systems
>>>> have more than one thread library.
>>>>
>>>> 2. IIRC, on Mac OS X you don't need any special library or flag at
>>>> all.  All pthread functionality is a part of libSystem (mac analog
>>>> of libc) and libpthread is just a symlink to it.
>>> My question wasn't on pthreads i'm using a macro i found for that:
>>> http://ac-archive.sourceforge.net/ac-archive/acx_pthread.html
>>>
>>> But the mpfr and gmp libs are the problem, as they are in different
>>> paths on both systems. But thanks because i don't know mac os that
>>> well just have access to it for a while for some dev.
>>>
>>
>> Sorry.  I didn't understand your needs.
>>
>> Seems like your compiler doesn't search /usr/local/ hierarchy or its
>> analog (at least it is common case on FreeBSD).
>>
>> I workaround it by following code:
>>
>>     AC_CANONICAL_HOST
>>
>>     # Workaround OS related problems in the default search path:
>>     #   o  FreeBSD bug: GCC on FreeBSD doesn't search
>>     #      /usr/local/include and /usr/local/lib directories.
>>     #   o  MacOS X/Darwin problem: GCC on Darwin doesn't search
>>     #      /opt/local/include and /opt/local/lib directories.
>>     #
>>     case "$host_os" in
>>     freebsd*)
>>         CPPFLAGS="$CPPFLAGS -I/usr/local/include"
>>         LDFLAGS="$LDFLAGS -L/usr/local/lib"
>>         ;;
>>     darwin*)
>>         CPPFLAGS="$CPPFLAGS -I/opt/local/include"
>>         LDFLAGS="$LDFLAGS -L/opt/local/lib"
>>         ;;
>>     esac
>>
>>     # ... AC_CHECK_LIB, AC_CHECK_HEADER, AC_CHECK_ waht you want
>>
>> Hope, it will help.
>>
>
> Ah this is nice! Thanks are these flags -I and -L still working on
> other compilers other than gcc? like sun etc would be nice. I am
> thinking i might keep this snippet for a while, but i might introduce
> a cmd line switch like gmp-lib-dir=/opt.... etc :)
>

'-I', '-l' and '-L' are standard flags supported by any C/C++ compiler.

-- 
Andrew W. Nosenko <address@hidden>




reply via email to

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