summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2021-09-13 18:41:59 +0200
committerGravatar Nikias Bassen2021-09-13 18:41:59 +0200
commit677b0c03f8fca937f6b16da3341602637d092179 (patch)
tree7a653c83ed13835081b2a556c18a0e325a706bc7 /configure.ac
parent68f1d4a136fca04665a209f2a215b27bee377003 (diff)
downloadlibplist-677b0c03f8fca937f6b16da3341602637d092179.tar.gz
libplist-677b0c03f8fca937f6b16da3341602637d092179.tar.bz2
Check availability of constructor attribute and use it on Windows in favor of DllMain
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac26
1 files changed, 22 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac
index 9300f31..0d13e04 100644
--- a/configure.ac
+++ b/configure.ac
@@ -55,17 +55,17 @@ AC_C_BIGENDIAN([AC_DEFINE([__BIG_ENDIAN__], [1], [big endian])],
# Check for operating system
-AC_MSG_CHECKING([wether we need platform-specific build settings for ${host_os}])
+AC_MSG_CHECKING([for platform-specific build settings])
case ${host_os} in
*mingw32*|*cygwin*)
- AC_MSG_RESULT([yes])
+ AC_MSG_RESULT([${host_os}])
win32=true
;;
darwin*|*android*)
- AC_MSG_RESULT([no])
+ AC_MSG_RESULT([${host_os}])
;;
*)
- AC_MSG_RESULT([yes])
+ AC_MSG_RESULT([${host_os}])
AX_PTHREAD([], [AC_MSG_ERROR([pthread is required to build libplist])])
AC_CHECK_LIB(pthread, [pthread_once], [], [AC_MSG_ERROR([pthread with pthread_once required to build libplist])])
;;
@@ -74,6 +74,24 @@ AM_CONDITIONAL(WIN32, test x$win32 = xtrue)
AC_SEARCH_LIBS([fmin],[m])
+# Check if the C compiler supports __attribute__((constructor))
+AC_CACHE_CHECK([wether the C compiler supports constructor/destructor attributes],
+ ac_cv_attribute_constructor, [
+ ac_cv_attribute_constructor=no
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+ [[
+ static void __attribute__((constructor)) test_constructor(void) {
+ }
+ static void __attribute__((destructor)) test_destructor(void) {
+ }
+ ]], [])],
+ [ac_cv_attribute_constructor=yes]
+ )]
+)
+if test "$ac_cv_attribute_constructor" = "yes"; then
+ AC_DEFINE(HAVE_ATTRIBUTE_CONSTRUCTOR, 1, [Define if the C compiler supports constructor/destructor attributes])
+fi
+
# Check if struct tm has a tm_gmtoff member
AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([