modified: makefile
[GalaxyCodeBases.git] / c_cpp / etc / mbuffer / configure.in
blobf7f01f9dce54551a071377499c190f74d0c9e5a0
1 AC_INIT([mbuffer],[20150412])
2 AC_CONFIG_HEADER([config.h])
3 AC_CONFIG_SRCDIR([mbuffer.c])
5 AC_CANONICAL_SYSTEM
6 AC_EXEEXT
8 if test "${LD_LIBRARY_PATH}" != "" ; then
9         echo ""
10         echo "    WARNING: LD_LIBRARY_PATH is set. This can cause severe problems!!!"
11         echo "    Please learn about using RUNPATH instead of LD_LIBRARY_PATH - e.g. here:"
12         echo "    - http://prefetch.net/articles/linkers.badldlibrary.html"
13         echo "    - http://blogs.sun.com/ali/entry/avoiding_ld_library_path_the"
14         echo "    For gcc, you can pass LDFLAGS=\"-R/usr/local/lib\" to configure,"
15         echo "    instead of setting LD_LIBRARY_PATH."
16         echo ""
17         sleep 5
20 AC_PREFIX_DEFAULT(/usr/local)
21 test "$prefix" = NONE && prefix=/usr/local
22 test "$exec_prefix" = NONE && exec_prefix=$prefix
24 USRCFLAGS=${CFLAGS}
26 AC_LANG_C
27 AC_PROG_CC_C99
28 AC_PROG_CC(cc gcc)
29 AC_C_RESTRICT
30 AC_C_INLINE
32 if test "${USRCFLAGS}" = "" ; then
33         if test "${GCC}" = "yes" ; then
34                 CFLAGS="${CFLAGS} -O2 -Wall"
35                 cflags_tmp="${CFLAGS}"
36                 CFLAGS="${CFLAGS} -m64"
37                 AC_MSG_CHECKING([whether $CC supports $CFLAGS])
38                 AC_RUN_IFELSE([AC_LANG_PROGRAM([])],
39                         [AC_MSG_RESULT([yes])],
40                         [AC_MSG_RESULT([no])]
41                         CFLAGS="$cflags_tmp"
42                 )
43         else
44                 SUNCCVERSION=`${CC} -V 2>&1 | grep Sun`
45                 SUNCC=$?
46                 if test "${SUNCC}" == "0" ; then
47                         CFLAGS="${CFLAGS} -O"
48                         cflags_tmp="$CFLAGS"
49                         HAS_M64=`${CC} -flags | grep m64`
50                         if test "${HAS_M64}" != "" ; then
51                                 CFLAGS="${CFLAGS} -m64"
52                                 AC_MSG_CHECKING([whether $CC supports $CFLAGS])
53                                 AC_RUN_IFELSE([AC_LANG_PROGRAM([])],
54                                         [AC_MSG_RESULT([yes])],
55                                         [AC_MSG_RESULT([no])]
56                                         CFLAGS="$cflags_tmp"
57                                 )
58                         else
59                                 CFLAGS="${CFLAGS} -xarch=generic64"
60                                 AC_MSG_CHECKING([whether $CC supports $CFLAGS])
61                                 AC_RUN_IFELSE([AC_LANG_PROGRAM([])],
62                                         [AC_MSG_RESULT([yes])],
63                                         [AC_MSG_RESULT([no])]
64                                         CFLAGS="$cflags_tmp"
65                                 )
66                         fi
67                 else
68                         echo unknown cc
69                         CFLAGS="${CFLAGS} -O"
70                 fi
71         fi
74 AC_SUBST(CFLAGS)
76 AC_PROG_INSTALL
77 AC_PATH_PROG(RM,rm)
78 AC_PATH_PROG(MT,mt,AC_MSG_WARN(could not find the program mt - you might need this if you want autoloader support))
79 AC_TYPE_SIGNAL
80 AC_SYS_LARGEFILE
81 AC_STRUCT_ST_BLKSIZE
83 AC_HEADER_ASSERT
84 AC_CHECK_LIB(pthread, pthread_mutex_init)
85 AC_SEARCH_LIBS(clock_gettime,rt,,AC_MSG_ERROR(could not find the library containing clock_gettime!))
86 AC_SEARCH_LIBS(sem_init,rt posix,,AC_MSG_ERROR(could not find semaphore functions!))
87 AC_SEARCH_LIBS(rint,m,,AC_MSG_ERROR(unable to find rint))
88 AC_SEARCH_LIBS(seteuid,c,AC_DEFINE([HAVE_SETEUID], [1], [Define to 1 if you have the seteuid() function]),)
89 AC_SEARCH_LIBS(atoll,c,,AC_DEFINE([atoll],[atol],[Define to 1 if you do not have the atoll() function to use atol() instead]))
90 AC_SEARCH_LIBS(hstrerror,resolv socket nsl,AC_DEFINE([HAVE_HSTRERROR], [1], [Define to 1 if you have the hstrerror() function]),)
91 AC_SEARCH_LIBS(getaddrinfo,resolv socket nsl,AC_DEFINE([HAVE_GETADDRINFO], [1], [Define to 1 if you have the getaddrinfo() function]),)
92 AC_SEARCH_LIBS(socket,socket,,AC_MSG_ERROR(could not find the library containing network functions!))
93 AC_SEARCH_LIBS(gethostbyname,nsl,,AC_MSG_ERROR(could not find the library containing name convertion functions!))
94 AC_SEARCH_LIBS(sendfile,sendfile,AC_DEFINE([HAVE_SENDFILE],[1],[libsendfile is available]),)
95 AC_CHECK_HEADER(sys/sendfile.h,AC_DEFINE([HAVE_SENDFILE_H],[1],[sendfile in sendfile.h]),)
96 AC_FUNC_ALLOCA
99 AC_ARG_ENABLE(debug,
100         [  --disable-debug         disable verbose logging to console for debugging purpose],
101         ,enable_debug=yes
102         )
103 if test x$enable_debug = xyes ; then
104         AC_DEFINE([DEBUG], [1], [Define to 1 to build in debugging mode])
107 AC_ARG_ENABLE(md5,
108         [  --disable-md5           disable md5 hash generation],
109         ,enable_md5=auto
110         )
111 if test x$enable_md5 != xno ; then
112         AC_SEARCH_LIBS(mhash_init,mhash,AC_DEFINE([HAVE_LIBMHASH], [1], [Define to 1 if you have the mhash library]),
113         AC_SEARCH_LIBS(MD5Init,md5,AC_DEFINE([HAVE_LIBMD5], [1], [Define to 1 if you have the md5 library]),
114         AC_SEARCH_LIBS(MD5_Init,crypto,AC_DEFINE([HAVE_LIBCRYPTO], [1], [Define to 1 if you have the OpenSSL crypto library]),
115                 if test x$enable_md5 = xauto ; then
116                         AC_MSG_WARN(could not find a library containing the md5 hash functions - md5 support disabled)
117                 else
118                         AC_MSG_ERROR(could not find the mhash library)
119                 fi
120         )))
123 AC_SUBST(DEBUG)
124 AC_SUBST(prefix)
125 AC_SUBST(AUTOCONF)
126 AC_DEFINE(_REENTRANT,1,Needed for thread safe compilation)
128 AC_OUTPUT(Makefile mbuffer.1)
130 # vim:tw=0