Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

To hell and back. No plugins yet, researching a clean method.

  • Loading branch information...
commit 865d52a08f04c73e5ed689a59213260cebd27bff 1 parent d05b3fa
Kevin Bowling authored April 05, 2011

Showing 77 changed files with 1,373 additions and 24 deletions. Show diff stats Hide diff stats

  1. 12  .gitignore
  2. 37  Makefile.am
  3. 1  autogen.sh
  4. 0  build/auto/aux/keep
  5. 83  build/auto/m4/ax_c_float_words_bigendian.m4
  6. 195  build/auto/m4/ax_cflags_warn_all.m4
  7. 128  build/auto/m4/ax_check_zlib.m4
  8. 40  build/auto/m4/ax_lib_socket_nsl.m4
  9. 90  build/auto/m4/ax_path_lib_pcre.m4
  10. 283  build/auto/m4/ax_pthread.m4
  11. 102  configure.ac
  12. 17  htdocs/Makefile.am
  13. 58  include/Makefile.am
  14. 1  include/bstring/bsafe.h
  15. 1  include/bstring/bstraux.h
  16. 1  include/bstring/bstrlib.h
  17. 1  include/bstring/bstrwrap.h
  18. 1  include/craftd
  19. 0  include/{ → craftd}/Arithmetic.h
  20. 0  include/{ → craftd}/Buffer.h
  21. 0  include/{ → craftd}/Buffers.h
  22. 0  include/{ → craftd}/Client.h
  23. 0  include/{ → craftd}/Config.h
  24. 0  include/{ → craftd}/Console.h
  25. 0  include/{ → craftd}/Dynamic.h
  26. 0  include/{ → craftd}/Error.h
  27. 0  include/{ → craftd}/Event.h
  28. 0  include/{ → craftd}/HTTPd.h
  29. 0  include/{ → craftd}/Hash.h
  30. 0  include/{ → craftd}/Job.h
  31. 0  include/{ → craftd}/List.h
  32. 0  include/{ → craftd}/Logger.h
  33. 0  include/{ → craftd}/Map.h
  34. 0  include/{ → craftd}/Plugin.h
  35. 0  include/{ → craftd}/Plugins.h
  36. 0  include/{ → craftd}/Regexp.h
  37. 0  include/{ → craftd}/ScriptingEngine.h
  38. 0  include/{ → craftd}/ScriptingEngines.h
  39. 0  include/{ → craftd}/Server.h
  40. 0  include/{ → craftd}/Set.h
  41. 0  include/{ → craftd}/String.h
  42. 0  include/{ → craftd}/TimeLoop.h
  43. 0  include/{ → craftd}/Worker.h
  44. 0  include/{ → craftd}/Workers.h
  45. 1  include/craftd/bstring/bsafe.h
  46. 1  include/craftd/bstring/bstraux.h
  47. 1  include/craftd/bstring/bstrlib.h
  48. 1  include/craftd/bstring/bstrwrap.h
  49. 0  include/{ → craftd}/common.h
  50. 261  include/craftd/config.h.in
  51. 0  include/{ → craftd}/javaendian.h
  52. 1  include/craftd/klib/kbtree.h
  53. 1  include/craftd/klib/khash.h
  54. 1  include/craftd/klib/khmm.h
  55. 1  include/craftd/klib/klist.h
  56. 1  include/craftd/klib/kmin.h
  57. 1  include/craftd/klib/knetfile.h
  58. 1  include/craftd/klib/knhx.h
  59. 1  include/craftd/klib/kseq.h
  60. 1  include/craftd/klib/ksort.h
  61. 1  include/craftd/klib/kstring.h
  62. 1  include/craftd/klib/kvec.h
  63. 2  include/{ → craftd}/memory.h
  64. 0  include/{ → craftd}/utils.h
  65. 2  include/{ → craftd}/version.h
  66. 1  include/klib/kbtree.h
  67. 1  include/klib/khash.h
  68. 1  include/klib/khmm.h
  69. 1  include/klib/klist.h
  70. 1  include/klib/kmin.h
  71. 1  include/klib/knetfile.h
  72. 1  include/klib/knhx.h
  73. 1  include/klib/kseq.h
  74. 1  include/klib/ksort.h
  75. 1  include/klib/kstring.h
  76. 1  include/klib/kvec.h
  77. 55  src/Makefile.am
12  .gitignore
@@ -6,8 +6,8 @@
6 6
 ###
7 7
 
8 8
 ## Binaries and generated
9  
-craftd
10  
-craftd-proxy
  9
+/craftd
  10
+/src/craftd
11 11
 third-party/jansson/src/jansson_config.h
12 12
 craftd.conf.dist
13 13
 
@@ -39,15 +39,15 @@ Makefile.in
39 39
 # Check build-aux/.gitignore for the commented stuff
40 40
 /autom4te.cache
41 41
 /aclocal.m4
42  
-#/compile
43  
-#/depcomp
44  
-#/install-sh
45  
-#/missing
  42
+/build/auto/aux/
  43
+/configure
46 44
 /config.guess
47 45
 /config.log
48 46
 /config.status
49 47
 /config.sub
50 48
 */include/config.h
  49
+stamp-h1
  50
+Makefile
51 51
 
52 52
 # libtool
53 53
 build-aux/ltmain.sh
37  Makefile.am
... ...
@@ -0,0 +1,37 @@
  1
+ACLOCAL_AMFLAGS = -I build/auto/m4
  2
+
  3
+SUBDIRS = include src htdocs
  4
+
  5
+EXTRA_DIST = craftd.conf.dist.in motd.conf.dist
  6
+
  7
+# Make a correct default config file
  8
+edit = sed \
  9
+       -e 's|@localstatedir[@]|$(localstatedir)|g' \
  10
+       -e 's|@datadir[@]|$(datadir)|g' \
  11
+       -e 's|@sysconfdir[@]|$(sysconfdir)|g' \
  12
+       -e 's|@libdir[@]|$(libdir)|g'
  13
+craftd.conf.dist: Makefile
  14
+	rm -f $@ $@.tmp
  15
+	srcdir='' \
  16
+	       test -f ./$@.in || srcdir=$(srcdir)/; \
  17
+	       $(edit) $${srcdir}$@.in >$@.tmp
  18
+	mv $@.tmp $@
  19
+
  20
+craftd.conf.dist: $(srcdir)/craftd.conf.dist.in
  21
+
  22
+DISTCLEANFILES = craftd.conf.dist
  23
+
  24
+craftdconfdir = ${sysconfdir}/craftd/
  25
+craftdconf_DATA = craftd.conf.dist motd.conf.dist
  26
+
  27
+# bstring extas
  28
+bstrdir = third-party/bstring
  29
+EXTRA_DIST += $(bstrdir)/license.txt $(bstrdir)/security.txt \
  30
+	      $(bstrdir)/bstrlib.txt $(bstrdir)/porting.txt
  31
+
  32
+# klib extras
  33
