How do I tell autoconf not to probe for fortran, C++ etc. when my package is built only in C?

StackOverflow https://stackoverflow.com/questions/4292683

문제

This has been bugging me for years, but I've just been ignoring it, like I suspect everyone else does.

AM_INIT_AUTOMAKE([dist-bzip2])
AC_PROG_CC
AC_PROG_LIBTOOL
AC_C_INLINE
AM_PROG_CC_C_O

With the above in my configure.ac file, configure will go and find me a C compiler, but then it continues on:

checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking how to run the C++ preprocessor... g++ -E
checking for g77... no
checking for xlf... no
checking for f77... no
checking for frt... no
checking for pgf77... no
checking for cf77... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking for xlf90... no
checking for f90... no
checking for pgf90... no
checking for pghpf... no
checking for epcf90... no
checking for gfortran... gfortran
checking whether we are using the GNU Fortran 77 compiler... yes
checking whether gfortran accepts -g... yes
checking the maximum length of command line arguments... 1966080

This doesn't really hurt anything, it just adds visual noise and makes things take a bit longer to run--again, it's not significant, but it's been bugging me for years.

I've tried using --with-tags=C, AC_LANG([C]) and a couple of other tricks with shell variables (definitely feels like the wrong way...) to see if I can turn this off.

Does anyone know the autoconf/automake/libtool blessed way to get configure probing only for C?

도움이 되었습니까?

해결책

If you use libtool 1.5 or earlier, you have to resort to a dirty trick. Put this in your configure.ac:

m4_defun([_LT_AC_LANG_CXX_CONFIG], [:])
m4_defun([_LT_AC_LANG_F77_CONFIG], [:])

Or you could switch to libtool 2.2 or later, it automatically (and more intelligently) detects what compilers to look for.

다른 팁

As ptomato says, the correct way to do this is to use a modern libtool. In configure.ac:

# Set up libtool. The argument enables support for win32 DLLs
# and replaces AC_LIBTOOL_WIN32_DLL.
LT_INIT([win32-dll])
# Add C support to libtool
AC_PROG_CC
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top