[Top][All Lists]

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

AC_CHECK_FUNC(qsort) fails when C++ is test language

From: Ossama Othman
Subject: AC_CHECK_FUNC(qsort) fails when C++ is test language
Date: Fri, 14 Mar 2003 10:29:06 -0800
User-agent: Mutt/1.3.28i


qsort() detection on Linux/glibc with g++ fails when C++ is set as the
test language.  For example, the following:


produces this output:

$ ./configure
checking for g++... g++
checking for C++ compiler default output... a.out
checking whether the C++ compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for qsort... no
configure: creating ./config.status

The error is due to a function prototype conflict between the
prototype in test code and the one in <stdlib.h>.  Here's the relevant
config.log excerpt:

configure:1754: checking for qsort
configure:1804: g++ -o conftest -g -O2  >&5
configure:1786: declaration of C function `char qsort()' conflicts with
/usr/include/stdlib.h:736: previous declaration `void qsort(void*, unsigned
   int, unsigned int, int (*)(const void*, const void*))' here

<stdlib.h> is only include in the C++ case, which is why the error
doesn't appear in the C case.  I assume that similar errors will occur
for other functions declared in <stdlib.h>.  I can work around the
problem by temporarily setting the test language to C, but I'd prefer
not to have to do that.  Any ideas?

The full `config.log' file is attached.

Ossama Othman <address@hidden>
Distributed Object Computing Laboratory, Univ. of California at Irvine
1024D/F7A394A8 - 84ED AA0B 1203 99E4 1068  70E6 5EB7 5E71 F7A3 94A8

Attachment: config.log
Description: Text document

reply via email to

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