+klibdir = third-party/klib
  34
+EXTRA_DIST += $(klibdir)
  35
+
  36
+install-data-local:
  37
+	$(MKDIR_P) $(DESTDIR)$(localstatedir)/craftd/world
1  autogen.sh 100644 → 100755
... ...
@@ -1,2 +1,3 @@
1 1
 git submodule init
2 2
 git submodule update
  3
+autoreconf -iv
0  build/auto/aux/keep
No changes.
83  build/auto/m4/ax_c_float_words_bigendian.m4
... ...
@@ -0,0 +1,83 @@
  1
+# ==============================================================================
  2
+#  http://www.gnu.org/software/autoconf-archive/ax_c_float_words_bigendian.html
  3
+# ==============================================================================
  4
+#
  5
+# SYNOPSIS
  6
+#
  7
+#   AX_C_FLOAT_WORDS_BIGENDIAN([ACTION-IF-TRUE], [ACTION-IF-FALSE], [ACTION-IF-UNKNOWN])
  8
+#
  9
+# DESCRIPTION
  10
+#
  11
+#   Checks the ordering of words within a multi-word float. This check is
  12
+#   necessary because on some systems (e.g. certain ARM systems), the float
  13
+#   word ordering can be different from the byte ordering. In a multi-word
  14
+#   float context, "big-endian" implies that the word containing the sign
  15
+#   bit is found in the memory location with the lowest address. This
  16
+#   implemenation was inspired by the AC_C_BIGENDIAN macro in autoconf.
  17
+#
  18
+#   The endianess is detected by first compiling C code that contains a
  19
+#   special double float value, then grepping the resulting object file for
  20
+#   certain strings of ASCII values. The double is specially crafted to have
  21
+#   a binary representation that corresponds with a simple string. In this
  22
+#   implementation, the string "noonsees" was selected because the
  23
+#   individual word values ("noon" and "sees") are palindromes, thus making
  24
+#   this test byte-order agnostic. If grep finds the string "noonsees" in
  25
+#   the object file, the target platform stores float words in big-endian
  26
+#   order. If grep finds "seesnoon", float words are in little-endian order.
  27
+#   If neither value is found, the user is instructed to specify the
  28
+#   ordering.
  29
+#
  30
+# LICENSE
  31
+#
  32
+#   Copyright (c) 2008 Daniel Amelang <dan@amelang.net>
  33
+#
  34
+#   Copying and distribution of this file, with or without modification, are
  35
+#   permitted in any medium without royalty provided the copyright notice
  36
+#   and this notice are preserved. This file is offered as-is, without any
  37
+#   warranty.
  38
+
  39
+#serial 7
  40
+
  41
+AC_DEFUN([AX_C_FLOAT_WORDS_BIGENDIAN],
  42
+  [AC_CACHE_CHECK(whether float word ordering is bigendian,
  43
+                  ax_cv_c_float_words_bigendian, [
  44
+
  45
+ax_cv_c_float_words_bigendian=unknown
  46
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
  47
+
  48
+double d = 90904234967036810337470478905505011476211692735615632014797120844053488865816695273723469097858056257517020191247487429516932130503560650002327564517570778480236724525140520121371739201496540132640109977779420565776568942592.0;
  49
+
  50
+]])], [
  51
+
  52
+if grep noonsees conftest.$ac_objext >/dev/null ; then
  53
+  ax_cv_c_float_words_bigendian=yes
  54
+fi
  55
+if grep seesnoon conftest.$ac_objext >/dev/null ; then
  56
+  if test "$ax_cv_c_float_words_bigendian" = unknown; then
  57
+    ax_cv_c_float_words_bigendian=no
  58
+  else
  59
+    ax_cv_c_float_words_bigendian=unknown
  60
+  fi
  61
+fi
  62
+
  63
+])])
  64
+
  65
+case $ax_cv_c_float_words_bigendian in
  66
+  yes)
  67
+    m4_default([$1],
  68
+      [AC_DEFINE([FLOAT_WORDS_BIGENDIAN], 1,
  69
+                 [Define to 1 if your system stores words within floats
  70
+                  with the most significant word first])]) ;;
  71
+  no)
  72
+    $2 ;;
  73
+  *)
  74
+    m4_default([$3],
  75
+      [AC_MSG_ERROR([
  76
+
  77
+Unknown float word ordering. You need to manually preset
  78
+ax_cv_c_float_words_bigendian=no (or yes) according to your system.
  79
+
  80
+    ])]) ;;
  81
+esac
  82
+
  83
+])# AX_C_FLOAT_WORDS_BIGENDIAN
195  build/auto/m4/ax_cflags_warn_all.m4
... ...
@@ -0,0 +1,195 @@
  1
+# ===========================================================================
  2
+#    http://www.gnu.org/software/autoconf-archive/ax_cflags_warn_all.html
  3
+# ===========================================================================
  4
+#
  5
+# SYNOPSIS
  6
+#
  7
+#   AX_CFLAGS_WARN_ALL   [(shellvar [,default, [A/NA]])]
  8
+#   AX_CXXFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])]
  9
+#   AX_FCFLAGS_WARN_ALL  [(shellvar [,default, [A/NA]])]
  10
+#
  11
+# DESCRIPTION
  12
+#
  13
+#   Try to find a compiler option that enables most reasonable warnings.
  14
+#
  15
+#   For the GNU compiler it will be -Wall (and -ansi -pedantic) The result
  16
+#   is added to the shellvar being CFLAGS, CXXFLAGS, or FCFLAGS by default.
  17
+#
  18
+#   Currently this macro knows about the GCC, Solaris, Digital Unix, AIX,
  19
+#   HP-UX, IRIX, NEC SX-5 (Super-UX 10), Cray J90 (Unicos 10.0.0.8), and
  20
+#   Intel compilers.  For a given compiler, the Fortran flags are much more
  21
+#   experimental than their C equivalents.
  22
+#
  23
+#    - $1 shell-variable-to-add-to : CFLAGS, CXXFLAGS, or FCFLAGS
  24
+#    - $2 add-value-if-not-found : nothing
  25
+#    - $3 action-if-found : add value to shellvariable
  26
+#    - $4 action-if-not-found : nothing
  27
+#
  28
+# LICENSE
  29
+#
  30
+#   Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
  31
+#   Copyright (c) 2010 Rhys Ulerich <rhys.ulerich@gmail.com>
  32
+#
  33
+#   This program is free software; you can redistribute it and/or modify it
  34
+#   under the terms of the GNU General Public License as published by the
  35
+#   Free Software Foundation; either version 3 of the License, or (at your
  36
+#   option) any later version.
  37
+#
  38
+#   This program is distributed in the hope that it will be useful, but
  39
+#   WITHOUT ANY WARRANTY; without even the implied warranty of
  40
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  41
+#   Public License for more details.
  42
+#
  43
+#   You should have received a copy of the GNU General Public License along
  44
+#   with this program. If not, see <http://www.gnu.org/licenses/>.
  45
