diff options
author | LRN <lrn1986@gmail.com> | 2014-01-27 06:59:02 +0000 |
---|---|---|
committer | LRN <lrn1986@gmail.com> | 2014-01-27 06:59:02 +0000 |
commit | 0d8aeae6df35a54ec2e612eb944663880758b857 (patch) | |
tree | a6f275e91f3ebad21cfd733533ebf15dc891b12c /configure.ac | |
parent | 34644b55bb6b4285b6341fbe9e375498c4e7cb41 (diff) | |
download | libmicrohttpd-0d8aeae6df35a54ec2e612eb944663880758b857.tar.gz libmicrohttpd-0d8aeae6df35a54ec2e612eb944663880758b857.zip |
Add decl check for _stati64 (required for newer plibc)
Remove redundant -no-undefined (it's part of mandatory MHD_LIB_LDFLAGS
now)
Remove --export-all-symbols for W32 (visibility is used instead)
Add -fvisibility=hidden configure check (shamelessly borrowed from GTK)
Remove unused -export-symbols-regex check
Define _MHD_EXTERN to "extern" if it's undefined (this is what clients
get)
Mark all public functions with _MHD_EXTERN
Remove HIDDEN_SYMBOL definition
Don't mark hidden functions with HIDDEN_SYMBOL (everything that is not
explicitly public is hidden by default now)
Change constructor macros a bit to apply _MHD_EXTERN to them cleanly
Use HIDDEN_VISIBILITY_CFLAGS when compiling libraries
Remove EXPORT.sym files, don't mention them in EXTRA_DIST, don't use
them to define a list of exported functions
Remove redundant -no-undefined, make sure only the one that gets into
Makefiles directly remains, remove -Wl prefix from it
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 49 |
1 files changed, 35 insertions, 14 deletions
diff --git a/configure.ac b/configure.ac index 85f7ef04..836f602c 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -83,6 +83,9 @@ AC_CHECK_MEMBER([struct sockaddr_in.sin_len], | |||
83 | #include <netinet/in.h> | 83 | #include <netinet/in.h> |
84 | ]) | 84 | ]) |
85 | 85 | ||
86 | # Needed for plibc.h | ||
87 | AC_CHECK_DECLS([_stati64, _wstat32i64]) | ||
88 | |||
86 | AC_CHECK_PROG(HAVE_CURL_BINARY,[curl],true,false) | 89 | AC_CHECK_PROG(HAVE_CURL_BINARY,[curl],true,false) |
87 | AM_CONDITIONAL(HAVE_CURL_BINARY,$HAVE_CURL_BINARY) | 90 | AM_CONDITIONAL(HAVE_CURL_BINARY,$HAVE_CURL_BINARY) |
88 | AC_CHECK_PROG(HAVE_MAKEINFO_BINARY,[makeinfo],true,false) | 91 | AC_CHECK_PROG(HAVE_MAKEINFO_BINARY,[makeinfo],true,false) |
@@ -163,13 +166,13 @@ netbsd*) | |||
163 | AC_DEFINE_UNQUOTED(CYGWIN,1,[This is a Cygwin system]) | 166 | AC_DEFINE_UNQUOTED(CYGWIN,1,[This is a Cygwin system]) |
164 | AM_CONDITIONAL(HAVE_GNU_LD, false) | 167 | AM_CONDITIONAL(HAVE_GNU_LD, false) |
165 | AM_CONDITIONAL(HAVE_W32, false) | 168 | AM_CONDITIONAL(HAVE_W32, false) |
166 | LDFLAGS="$LDFLAGS -Wl,no-undefined" | 169 | LDFLAGS="$LDFLAGS" |
167 | ;; | 170 | ;; |
168 | *mingw*) | 171 | *mingw*) |
169 | AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system]) | 172 | AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system]) |
170 | AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system]) | 173 | AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system]) |
171 | AM_CONDITIONAL(HAVE_W32, true) | 174 | AM_CONDITIONAL(HAVE_W32, true) |
172 | LDFLAGS="$LDFLAGS -Wl,-no-undefined -Wl,--export-all-symbols -lws2_32" | 175 | LDFLAGS="$LDFLAGS -lws2_32" |
173 | AM_CONDITIONAL(HAVE_GNU_LD, true) | 176 | AM_CONDITIONAL(HAVE_GNU_LD, true) |
174 | # check if PlibC is available | 177 | # check if PlibC is available |
175 | CHECK_PLIBC | 178 | CHECK_PLIBC |
@@ -294,6 +297,35 @@ AC_CHECK_DECLS([TCP_CORK], [], [], [[#include <netinet/tcp.h>]]) | |||
294 | # TCP_NOPUSH | 297 | # TCP_NOPUSH |
295 | AC_CHECK_DECLS([TCP_NOPUSH], [], [], [[#include <netinet/tcp.h>]]) | 298 | AC_CHECK_DECLS([TCP_NOPUSH], [], [], [[#include <netinet/tcp.h>]]) |
296 | 299 | ||
300 | HIDDEN_VISIBILITY_CFLAGS="" | ||
301 | case "$host" in | ||
302 | *-*-mingw*) | ||
303 | dnl on mingw32 we do -fvisibility=hidden and __declspec(dllexport) | ||
304 | AC_DEFINE([_MHD_EXTERN], [__attribute__((visibility("default"))) __declspec(dllexport) extern], | ||
305 | [defines how to decorate public symbols while building]) | ||
306 | HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden" | ||
307 | ;; | ||
308 | *) | ||
309 | dnl on other compilers, check if we can do -fvisibility=hidden | ||
310 | SAVED_CFLAGS="${CFLAGS}" | ||
311 | CFLAGS="-fvisibility=hidden" | ||
312 | AC_MSG_CHECKING([for -fvisibility=hidden compiler flag]) | ||
313 | AC_TRY_COMPILE([], [int main (void) { return 0; }], | ||
314 | AC_MSG_RESULT(yes) | ||
315 | enable_fvisibility_hidden=yes, | ||
316 | AC_MSG_RESULT(no) | ||
317 | enable_fvisibility_hidden=no) | ||
318 | CFLAGS="${SAVED_CFLAGS}" | ||
319 | |||
320 | AS_IF([test "${enable_fvisibility_hidden}" = "yes"], [ | ||
321 | AC_DEFINE([_MHD_EXTERN], [__attribute__((visibility("default"))) extern], | ||
322 | [defines how to decorate public symbols while building]) | ||
323 | HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden" | ||
324 | ]) | ||
325 | ;; | ||
326 | esac | ||
327 | AC_SUBST(HIDDEN_VISIBILITY_CFLAGS) | ||
328 | |||
297 | # libcurl (required for testing) | 329 | # libcurl (required for testing) |
298 | SAVE_LIBS=$LIBS | 330 | SAVE_LIBS=$LIBS |
299 | 331 | ||
@@ -524,18 +556,7 @@ AM_CONDITIONAL(ENABLE_DAUTH, [test "x$enable_dauth" != "xno"]) | |||
524 | 556 | ||
525 | 557 | ||
526 | 558 | ||
527 | MHD_LIB_LDFLAGS="-export-dynamic -Wl,-no-undefined" | 559 | MHD_LIB_LDFLAGS="-export-dynamic -no-undefined" |
528 | |||
529 | # TODO insert a proper check here | ||
530 | AC_CACHE_CHECK([whether -export-symbols-regex works], | ||
531 | gn_cv_export_symbols_regex_works, | ||
532 | [ | ||
533 | case "$host_os" in | ||
534 | mingw*) gn_cv_export_symbols_regex_works=no;; | ||
535 | *) gn_cv_export_symbols_regex_works=yes;; | ||
536 | esac | ||
537 | ]) | ||
538 | |||
539 | 560 | ||
540 | # gcov compilation | 561 | # gcov compilation |
541 | AC_MSG_CHECKING(whether to compile with support for code coverage analysis) | 562 | AC_MSG_CHECKING(whether to compile with support for code coverage analysis) |