Restore AC_HAVE_LIBRARY.

* acgeneral.m4 (AC_HAVE_LIBRARY): AU_DEFUNed in terms of
AC_CHECK_LIB.
* doc/autoconf.texi (Libraries): Document.
This commit is contained in:
Akim Demaille 2000-02-10 08:42:26 +00:00
parent e1b31f306e
commit c979e7622f
6 changed files with 70 additions and 67 deletions

View File

@ -1,3 +1,11 @@
2000-02-10 Akim Demaille <akim@epita.fr>
Restore AC_HAVE_LIBRARY.
* acgeneral.m4 (AC_HAVE_LIBRARY): AU_DEFUNed in terms of
AC_CHECK_LIB.
* doc/autoconf.texi (Libraries): Document.
2000-02-09 Akim Demaille <akim@epita.fr>
Fix the handling of `./configure foo=bar' and test it.

45
TODO
View File

@ -13,51 +13,6 @@ These are things mandatory to fulfill before releasing 2.15. There
are also suggestions we should either satisfy right now (they're
easy), or remove (obsoleted since then).
** Check my definition of AC_HAVE_LIBRARY
The original definition was:
dnl AC_HAVE_LIBRARY(LIBRARY, [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
dnl [, OTHER-LIBRARIES]]])
AC_DEFUN(AC_HAVE_LIBRARY,
[AC_OBSOLETE([$0], [; instead use AC_CHECK_LIB])dnl
changequote(<<, >>)dnl
define(<<AC_LIB_NAME>>, dnl
patsubst(patsubst($1, <<lib\([^\.]*\)\.a>>, <<\1>>), <<-l>>, <<>>))dnl
define(<<AC_CV_NAME>>, ac_cv_lib_<<>>AC_LIB_NAME)dnl
changequote([, ])dnl
AC_MSG_CHECKING([for -l[]AC_LIB_NAME])
AC_CACHE_VAL(AC_CV_NAME,
[ac_save_LIBS="$LIBS"
LIBS="-l[]AC_LIB_NAME[] $4 $LIBS"
AC_TRY_LINK( , [main()], AC_CV_NAME=yes, AC_CV_NAME=no)
LIBS="$ac_save_LIBS"
])dnl
AC_MSG_RESULT($AC_CV_NAME)
if test "$AC_CV_NAME" = yes; then
ifelse([$2], ,
[AC_DEFINE([HAVE_LIB]translit(AC_LIB_NAME, [a-z], [A-Z]))
LIBS="-l[]AC_LIB_NAME[] $LIBS"
], [$2])
ifelse([$3], , , [else
$3
])dnl
fi
undefine([AC_LIB_NAME])dnl
undefine([AC_CV_NAME])dnl
])
I used this:
AU_DEFUN(AC_HAVE_LIBRARY,
[pushdef([AC_LIB_NAME],
patsubst(patsubst([[$1]], [lib\([^\.]*\)\.a], [\1]), [-l], []))dnl
AC_CHECK_LIB(AC_LIB_NAME, main, [$2], [$3], [$4])dnl
popdef([AC_LIB_NAME])dnl
])
The only difference I see is the name of the cache var, which we can
easily reflect at the end, but do we want that?
** AU_
Document.

View File

@ -2259,6 +2259,7 @@ fi
rm -fr conftest*])
## ------------------------ ##
## Checking for libraries. ##
## ------------------------ ##
@ -2357,9 +2358,24 @@ AC_VAR_POPDEF([ac_Lib])dnl
# AC_HAVE_LIBRARY
# ---------------
AC_DEFUNCT(AC_HAVE_LIBRARY, [; instead use AC_CHECK_LIB])
# AC_HAVE_LIBRARY(LIBRARY,
# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
# [OTHER-LIBRARIES])
# ---------------------------------------------------------
#
# This macro is equivalent to calling `AC_CHECK_LIB' with a FUNCTION
# argument of `main'. In addition, LIBRARY can be written as any of
# `foo', `-lfoo', or `libfoo.a'. In all of those cases, the compiler
# is passed `-lfoo'. However, LIBRARY cannot be a shell variable;
# it must be a literal name.
AU_DEFUN(AC_HAVE_LIBRARY,
[pushdef([AC_Lib_Name],
patsubst(patsubst([[$1]], [lib\([^\.]*\)\.a], [\1]), [-l], []))dnl
AC_CHECK_LIB(AC_Lib_Name, main, [$2], [$3], [$4])dnl
ac_cv_lib_[]AC_Lib_Name()=ac_cv_lib_[]AC_Lib_Name()_main
popdef([AC_Lib_Name])dnl
])
## ------------------------ ##