+#
  46
+#   As a special exception, the respective Autoconf Macro's copyright owner
  47
+#   gives unlimited permission to copy, distribute and modify the configure
  48
+#   scripts that are the output of Autoconf when processing the Macro. You
  49
+#   need not follow the terms of the GNU General Public License when using
  50
+#   or distributing such scripts, even though portions of the text of the
  51
+#   Macro appear in them. The GNU General Public License (GPL) does govern
  52
+#   all other use of the material that constitutes the Autoconf Macro.
  53
+#
  54
+#   This special exception to the GPL applies to versions of the Autoconf
  55
+#   Macro released by the Autoconf Archive. When you make and distribute a
  56
+#   modified version of the Autoconf Macro, you may extend this special
  57
+#   exception to the GPL to apply to your modified version as well.
  58
+
  59
+#serial 10
  60
+
  61
+AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl
  62
+AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
  63
+AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_warn_all])dnl
  64
+AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
  65
+VAR,[VAR="no, unknown"
  66
+ AC_LANG_PUSH([C])
  67
+ ac_save_[]FLAGS="$[]FLAGS"
  68
+for ac_arg dnl
  69
+in "-pedantic  % -Wall"       dnl   GCC
  70
+   "-xstrconst % -v"          dnl Solaris C
  71
+   "-std1      % -verbose -w0 -warnprotos" dnl Digital Unix
  72
+   "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
  73
+   "-ansi -ansiE % -fullwarn" dnl IRIX
  74
+   "+ESlit     % +w1"         dnl HP-UX C
  75
+   "-Xc        % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10)
  76
+   "-h conform % -h msglevel 2" dnl Cray C (Unicos)
  77
+   #
  78
+do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
  79
+   AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
  80
+                     [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
  81
+done
  82
+ FLAGS="$ac_save_[]FLAGS"
  83
+ AC_LANG_POP([C])
  84
+])
  85
+case ".$VAR" in
  86
+     .ok|.ok,*) m4_ifvaln($3,$3) ;;
  87
+   .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
  88
+        AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
  89
+                      m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
  90
+   *) m4_ifvaln($3,$3,[
  91
+   if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
  92
+   then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
  93
+   else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
  94
+                      m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
  95
+   fi ]) ;;
  96
+esac
  97
+AS_VAR_POPDEF([VAR])dnl
  98
+AS_VAR_POPDEF([FLAGS])dnl
  99
+])
  100
+
  101
+dnl the only difference - the LANG selection... and the default FLAGS
  102
+
  103
+AC_DEFUN([AX_CXXFLAGS_WARN_ALL],[dnl
  104
+AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
  105
+AS_VAR_PUSHDEF([VAR],[ax_cv_cxxflags_warn_all])dnl
  106
+AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
  107
+VAR,[VAR="no, unknown"
  108
+ AC_LANG_PUSH([C++])
  109
+ ac_save_[]FLAGS="$[]FLAGS"
  110
+for ac_arg dnl
  111
+in "-pedantic  % -Wall"       dnl   GCC
  112
+   "-xstrconst % -v"          dnl Solaris C
  113
+   "-std1      % -verbose -w0 -warnprotos" dnl Digital Unix
  114
+   "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
  115
+   "-ansi -ansiE % -fullwarn" dnl IRIX
  116
+   "+ESlit     % +w1"         dnl HP-UX C
  117
+   "-Xc        % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10)
  118
+   "-h conform % -h msglevel 2" dnl Cray C (Unicos)
  119
+   #
  120
+do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
  121
+   AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
  122
+                     [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
  123
+done
  124
+ FLAGS="$ac_save_[]FLAGS"
  125
+ AC_LANG_POP([C++])
  126
+])
  127
+case ".$VAR" in
  128
+     .ok|.ok,*) m4_ifvaln($3,$3) ;;
  129
+   .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
  130
+        AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
  131
+                      m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
  132
+   *) m4_ifvaln($3,$3,[
  133
+   if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
  134
+   then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
  135
+   else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
  136
+                      m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
  137
+   fi ]) ;;
  138
+esac
  139
+AS_VAR_POPDEF([VAR])dnl
  140
+AS_VAR_POPDEF([FLAGS])dnl
  141
+])
  142
+
  143
+dnl the only difference - the LANG selection... and the default FLAGS
  144
+
  145
+AC_DEFUN([AX_FCFLAGS_WARN_ALL],[dnl
  146
+AS_VAR_PUSHDEF([FLAGS],[FCFLAGS])dnl
  147
+AS_VAR_PUSHDEF([VAR],[ax_cv_fcflags_warn_all])dnl
  148
+AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
  149
+VAR,[VAR="no, unknown"
  150
+ AC_LANG_PUSH([Fortran])
  151
+ ac_save_[]FLAGS="$[]FLAGS"
  152
+for ac_arg dnl
  153
+in "-warn all  % -warn all"   dnl Intel
  154
+   "-pedantic  % -Wall"       dnl GCC
  155
+   "-xstrconst % -v"          dnl Solaris C
  156
+   "-std1      % -verbose -w0 -warnprotos" dnl Digital Unix
  157
+   "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
  158
+   "-ansi -ansiE % -fullwarn" dnl IRIX
  159
+   "+ESlit     % +w1"         dnl HP-UX C
  160
+   "-Xc        % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10)
  161
+   "-h conform % -h msglevel 2" dnl Cray C (Unicos)
  162
+   #
  163
+do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
  164
+   AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
  165
+                     [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
  166
+done
  167
+ FLAGS="$ac_save_[]FLAGS"
  168
+ AC_LANG_POP([Fortran])
  169
+])
  170
+case ".$VAR" in
  171
+     .ok|.ok,*) m4_ifvaln($3,$3) ;;
  172
+   .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
  173
+        AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
  174
+                      m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
  175
+   *) m4_ifvaln($3,$3,[
  176
+   if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
  177
+   then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
  178
+   else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
  179
+                      m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
  180
+   fi ]) ;;
  181
+esac
  182
+AS_VAR_POPDEF([VAR])dnl
  183
+AS_VAR_POPDEF([FLAGS])dnl
  184
+])
  185
+
  186
+dnl  implementation tactics:
  187
+dnl   the for-argument contains a list of options. The first part of
  188
+dnl   these does only exist to detect the compiler - usually it is
  189
+dnl   a global option to enable -ansi or -extrawarnings. All other
  190
+dnl   compilers will fail about it. That was needed since a lot of
  191
+dnl   compilers will give false positives for some option-syntax
  192
+dnl   like -Woption or -Xoption as they think of it is a pass-through
  193
+dnl   to later compile stages or something. The "%" is used as a
  194
+dnl   delimiter. A non-option comment can be given after "%%" marks
  195
+dnl   which will be shown but not added to the respective C/CXXFLAGS.
128  build/auto/m4/ax_check_zlib.m4
... ...
@@ -0,0 +1,128 @@
  1
+# ===========================================================================
  2
