I'm in the early stages of adding Autotools support to a C++ library. At this point I'm running autoreconf
with the following configuration.
$ cat Makefile.am
AUTOMAKE_OPTIONS = foreign
bin_PROGRAMS=cryptest
$ cat configure.ac
AC_INIT(Crypto++, 6.0, http://www.cryptopp.com/wiki/Bug_Report)
AM_INIT_AUTOMAKE
AC_PROG_CXX
AC_CONFIG_FILES([Makefile])
It is producing:
$ autoreconf --install --force
/usr/share/automake-1.15/am/depend2.am: error: am__fastdepCC does not appear in AM_CONDITIONAL
/usr/share/automake-1.15/am/depend2.am: The usual way to define 'am__fastdepCC' is to add 'AC_PROG_CC'
/usr/share/automake-1.15/am/depend2.am: to 'configure.ac' and run 'aclocal' and 'autoconf' again
Makefile.am: error: C source seen but 'CC' is undefined
Makefile.am: The usual way to define 'CC' is to add 'AC_PROG_CC'
Makefile.am: to 'configure.ac' and run 'autoconf' again.
autoreconf: automake failed with exit status: 1
I'm trying to tackle the error: C source seen but 'CC' is undefined
issue first.
Conventional wisdom based on mailing list reading is to add AC_PROG_CC
to work around the issue. I really don't feel like working around the problems C++ flags are going to cause a C compiler, especially on compilers like IBM's xlc and Sun's cc. It also seem wrong given GNU is all about user choice.
How do I tell Autotools this project is a C++ project, and it should not do anything with C or a C compiler?
Here are some of the issues it is causing.
$ egrep 'CC|CFLAGS' Makefile
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
...
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(AM_CFLAGS) $(CFLAGS)
...
CCLD = $(CC)
...
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$ autoreconf --version
autoreconf (GNU Autoconf) 2.69
$ autoconf --version
autoconf (GNU Autoconf) 2.69
$ automake --version
automake (GNU automake) 1.15