summaryrefslogtreecommitdiff
path: root/configure.in
blob: f12be3091922d9e6ab1d64be584d51f2c14f1432 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
dnl
dnl Copyright (c) 2004, Nate Nielsen
dnl All rights reserved.
dnl
dnl Redistribution and use in source and binary forms, with or without
dnl modification, are permitted provided that the following conditions
dnl are met:
dnl
dnl     * Redistributions of source code must retain the above
dnl       copyright notice, this list of conditions and the
dnl       following disclaimer.
dnl     * Redistributions in binary form must reproduce the
dnl       above copyright notice, this list of conditions and
dnl       the following disclaimer in the documentation and/or
dnl       other materials provided with the distribution.
dnl     * The names of contributors to this software may not be
dnl       used to endorse or promote products derived from this
dnl       software without specific prior written permission.
dnl
dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
dnl "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
dnl LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
dnl FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
dnl COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
dnl INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
dnl BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
dnl OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
dnl AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
dnl OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
dnl THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
dnl DAMAGE.
dnl
dnl
dnl CONTRIBUTORS
dnl  Nate Nielsen <nielsen@memberwebs.com>
dnl

AC_INIT(rep, 2.3.2e, nielsen@memberwebs.com)
AM_INIT_AUTOMAKE(rep, 2.3.2e)

CFLAGS="$CFLAGS -I/usr/local/include"
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
LDFLAGS="$LDFLAGS -L/usr/local/lib"

AC_CONFIG_SRCDIR([src/rep.c])
AM_CONFIG_HEADER([config.h])

# Checks for programs.
AC_PROG_CC
AC_PROG_LIBTOOL
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_AWK

# Debug mode
AC_ARG_ENABLE(debug,
        AC_HELP_STRING([--enable-debug],
        [Compile binaries in debug mode]))

if test "$enable_debug" = "yes"; then
  CFLAGS="$CFLAGS -g -O0 -Wall"
  AC_DEFINE_UNQUOTED(_DEBUG, 1, [In debug mode])
  echo "enabling debug compile mode"
fi

# The maximum buffer size
AC_ARG_ENABLE(BUF,
	    AC_HELP_STRING([--max-buf=SIZE],
	    [maximum match buffer size (default 15 MB)]),
	    ac_max_buff=$enableval,
	    ac_max_buff=15728640)

AC_DEFINE_UNQUOTED(MAX_BUFF, $ac_max_buff, [The maximum match buffer size])

# Check for libraries
AC_CHECK_LIB(pcre, pcre_compile, ,
	     [echo "ERROR: Must install PCRE libraries."; exit 1])

# Checks for header files.
AC_FUNC_ALLOCA
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS([memory.h stddef.h stdlib.h string.h stdarg.h], ,
		[echo "ERROR: Required header missing"; exit 1])
AC_CHECK_HEADERS([unistd.h err.h])

AC_CHECK_HEADERS([pcre.h], [ AC_DEFINE_UNQUOTED([PCRE_H], ["pcre.h"], [PCRE header path]) ],
    [ AC_CHECK_HEADERS([pcre/pcre.h],
         [ AC_DEFINE([PCRE_H], ["pcre/pcre.h"], [PCRE header path]) ],
         [echo "ERROR: Required PCRE header missing"; exit 1])
    ])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_CHECK_TYPES([bool, byte, uint])

# Checks for library functions.
AC_FUNC_FNMATCH
AC_FUNC_MALLOC
AC_FUNC_STAT
AC_FUNC_VPRINTF

# Required Functions
AC_CHECK_FUNCS([bzero chdir getcwd memmove memset strchr strcspn strerror strrchr strspn malloc realloc stat], ,
	       [echo "ERROR: Required function missing"; exit 1])
AC_CHECK_FUNCS([strcasestr strlcpy strncpy strcpy strlcat strncat strcat strdup strndup stricmp strnicmp strcasecmp strncasecmp tolower])
AC_CHECK_FUNCS([getopt vasprintf vsnprintf reallocf])

# DMALLOC memory debugging
AC_ARG_ENABLE(dmalloc,
	    AC_HELP_STRING([--with-dmalloc],
	    [malloc memory debugging (default: no)]))

if test "$enable_dmalloc" = "yes"; then
  AC_DEFINE_UNQUOTED(WITH_DMALLOC, 1, [malloc memory debugging])
  LIBS="${LIBS} -ldmalloc"
  echo "enabling dmalloc memory debugging"
fi

AC_CONFIG_FILES([Makefile lib/Makefile src/Makefile common/Makefile doc/Makefile
		 win32/Makefile win32/common/Makefile win32/droplet/Makefile win32/makedrop/Makefile])
AC_OUTPUT