+#       http://www.gnu.org/software/autoconf-archive/ax_check_zlib.html
  3
+# ===========================================================================
  4
+#
  5
+# SYNOPSIS
  6
+#
  7
+#   AX_CHECK_ZLIB()
  8
+#
  9
+# DESCRIPTION
  10
+#
  11
+#   This macro searches for an installed zlib library. If nothing was
  12
+#   specified when calling configure, it searches first in /usr/local and
  13
+#   then in /usr. If the --with-zlib=DIR is specified, it will try to find
  14
+#   it in DIR/include/zlib.h and DIR/lib/libz.a. If --without-zlib is
  15
+#   specified, the library is not searched at all.
  16
+#
  17
+#   If either the header file (zlib.h) or the library (libz) is not found,
  18
+#   the configuration exits on error, asking for a valid zlib installation
  19
+#   directory or --without-zlib.
  20
+#
  21
+#   The macro defines the symbol HAVE_LIBZ if the library is found. You
  22
+#   should use autoheader to include a definition for this symbol in a
  23
+#   config.h file. Sample usage in a C/C++ source is as follows:
  24
+#
  25
+#     #ifdef HAVE_LIBZ
  26
+#     #include <zlib.h>
  27
+#     #endif /* HAVE_LIBZ */
  28
+#
  29
+# LICENSE
  30
+#
  31
+#   Copyright (c) 2008 Loic Dachary <loic@senga.org>
  32
+#
  33
+#   This program is free software; you can redistribute it and/or modify it
  34
+#   under the terms of the GNU General Public License as published by the
  35
+#   Free Software Foundation; either version 2 of the License, or (at your
  36
+#   option) any later version.
  37
+#
  38
+#   This program is distributed in the hope that it will be useful, but
  39
+#   WITHOUT ANY WARRANTY; without even the implied warranty of
  40
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  41
+#   Public License for more details.
  42
+#
  43
+#   You should have received a copy of the GNU General Public License along
  44
+#   with this program. If not, see <http://www.gnu.org/licenses/>.
  45
+#
  46
+#   As a special exception, the respective Autoconf Macro's copyright owner
  47
+#   gives unlimited permission to copy, distribute and modify the configure
  48
+#   scripts that are the output of Autoconf when processing the Macro. You
  49
+#   need not follow the terms of the GNU General Public License when using
  50
+#   or distributing such scripts, even though portions of the text of the
  51
+#   Macro appear in them. The GNU General Public License (GPL) does govern
  52
+#   all other use of the material that constitutes the Autoconf Macro.
  53
+#
  54
+#   This special exception to the GPL applies to versions of the Autoconf
  55
+#   Macro released by the Autoconf Archive. When you make and distribute a
  56
+#   modified version of the Autoconf Macro, you may extend this special
  57
+#   exception to the GPL to apply to your modified version as well.
  58
+
  59
+#serial 7
  60
+
  61
+AU_ALIAS([CHECK_ZLIB], [AX_CHECK_ZLIB])
  62
+AC_DEFUN([AX_CHECK_ZLIB],
  63
+#
  64
+# Handle user hints
  65
+#
  66
+[AC_MSG_CHECKING(if zlib is wanted)
  67
+AC_ARG_WITH(zlib,
  68
+[  --with-zlib=DIR root directory path of zlib installation [defaults to
  69
+                    /usr/local or /usr if not found in /usr/local]
  70
+  --without-zlib to disable zlib usage completely],
  71
+[if test "$withval" != no ; then
  72
+  AC_MSG_RESULT(yes)
  73
+  if test -d "$withval"
  74
+  then
  75
+    ZLIB_HOME="$withval"
  76
+  else
  77
+    AC_MSG_WARN([Sorry, $withval does not exist, checking usual places])
  78
+  fi
  79
+else
  80
+  AC_MSG_RESULT(no)
  81
+fi],
  82
+[AC_MSG_RESULT(yes)])
  83
+
  84
+if test ! $ZLIB_HOME
  85
+then
  86
+        ZLIB_HOME=/usr/local
  87
+fi
  88
+
  89
+if test ! -f "${ZLIB_HOME}/include/zlib.h"
  90
+then
  91
+        ZLIB_HOME=/usr
  92
+fi
  93
+
  94
+#
  95
+# Locate zlib, if wanted
  96
+#
  97
+if test -n "${ZLIB_HOME}"
  98
+then
  99
+        ZLIB_OLD_LDFLAGS=$LDFLAGS
  100
+        ZLIB_OLD_CPPFLAGS=$LDFLAGS
  101
+        LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib"
  102
+        CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include"
  103
+        AC_LANG_SAVE
  104
+        AC_LANG_C
  105
+        AC_CHECK_LIB(z, inflateEnd, [zlib_cv_libz=yes], [zlib_cv_libz=no])
  106
+        AC_CHECK_HEADER(zlib.h, [zlib_cv_zlib_h=yes], [zlib_cv_zlib_h=no])
  107
+        AC_LANG_RESTORE
  108
+        if test "$zlib_cv_libz" = "yes" -a "$zlib_cv_zlib_h" = "yes"
  109
+        then
  110
+                #
  111
+                # If both library and header were found, use them
  112
+                #
  113
+                AC_CHECK_LIB(z, inflateEnd)
  114
+                AC_MSG_CHECKING(zlib in ${ZLIB_HOME})
  115
+                AC_MSG_RESULT(ok)
  116
+        else
  117
+                #
  118
+                # If either header or library was not found, revert and bomb
  119
+                #
  120
+                AC_MSG_CHECKING(zlib in ${ZLIB_HOME})
  121
+                LDFLAGS="$ZLIB_OLD_LDFLAGS"
  122
+                CPPFLAGS="$ZLIB_OLD_CPPFLAGS"
  123
+                AC_MSG_RESULT(failed)
  124
+                AC_MSG_ERROR(either specify a valid zlib installation with --with-zlib=DIR or disable zlib usage with --without-zlib)
  125
+        fi
  126
+fi
  127
+
  128
+])
40  build/auto/m4/ax_lib_socket_nsl.m4
... ...
@@ -0,0 +1,40 @@
  1
+# ===========================================================================
  2
+#     http://www.gnu.org/software/autoconf-archive/ax_lib_socket_nsl.html
  3
+# ===========================================================================
  4
+#
  5
+# SYNOPSIS
  6
+#
  7
+#   AX_LIB_SOCKET_NSL
  8
+#
  9
+# DESCRIPTION
  10
+#
  11
+#   This macro figures out what libraries are required on this platform to
  12
+#   link sockets programs.
  13
+#
  14
+#   The common cases are not to need any extra libraries, or to need
  15
+#   -lsocket and -lnsl. We need to avoid linking with libnsl unless we need
  16
+#   it, though, since on some OSes where it isn't necessary it will totally
  17
+#   break networking. Unisys also includes gethostbyname() in libsocket but
  18
+#   needs libnsl for socket().
  19
+#
  20
+# LICENSE
  21
