-
Notifications
You must be signed in to change notification settings - Fork 5
/
configure.in
130 lines (115 loc) · 4.32 KB
/
configure.in
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
125
126
127
128
129
130
AC_INIT([mbuffer],[20141227])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_SRCDIR([mbuffer.c])
AC_CANONICAL_SYSTEM
AC_EXEEXT
if test "${LD_LIBRARY_PATH}" != "" ; then
echo ""
echo " WARNING: LD_LIBRARY_PATH is set. This can cause severe problems!!!"
echo " Please learn about using RUNPATH instead of LD_LIBRARY_PATH - e.g. here:"
echo " - http://prefetch.net/articles/linkers.badldlibrary.html"
echo " - http://blogs.sun.com/ali/entry/avoiding_ld_library_path_the"
echo " For gcc, you can pass LDFLAGS=\"-R/usr/local/lib\" to configure,"
echo " instead of setting LD_LIBRARY_PATH."
echo ""
sleep 5
fi
AC_PREFIX_DEFAULT(/usr/local)
test "$prefix" = NONE && prefix=/usr/local
test "$exec_prefix" = NONE && exec_prefix=$prefix
USRCFLAGS=${CFLAGS}
AC_LANG_C
AC_PROG_CC_C99
AC_PROG_CC(cc gcc)
AC_C_RESTRICT
AC_C_INLINE
if test "${USRCFLAGS}" = "" ; then
if test "${GCC}" = "yes" ; then
CFLAGS="${CFLAGS} -O2 -Wall"
cflags_tmp="${CFLAGS}"
CFLAGS="${CFLAGS} -m64"
AC_MSG_CHECKING([whether $CC supports $CFLAGS])
AC_RUN_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])]
CFLAGS="$cflags_tmp"
)
else
SUNCCVERSION=`${CC} -V 2>&1 | grep Sun`
SUNCC=$?
if test "${SUNCC}" == "0" ; then
CFLAGS="${CFLAGS} -O"
cflags_tmp="$CFLAGS"
HAS_M64=`${CC} -flags | grep m64`
if test "${HAS_M64}" != "" ; then
CFLAGS="${CFLAGS} -m64"
AC_MSG_CHECKING([whether $CC supports $CFLAGS])
AC_RUN_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])]
CFLAGS="$cflags_tmp"
)
else
CFLAGS="${CFLAGS} -xarch=generic64"
AC_MSG_CHECKING([whether $CC supports $CFLAGS])
AC_RUN_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])]
CFLAGS="$cflags_tmp"
)
fi
else
echo unknown cc
CFLAGS="${CFLAGS} -O"
fi
fi
fi
AC_SUBST(CFLAGS)
AC_PROG_INSTALL
AC_PATH_PROG(RM,rm)
AC_PATH_PROG(MT,mt,AC_MSG_WARN(could not find the program mt - you might need this if you want autoloader support))
AC_TYPE_SIGNAL
AC_SYS_LARGEFILE
AC_STRUCT_ST_BLKSIZE
AC_HEADER_ASSERT
AC_CHECK_LIB(pthread, pthread_mutex_init)
#AC_SEARCH_LIBS(clock_gettime,rt,,AC_MSG_ERROR(could not find the library containing clock_gettime!))
AC_SEARCH_LIBS(sem_init,rt posix,,AC_MSG_ERROR(could not find semaphore functions!))
AC_SEARCH_LIBS(rint,m,,AC_MSG_ERROR(unable to find rint))
AC_SEARCH_LIBS(seteuid,c,AC_DEFINE([HAVE_SETEUID], [1], [Define to 1 if you have the seteuid() function]),)
AC_SEARCH_LIBS(atoll,c,,AC_DEFINE([atoll],[atol],[Define to 1 if you do not have the atoll() function to use atol() instead]))
AC_SEARCH_LIBS(hstrerror,resolv socket nsl,AC_DEFINE([HAVE_HSTRERROR], [1], [Define to 1 if you have the hstrerror() function]),)
AC_SEARCH_LIBS(getaddrinfo,resolv socket nsl,AC_DEFINE([HAVE_GETADDRINFO], [1], [Define to 1 if you have the getaddrinfo() function]),)
AC_SEARCH_LIBS(socket,socket,,AC_MSG_ERROR(could not find the library containing network functions!))
AC_SEARCH_LIBS(gethostbyname,nsl,,AC_MSG_ERROR(could not find the library containing name convertion functions!))
AC_SEARCH_LIBS(sendfile,sendfile,AC_DEFINE([HAVE_SENDFILE],[1],[libsendfile is available]),)
AC_CHECK_HEADER(sys/sendfile.h,AC_DEFINE([HAVE_SENDFILE_H],[1],[sendfile in sendfile.h]),)
AC_FUNC_ALLOCA
AC_ARG_ENABLE(debug,
[ --disable-debug disable verbose logging to console for debugging purpose],
,enable_debug=yes
)
if test x$enable_debug = xyes ; then
AC_DEFINE([DEBUG], [1], [Define to 1 to build in debugging mode])
fi
AC_ARG_ENABLE(md5,
[ --disable-md5 disable md5 hash generation],
,enable_md5=auto
)
if test x$enable_md5 != xno ; then
AC_SEARCH_LIBS(mhash_init,mhash,AC_DEFINE([HAVE_LIBMHASH], [1], [Define to 1 if you have the mhash library]),
AC_SEARCH_LIBS(MD5Init,md5,AC_DEFINE([HAVE_LIBMD5], [1], [Define to 1 if you have the md5 library]),
AC_SEARCH_LIBS(MD5_Init,crypto,AC_DEFINE([HAVE_LIBCRYPTO], [1], [Define to 1 if you have the OpenSSL crypto library]),
if test x$enable_md5 = xauto ; then
AC_MSG_WARN(could not find a library containing the md5 hash functions - md5 support disabled)
else
AC_MSG_ERROR(could not find the mhash library)
fi
)))
fi
AC_SUBST(DEBUG)
AC_SUBST(prefix)
AC_SUBST(AUTOCONF)
AC_DEFINE(_REENTRANT,1,Needed for thread safe compilation)
AC_OUTPUT(Makefile mbuffer.1)
# vim:tw=0