📄 configure.in
字号:
dnl This is the input file which autoconf uses to construct adnl "configure" script for the tecla library. It is a bourne shelldnl script which autoconf pre-processes with the m4 preprocessor todnl expand autoconf-defined m4 macros such as AC_INIT(). Thednl following line just initializes autoconf. Autoconf interprets thednl single argument as the name of an arbitrary file, which it uses todnl ensure that it is being run correctly from the directory whichdnl contains the libtecla source code.AC_INIT(getline.c)dnl Here we set the major version number of the tecla library.dnl Incrementing this number implies that a change has been made todnl the library's public interface, which makes it binary incompatiblednl with programs that were linked with previous shared versions ofdnl the tecla library. Incompatible changes of this type should bednl avoided at all costs, so it is hoped that the major version numberdnl won't ever have to change. The major version number must be adnl small integer number, preferably a single numeric digit.AC_SUBST(MAJOR_VER)MAJOR_VER="1"dnl Set the minor version number of the tecla library. This numberdnl should be incremented by one whenever additional functionality,dnl such as new functions or modules, are added to the library. Thednl idea is that a program that was linked with a shared library ofdnl the same major version number, but a lower minor version number,dnl will continue to function when the run-time loader links itdnl against the updated version. The minor version number must be adnl small integer number, which should be reset to 0 whenever thednl major version number is incremented.AC_SUBST(MINOR_VER)MINOR_VER="4"dnl Set the micro version number of the tecla library. This isdnl incremented whenever modifications to the library are made whichdnl make no changes to the public interface, but which fix bugs and/ordnl improve the behind-the-scenes implementation. The micro versiondnl number should be reset to 0 whenever the minor version number isdnl incremented. The micro version number must be a small integerdnl number.AC_SUBST(MICRO_VER)MICRO_VER="0"dnl The AC_PROG_CC line looks for a C compiler, and if gcc is chosen,dnl sets the $GCC shell variable to "yes". Make sure that CFLAGS isdnl set to something first, to prevent AC_PROG_CC from substituting -gdnl for the optimization level.CFLAGS="$CFLAGS"AC_PROG_CCdnl Apparently not all implementations of the 'make' command definednl the MAKE variable. The following directive creates a variablednl called SET_MAKE which when expanded in a makefile is either emptydnl if the local 'make' command was found to define the MAKE variable,dnl or contains an assignment which will give the MAKE variable thednl value 'make'.AC_PROG_MAKE_SETdnl The following directive causes autoconf to see if symbolic linksdnl are supported on the current filesystem. If so, it sets thednl variable LN_S to "ln -s". Otherwise it sets LN_S to just "ln".dnl This allows us to create symbolic links where possible, but fallsdnl back to creating hard links where symbolic links aren't available.AC_PROG_LN_Sdnl The following macro searches for the best implementation of awkdnl on the host system, and records it in the AWK shell variable.AC_PROG_AWKdnl The following directive tells autoconf to figure out the targetdnl system type and assign a canonical name for this to the $targetdnl shell variable. This is used below in the target-specific casednl statement.AC_CANONICAL_SYSTEMdnl In early versions of Solaris, some libraries are in /usr/ccs/lib,dnl where gcc doesn't look. The tests below for the curses librarydnl would thus fail without this directory being added to the searchdnl path. We thus add it here before the tests. Note that in thednl following, since [ and ] are m4 quotes, and m4 will remove thednl outermost quotes when it processes this file, we have to doublednl them up here to get [0-6] to appear in the output configurednl script.case $target in*-sun-solaris2.[[0-6]]|*-sun-solaris2.[[0-6]].*) LIBS="$LIBS -L/usr/ccs/lib" ;;esacdnl The following lines look for terminfo functions in the normaldnl curses library. If not found, they are searched for in the GNUdnl ncurses library. If the terminfo functions still aren't found,dnl then termcap functions are searched for in the curses library. Ifdnl either set of functions is found, the corresponding variablednl USE_TERMINFO or USE_TERMCAP is arranged to be defined in CFLAGS,dnl via the exported DEFINES shell variable, and the library in whichdnl they were found is appended to the LIBS shell variable.AC_CHECK_LIB(curses, tigetstr, [ AC_DEFINE(USE_TERMINFO) LIBS="$LIBS -lcurses"], [AC_CHECK_LIB(ncurses, tigetstr, [ AC_DEFINE(USE_TERMINFO) LIBS="$LIBS -lncurses"], [AC_CHECK_LIB(curses, tgetstr, [ AC_DEFINE(USE_TERMCAP) LIBS="$LIBS -lcurses" AC_CHECK_HEADER(termcap.h, AC_DEFINE(HAVE_TERMCAP_H))])])])dnldnl Check for various headersdnlAC_CHECK_HEADER(sys/ioctl.h, AC_DEFINE(HAVE_SYS_IOCTL_H))AC_CHECK_HEADER(unistd.h, AC_DEFINE(HAVE_UNISTD_H))AC_CHECK_HEADER(termios.h, AC_DEFINE(HAVE_TERMIOS_H))dnl The following variable lists the targets that will be created ifdnl the user runs make without any arguments. Initially we assumednl that we can create both the normal and the reentrant versionsdnl of the library.AC_SUBST(TARGETS)TARGETS="normal reentrant"dnl Check for reentrant functions by attempting to compile and link adnl temporary program which calls them, being sure to include thednl appropriate headers and define _POSIX_C_SOURCE, just in case anydnl of the functions are defined as macros. In the following,dnl AC_CACHE_CHECK outputs the message "checking for reentrantdnl functions". If this check has been done before, it assigns thednl cached yes/no value to tecla_cv_reentrant. Otherwise it usesdnl AC_TRY_LINK() to attempt to compile and link the specified dummydnl program, and sets tecla_cv_reentrant to yes or no, depending ondnl whether this succeeds. Finally it caches the value ofdnl tecla_cv_reentrant in the file config.cache, and writes "yes" ordnl "no" to the terminal.AC_CACHE_CHECK(for reentrant functions, tecla_cv_reentrant, [ KEPT_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=200112L" AC_TRY_LINK([#include <unistd.h>#include <sys/types.h>#include <sys/stat.h>#include <dirent.h>#include <pwd.h> ], [ (void) readdir_r(NULL, NULL, NULL); (void) getpwuid_r(geteuid(), NULL, NULL, 0, NULL); (void) getpwnam_r(NULL, NULL, NULL, 0, NULL); ], tecla_cv_reentrant=yes, tecla_cv_reentrant=no) CFLAGS="$KEPT_CFLAGS"])dnl If the necessary reentrant functions weren't found to bednl available, default to only compiling the non-reentrant version ofdnl the library.if test $tecla_cv_reentrant = no; then TARGETS="normal"fidnl Check for the select system call with the normal arguments,dnl by attempting to compile and link a temporary program whichdnl calls it, being sure to include the appropriate headers.dnl In the following, AC_CACHE_CHECK outputs the messagednl "checking for select system call". If this check has been donednl before, it assigns the cached yes/no value to tecla_cv_select.dnl Otherwise it uses AC_TRY_LINK() to attempt to compile and linkdnl the specified dummy program, and sets tecla_cv_select to yesdnl or no, depending on whether this succeeds. Finally it cachesdnl the value of tecla_cv_select in the file config.cache, anddnl writes "yes" or "no" to the terminal.AC_CACHE_CHECK(for select system call, tecla_cv_select, [ AC_TRY_LINK([#ifdef HAVE_SELECT_H#include <select.h>#endif#include <sys/time.h>#include <sys/types.h>#include <unistd.h> ], [ fd_set fds; int nready; FD_ZERO(&fds); FD_SET(1, &fds);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -