Todd Fiala | 12e2168 | 2013-10-30 10:02:25 -0700 | [diff] [blame] | 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 | |
| 26 | AC_INIT(libedit, [EL_RELEASE],, libedit-[EL_TIMESTAMP]) |
| 27 | AC_CONFIG_MACRO_DIR([m4]) |
| 28 | AC_CONFIG_SRCDIR([src/strlcat.c]) |
| 29 | AC_CONFIG_HEADER([config.h]) |
| 30 | |
| 31 | # features of Posix that are extensions to C (define _GNU_SOURCE) |
| 32 | AC_USE_SYSTEM_EXTENSIONS |
| 33 | |
| 34 | AM_INIT_AUTOMAKE |
| 35 | AC_PROG_LIBTOOL |
| 36 | |
| 37 | # libtool -version-info |
| 38 | AC_SUBST(LT_VERSION, [0:47:0]) |
| 39 | |
| 40 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
| 41 | |
| 42 | # Checks for programs. |
| 43 | AC_PROG_CC_C99 |
| 44 | #AC_PROG_CC |
| 45 | AC_PROG_LN_S |
| 46 | AC_PROG_AWK |
| 47 | EL_MANTYPE |
| 48 | |
| 49 | |
| 50 | AC_CHECK_LIB(tinfo, tgetent,, |
| 51 | [AC_CHECK_LIB(terminfo, tgetent,, |
| 52 | [AC_CHECK_LIB(termcap, tgetent,, |
| 53 | [AC_CHECK_LIB(termlib, tgetent,, |
| 54 | [AC_CHECK_LIB(curses, tgetent,, |
| 55 | [AC_CHECK_LIB(ncurses, tgetent,, |
| 56 | [AC_MSG_ERROR([libcurses or libncurses are required!])] |
| 57 | )] |
| 58 | )] |
| 59 | )] |
| 60 | )] |
| 61 | )] |
| 62 | ) |
| 63 | |
| 64 | |
| 65 | ### use option --enable-widec to turn on use of wide-character support |
| 66 | EL_ENABLE_WIDEC |
| 67 | |
| 68 | # Checks for header files. |
| 69 | AC_HEADER_DIRENT |
| 70 | AC_HEADER_STDC |
| 71 | AC_HEADER_SYS_WAIT |
| 72 | AC_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]) |
| 73 | |
| 74 | AC_CHECK_HEADER([termios.h], [], [AC_MSG_ERROR([termios.h is required!])],[]) |
| 75 | |
| 76 | ## include curses.h to prevent "Present But Cannot Be Compiled" |
| 77 | AC_CHECK_HEADERS([term.h],,, |
| 78 | [[#if HAVE_CURSES_H |
| 79 | # include <curses.h> |
| 80 | #elif HAVE_NCURSES_H |
| 81 | # include <ncurses.h> |
| 82 | #endif |
| 83 | ]]) |
| 84 | |
| 85 | # Check for dirent.d_namlen field explicitly |
| 86 | # (This is a bit more straightforward than, if not quite as portable as, |
| 87 | # the recipe given by the autoconf maintainers.) |
| 88 | AC_CHECK_MEMBER(struct dirent.d_namlen, |
| 89 | AC_DEFINE([HAVE_STRUCT_DIRENT_D_NAMLEN],[1], |
| 90 | [Define to 1 if struct dirent has member d_namlen]),, |
| 91 | [#if HAVE_DIRENT_H |
| 92 | #include <dirent.h> |
| 93 | #endif |
| 94 | ]) |
| 95 | |
| 96 | # Checks for typedefs, structures, and compiler characteristics. |
| 97 | AC_C_CONST |
| 98 | AC_TYPE_PID_T |
| 99 | AC_TYPE_SIZE_T |
| 100 | AC_CHECK_TYPES([u_int32_t]) |
| 101 | |
| 102 | # Checks for library functions. |
| 103 | AC_FUNC_CLOSEDIR_VOID |
| 104 | AC_FUNC_FORK |
| 105 | AC_PROG_GCC_TRADITIONAL |
| 106 | ## _AIX is offended by rpl_malloc and rpl_realloc |
| 107 | #AC_FUNC_MALLOC |
| 108 | #AC_FUNC_REALLOC |
| 109 | AC_TYPE_SIGNAL |
| 110 | AC_FUNC_STAT |
| 111 | AC_CHECK_FUNCS([endpwent isascii memchr memset re_comp regcomp strcasecmp strchr strcspn strdup strerror strrchr strstr strtol issetugid wcsdup strlcpy strlcat fgetln vis strvis strunvis __secure_getenv secure_getenv]) |
| 112 | |
| 113 | # strlcpy |
| 114 | AC_CHECK_FUNC(strlcpy, found_strlcpy=yes, found_strlcpy=no) |
| 115 | AM_CONDITIONAL(HAVE_STRLCPY, [test "x$found_strlcpy" = xyes]) |
| 116 | |
| 117 | # strlcat |
| 118 | AC_CHECK_FUNC(strlcat, found_strlcat=yes, found_strlcat=no) |
| 119 | AM_CONDITIONAL(HAVE_STRLCAT, [test "x$found_strlcat" = xyes]) |
| 120 | |
| 121 | # vis |
| 122 | AC_CHECK_FUNC(vis, found_vis=yes, found_vis=no) |
| 123 | AM_CONDITIONAL(HAVE_VIS, [test "x$found_vis" = xyes]) |
| 124 | |
| 125 | # unvis |
| 126 | AC_CHECK_FUNC(unvis, found_unvis=yes, found_unvis=no) |
| 127 | AM_CONDITIONAL(HAVE_UNVIS, [test "x$found_unvis" = xyes]) |
| 128 | |
| 129 | |
| 130 | EL_GETPW_R_POSIX |
| 131 | EL_GETPW_R_DRAFT |
| 132 | |
| 133 | |
| 134 | AH_BOTTOM([ |
| 135 | #include "sys.h" |
| 136 | #define SCCSID |
| 137 | #undef LIBC_SCCS |
| 138 | #define lint |
| 139 | ]) |
| 140 | |
| 141 | AC_CONFIG_FILES([Makefile |
| 142 | libedit.pc |
| 143 | src/Makefile |
| 144 | doc/Makefile |
| 145 | examples/Makefile]) |
| 146 | AC_OUTPUT |