aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac142
1 files changed, 112 insertions, 30 deletions
diff --git a/configure.ac b/configure.ac
index dd2b14d3..361917a4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -81,19 +81,36 @@ AC_SUBST([PACKAGE_VERSION_MINOR])
81AC_SUBST([PACKAGE_VERSION_SUBMINOR]) 81AC_SUBST([PACKAGE_VERSION_SUBMINOR])
82AC_CONFIG_FILES([src/microhttpd/microhttpd_dll_res.rc]) 82AC_CONFIG_FILES([src/microhttpd/microhttpd_dll_res.rc])
83 83
84AX_PTHREAD(,[AC_MSG_ERROR([[Compiling libmicrohttpd requires pthread support]])]) 84MHD_LIB_CPPFLAGS=""
85CC="$PTHREAD_CC" 85MHD_LIB_CFLAGS=""
86 86MHD_LIB_LDFLAGS=""
87# set GCC options 87MHD_LIBDEPS=""
88# use '-fno-strict-aliasing', but only if the compiler can take it
89AX_APPEND_COMPILE_FLAGS([[-fno-strict-aliasing]])
90
91AC_C_BIGENDIAN
92 88
93AC_CHECK_PROG([HAVE_CURL_BINARY],[curl],[yes],[no]) 89AC_ARG_WITH([threads],
94AM_CONDITIONAL([HAVE_CURL_BINARY],[test "x$HAVE_CURL_BINARY" = "xyes"]) 90 [AC_HELP_STRING([--with-threads=LIB],[choose threading library (posix, w32, auto) [auto]])],
95AC_CHECK_PROG([HAVE_MAKEINFO_BINARY],[makeinfo],[yes],[no]) 91 [], [with_threads='auto'])
96AM_CONDITIONAL([HAVE_MAKEINFO_BINARY],[test "x$HAVE_MAKEINFO_BINARY" = "xyes"]) 92test "x$with_threads" = "xwin32" && with_threads='w32'
93test "x$with_threads" = "xpthreads" && with_threads='posix'
94
95# Check for posix threads support
96AX_PTHREAD([HAVE_POSIX_THREADS='yes'],[HAVE_POSIX_THREADS='no'])
97AM_CONDITIONAL([HAVE_POSIX_THREADS],[test "x$HAVE_POSIX_THREADS" = "xyes"])
98# Simple check for W32 threads support
99AC_CHECK_HEADER([windows.h],
100 [
101 AC_MSG_CHECKING([for CreateThread()])
102 AC_LINK_IFELSE(
103 [AC_LANG_PROGRAM([#include <windows.h>], [ HANDLE h = CreateThread(NULL, 0, NULL, NULL, 0, NULL);])],
104 [
105 AC_MSG_RESULT([yes])
106 HAVE_W32_THREADS='yes'
107 ],
108 [
109 AC_MSG_RESULT([no])
110 HAVE_W32_THREADS='no'
111 ])
112 ],
113 [HAVE_W32_THREADS='no'])
97 114
98# for pkg-config 115# for pkg-config
99MHD_LIBDEPS="" 116MHD_LIBDEPS=""
@@ -156,7 +173,7 @@ netbsd*)
156 AC_DEFINE_UNQUOTED(OS390,1,[This is a OS/390 system]) 173 AC_DEFINE_UNQUOTED(OS390,1,[This is a OS/390 system])
157 ;; 174 ;;
158*) 175*)
159 AC_MSG_RESULT(Unrecognised OS $host_os) 176 AC_MSG_WARN([Unrecognised OS $host_os])
160 AC_DEFINE_UNQUOTED(OTHEROS,1,[Some strange OS]) 177 AC_DEFINE_UNQUOTED(OTHEROS,1,[Some strange OS])
161# You might want to find out if your OS supports shutdown on listen sockets, 178# You might want to find out if your OS supports shutdown on listen sockets,
162# and extend the switch statement; if we do not have 'HAVE_LISTEN_SHUTDOWN', 179# and extend the switch statement; if we do not have 'HAVE_LISTEN_SHUTDOWN',
@@ -165,6 +182,57 @@ netbsd*)
165;; 182;;
166esac 183esac
167 184
185if test "x$with_threads" = "xposix"; then
186# forced posix threads
187 if test "x$HAVE_POSIX_THREADS" = "xyes"; then
188 USE_THREADS='posix'
189 else
190 if test "x$HAVE_W32_THREADS" = "xyes"; then
191 AC_MSG_ERROR([[Posix threads are not available. Try to configure --with-threads=auto]])
192 else
193 AC_MSG_ERROR([[Posix threads are not available]])
194 fi
195 fi
196elif test "x$with_threads" = "xw32"; then
197# forced w32 threads
198 if test "x$HAVE_W32_THREADS" = "xyes"; then
199 USE_THREADS='w32'
200 else
201 if test "x$HAVE_POSIX_THREADS" = "xyes"; then
202 AC_MSG_ERROR([[W32 threads are not available. Try to configure --with-threads=auto]])
203 else
204 AC_MSG_ERROR([[W32 threads are not available]])
205 fi
206 fi
207else
208# automatic threads lib selection
209 if test "x$HAVE_POSIX_THREADS" = "xyes" && test "x$HAVE_W32_THREADS" = "xyes"; then
210 if test "x$os_is_native_w32" = "xyes"; then
211 USE_THREADS='w32'
212 else
213 USE_THREADS='posix'
214 fi
215 elif test "x$HAVE_POSIX_THREADS" = "xyes"; then
216 USE_THREADS='posix'
217 elif test "x$HAVE_W32_THREADS" = "xyes"; then
218 USE_THREADS='w32'
219 else
220 AC_MSG_ERROR([[No threading lib is available. Cosider installing pthreads]])
221 fi
222fi
223
224if test "x$USE_THREADS" = "xposix"; then
225 CC="$PTHREAD_CC"
226 AC_DEFINE([MHD_USE_POSIX_THREADS],[1],[define to use pthreads])
227 MHD_LIB_CFLAGS="$MHD_LIB_CFLAGS $PTHREAD_CFLAGS"
228 MHD_LIBDEPS="$PTHREAD_LIBS $MHD_LIBDEPS"
229elif test "x$USE_THREADS" = "xw32"; then
230 AC_DEFINE([MHD_USE_W32_THREADS],[1],[define to use W32 threads])
231fi
232AM_CONDITIONAL([USE_POSIX_THREADS], [test "x$USE_THREADS" = "xposix"])
233AM_CONDITIONAL([USE_W32_THREADS], [test "x$USE_THREADS" = "xw32"])
234
235
168AM_CONDITIONAL(HAVE_W32, [test "x$os_is_native_w32" = "xyes"]) 236AM_CONDITIONAL(HAVE_W32, [test "x$os_is_native_w32" = "xyes"])
169w32_shared_lib_exp=no 237w32_shared_lib_exp=no
170if test "x$enable_shared" = "xyes" && test "x$os_is_native_w32" = "xyes"; then 238if test "x$enable_shared" = "xyes" && test "x$os_is_native_w32" = "xyes"; then
@@ -177,6 +245,17 @@ if test "x$enable_shared" = "xyes" && test "x$os_is_native_w32" = "xyes"; then
177fi 245fi
178AM_CONDITIONAL(W32_SHARED_LIB_EXP, [test "x$w32_shared_lib_exp" = "xyes"]) 246AM_CONDITIONAL(W32_SHARED_LIB_EXP, [test "x$w32_shared_lib_exp" = "xyes"])
179AM_CONDITIONAL(USE_MS_LIB_TOOL, [test "x$ac_cv_use_ms_lib_tool" = "xyes"]) 247AM_CONDITIONAL(USE_MS_LIB_TOOL, [test "x$ac_cv_use_ms_lib_tool" = "xyes"])
248
249# set GCC options
250# use '-fno-strict-aliasing', but only if the compiler can take it
251AX_APPEND_COMPILE_FLAGS([[-fno-strict-aliasing]])
252
253AC_C_BIGENDIAN
254
255AC_CHECK_PROG([HAVE_CURL_BINARY],[curl],[yes],[no])
256AM_CONDITIONAL([HAVE_CURL_BINARY],[test "x$HAVE_CURL_BINARY" = "xyes"])
257AC_CHECK_PROG([HAVE_MAKEINFO_BINARY],[makeinfo],[yes],[no])
258AM_CONDITIONAL([HAVE_MAKEINFO_BINARY],[test "x$HAVE_MAKEINFO_BINARY" = "xyes"])
180AM_CONDITIONAL(W32_STATIC_LIB, [test "x$os_is_native_w32" = "xyes" && test "x$enable_static" = "xyes"]) 259AM_CONDITIONAL(W32_STATIC_LIB, [test "x$os_is_native_w32" = "xyes" && test "x$enable_static" = "xyes"])
181 260
182 261
@@ -212,19 +291,21 @@ if test "$enable_epoll" != "no"; then
212 fi 291 fi
213fi 292fi
214 293
215SAVE_LIBS="$LIBS" 294if test "x$HAVE_POSIX_THREADS" = "xyes"; then
216SAVE_CFLAGS="$CFLAGS" 295 # Check for pthread_setname_np()
217LIBS="$PTHREAD_LIBS $LIBS" 296 SAVE_LIBS="$LIBS"
218CFLAGS="$CFLAGS $PTHREAD_CFLAGS" 297 SAVE_CFLAGS="$CFLAGS"
219# Check for pthread_setname_np() 298 LIBS="$PTHREAD_LIBS $LIBS"
220AC_MSG_CHECKING([[for pthread_setname_np]]) 299 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
221AC_LINK_IFELSE( 300 AC_MSG_CHECKING([[for pthread_setname_np]])
222 [AC_LANG_PROGRAM([[#include <pthread.h>]], [[ pthread_setname_np(pthread_self(), "name")]])], 301 AC_LINK_IFELSE(
223 [AC_DEFINE([[HAVE_PTHREAD_SETNAME_NP]], [[1]], [Define if you have pthread_setname_np function.]) 302 [AC_LANG_PROGRAM([[#include <pthread.h>]], [[ pthread_setname_np(pthread_self(), "name")]])],
224 AC_MSG_RESULT([[yes]])], 303 [AC_DEFINE([[HAVE_PTHREAD_SETNAME_NP]], [[1]], [Define if you have pthread_setname_np function.])
225 [AC_MSG_RESULT([[no]])] ) 304 AC_MSG_RESULT([[yes]])],
226LIBS="$SAVE_LIBS" 305 [AC_MSG_RESULT([[no]])] )
227CFLAGS="$SAVE_CFLAGS" 306 LIBS="$SAVE_LIBS"
307 CFLAGS="$SAVE_CFLAGS"
308fi
228 309
229# Check for headers that are ALWAYS required 310# Check for headers that are ALWAYS required
230AC_CHECK_HEADERS([fcntl.h math.h errno.h limits.h stdio.h locale.h sys/stat.h sys/types.h pthread.h],,AC_MSG_ERROR([Compiling libmicrohttpd requires standard UNIX headers files])) 311AC_CHECK_HEADERS([fcntl.h math.h errno.h limits.h stdio.h locale.h sys/stat.h sys/types.h pthread.h],,AC_MSG_ERROR([Compiling libmicrohttpd requires standard UNIX headers files]))
@@ -599,10 +680,10 @@ if test "x$enable_https" != "xno"
599then 680then
600 AS_IF([test "x$have_gnutls" = "xyes" && test "x$have_gcrypt" = "xyes"], [ 681 AS_IF([test "x$have_gnutls" = "xyes" && test "x$have_gcrypt" = "xyes"], [
601 AC_DEFINE([HTTPS_SUPPORT],[1],[include HTTPS support]) 682 AC_DEFINE([HTTPS_SUPPORT],[1],[include HTTPS support])
602 MHD_LIB_CPPFLAGS="$GNUTLS_CPPFLAGS $LIBGCRYPT_CFLAGS" 683 MHD_LIB_CPPFLAGS="$MHD_LIB_CPPFLAGS $GNUTLS_CPPFLAGS $LIBGCRYPT_CFLAGS"
603 MHD_LIB_CFLAGS="$GNUTLS_CFLAGS $LIBGCRYPT_CFLAGS" 684 MHD_LIB_CFLAGS="$MHD_LIB_CFLAGS $GNUTLS_CFLAGS $LIBGCRYPT_CFLAGS"
604 MHD_LIB_LDFLAGS="$GNUTLS_LDFLAGS" 685 MHD_LIB_LDFLAGS="$MHD_LIB_LDFLAGS $GNUTLS_LDFLAGS"
605 MHD_LIBDEPS="$GNUTLS_LIBS $LIBGCRYPT_LIBS" 686 MHD_LIBDEPS="$GNUTLS_LIBS $LIBGCRYPT_LIBS $MHD_LIBDEPS"
606 enable_https=yes 687 enable_https=yes
607 MSG_HTTPS="yes (using libgnutls and libgcrypt)" 688 MSG_HTTPS="yes (using libgnutls and libgcrypt)"
608 ], [ 689 ], [
@@ -715,6 +796,7 @@ fi
715 796
716AC_MSG_NOTICE([Configuration Summary: 797AC_MSG_NOTICE([Configuration Summary:
717 Operating System: ${host_os} 798 Operating System: ${host_os}
799 Threading lib: ${USE_THREADS}
718 libcurl (testing): ${MSG_CURL} 800 libcurl (testing): ${MSG_CURL}
719 Target directory: ${prefix} 801 Target directory: ${prefix}
720 Messages: ${enable_messages} 802 Messages: ${enable_messages}