Bug 42072 - autoscan produces call to AC_PROG_CPP before AC_PROG_CC
autoscan produces call to AC_PROG_CPP before AC_PROG_CC
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: autoconf (Show other bugs)
7.1
i386 Linux
medium Severity low
: ---
: ---
Assigned To: Jens Petersen
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-05-23 21:33 EDT by Wagner T. Correa
Modified: 2007-04-18 12:33 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-07-10 07:00:36 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Wagner T. Correa 2001-05-23 21:33:50 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.77 [en] (X11; U; Linux 2.4.2-2smp i686)

Description of problem:
autoscan creates a configure.scan file in which AC_PROG_CPP comes before
AC_PROG_CC.

How reproducible:
Always

Steps to Reproduce:
1. Run autoscan on some source tree.
2. Copy configure.scan to configure.in.
3. Try to generate configure (run autogen.sh or bootstrap).
	

Actual Results:  autogen.sh or bootstrap will fail with the error message:
AC_PROG_CPP was called before AC_PROG_CC.

Expected Results:  autoscan should have called AC_PROG_CC before
AC_PROG_CPP.


Additional info:

rpm -q autoconf
autoconf-2.13-10
Comment 1 Jens Petersen 2001-07-02 03:31:13 EDT
Thanks for the report.
Could you provide a short example test case for it?

Comment 2 Wagner T. Correa 2001-07-02 21:42:43 EDT
Petersen, here's the smallest example I could come up with:

% mkdir foo
% cd foo
% cat > foo.c

#include <stdio.h>
int main(void)
{
	printf("Hello, C world!\n");
	return 0;
}

% cat > bar.cpp

#include <iostream>
int main()
{
	cout << "Hello, C++ world!\n";
	return 0;
}

% cat > Makefile.am

bin_PROGRAMS = foo bar
foo_SOURCES = foo.c
bar_SOURCES = bar.cpp

% cat > bootstrap

#!/bin/sh
set -x
aclocal
autoheader
automake --add-missing
autoconf

% chmod 775 bootstrap
% cat > configure.in

AC_INIT(foo.c)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(foo, 0.0.1)
AC_PROG_CXX
AC_PROG_CC
AC_OUTPUT(Makefile)

% touch AUTHORS ChangeLog NEWS README
% ./bootstrap

+ aclocal
+ autoheader
+ automake --add-missing
automake: configure.in: installing `./install-sh'
automake: configure.in: installing `./mkinstalldirs'
automake: configure.in: installing `./missing'
automake: Makefile.am: installing `./INSTALL'
automake: Makefile.am: installing `./COPYING'
+ autoconf

% ./configure

creating cache ./config.cache
checking for a BSD compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking whether make sets ${MAKE}... yes
checking for working aclocal... found
checking for working autoconf... found
checking for working automake... found
checking for working autoheader... found
checking for working makeinfo... found
checking for c++... c++
checking whether the C++ compiler (c++  ) works... yes
checking whether the C++ compiler (c++  ) is a cross-compiler... no
checking whether we are using GNU C++... yes
checking whether c++ accepts -g... yes
checking for gcc... gcc
checking whether the C compiler (gcc  ) works... yes
checking whether the C compiler (gcc  ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
updating cache ./config.cache
creating ./config.status
creating Makefile
creating config.h

% make

gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2 -c foo.c
gcc  -g -O2  -o foo  foo.o  
c++ -DHAVE_CONFIG_H -I. -I. -I.     -g -O2 -c bar.cpp
c++  -g -O2  -o bar  bar.o  

% ./foo

Hello, C world!

% ./bar

Hello, C++ world!

% autoscan
% cat configure.scan

dnl Process this file with autoconf to produce a configure script.
AC_INIT(foo.c)

dnl Checks for programs.
AC_PROG_AWK
AC_PROG_CPP
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S

dnl Checks for libraries.

dnl Checks for header files.

dnl Checks for typedefs, structures, and compiler characteristics.

dnl Checks for library functions.

AC_OUTPUT(Makefile)

% mv configure.in configure.in.bak
% mv configure.scan configure.in
% ./bootstrap

+ aclocal
+ autoheader
configure.in:7: AC_PROG_CPP was called before AC_PROG_CC
+ automake --add-missing
automake: Makefile.am: C++ source seen but `CXX' not defined in `configure.in'
+ autoconf
configure.in:7: AC_PROG_CPP was called before AC_PROG_CC

(Note that autoscan also fails to call AC_PROG_CXX, which I've submitted as a
separate bug.)
Comment 3 Jens Petersen 2001-07-04 01:18:14 EDT
[Comment this is already fixed in the current release autoconf-2.50.]

The patch below should fix the problem in 2.13.

--- autoconf-2.13/autoscan.pl~	Wed Jul  4 14:19:02 2001
+++ autoconf-2.13/autoscan.pl	Wed Jul  4 14:19:02 2001
@@ -147,6 +159,7 @@
     }
 
     foreach $file (@cfiles) {
+        $programs{"cc"}++;
 	&scan_c_file($file);
     }
 

Note You need to log in before you can comment on or make changes to this bug.