[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 1.5 automatically generating C++, F77 tags
From: |
Albert Chin |
Subject: |
Re: 1.5 automatically generating C++, F77 tags |
Date: |
Tue, 3 Jun 2003 10:24:44 -0500 |
User-agent: |
Mutt/1.4i |
On Tue, Jun 03, 2003 at 08:56:38AM -0500, Bob Friesenhahn wrote:
> On Tue, 3 Jun 2003, Alexandre Duret-Lutz wrote:
>
> > >>> "Albert" == Albert Chin <address@hidden> writes:
> >
> > [...]
> >
> > Albert> I don't have a problem requiring AC_PROG_CXX, AC_PROG_F77, or
> > Albert> AM_PROG_GCJ before AC_PROG_LIBTOOL. Anyone see this as a problem?
> >
> > As a user I wouldn't care about this little inconvenience if it
> > allows Libtool not to bloat my configure with useless checks.
> >
> > However, requiring this will break thousands of configure.ac. I
> > expect most of them to run AC_INIT, AM_INIT_AUTOMAKE,
> > AC_PROG_LIBTOOL early, and then go on with other checks such as
> > language checks.
>
> This is true. It may be very inconvenient for some packages to change
> the ordering.
>
> > Maybe this could be changed as follows:
>
> It is generally not a good approach to base a design on side-effects
> or assumptions. Up to now, adding AC_PROG_LIBTOOL to a configure.ac
> file has been sufficient to configure libtool, regardless of whether
> libtool is stand-alone or embedded. This behavior should not be
> altered.
>
> I believe that a much better solution is to add a AC_LIBTOOL_TAGS (or
> AC_LIBTOOL_LANGUAGES) macro which can be used like
>
> AC_LIBTOOL_TAGS([c c++])
> AC_PROG_LIBTOOL
>
> [ snip snip ]
Ok, just whipped this up as a proof of concept. Haven't really tested.
Am I headed in the right direction.
--
albert chin (address@hidden)
-- snip snip
--- libtool.m4.orig 2003-06-01 16:07:41.276467000 -0500
+++ libtool.m4 2003-06-03 10:22:57.667598339 -0500
@@ -39,35 +39,9 @@
# ---------------
AC_DEFUN([AC_PROG_LIBTOOL],
[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl
-dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
-dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
- AC_PROVIDE_IFELSE([AC_PROG_CXX],
- [AC_LIBTOOL_CXX],
- [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
- ])])
-dnl And a similar setup for Fortran 77 support
- AC_PROVIDE_IFELSE([AC_PROG_F77],
- [AC_LIBTOOL_F77],
- [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77
-])])
-
-dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
-dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
-dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
- AC_PROVIDE_IFELSE([AC_PROG_GCJ],
- [AC_LIBTOOL_GCJ],
- [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
- [AC_LIBTOOL_GCJ],
- [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],
- [AC_LIBTOOL_GCJ],
- [ifdef([AC_PROG_GCJ],
- [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])
- ifdef([A][M_PROG_GCJ],
- [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])])
- ifdef([LT_AC_PROG_GCJ],
- [define([LT_AC_PROG_GCJ],
- defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])])
-])])# AC_PROG_LIBTOOL
+AC_PROVIDE_IFELSE([AC_LIBTOOL_TAGS],,
+ [AC_LIBTOOL_TAGS([C C++ F77])])
+]) # AC_PROG_LIBTOOL
# _AC_PROG_LIBTOOL
@@ -1608,15 +1581,26 @@
])# AC_LIBTOOL_SYS_DYNAMIC_LINKER
+# AC_LIBTOOL_TAGS
+# ---------------
+# tags to enable
+AC_DEFUN([AC_LIBTOOL_TAGS],
+[m4_define([_LT_TAGS],[$1])
+]) # AC_LIBTOOL_TAGS
+
+# _LT_AC_CHECK_TAG
+# ----------------
+AC_DEFUN([_LT_AC_CHECK_TAG],
+[if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $1$" < "${ofile}" > /dev/null
+then
+ AC_MSG_ERROR([tag name \"$1\" already exists])
+fi
+]) # _LT_AC_CHECK_TAG
+
# _LT_AC_TAGCONFIG
# ----------------
AC_DEFUN([_LT_AC_TAGCONFIG],
-[AC_ARG_WITH([tags],
- [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@],
- [include additional configurations @<:@automatic@:>@])],
- [tagnames="$withval"])
-
-if test -f "$ltmain" && test -n "$tagnames"; then
+[if test -f "$ltmain" && test -n "_LT_TAGS"; then
if test ! -f "${ofile}"; then
AC_MSG_WARN([output file `$ofile' does not exist])
fi
@@ -1634,66 +1618,37 @@
# Note that this assumes the entire list is on one line.
available_tags=`grep "^available_tags=" "${ofile}" | $SED -e
's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
- lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
- for tagname in $tagnames; do
- IFS="$lt_save_ifs"
- # Check whether tagname contains only valid characters
- case `$echo "X$tagname" | $Xsed -e
's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'`
in
- "") ;;
- *) AC_MSG_ERROR([invalid tag name: $tagname])
- ;;
- esac
-
- if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" >
/dev/null
- then
- AC_MSG_ERROR([tag name \"$tagname\" already exists])
- fi
-
- # Update the list of available tags.
- if test -n "$tagname"; then
- echo appending configuration tag \"$tagname\" to $ofile
-
- case $tagname in
- CXX)
- if test -n "$CXX" && test "X$CXX" != "Xno"; then
- AC_LIBTOOL_LANG_CXX_CONFIG
- else
- tagname=""
- fi
- ;;
-
- F77)
- if test -n "$F77" && test "X$F77" != "Xno"; then
- AC_LIBTOOL_LANG_F77_CONFIG
- else
- tagname=""
- fi
- ;;
-
- GCJ)
- if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
- AC_LIBTOOL_LANG_GCJ_CONFIG
- else
- tagname=""
- fi
- ;;
-
- RC)
- AC_LIBTOOL_LANG_RC_CONFIG
- ;;
-
- *)
- AC_MSG_ERROR([Unsupported tag name: $tagname])
- ;;
- esac
-
- # Append the new tag name to the list of available tags.
- if test -n "$tagname" ; then
- available_tags="$available_tags $tagname"
- fi
- fi
- done
- IFS="$lt_save_ifs"
+ AC_FOREACH([_LT_TAG], _LT_TAGS,
+ [m4_if(_LT_TAG, C, ,
+ [m4_if(_LT_TAG, C++,
+ [_LT_AC_CHECK_TAG([CXX])
+ echo appending configuration tag \"_LT_TAG\" to $ofile
+ if test -n "$CXX" && test "X$CXX" != "Xno"; then
+ AC_LIBTOOL_LANG_CXX_CONFIG
+ available_tags="$available_tags _LT_TAG"
+ fi],
+ [m4_if(_LT_TAG, F77,
+ [_LT_AC_CHECK_TAG(_LT_TAG)
+ echo appending configuration tag \"_LT_TAG\" to $ofile
+ if test -n "$F77" && test "X$F77" != "Xno"; then
+ AC_LIBTOOL_LANG_F77_CONFIG
+ available_tags="$available_tags _LT_TAG"
+ fi],
+ [m4_if(_LT_TAG, GCJ,
+ [_LT_AC_CHECK_TAG(_LT_TAG)
+ echo appending configuration tag \"_LT_TAG\" to $ofile
+ if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
+ AC_LIBTOOL_LANG_GCJ_CONFIG
+ available_tags="$available_tags _LT_TAG"
+ fi],
+ [m4_if(_LT_TAG, RC,
+ [_LT_AC_CHECK_TAG(_LT_TAG)
+ echo appending configuration tag \"_LT_TAG\" to $ofile
+ AC_LIBTOOL_LANG_RC_CONFIG
+ available_tags="$available_tags _LT_TAG"
+ fi],
+ m4_errprintn(m4_location[: error: invalid tag name:
]"_LT_TAG")
+ )])])])])])
# Now substitute the updated list of available tags.
if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/'
\"$ofile\" > \"${ofile}T\""; then
- 1.5 automatically generating C++, F77 tags, Albert Chin, 2003/06/02
- Re: 1.5 automatically generating C++, F77 tags, Bob Friesenhahn, 2003/06/02
- Re: 1.5 automatically generating C++, F77 tags, Albert Chin, 2003/06/02
- Re: 1.5 automatically generating C++, F77 tags, Alexandre Duret-Lutz, 2003/06/02
- Re: 1.5 automatically generating C++, F77 tags, Albert Chin, 2003/06/02
- Re: 1.5 automatically generating C++, F77 tags, Earnie Boyd, 2003/06/03
- Re: 1.5 automatically generating C++, F77 tags, Alexandre Duret-Lutz, 2003/06/03
- Re: 1.5 automatically generating C++, F77 tags, Bob Friesenhahn, 2003/06/03
- Re: 1.5 automatically generating C++, F77 tags,
Albert Chin <=
- Re: 1.5 automatically generating C++, F77 tags, Alexandre Duret-Lutz, 2003/06/03
- Re: 1.5 automatically generating C++, F77 tags, Albert Chin, 2003/06/03
- Re: 1.5 automatically generating C++, F77 tags, Albert Chin, 2003/06/03
- Re: 1.5 automatically generating C++, F77 tags, Bob Friesenhahn, 2003/06/03
- Re: 1.5 automatically generating C++, F77 tags, Albert Chin, 2003/06/03
- Re: 1.5 automatically generating C++, F77 tags, Bob Friesenhahn, 2003/06/03
- Re: 1.5 automatically generating C++, F77 tags, Kevin Ryde, 2003/06/04
Re: 1.5 automatically generating C++, F77 tags, Jeff Trawick, 2003/06/02