View File

@ -3334,6 +3334,7 @@ If words are stored with the most significant byte first (like Motorola
and SPARC, but not Intel and VAX, CPUs), define @code{WORDS_BIGENDIAN}.
@end defmac
@defmac AC_C_CONST
@maindex C_CONST
@cvindex const
@ -3345,17 +3346,20 @@ can simply use @code{const} as if every C compiler supported it; for
those that don't, the @file{Makefile} or configuration header file will
define it as empty.
If ever you happen to have the sad idea to use a C++ compiler for
@samp{CC}, this test will @strong{not} test the validity of
@code{const}, and will trust it. The main difference between C and C++
is that C++ does not allow to define a @code{const} variable without
initializer:
Occasionally installers use a C++ compiler to compile C code, typically
because they lack a C compiler. This causes problems with @code{const},
because C and C++ treat @code{const} differently. For example:
@example
const int foo;
@end example
while ANSI C supports this. After long debates, it has been decided to
trust the @code{const} of C++ compilers in all the cases, even if it is
not ANSI C conforming.
is valid in C but not in C++. These differences unfortunately cannot be
papered over by defining @code{const} to be empty.
If @code{autoconf} detects this situation, it leaves @code{const} alone,
as this generally yields better results in practice. However, using a
C++ compiler to compile C code is not recommended or supported, and
installers who run into trouble in this area should get a C compiler
like GCC to compile their C code.
@end defmac
@defmac AC_C_VOLATILE

View File

@ -3334,6 +3334,7 @@ If words are stored with the most significant byte first (like Motorola
and SPARC, but not Intel and VAX, CPUs), define @code{WORDS_BIGENDIAN}.
@end defmac
@defmac AC_C_CONST
@maindex C_CONST
@cvindex const
@ -3345,17 +3346,20 @@ can simply use @code{const} as if every C compiler supported it; for
those that don't, the @file{Makefile} or configuration header file will
define it as empty.
If ever you happen to have the sad idea to use a C++ compiler for
@samp{CC}, this test will @strong{not} test the validity of
@code{const}, and will trust it. The main difference between C and C++
is that C++ does not allow to define a @code{const} variable without
initializer:
Occasionally installers use a C++ compiler to compile C code, typically
because they lack a C compiler. This causes problems with @code{const},
because C and C++ treat @code{const} differently. For example:
@example
const int foo;
@end example
while ANSI C supports this. After long debates, it has been decided to
trust the @code{const} of C++ compilers in all the cases, even if it is
not ANSI C conforming.
is valid in C but not in C++. These differences unfortunately cannot be
papered over by defining @code{const} to be empty.
If @code{autoconf} detects this situation, it leaves @code{const} alone,
as this generally yields better results in practice. However, using a
C++ compiler to compile C code is not recommended or supported, and
installers who run into trouble in this area should get a C compiler
like GCC to compile their C code.
@end defmac
@defmac AC_C_VOLATILE

View File

@ -2259,6 +2259,7 @@ fi
rm -fr conftest*])
## ------------------------ ##
## Checking for libraries. ##
## ------------------------ ##
@ -2357,9 +2358,24 @@ AC_VAR_POPDEF([ac_Lib])dnl
# AC_HAVE_LIBRARY
# ---------------
AC_DEFUNCT(AC_HAVE_LIBRARY, [; instead use AC_CHECK_LIB])
# AC_HAVE_LIBRARY(LIBRARY,
# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
# [OTHER-LIBRARIES])
# ---------------------------------------------------------
#
# This macro is equivalent to calling `AC_CHECK_LIB' with a FUNCTION
# argument of `main'. In addition, LIBRARY can be written as any of
# `foo', `-lfoo', or `libfoo.a'. In all of those cases, the compiler
# is passed `-lfoo'. However, LIBRARY cannot be a shell variable;
# it must be a literal name.
AU_DEFUN(AC_HAVE_LIBRARY,
[pushdef([AC_Lib_Name],
patsubst(patsubst([[$1]], [lib\([^\.]*\)\.a], [\1]), [-l], []))dnl
AC_CHECK_LIB(AC_Lib_Name, main, [$2], [$3], [$4])dnl
ac_cv_lib_[]AC_Lib_Name()=ac_cv_lib_[]AC_Lib_Name()_main
popdef([AC_Lib_Name])dnl
])
## ------------------------ ##