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.

149 lines
3.6 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. case "$AC_CC $AC_CFLAGS" in
  54. *-Wall*) AC_DEFINE 'while(x)' 'while( (x) != 0 )'
  55. AC_DEFINE 'if(x)' 'if( (x) != 0 )' ;;
  56. esac
  57. AC_PROG ar || AC_FAIL "$TARGET requires ar"
  58. AC_PROG ranlib
  59. AC_C_VOLATILE
  60. AC_C_CONST
  61. AC_C_INLINE
  62. AC_SCALAR_TYPES sub hdr
  63. AC_CHECK_BASENAME
  64. AC_CHECK_HEADERS sys/types.h pwd.h && AC_CHECK_FUNCS getpwuid
  65. if AC_CHECK_FUNCS srandom; then
  66. AC_DEFINE 'INITRNG(x)' 'srandom((unsigned int)x)'
  67. elif AC_CHECK_FUNCS srand; then
  68. AC_DEFINE 'INITRNG(x)' 'srand((unsigned int)x)'
  69. else
  70. AC_DEFINE 'INITRNG(x)' '(void)1'
  71. fi
  72. if AC_CHECK_FUNCS 'bzero((char*)0,0)'; then
  73. : # Yay
  74. elif AC_CHECK_FUNCS 'memset((char*)0,0,0)'; then
  75. AC_DEFINE 'bzero(p,s)' 'memset(p,s,0)'
  76. else
  77. AC_FAIL "$TARGET requires bzero or memset"
  78. fi
  79. if AC_CHECK_FUNCS random; then
  80. AC_DEFINE 'COINTOSS()' '(random()&1)'
  81. elif AC_CHECK_FUNCS rand; then
  82. AC_DEFINE 'COINTOSS()' '(rand()&1)'
  83. else
  84. AC_DEFINE 'COINTOSS()' '1'
  85. fi
  86. if AC_CHECK_FUNCS strcasecmp; then
  87. :
  88. elif AC_CHECK_FUNCS stricmp; then
  89. AC_DEFINE strcasecmp stricmp
  90. else
  91. AC_FAIL "$TARGET requires either strcasecmp() or stricmp()"
  92. fi
  93. if AC_CHECK_FUNCS strncasecmp; then
  94. :
  95. elif AC_CHECK_FUNCS strnicmp; then
  96. AC_DEFINE strncasecmp strnicmp
  97. else
  98. AC_FAIL "$TARGET requires either strncasecmp() or strnicmp()"
  99. fi
  100. if AC_CHECK_FUNCS fchdir || AC_CHECK_FUNCS getcwd ; then
  101. AC_SUB 'THEME' ''
  102. else
  103. AC_SUB 'THEME' '#'
  104. fi
  105. if [ -z "$WITH_TABSTOPS" ]; then
  106. TABSTOP=4
  107. elif [ "$WITH_TABSTOPS" -eq 1 ]; then
  108. TABSTOP=8
  109. else
  110. TABSTOP=$WITH_TABSTOPS
  111. fi
  112. AC_DEFINE 'TABSTOP' $TABSTOP
  113. AC_SUB 'TABSTOP' $TABSTOP
  114. if [ "$WITH_AMALLOC" ]; then
  115. AC_DEFINE 'USE_AMALLOC' 1
  116. AC_SUB 'AMALLOC' 'amalloc.o'
  117. else
  118. AC_SUB 'AMALLOC' ''
  119. fi
  120. [ "$OS_FREEBSD" -o "$OS_DRAGONFLY" ] || AC_CHECK_HEADERS malloc.h
  121. [ "$WITH_PANDOC_HEADER" ] && AC_DEFINE 'PANDOC_HEADER' '1'
  122. AC_OUTPUT Makefile version.c mkdio.h