Bug 42072 - autoscan produces call to AC_PROG_CPP before AC_PROG_CC
Summary: autoscan produces call to AC_PROG_CPP before AC_PROG_CC
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: autoconf
Version: 7.1
Hardware: i386
OS: Linux
medium
low
Target Milestone: ---
Assignee: Jens Petersen
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-05-24 01:33 UTC by Wagner T. Correa
Modified: 2007-04-18 16:33 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2001-07-10 11:00:36 UTC
Embargoed:


Attachments (Terms of Use)

Description Wagner T. Correa 2001-05-24 01:33:50 UTC
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 07:31:13 UTC
Thanks for the report.
Could you provide a short example test case for it?



Comment 2 Wagner T. Correa 2001-07-03 01:42:43 UTC
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 05:18:14 UTC
[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.