mirror of
https://github.com/troglobit/editline.git
synced 2025-12-16 02:54:46 +08:00
Cleanup configure.ac and regenerate default configure files.
This commit is contained in:
92
configure.ac
92
configure.ac
@@ -76,100 +76,8 @@ AC_ARG_ENABLE(termcap,
|
||||
[AS_HELP_STRING([--enable-termcap], [Use termcap library to query terminal size.])],
|
||||
AC_DEFINE([CONFIG_USE_TERMCAP], 1, [Define to use the termcap library for terminal size.]))
|
||||
|
||||
# Restore gnu89 inline semantics on gcc 4.3 and newer
|
||||
saved_cflags="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -fgnu89-inline"
|
||||
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]), inline_cflags="-fgnu89-inline", inline_cflags="")
|
||||
CFLAGS="$saved_cflags"
|
||||
|
||||
# check for -fvisibility=hidden compiler support (GCC >= 3.4)
|
||||
saved_cflags="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -fvisibility=hidden"
|
||||
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),
|
||||
[VISIBILITY_CFLAGS="-fvisibility=hidden"
|
||||
AC_DEFINE([API_EXPORTED], [__attribute__((visibility("default")))], [Default visibility]) ],
|
||||
[ VISIBILITY_CFLAGS=""
|
||||
AC_DEFINE([API_EXPORTED], [], [Default visibility]) ],
|
||||
])
|
||||
CFLAGS="$saved_cflags"
|
||||
|
||||
# check for -Wno-pointer-sign compiler support (GCC >= 4)
|
||||
saved_cflags="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -Wno-pointer-sign"
|
||||
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),
|
||||
nopointersign_cflags="-Wno-pointer-sign", nopointersign_cflags="")
|
||||
CFLAGS="$saved_cflags"
|
||||
|
||||
AM_CFLAGS="-std=gnu99 $inline_cflags -W -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration $nopointersign_cflags -Wshadow -Wcast-qual"
|
||||
AC_SUBST(AM_CFLAGS)
|
||||
|
||||
### The following magic for determining the location of termcap library is from GNU Texinfo
|
||||
### http://www.tex.ac.uk/tex-archive/macros/texinfo/texinfo/configure.ac
|
||||
if test x$enable_termcap = "xyes"; then
|
||||
# Some GNU/Linux systems (e.g., SuSE 4.3, 1996) don't have curses, but
|
||||
# rather ncurses. So we check for it.
|
||||
TERMLIBS=
|
||||
# Check for termlib before termcap because Solaris termcap needs libucb.
|
||||
TERMLIB_VARIANTS="termlib termcap terminfo ncurses curses"
|
||||
for termlib in ${TERMLIB_VARIANTS}; do
|
||||
AC_CHECK_LIB(${termlib}, tgetent,
|
||||
[TERMLIBS="${TERMLIBS} -l${termlib}"; break])
|
||||
done
|
||||
# don't bother warning on djgpp, it doesn't have a term library, it
|
||||
# ports each termcap-needing program separately according to its needs.
|
||||
if test -z "$TERMLIBS" && echo "$build" | grep -v djgpp >/dev/null; then
|
||||
AC_MSG_WARN([probably need a terminal library, one of: ${TERMLIB_VARIANTS}])
|
||||
fi
|
||||
|
||||
# Checks for variables.
|
||||
# HP-UX 9 (at least) needs -lncurses which defines termcap variables PC etc.
|
||||
AC_MSG_CHECKING(for library with termcap variables)
|
||||
AC_CACHE_VAL(ac_cv_var_ospeed,
|
||||
[oldLIBS=$LIBS
|
||||
for trylib in $termlib ${TERMLIB_VARIANTS}; do
|
||||
if test "x$trylib" != "x$termlib"; then
|
||||
LIBS="$oldLIBS -l$termlib -l$trylib"
|
||||
else
|
||||
LIBS="$oldLIBS -l$termlib"
|
||||
fi
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[#ifdef HAVE_NCURSES_TERMCAP_H
|
||||
#include <ncurses/termcap.h>
|
||||
#else
|
||||
#ifdef HAVE_TERMCAP_H
|
||||
#include <termcap.h>
|
||||
#else
|
||||
#undef PC
|
||||
char *BC;
|
||||
char **UP;
|
||||
char PC;
|
||||
short ospeed;
|
||||
#endif
|
||||
#endif
|
||||
/* Make sure all variables actually exist. AIX 4.3 has ospeed but no BC.
|
||||
--Andreas Ley <andy@rz.uni-karlsruhe.de> 24 Aug 2000. */
|
||||
BC++;
|
||||
UP++;
|
||||
PC++;
|
||||
return ospeed != 0;
|
||||
]])], [ac_cv_var_ospeed=$trylib; break])
|
||||
done
|
||||
LIBS=$oldLIBS
|
||||
])
|
||||
AC_MSG_RESULT($ac_cv_var_ospeed)
|
||||
if test -n "$ac_cv_var_ospeed" \
|
||||
&& test "x$termlib" != "x$ac_cv_var_ospeed"; then
|
||||
TERMLIBS="${TERMLIBS} -l${ac_cv_var_ospeed}"
|
||||
fi
|
||||
AC_SUBST(TERMLIBS)#
|
||||
fi
|
||||
|
||||
# Do not use <ncurses/termcap.h> unless we're linking with ncurses.
|
||||
# Must come after the termlib tests.
|
||||
if test "x$termlib" = xncurses; then
|
||||
# Use AC_CHECK_HEADERS so the HAVE_*_H symbol gets defined.
|
||||
AC_CHECK_HEADERS(ncurses/termcap.h)
|
||||
fi
|
||||
### End-of-Termcap magic from http://www.tex.ac.uk/tex-archive/macros/texinfo/texinfo/configure.ac
|
||||
|
||||
AC_OUTPUT(Makefile src/Makefile include/Makefile man/Makefile examples/Makefile)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user