I have a library which can provides C, C++ and Fortran (F77) interfaces.
On systems without Fortran, I would like to have it (automatically) not
build the Fortran interface.
The first obstacle I’ve run into is that
AC_PROG_F77
fails if no compiler is found, aborting the installation. I’d like to
turn that failure into something I can use in a conditional.
If it’s not possible to automatically move on from this failure, I can
force the user to make a decision using something like this:
AC_PREREQ([2.57])
AC_INIT([cxcparam],[4.12.0.3],[yeah@xxxxxxxxx],[cxcparam])
AC_ARG_WITH([fortran],
[AS_HELP_STRING([--with-fortran],[compile fortran interface
library])],
[use_fortran=$withval],
[use_fortran=no])
AS_IF([test "x$with_fortran" != xno], [
AC_PROG_F77
])
AC_OUTPUT
But then there are further obstacles; I would like to use the additional
macros
AC_F77_WRAPPERS
AC_F77_LIBRARY_LDFLAGS
AC_F77_FUNC(getarg,GETARG)
but they directly or indirectly REQUIRE AC_PROG_F77, so even if
AC_PROG_F77 is wrapped in a conditional, e.g.:
AC_PREREQ([2.57])
AC_INIT([cxcparam],[4.12.0.3],[yeah@xxxxxxxxx],[cxcparam])
AC_ARG_WITH([fortran],
[AS_HELP_STRING([--with-fortran],[compile fortran interface
library])],
[use_fortran=$withval],
[use_fortran=yes])
AS_IF([test "x$with_fortran" != xno], [
AC_PROG_F77
AC_F77_WRAPPERS
AC_F77_LIBRARY_LDFLAGS
AC_F77_FUNC(getarg,GETARG)
])
AC_OUTPUT
AC_PROG_F77 will always be executed, regardless of the --without-fortran
flag (and autoconf will warn
configure.ac:11: warning: AC_REQUIRE: `AC_PROG_F77' was expanded
before it was required
)
I must be missing something obvious.
Any ideas on where I’ve gone astray?
Thanks,
Diab