+#
  22
+#   Copyright (c) 2008 Russ Allbery <rra@stanford.edu>
  23
+#   Copyright (c) 2008 Stepan Kasal <kasal@ucw.cz>
  24
+#   Copyright (c) 2008 Warren Young <warren@etr-usa.com>
  25
+#
  26
+#   Copying and distribution of this file, with or without modification, are
  27
+#   permitted in any medium without royalty provided the copyright notice
  28
+#   and this notice are preserved. This file is offered as-is, without any
  29
+#   warranty.
  30
+
  31
+#serial 6
  32
+
  33
+AU_ALIAS([LIB_SOCKET_NSL], [AX_LIB_SOCKET_NSL])
  34
+AC_DEFUN([AX_LIB_SOCKET_NSL],
  35
+[
  36
+	AC_SEARCH_LIBS([gethostbyname], [nsl])
  37
+	AC_SEARCH_LIBS([socket], [socket], [], [
  38
+		AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
  39
+		[], [-lnsl])])
  40
+])
90  build/auto/m4/ax_path_lib_pcre.m4
... ...
@@ -0,0 +1,90 @@
  1
+# ===========================================================================
  2
+#     http://www.gnu.org/software/autoconf-archive/ax_path_lib_pcre.html
  3
+# ===========================================================================
  4
+#
  5
+# SYNOPSIS
  6
+#
  7
+#   AX_PATH_LIB_PCRE [(A/NA)]
  8
+#
  9
+# DESCRIPTION
  10
+#
  11
+#   check for pcre lib and set PCRE_LIBS and PCRE_CFLAGS accordingly.
  12
+#
  13
+#   also provide --with-pcre option that may point to the $prefix of the
  14
+#   pcre installation - the macro will check $pcre/include and $pcre/lib to
  15
+#   contain the necessary files.
  16
+#
  17
+#   the usual two ACTION-IF-FOUND / ACTION-IF-NOT-FOUND are supported and
  18
+#   they can take advantage of the LIBS/CFLAGS additions.
  19
+#
  20
+# LICENSE
  21
+#
  22
+#   Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
  23
+#
  24
+#   This program is free software; you can redistribute it and/or modify it
  25
+#   under the terms of the GNU General Public License as published by the
  26
+#   Free Software Foundation; either version 3 of the License, or (at your
  27
+#   option) any later version.
  28
+#
  29
+#   This program is distributed in the hope that it will be useful, but
  30
+#   WITHOUT ANY WARRANTY; without even the implied warranty of
  31
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  32
+#   Public License for more details.
  33
+#
  34
+#   You should have received a copy of the GNU General Public License along
  35
+#   with this program. If not, see <http://www.gnu.org/licenses/>.
  36
+#
  37
+#   As a special exception, the respective Autoconf Macro's copyright owner
  38
+#   gives unlimited permission to copy, distribute and modify the configure
  39
+#   scripts that are the output of Autoconf when processing the Macro. You
  40
+#   need not follow the terms of the GNU General Public License when using
  41
+#   or distributing such scripts, even though portions of the text of the
  42
+#   Macro appear in them. The GNU General Public License (GPL) does govern
  43
+#   all other use of the material that constitutes the Autoconf Macro.
  44
+#
  45
+#   This special exception to the GPL applies to versions of the Autoconf
  46
+#   Macro released by the Autoconf Archive. When you make and distribute a
  47
+#   modified version of the Autoconf Macro, you may extend this special
  48
+#   exception to the GPL to apply to your modified version as well.
  49
+
  50
+#serial 7
  51
+
  52
+AC_DEFUN([AX_PATH_LIB_PCRE],[dnl
  53
+AC_MSG_CHECKING([lib pcre])
  54
+AC_ARG_WITH(pcre,
  55
+[  --with-pcre[[=prefix]]    compile xmlpcre part (via libpcre check)],,
  56
+     with_pcre="yes")
  57
+if test ".$with_pcre" = ".no" ; then
  58
+  AC_MSG_RESULT([disabled])
  59
+  m4_ifval($2,$2)
  60
+else
  61
+  AC_MSG_RESULT([(testing)])
  62
+  AC_CHECK_LIB(pcre, pcre_study)
  63
+  if test "$ac_cv_lib_pcre_pcre_study" = "yes" ; then
  64
+     PCRE_LIBS="-lpcre"
  65
+     AC_MSG_CHECKING([lib pcre])
  66
+     AC_MSG_RESULT([$PCRE_LIBS])
  67
+     m4_ifval($1,$1)
  68
+  else
  69
+     OLDLDFLAGS="$LDFLAGS" ; LDFLAGS="$LDFLAGS -L$with_pcre/lib"
  70
+     OLDCPPFLAGS="$CPPFLAGS" ; CPPFLAGS="$CPPFLAGS -I$with_pcre/include"
  71
+     AC_CHECK_LIB(pcre, pcre_compile)
  72
+     CPPFLAGS="$OLDCPPFLAGS"
  73
+     LDFLAGS="$OLDLDFLAGS"
  74
+     if test "$ac_cv_lib_pcre_pcre_compile" = "yes" ; then
  75
+        AC_MSG_RESULT(.setting PCRE_LIBS -L$with_pcre/lib -lpcre)
  76
+        PCRE_LIBS="-L$with_pcre/lib -lpcre"
  77
+        test -d "$with_pcre/include" && PCRE_CFLAGS="-I$with_pcre/include"
  78
+        AC_MSG_CHECKING([lib pcre])
  79
+        AC_MSG_RESULT([$PCRE_LIBS])
  80
+        m4_ifval($1,$1)
  81
+     else
  82
+        AC_MSG_CHECKING([lib pcre])
  83
+        AC_MSG_RESULT([no, (WARNING)])
  84
+        m4_ifval($2,$2)
  85
+     fi
  86
+  fi
  87
+fi
  88
+AC_SUBST([PCRE_LIBS])
  89
+AC_SUBST([PCRE_CFLAGS])
  90
+])
283  build/auto/m4/ax_pthread.m4
... ...
@@ -0,0 +1,283 @@
  1
+# ===========================================================================
  2
+#        http://www.gnu.org/software/autoconf-archive/ax_pthread.html
  3
+# ===========================================================================
  4
+#
  5
+# SYNOPSIS
  6
+#
  7
+#   AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
  8
+#
  9
+# DESCRIPTION
  10
+#
  11
+#   This macro figures out how to build C programs using POSIX threads. It
  12
+#   sets the PTHREAD_LIBS output variable to the threads library and linker
  13
+#   flags, and the PTHREAD_CFLAGS output variable to any special C compiler
  14
+#   flags that are needed. (The user can also force certain compiler
  15
+#   flags/libs to be tested by setting these environment variables.)
  16
+#
  17
+#   Also sets PTHREAD_CC to any special C compiler that is needed for
  18
+#   multi-threaded programs (defaults to the value of CC otherwise). (This
  19
