-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathconfigure.ac
109 lines (96 loc) · 2.56 KB
/
configure.ac
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
AC_INIT([qstat], m4_esyscmd([./scripts/version.sh | tr -d '\n']),[https://github.com/multiplay/qstat/issues])
AC_CONFIG_SRCDIR([qstat.c])
AM_CONFIG_HEADER([gnuconfig.h])
AC_PREREQ(2.53)
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([1.6 foreign])
dnl Checks for programs.
AC_PROG_CC
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADER(sys/mman.h, [have_mman_h=yes])
case $host in
*mingw32*)
AC_MSG_NOTICE([compiling for $host, adding -lwsock32])
LIBS="$LIBS -lwsock32"
;;
esac
AC_CHECK_FUNCS([strndup], [HAVE_STRNDUP=yes], [HAVE_STRNDUP=no])
AM_CONDITIONAL(NEED_STRNDUP, [test x$HAVE_STRNDUP = xno])
dnl Check for strnstr including broken one on MacOSX 10.4 which crashes
dnl
AC_CACHE_CHECK(for strnstr, ac_cv_func_strnstr,
AC_TRY_RUN([
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
// we expect this to succeed, or crash on over-run.
// if it passes otherwise we may need a better check.
int main(int argc, char **argv)
{
int size = 20;
char *str = malloc(size);
memset(str, 'x', size);
strnstr(str, "fubar", size);
return 0;
}
],ac_cv_func_strnstr="yes",ac_cv_func_strnstr="no")
)
if test "$ac_cv_func_strnstr" = "yes" ; then
AC_DEFINE(HAVE_STRNSTR,1,[Working strnstr])
else
AC_DEFINE(HAVE_STRNSTR,0,[No or broken strnstr])
fi
dnl check if user wants debug
AC_MSG_CHECKING([whether to enable optimization])
AC_ARG_ENABLE(optimize,[ --disable-optimize turn off optimization])
if test x$enable_optimize != xno; then
AC_MSG_RESULT([yes])
else
CPPFLAGS=""
CFLAGS="-ggdb"
AC_MSG_RESULT([no])
fi
dnl check if user wants debug
AC_MSG_CHECKING([whether to enable debug output])
AC_ARG_ENABLE(debug,[ --disable-debug turn off debugging code])
if test x$enable_debug != xno; then
CPPFLAGS="$CPPFLAGS -DDEBUG"
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
AC_MSG_CHECKING([whether to enable packet dumps])
AC_ARG_ENABLE(dump,[ --enable-dump enable packet dumps])
if test x$enable_dump != xno; then
if test x$have_mman_h = xyes; then
CPPFLAGS="$CPPFLAGS -DENABLE_DUMP"
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no, sys/mman.h missing])
fi
else
AC_MSG_RESULT([no])
fi
AC_ARG_WITH(efence,
[ --with-efence=<path> Use electric fence for malloc debugging.],
if test x$withval != xyes ; then
LDFLAGS="${LDFLAGS} -L$withval"
fi
AC_CHECK_LIB(efence,malloc)
)
dnl Use -Wall if we have gcc.
changequote(,)dnl
if test "x$GCC" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-Wall[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wall" ;;
esac
fi
changequote([,])dnl
AC_CONFIG_FILES([
Makefile
template/Makefile
info/Makefile
])
AC_OUTPUT