[gspell/wip/misc] Replace _GSPELL_EXTERN by G_MODULE_EXPORT




commit 611b65fcca89d231317d5c96e884a2be8bf3e71c
Author: Sébastien Wilmet <swilmet informatique-libre be>
Date:   Tue Aug 16 16:00:00 2022 +0200

    Replace _GSPELL_EXTERN by G_MODULE_EXPORT
    
    Like how it is done in the Amtk library.
    To simplify things.

 configure.ac | 48 ++++++++++++++++--------------------------------
 1 file changed, 16 insertions(+), 32 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index cac457f..641e8d5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -134,39 +134,23 @@ AX_CODE_COVERAGE
 AX_REQUIRE_DEFINED([AX_VALGRIND_CHECK])
 AX_VALGRIND_CHECK
 
-# Symbol visibility handling.
-#
-# This requires to #include config.h in every *.c file where there is a public
-# symbol. As a simpler rule, it's easier to #include config.h in all gspell/*.c
-# files, to be sure that we don't miss any public symbol.
+# Check if the compiler supports -fvisibility=hidden
+SAVED_CFLAGS="${CFLAGS}"
+CFLAGS="-fvisibility=hidden"
+AC_MSG_CHECKING([for -fvisibility=hidden compiler flag])
+AC_TRY_COMPILE([], [return 0],
+               AC_MSG_RESULT(yes)
+               enable_fvisibility_hidden=yes,
+               AC_MSG_RESULT(no)
+               enable_fvisibility_hidden=no)
+CFLAGS="${SAVED_CFLAGS}"
+
 GSPELL_HIDDEN_VISIBILITY_CFLAGS=""
-case "$host" in
-    *-*-mingw*)
-        dnl on mingw32 we do -fvisibility=hidden and __declspec(dllexport)
-        AC_DEFINE([_GSPELL_EXTERN], [__attribute__((visibility("default"))) __declspec(dllexport) extern],
-                  [defines how to decorate public symbols while building])
-        GSPELL_HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden"
-        ;;
-    *)
-        dnl on other compilers, check if we can do -fvisibility=hidden
-        SAVED_CFLAGS="${CFLAGS}"
-        CFLAGS="-fvisibility=hidden"
-        AC_MSG_CHECKING([for -fvisibility=hidden compiler flag])
-        AC_TRY_COMPILE([], [return 0],
-                       AC_MSG_RESULT(yes)
-                       enable_fvisibility_hidden=yes,
-                       AC_MSG_RESULT(no)
-                       enable_fvisibility_hidden=no)
-        CFLAGS="${SAVED_CFLAGS}"
-
-        AS_IF([test "${enable_fvisibility_hidden}" = "yes"], [
-            AC_DEFINE([_GSPELL_EXTERN], [__attribute__((visibility("default"))) extern],
-                      [defines how to decorate public symbols while building])
-            GSPELL_HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden"
-        ])
-        ;;
-esac
-AC_SUBST(GSPELL_HIDDEN_VISIBILITY_CFLAGS)
+if test "x${enable_fvisibility_hidden}" = "xyes"
+then
+       GSPELL_HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden"
+fi
+AC_SUBST([GSPELL_HIDDEN_VISIBILITY_CFLAGS])
 
 # Check for Mac OS X platform
 AC_MSG_CHECKING([for Mac OS X platform])


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]