+#   is necessary on AIX to use the special cc_r compiler alias.)
  20
+#
  21
+#   NOTE: You are assumed to not only compile your program with these flags,
  22
+#   but also link it with them as well. e.g. you should link with
  23
+#   $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
  24
+#
  25
+#   If you are only building threads programs, you may wish to use these
  26
+#   variables in your default LIBS, CFLAGS, and CC:
  27
+#
  28
+#     LIBS="$PTHREAD_LIBS $LIBS"
  29
+#     CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
  30
+#     CC="$PTHREAD_CC"
  31
+#
  32
+#   In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
  33
+#   has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
  34
+#   (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
  35
+#
  36
+#   ACTION-IF-FOUND is a list of shell commands to run if a threads library
  37
+#   is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
  38
+#   is not found. If ACTION-IF-FOUND is not specified, the default action
  39
+#   will define HAVE_PTHREAD.
  40
+#
  41
+#   Please let the authors know if this macro fails on any platform, or if
  42
+#   you have any other suggestions or comments. This macro was based on work
  43
+#   by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
  44
+#   from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
  45
+#   Alejandro Forero Cuervo to the autoconf macro repository. We are also
  46
+#   grateful for the helpful feedback of numerous users.
  47
+#
  48
+# LICENSE
  49
+#
  50
+#   Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
  51
+#
  52
+#   This program is free software: you can redistribute it and/or modify it
  53
+#   under the terms of the GNU General Public License as published by the
  54
+#   Free Software Foundation, either version 3 of the License, or (at your
  55
+#   option) any later version.
  56
+#
  57
+#   This program is distributed in the hope that it will be useful, but
  58
+#   WITHOUT ANY WARRANTY; without even the implied warranty of
  59
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  60
+#   Public License for more details.
  61
+#
  62
+#   You should have received a copy of the GNU General Public License along
  63
+#   with this program. If not, see <http://www.gnu.org/licenses/>.
  64
+#
  65
+#   As a special exception, the respective Autoconf Macro's copyright owner
  66
+#   gives unlimited permission to copy, distribute and modify the configure
  67
+#   scripts that are the output of Autoconf when processing the Macro. You
  68
+#   need not follow the terms of the GNU General Public License when using
  69
+#   or distributing such scripts, even though portions of the text of the
  70
+#   Macro appear in them. The GNU General Public License (GPL) does govern
  71
+#   all other use of the material that constitutes the Autoconf Macro.
  72
+#
  73
+#   This special exception to the GPL applies to versions of the Autoconf
  74
+#   Macro released by the Autoconf Archive. When you make and distribute a
  75
+#   modified version of the Autoconf Macro, you may extend this special
  76
+#   exception to the GPL to apply to your modified version as well.
  77
+
  78
+#serial 11
  79
+
  80
+AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
  81
+AC_DEFUN([AX_PTHREAD], [
  82
+AC_REQUIRE([AC_CANONICAL_HOST])
  83
+AC_LANG_SAVE
  84
+AC_LANG_C
  85
+ax_pthread_ok=no
  86
+
  87
+# We used to check for pthread.h first, but this fails if pthread.h
  88
+# requires special compiler flags (e.g. on True64 or Sequent).
  89
+# It gets checked for in the link test anyway.
  90
+
  91
+# First of all, check if the user has set any of the PTHREAD_LIBS,
  92
+# etcetera environment variables, and if threads linking works using
  93
+# them:
  94
+if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
  95
+        save_CFLAGS="$CFLAGS"
  96
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
  97
+        save_LIBS="$LIBS"
  98
+        LIBS="$PTHREAD_LIBS $LIBS"
  99
+        AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
  100
+        AC_TRY_LINK_FUNC(pthread_join, ax_pthread_ok=yes)
  101
+        AC_MSG_RESULT($ax_pthread_ok)
  102
+        if test x"$ax_pthread_ok" = xno; then
  103
+                PTHREAD_LIBS=""
  104
+                PTHREAD_CFLAGS=""
  105
+        fi
  106
+        LIBS="$save_LIBS"
  107
+        CFLAGS="$save_CFLAGS"
  108
+fi
  109
+
  110
+# We must check for the threads library under a number of different
  111
+# names; the ordering is very important because some systems
  112
+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
  113
+# libraries is broken (non-POSIX).
  114
+
  115
+# Create a list of thread flags to try.  Items starting with a "-" are
  116
+# C compiler flags, and other items are library names, except for "none"
  117
+# which indicates that we try without any flags at all, and "pthread-config"
  118
+# which is a program returning the flags for the Pth emulation library.
  119
+
  120
+ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
  121
+
  122
+# The ordering *is* (sometimes) important.  Some notes on the
  123
+# individual items follow:
  124
+
  125
+# pthreads: AIX (must check this before -lpthread)
  126
+# none: in case threads are in libc; should be tried before -Kthread and
  127
+#       other compiler flags to prevent continual compiler warnings
  128
+# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
  129
+# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
  130
+# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
  131
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
  132
+# -pthreads: Solaris/gcc
  133
+# -mthreads: Mingw32/gcc, Lynx/gcc
  134
+# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
  135
+#      doesn't hurt to check since this sometimes defines pthreads too;
  136
+#      also defines -D_REENTRANT)
  137
+#      ... -mt is also the pthreads flag for HP/aCC
  138
+# pthread: Linux, etcetera
  139
+# --thread-safe: KAI C++
  140
+# pthread-config: use pthread-config program (for GNU Pth library)
  141
+
  142
+case "${host_cpu}-${host_os}" in
  143
+        *solaris*)
  144
+
  145
+        # On Solaris (at least, for some versions), libc contains stubbed
  146
+        # (non-functional) versions of the pthreads routines, so link-based
  147
+        # tests will erroneously succeed.  (We need to link with -pthreads/-mt/
  148
+        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
  149
+        # a function called by this macro, so we could check for that, but
  150
+        # who knows whether they'll stub that too in a future libc.)  So,
  151
+        # we'll just look for -pthreads and -lpthread first:
  152
+
  153
+        ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
  154
+        ;;
  155
+
  156
+	*-darwin*)
  157
+	ax_pthread_flags="-pthread $ax_pthread_flags"
  158
+	;;
  159
+esac
  160
+
  161
+if test x"$ax_pthread_ok" = xno; then
  162
+for flag in $ax_pthread_flags; do
  163
+
  164
+        case $flag in
  165
+                none)
  166
+                AC_MSG_CHECKING([whether pthreads work without any flags])
  167
+                ;;
  168
+
  169
+                -*)
  170
+                AC_MSG_CHECKING([whether pthreads work with $flag])
  171
+                PTHREAD_CFLAGS="$flag"
  172
+                ;;
  173
+
  174
+		pthread-config)
  175
+		AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no)
  176
+		if test x"$ax_pthread_config" = xno; then continue; fi
  177
+		PTHREAD_CFLAGS="`pthread-config --cflags`"
  178
+		PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
  179
+		;;
  180
+
  181
+                *)
  182
