1# -*- Autoconf -*- 2# Process this file with autoconf to produce a configure script. 3# 4# Compile with debug symbols: 5# CFLAGS="-ggdb -pedandic -O0" ./configure 6# CFLAGS="-ggdb -Wall -Wextra -pedantic -O0" ./configure 7# 8# Use libtool (glibtool on OSX) to debug: 9# 10# libtool --mode=execute gdb examples/tc1 11# 12# Run valgrind like this, but note 13# http://invisible-island.net/ncurses/ncurses.faq.html#config_leaks. 14# 15# libtool --mode=execute valgrind --leak-check=full examples/tc1 16# 17# A valgrind suppressions file for ncurses is available at 18# http://www.opensource.apple.com/source/ncurses/ncurses-27/ncurses/misc/ncurses.supp 19# 20# libtool --mode=execute valgrind --suppressions=ncurses.supp.txt --leak-check=full examples/tc1 21# 22# Verbose output can be enabled with 23# "./configure --disable-silent-rules" or "make V=1" 24# 25 26AC_INIT([libedit],[EL_RELEASE],[],[libedit-EL_TIMESTAMP]) 27AC_CONFIG_MACRO_DIR([m4]) 28AC_CONFIG_SRCDIR([src/strlcat.c]) 29AC_CONFIG_HEADERS([config.h]) 30 31# features of Posix that are extensions to C (define _GNU_SOURCE) 32AC_USE_SYSTEM_EXTENSIONS 33 34AM_INIT_AUTOMAKE 35LT_INIT 36 37# libtool -version-info 38AC_SUBST(LT_VERSION, [0:75:0]) 39 40m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 41 42# Checks for programs. 43AC_PROG_CC 44AC_PROG_LN_S 45AC_PROG_AWK 46EL_MANTYPE 47 48AC_CHECK_LIB(ncurses, tgetent,, 49 [AC_CHECK_LIB(curses, tgetent,, 50 [AC_CHECK_LIB(termcap, tgetent,, 51 [AC_CHECK_LIB(tinfo, tgetent,, 52 [AC_MSG_ERROR([libncurses, libcurses, libtermcap or libtinfo is required!])] 53 )] 54 )] 55 )] 56) 57 58### deprecate option --enable-widec to turn on use of wide-character support 59EL_DEPRECATE_WIDEC 60 61AC_ARG_ENABLE( 62 [examples], 63 [AS_HELP_STRING([--enable-examples], [build the example programs [default=yes]])], 64 [enable_examples="$enableval"], 65 [enable_examples="yes"] 66) 67 68AM_CONDITIONAL(ENABLE_EXAMPLES, [test "$enable_examples" = "yes"]) 69 70# Checks for header files. 71AC_HEADER_DIRENT 72AC_CHECK_INCLUDES_DEFAULT 73AC_PROG_EGREP 74 75AC_HEADER_SYS_WAIT 76AC_CHECK_HEADERS([fcntl.h limits.h malloc.h stdlib.h string.h sys/ioctl.h sys/param.h unistd.h curses.h ncurses.h sys/cdefs.h termcap.h]) 77 78AC_CHECK_HEADER([ncurses.h], [], 79 [AC_CHECK_HEADER([curses.h], [], 80 [AC_CHECK_HEADER([termcap.h], [], 81 [AC_MSG_ERROR([ncurses.h, curses.h, or termcap.h is required!])], 82 [])], 83 [])], 84[]) 85 86AC_CHECK_HEADER([termios.h], [], [AC_MSG_ERROR([termios.h is required!])], []) 87 88## include curses.h to prevent "Present But Cannot Be Compiled" 89AC_CHECK_HEADERS([term.h],,, 90[[#if HAVE_CURSES_H 91# include <curses.h> 92#elif HAVE_NCURSES_H 93# include <ncurses.h> 94#endif 95]]) 96 97# Check for dirent.d_namlen field explicitly 98# (This is a bit more straightforward than, if not quite as portable as, 99# the recipe given by the autoconf maintainers.) 100AC_CHECK_MEMBER(struct dirent.d_namlen, 101AC_DEFINE([HAVE_STRUCT_DIRENT_D_NAMLEN],[1], 102[Define to 1 if struct dirent has member d_namlen]),, 103[#if HAVE_DIRENT_H 104#include <dirent.h> 105#endif 106]) 107 108# Checks for typedefs, structures, and compiler characteristics. 109AC_C_CONST 110AC_TYPE_PID_T 111AC_TYPE_SIZE_T 112AC_CHECK_TYPES([u_int32_t]) 113 114# Checks for library functions. 115AC_FUNC_CLOSEDIR_VOID 116AC_FUNC_FORK 117AC_PROG_CC 118## _AIX is offended by rpl_malloc and rpl_realloc 119#AC_FUNC_MALLOC 120#AC_FUNC_REALLOC 121AC_FUNC_STAT 122AC_CHECK_FUNCS([endpwent isascii memchr memset re_comp regcomp strcasecmp strchr strcspn strdup strerror strrchr strstr strtol issetugid wcsdup strlcpy strlcat vis strvis strunvis __secure_getenv secure_getenv reallocarr]) 123 124# strlcpy 125AC_CHECK_FUNC(strlcpy, found_strlcpy=yes, found_strlcpy=no) 126AM_CONDITIONAL(HAVE_STRLCPY, [test "x$found_strlcpy" = xyes]) 127 128# strlcat 129AC_CHECK_FUNC(strlcat, found_strlcat=yes, found_strlcat=no) 130AM_CONDITIONAL(HAVE_STRLCAT, [test "x$found_strlcat" = xyes]) 131 132# getline 133AC_CHECK_FUNC(getline, found_getline=yes, found_getline=no) 134AM_CONDITIONAL(HAVE_GETLINE, [test "x$found_getline" = xyes]) 135 136# vis 137AC_CHECK_FUNC(vis, found_vis=yes, found_vis=no) 138AM_CONDITIONAL(HAVE_VIS, [test "x$found_vis" = xyes]) 139 140# unvis 141AC_CHECK_FUNC(unvis, found_unvis=yes, found_unvis=no) 142AM_CONDITIONAL(HAVE_UNVIS, [test "x$found_unvis" = xyes]) 143 144 145EL_GETPW_R_POSIX 146EL_GETPW_R_DRAFT 147 148 149AH_BOTTOM([ 150#include "sys.h" 151#define SCCSID 152#undef LIBC_SCCS 153#define lint 154]) 155 156AC_CONFIG_FILES([Makefile 157 libedit.pc 158 src/Makefile 159 doc/Makefile 160 examples/Makefile]) 161AC_OUTPUT 162