Autotools: проверка функции pow()

IDE, VCS и прочее

Модератор: Модераторы разделов

Ответить
IMB
Сообщения: 2561
ОС: Debian

Autotools: проверка функции pow()

Сообщение IMB »

Доброго дня!
Использую в работе функцию pow() из libm, для проверки её наличия в configure.ac внесена запись - AC_CHECK_FUNCS([memset pow socket])
К сожаления при вызове configure проверка функции завершается с отрицательным результатом, в config.log следующее:

Код: Выделить всё

configure:14797: checking for pow
configure:14797: gcc -o conftest -g -O2   conftest.c  >&5
conftest.c:53: warning: conflicting types for built-in function 'pow'
/tmp/ccLJU0Ac.o: In function `main':
/home/kirill/IPCam/src/librtnl/conftest.c:64: undefined reference to `pow'
collect2: ld returned 1 exit status
configure:14797: $? = 1
configure: failed program was:
..............
| /* Define pow to an innocuous variant, in case <limits.h> declares pow.
|    For example, HP-UX 11i <limits.h> declares gettimeofday.  */
| #define pow innocuous_pow
|
| /* System header to define __stub macros and hopefully few prototypes,
|     which can conflict with char pow (); below.
|     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|     <limits.h> exists even on freestanding compilers.  */
|
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
|
| #undef pow
|
| /* Override any GCC internal prototype to avoid an error.
|    Use char because int might match the return type of a GCC
|    builtin and then its argument prototype would still apply.  */
| #ifdef __cplusplus
| extern "C"
| #endif
| char pow ();
| /* The GNU C library defines this for functions which it implements
|     to always fail with ENOSYS.  Some functions are actually named
|     something starting with __ and the normal name is an alias.  */
| #if defined __stub_pow || defined __stub___pow
| choke me
| #endif
|
| int
| main ()
| {
| return pow ();
|   ;
|   return 0;
| }
configure:14797: result: no
configure:14797: checking for socket
configure:14797: gcc -o conftest -g -O2   conftest.c  >&5
configure:14797: $? = 0
configure:14797: result: yes

Применять AC_CHECK_LIB не хочется, так как тогда все части будут собраны с libm, а это не нужно.
Можно конечно убрать эту проверку, так как, скорее всего, libm будет на всех системах, но хочется разобраться в причинах.
Вопрос - как средствами autotools проверить наличие функции pow()?
Спасибо.
Спасибо сказали:
Ответить