Opened 8 years ago

Closed 5 years ago

#786 closed defect (fixed)

configure is incorrectly test C compiler flags and not C++ flags (configure.in needs fixing)

Reported by: awatkins1966 Owned by: strk
Priority: major Milestone: 3.5.3
Component: Build/Install Version: 3.5.0
Severity: Unassigned Keywords: configure
Cc:

Description

While testing geos 3.5.0 with Oracle Developer Studio 12.5 (formally Sun Studio12) I got an error with -ansi flag (-ansi is not supported with CC). Further testing showed that configure was not testing the CC compiler but cc.

# ./configure CC='cc' CXX='CC'
configure:17560: checking if CC supports -ansi
configure:17578: cc -c -g  -ansi conftest.c >&5
configure:17582: $? = 0
configure:17594: result: yes

doubling check with g++

# ./configure
configure:17575: checking if g++ supports -ansi
configure:17593: gcc -c -g -O2  -ansi conftest.c >&5
configure:17597: $? = 0
configure:17610: result: yes 

As you can see it is not testing the C++ compiler.

Need a way to tell AC_LIBTOOL_COMPILER_OPTION to use CXX in configure.in

# Set default AM_CXXFLAGS and AM_CFLAGS
# -pedantic: ISO does not support long long
# we add -Wno-long-long to avoid those messages
WARNFLAGS=""
AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -pedantic], [dummy_cv_pedantic], [-pedantic], [], [WARNFLAGS="$WARNFLAGS -pedantic"], [])
AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -Wall], [dummy_cv_wall], [-Wall], [], [WARNFLAGS="$WARNFLAGS -Wall"], [])
AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -ansi], [dummy_cv_ansi], [-ansi], [], [WARNFLAGS="$WARNFLAGS -ansi"], [])
AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -Wno-long-long], [dummy_cv_no_long_long], [-Wno-long-long], [], [WARNFLAGS="$WARNFLAGS -Wno-long-long"], [])

Change History (6)

comment:1 by strk, 8 years ago

Something like:

AC_LANG_PUSH([C++])
...
AC_LANG_PULL([C++])

comment:2 by strk, 7 years ago

Milestone: 3.5.13.5.2

Ticket retargeted after milestone closed

comment:3 by robe, 6 years ago

Milestone: 3.5.23.5.3

comment:4 by pramsey, 5 years ago

I see that in 3.8 we've simply removed the test for -ansi and don't use it.

For 3.5 it looks like strk's guess about wrapping the test in a push/pop seems to work? (at least on my platform) (the first test isn't in the push/pop, the second is)

configure:17575: checking if g++ supports -Wno-long-long
configure:17593: gcc -c -g -O2  -Wno-long-long conftest.c >&5
configure:17597: $? = 0
configure:17610: result: yes
configure:17626: checking if g++ supports -ansi
configure:17644: g++ -c -g -O2  -ansi conftest.cpp >&5
configure:17648: $? = 0
configure:17661: result: yes

comment:5 by Paul Ramsey <pramsey@…>, 5 years ago

In fa3be2e/git:

Test -ansi w/i the context of C++
References #786

comment:6 by pramsey, 5 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.