configure.ac 3.8 KB

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