+                AC_MSG_CHECKING([for the pthreads library -l$flag])
  183
+                PTHREAD_LIBS="-l$flag"
  184
+                ;;
  185
+        esac
  186
+
  187
+        save_LIBS="$LIBS"
  188
+        save_CFLAGS="$CFLAGS"
  189
+        LIBS="$PTHREAD_LIBS $LIBS"
  190
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
  191
+
  192
+        # Check for various functions.  We must include pthread.h,
  193
+        # since some functions may be macros.  (On the Sequent, we
  194
+        # need a special flag -Kthread to make this header compile.)
  195
+        # We check for pthread_join because it is in -lpthread on IRIX
  196
+        # while pthread_create is in libc.  We check for pthread_attr_init
  197
+        # due to DEC craziness with -lpthreads.  We check for
  198
+        # pthread_cleanup_push because it is one of the few pthread
  199
+        # functions on Solaris that doesn't have a non-functional libc stub.
  200
+        # We try pthread_create on general principles.
  201
+        AC_TRY_LINK([#include <pthread.h>
  202
+		     static void routine(void* a) {a=0;}
  203
+		     static void* start_routine(void* a) {return a;}],
  204
+                    [pthread_t th; pthread_attr_t attr;
  205
+                     pthread_create(&th,0,start_routine,0);
  206
+                     pthread_join(th, 0);
  207
+                     pthread_attr_init(&attr);
  208
+                     pthread_cleanup_push(routine, 0);
  209
+                     pthread_cleanup_pop(0); ],
  210
+                    [ax_pthread_ok=yes])
  211
+
  212
+        LIBS="$save_LIBS"
  213
+        CFLAGS="$save_CFLAGS"
  214
+
  215
+        AC_MSG_RESULT($ax_pthread_ok)
  216
+        if test "x$ax_pthread_ok" = xyes; then
  217
+                break;
  218
+        fi
  219
+
  220
+        PTHREAD_LIBS=""
  221
+        PTHREAD_CFLAGS=""
  222
+done
  223
+fi
  224
+
  225
+# Various other checks:
  226
+if test "x$ax_pthread_ok" = xyes; then
  227
+        save_LIBS="$LIBS"
  228
+        LIBS="$PTHREAD_LIBS $LIBS"
  229
+        save_CFLAGS="$CFLAGS"
  230
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
  231
+
  232
+        # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
  233
+	AC_MSG_CHECKING([for joinable pthread attribute])
  234
+	attr_name=unknown
  235
+	for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
  236
+	    AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;],
  237
+                        [attr_name=$attr; break])
  238
+	done
  239
+        AC_MSG_RESULT($attr_name)
  240
+        if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
  241
+            AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
  242
+                               [Define to necessary symbol if this constant
  243
+                                uses a non-standard name on your system.])
  244
+        fi
  245
+
  246
+        AC_MSG_CHECKING([if more special flags are required for pthreads])
  247
+        flag=no
  248
+        case "${host_cpu}-${host_os}" in
  249
+            *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
  250
+            *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
  251
+        esac
  252
+        AC_MSG_RESULT(${flag})
  253
+        if test "x$flag" != xno; then
  254
+            PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
  255
+        fi
  256
+
  257
+        LIBS="$save_LIBS"
  258
+        CFLAGS="$save_CFLAGS"
  259
+
  260
+        # More AIX lossage: must compile with xlc_r or cc_r
  261
+	if test x"$GCC" != xyes; then
  262
+          AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
  263
+        else
  264
+          PTHREAD_CC=$CC
  265
+	fi
  266
+else
  267
+        PTHREAD_CC="$CC"
  268
+fi
  269
+
  270
+AC_SUBST(PTHREAD_LIBS)
  271
+AC_SUBST(PTHREAD_CFLAGS)
  272
+AC_SUBST(PTHREAD_CC)
  273
+
  274
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
  275
+if test x"$ax_pthread_ok" = xyes; then
  276
+        ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
  277
+        :
  278
+else
  279
+        ax_pthread_ok=no
  280
+        $2
  281
+fi
  282
+AC_LANG_RESTORE
  283
+])dnl AX_PTHREAD
102  configure.ac
... ...
@@ -0,0 +1,102 @@
  1
+# craftd configure.ac
  2
+AC_PREREQ([2.64])
  3
+
  4
+AC_INIT([craftd], [0.2-pre], [kevin.bowling@kev009.com])
  5
+
  6
+AC_CONFIG_AUX_DIR([build/auto/aux])
  7
+AM_INIT_AUTOMAKE([foreign -Wall -Werror dist-bzip2])
  8
+AC_CONFIG_MACRO_DIR([build/auto/m4])
  9
+
  10
+# Don't look for C++ or Fortran compilers
  11
+m4_undefine([AC_PROG_CXX])
  12
+m4_defun([AC_PROG_CXX],[])
  13
+m4_undefine([AC_PROG_F77])
  14
+m4_defun([AC_PROG_F77],[])
  15
+
  16
+AC_PROG_CC_C99
  17
+AC_USE_SYSTEM_EXTENSIONS
  18
+LT_PREREQ([2.2])
  19
+AM_PROG_LIBTOOL
  20
+AC_LTDL_DLLIB
  21
+AC_SUBST(LIBTOOL_DEPS)
  22
+LT_INIT([dlopen])
  23
+
  24
+AC_CONFIG_HEADERS([include/craftd/config.h])
  25
+AC_CONFIG_FILES([Makefile src/Makefile include/Makefile \
  26
+                 htdocs/Makefile])
  27
+AC_CONFIG_SRCDIR([src/craftd.c])
  28
+
  29
+# Checks for libraries.
  30
+AC_CHECK_LIB([ltdl], [lt_dlopen])
  31
+AX_LIB_SOCKET_NSL
  32
+AX_CHECK_ZLIB
  33
+AX_PTHREAD([], AC_MSG_ERROR([pthreads is required]))
  34
+AX_PATH_LIB_PCRE
  35
+
  36
+PKG_CHECK_MODULES([libevent2_pthreads], [libevent_pthreads >= 2.0.9],
  37
+, ,
  38
+AC_MSG_ERROR([System libevent2_pthreads not found.  Install it and specify the PKG_CONFIG_PATH. ]))
  39
+
  40
+PKG_CHECK_MODULES([jansson], [jansson >= 2.0],
  41
+, ,
  42
+AC_MSG_ERROR([System jansson not found. Install it and specify the PKG_CONFIG_PATH. ]))
  43
+
  44
+
  45
+# Establish default CFLAGS and pthread portability
  46
+AX_CFLAGS_WARN_ALL
  47
+CC="$PTHREAD_CC"
  48
+PTHREAD_LIBS="$PTHREAD_LIBS"
  49
+PTHREAD_CFLAGS="$PTHREAD_CFLAGS"
  50
+# Force pthread for everything?
  51
+#LIBS="$PTHREAD_LIBS $LIBS"
  52
