Text::Markdown::Discount
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

160 lines
3.9 KiB

  1. #! /bin/sh
  2. # local options: ac_help is the help message that describes them
  3. # and LOCAL_AC_OPTIONS is the script that interprets them. LOCAL_AC_OPTIONS
  4. # is a script that's processed with eval, so you need to be very careful to
  5. # make certain that what you quote is what you want to quote.
  6. # load in the configuration file
  7. #
  8. ac_help='--enable-amalloc Enable memory allocation debugging
  9. --with-tabstops=N Set tabstops to N characters (default is 4)
  10. --with-dl=X Use Discount, Extra, or Both types of definition list
  11. --with-id-anchor Use id= anchors for table-of-contents links
  12. --with-github-tags Allow `_` and `-` in <> tags
  13. --with-fenced-code Allow fenced code blocks
  14. --enable-all-features Turn on all stable optional features
  15. --shared Build shared libraries (default is static)'
  16. LOCAL_AC_OPTIONS='
  17. set=`locals $*`;
  18. if [ "$set" ]; then
  19. eval $set
  20. shift 1
  21. else
  22. ac_error=T;
  23. fi'
  24. locals() {
  25. K=`echo $1 | $AC_UPPERCASE`
  26. case "$K" in
  27. --SHARED)
  28. echo TRY_SHARED=T
  29. ;;
  30. --ENABLE-ALL|--ENABLE-ALL-FEATURES)
  31. echo WITH_AMALLOC=T
  32. ;;
  33. --ENABLE-*) enable=`echo $K | sed -e 's/--ENABLE-//' | tr '-' '_'`
  34. echo WITH_${enable}=T ;;
  35. esac
  36. }
  37. TARGET=markdown
  38. . ./configure.inc
  39. AC_INIT $TARGET
  40. __DL=`echo "$WITH_DL" | $AC_UPPERCASE`
  41. case "$__DL" in
  42. EXTRA) AC_DEFINE 'USE_EXTRA_DL' 1 ;;
  43. DISCOUNT|1|"") AC_DEFINE 'USE_DISCOUNT_DL' 1 ;;
  44. BOTH) AC_DEFINE 'USE_EXTRA_DL' 1
  45. AC_DEFINE 'USE_DISCOUNT_DL' 1 ;;
  46. *) AC_FAIL "Unknown value <$WITH_DL> for --with-dl (want 'discount', 'extra', or 'both')" ;;
  47. esac
  48. test "$WITH_FENCED_CODE" && AC_DEFINE "WITH_FENCED_CODE" 1
  49. test "$WITH_ID_ANCHOR" && AC_DEFINE 'WITH_ID_ANCHOR' 1
  50. test "$WITH_GITHUB_TAGS" && AC_DEFINE 'WITH_GITHUB_TAGS' 1
  51. AC_PROG_CC
  52. test "$TRY_SHARED" && AC_COMPILER_PIC && AC_CC_SHLIBS
  53. if [ "IS_BROKEN_CC" ]; then
  54. case "$AC_CC $AC_CFLAGS" in
  55. *-pedantic*) ;;
  56. *) # hack around deficiencies in gcc and clang
  57. #
  58. AC_DEFINE 'while(x)' 'while( (x) != 0 )'
  59. AC_DEFINE 'if(x)' 'if( (x) != 0 )'
  60. if [ "$IS_CLANG" ]; then
  61. AC_CC="$AC_CC -Wno-implicit-int"
  62. elif [ "$IS_GCC" ]; then
  63. AC_CC="$AC_CC -Wno-return-type -Wno-implicit-int"
  64. fi ;;
  65. esac
  66. fi
  67. AC_PROG ar || AC_FAIL "$TARGET requires ar"
  68. AC_PROG ranlib
  69. AC_C_VOLATILE
  70. AC_C_CONST
  71. AC_C_INLINE
  72. AC_SCALAR_TYPES sub hdr
  73. AC_CHECK_BASENAME
  74. AC_CHECK_HEADERS sys/types.h pwd.h && AC_CHECK_FUNCS getpwuid
  75. if AC_CHECK_FUNCS srandom; then
  76. AC_DEFINE 'INITRNG(x)' 'srandom((unsigned int)x)'
  77. elif AC_CHECK_FUNCS srand; then
  78. AC_DEFINE 'INITRNG(x)' 'srand((unsigned int)x)'
  79. else
  80. AC_DEFINE 'INITRNG(x)' '(void)1'
  81. fi
  82. if AC_CHECK_FUNCS 'bzero((char*)0,0)'; then
  83. : # Yay
  84. elif AC_CHECK_FUNCS 'memset((char*)0,0,0)'; then
  85. AC_DEFINE 'bzero(p,s)' 'memset(p,s,0)'
  86. else
  87. AC_FAIL "$TARGET requires bzero or memset"
  88. fi
  89. if AC_CHECK_FUNCS random; then
  90. AC_DEFINE 'COINTOSS()' '(random()&1)'
  91. elif AC_CHECK_FUNCS rand; then
  92. AC_DEFINE 'COINTOSS()' '(rand()&1)'
  93. else
  94. AC_DEFINE 'COINTOSS()' '1'
  95. fi
  96. if AC_CHECK_FUNCS strcasecmp; then
  97. :
  98. elif AC_CHECK_FUNCS stricmp; then
  99. AC_DEFINE strcasecmp stricmp
  100. else
  101. AC_FAIL "$TARGET requires either strcasecmp() or stricmp()"
  102. fi
  103. if AC_CHECK_FUNCS strncasecmp; then
  104. :
  105. elif AC_CHECK_FUNCS strnicmp; then
  106. AC_DEFINE strncasecmp strnicmp
  107. else
  108. AC_FAIL "$TARGET requires either strncasecmp() or strnicmp()"
  109. fi
  110. if AC_CHECK_FUNCS fchdir || AC_CHECK_FUNCS getcwd ; then
  111. AC_SUB 'THEME' ''
  112. else
  113. AC_SUB 'THEME' '#'
  114. fi
  115. if [ -z "$WITH_TABSTOPS" ]; then
  116. TABSTOP=4
  117. elif [ "$WITH_TABSTOPS" -eq 1 ]; then
  118. TABSTOP=8
  119. else
  120. TABSTOP=$WITH_TABSTOPS
  121. fi
  122. AC_DEFINE 'TABSTOP' $TABSTOP
  123. AC_SUB 'TABSTOP' $TABSTOP
  124. if [ "$WITH_AMALLOC" ]; then
  125. AC_DEFINE 'USE_AMALLOC' 1
  126. AC_SUB 'AMALLOC' 'amalloc.o'
  127. else
  128. AC_SUB 'AMALLOC' ''
  129. fi
  130. [ "$OS_FREEBSD" -o "$OS_DRAGONFLY" ] || AC_CHECK_HEADERS malloc.h
  131. [ "$WITH_PANDOC_HEADER" ] && AC_DEFINE 'PANDOC_HEADER' '1'
  132. AC_OUTPUT Makefile version.c mkdio.h