+CFLAGS="$CFLAGS -Wno-unused-label"
  53
+#CC="$PTHREAD_CC"
  54
+
  55
+# Checks for header files.
  56
+AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h stdlib.h string.h \
  57
+                  sys/socket.h unistd.h endian.h sys/endian.h ltdl.h])
  58
+
  59
+AC_C_INLINE
  60
+case $ac_cv_c_inline in
  61
+    yes) json_inline=inline;;
  62
+    no) json_inline=;;
  63
+    *) json_inline=$ac_cv_c_inline;;
  64
+esac
  65
+AC_SUBST([json_inline])
  66
+
  67
+# Checks for typedefs, structures, and compiler characteristics.
  68
+AC_HEADER_STDBOOL
  69
+AC_TYPE_INT16_T
  70
+AC_TYPE_INT32_T
  71
+AC_TYPE_INT64_T
  72
+AC_TYPE_INT8_T
  73
+AC_TYPE_UINT64_T
  74
+AC_TYPE_UINT32_T
  75
+AC_TYPE_UINT16_T
  76
+AC_TYPE_UINT8_T
  77
+AC_TYPE_SIZE_T
  78
+AC_TYPE_INTPTR_T
  79
+AC_CHECK_SIZEOF([intptr_t])
  80
+AC_CHECK_SIZEOF([fp], [], [typedef void (*fp)();])
  81
+
  82
+AC_C_BIGENDIAN
  83
+AC_CHECK_DECLS([be64toh,htobe64], [], [],
  84
+[#ifdef HAVE_ENDIAN_H
  85
+#include <endian.h>
  86
+#endif
  87
+#ifdef HAVE_SYS_ENDIAN_H
  88
+#include <sys/endian.h>
  89
+#endif
  90
+])
  91
+
  92
+AC_CHECK_MEMBERS([struct sigaction.sa_handler], [], [],
  93
+[#include <signal.h>
  94
+])
  95
+
  96
+# Check if we need to reorder float and double types
  97
+AX_C_FLOAT_WORDS_BIGENDIAN
  98
+
  99
+# Checks for library functions.
  100
+AC_CHECK_FUNCS([socket])
  101
+
  102
+AC_OUTPUT
17  htdocs/Makefile.am
... ...
@@ -0,0 +1,17 @@
  1
+htdocsdir = $(datadir)/craftd/htdocs
  2
+dist_htdocs_DATA = LICENSES.txt
  3
+dist_noinst_DATA = js css images index.html schedule.html settings.html
  4
+dist_noinst_DATA += logs.html help.html players_blacklist.html players.html
  5
+
  6
+install-data-hook:
  7
+	if ! test -d $(htdocsdir); then \
  8
+		$(mkdir_p) $(htdocsdir); \
  9
+		for p in $(dist_noinst_DATA); do \
  10
+			if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
  11
+			echo "$$d$$p"; \
  12
+		done | $(am__base_list) | \
  13
+		while read files; do \
  14
+			echo " $(INSTALL_DATA) $$files '$(htdocsdir)'"; \
  15
+			$(INSTALL_DATA) $$files "$(htdocsdir)" || exit $$?; \
  16
+		done \
  17
+	fi
58  include/Makefile.am
... ...
@@ -0,0 +1,58 @@
  1
+# Add in lexicographic order:
  2
+#
  3
+# pkginclude_HEADERS =
  4
+# ls craftd/*.h | awk '{ print $1" \\" }' | sort
  5
+# truncate last \
  6
+#
  7
+pkginclude_HEADERS = craftd/Arithmetic.h \
  8
+		     craftd/Buffer.h \
  9
+		     craftd/Buffers.h \
  10
+		     craftd/Client.h \
  11
+		     craftd/common.h \
  12
+		     craftd/Config.h \
  13
+		     craftd/Console.h \
  14
+		     craftd/Dynamic.h \
  15
+		     craftd/Error.h \
  16
+		     craftd/Event.h \
  17
+		     craftd/Hash.h \
  18
+		     craftd/HTTPd.h \
  19
+		     craftd/javaendian.h \
  20
+		     craftd/Job.h \
  21
+		     craftd/List.h \
  22
+		     craftd/Logger.h \
  23
+		     craftd/Map.h \
  24
+		     craftd/memory.h \
  25
+		     craftd/Plugin.h \
  26
+		     craftd/Plugins.h \
  27
+		     craftd/Regexp.h \
  28
+		     craftd/ScriptingEngine.h \
  29
+		     craftd/ScriptingEngines.h \
  30
+		     craftd/Server.h \
  31
+		     craftd/Set.h \
  32
+		     craftd/String.h \
  33
+		     craftd/TimeLoop.h \
  34
+		     craftd/utils.h \
  35
+		     craftd/version.h \
  36
+		     craftd/Worker.h \
  37
+		     craftd/Workers.h
  38
+
  39
+# bstring headers
  40
+bstringdir = $(pkgincludedir)/bstring
  41
+bstring_HEADERS = craftd/bstring/bsafe.h \
  42
+		  craftd/bstring/bstraux.h \
  43
+		  craftd/bstring/bstrlib.h \
  44
+		  craftd/bstring/bstrwrap.h
  45
+
  46
+# klib headers
  47
+klibdir = $(pkgincludedir)/klib
  48
+klib_HEADERS = craftd/klib/kbtree.h \
  49
+	       craftd/klib/khash.h \
  50
+	       craftd/klib/khmm.h \
  51
+	       craftd/klib/klist.h \
  52
+	       craftd/klib/kmin.h \
  53
+	       craftd/klib/knetfile.h \
  54
+	       craftd/klib/knhx.h \
  55
+	       craftd/klib/kseq.h \
  56
+	       craftd/klib/ksort.h \
  57
+	       craftd/klib/kstring.h \
  58
+	       craftd/klib/kvec.h
1  include/bstring/bsafe.h
1  include/bstring/bstraux.h
1  include/bstring/bstrlib.h
1  include/bstring/bstrwrap.h
1  include/craftd
0  include/Arithmetic.h → include/craftd/Arithmetic.h
File renamed without changes
0  include/Buffer.h → include/craftd/Buffer.h
File renamed without changes
0  include/Buffers.h → include/craftd/Buffers.h
File renamed without changes
0  include/Client.h → include/craftd/Client.h
File renamed without changes
0  include/Config.h → include/craftd/Config.h
File renamed without changes
0  include/Console.h → include/craftd/Console.h
File renamed without changes
0  include/Dynamic.h → include/craftd/Dynamic.h
File renamed without changes
0  include/Error.h → include/craftd/Error.h
File renamed without changes
0  include/Event.h → include/craftd/Event.h
File renamed without changes
0  include/HTTPd.h → include/craftd/HTTPd.h
File renamed without changes
0  include/Hash.h → include/craftd/Hash.h
File renamed without changes
0  include/Job.h → include/craftd/Job.h
File renamed without changes
0  include/List.h → include/craftd/List.h
File renamed without changes
0 