Commits

Ondřej Surý committed 0199503

Export only declared symbols and also bump SONAME to 3

Comments (0)

Files changed (4)

 # See http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
 GDLIB_CURRENT=3
 GDLIB_REVISION=0
-GDLIB_AGE=1
+GDLIB_AGE=0
 AC_SUBST(GDLIB_CURRENT)
 AC_SUBST(GDLIB_REVISION)
 AC_SUBST(GDLIB_AGE)
 AC_PATH_X
 
 if test -n "$x_includes" && test "x$x_includes" != xNONE ; then
-  CPPFLAGS="$CPPFLAGS -I$x_includes"
+  CFLAGS="$CFLAGS -I$x_includes"
 fi
 if test -n "$x_libraries" && test "x$x_libraries" != xNONE ; then
   LDFLAGS="$LDFLAGS -L$x_libraries"
   fi
 
   if test -n "$LIBPNG12_CONFIG"; then
-    libpng_CPPFLAGS=`$LIBPNG12_CONFIG --cflags`
+    libpng_CFLAGS=`$LIBPNG12_CONFIG --cflags`
     # should be --ldopts, but it's currently broken
     libpng_LDFLAGS=`$LIBPNG12_CONFIG --ldflags`
     libpng_LDFLAGS=`echo " $libpng_LDFLAGS" | sed 's/ -l[[^ ]][[^ ]]*//g'`
   elif test -n "$LIBPNG_CONFIG"; then
-    libpng_CPPFLAGS=`$LIBPNG_CONFIG --cflags`
+    libpng_CFLAGS=`$LIBPNG_CONFIG --cflags`
     # should be --ldopts, but it's currently broken
     libpng_LDFLAGS=`$LIBPNG_CONFIG --ldflags`
     libpng_LDFLAGS=`echo " $libpng_LDFLAGS" | sed 's/ -l[[^ ]][[^ ]]*//g'`
 
   AC_CHECK_HEADERS(png.h,,
     [AC_CHECK_HEADERS(libpng/png.h,
-       [CPPFLAGS="$CPPFLAGS $libpng_CPPFLAGS/libpng"],
-       [CPPFLAGS="$_cppflags"])])
+       [CFLAGS="$CFLAGS $libpng_CFLAGS/libpng"],
+       [CFLAGS="$_cppflags"])])
 
   _ldflags="$LDFLAGS"
   LDFLAGS="$libpng_LDFLAGS $LDFLAGS"
     fi
   fi
 
-  _cppflags="$CPPFLAGS"
+  _cppflags="$CFLAGS"
   _ldflags="$LDFLAGS"
-  CPPFLAGS="$libft_INCLUDES $CPPFLAGS"
+  CFLAGS="$libft_INCLUDES $CFLAGS"
   LDFLAGS="$libft_LDFLAGS $LDFLAGS"
   SAVE_FEATURES=$FEATURES
   AC_CHECK_LIB(freetype,FT_Init_FreeType,
       [AC_MSG_RESULT([no])
       FEATURES=$SAVE_FEATURES
       ac_cv_lib_freetype_FT_Init_FreeType=no
-      CPPFLAGS="$_cppflags"])
+      CFLAGS="$_cppflags"])
 
 else
   ac_cv_lib_freetype_FT_Init_FreeType=no
 [  --with-fontconfig=DIR         where to find the fontconfig library],
   [if test -d "$withval"; then
      LDFLAGS="$LDFLAGS -L$withval/lib"
-     CPPFLAGS="$CPPFLAGS -I$withval/include"
+     CFLAGS="$CFLAGS -I$withval/include"
    fi],
   withval=yes)
 
 [  --with-jpeg=DIR         where to find the jpeg library],
   [if test -d "$withval"; then
      LDFLAGS="$LDFLAGS -L$withval/lib"
-     CPPFLAGS="$CPPFLAGS -I$withval/include"
+     CFLAGS="$CFLAGS -I$withval/include"
    fi],
   withval=yes)
 
 [  --with-xpm=DIR          where to find the xpm library],
   [if test -d "$withval"; then
      LDFLAGS="$LDFLAGS -L$withval/lib"
-     CPPFLAGS="$CPPFLAGS -I$withval/include"
+     CFLAGS="$CFLAGS -I$withval/include"
    fi],
   withval=yes)
 
 [  --with-vpx=DIR         where to find the vpx library],
   [if test -d "$withval"; then
      LDFLAGS="$LDFLAGS -L$withval/lib"
-     CPPFLAGS="$CPPFLAGS -I$withval/include"
+     CFLAGS="$CFLAGS -I$withval/include"
    fi],
   withval=yes)
 
 [  --with-tiff=DIR         where to find the tiff library],
   [if test -d "$withval"; then
      LDFLAGS="$LDFLAGS -L$withval/lib"
-     CPPFLAGS="$CPPFLAGS -I$withval/include"
+     CFLAGS="$CFLAGS -I$withval/include"
    fi],
   withval=yes)
 
   ac_cv_lib_tiff_TIFFClientOpen=no
 fi
 
-
-
-
-
-
+gl_VISIBILITY()
+CFLAGS="$CFLAGS $CFLAG_VISIBILITY"
 
 AX_PTHREAD()
 
+# visibility.m4 serial 1 (gettext-0.15)
+dnl Copyright (C) 2005 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+dnl Tests whether the compiler supports the command-line option
+dnl -fvisibility=hidden and the function and variable attributes
+dnl __attribute__((__visibility__("hidden"))) and
+dnl __attribute__((__visibility__("default"))).
+dnl Does *not* test for __visibility__("protected") - which has tricky
+dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on
+dnl MacOS X.
+dnl Does *not* test for __visibility__("internal") - which has processor
+dnl dependent semantics.
+dnl Does *not* test for #pragma GCC visibility push(hidden) - which is
+dnl "really only recommended for legacy code".
+dnl Set the variable CFLAG_VISIBILITY.
+dnl Defines and sets the variable HAVE_VISIBILITY.
+
+AC_DEFUN([gl_VISIBILITY],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  CFLAG_VISIBILITY=
+  HAVE_VISIBILITY=0
+  if test -n "$GCC"; then
+    AC_MSG_CHECKING([for simple visibility declarations])
+    AC_CACHE_VAL(gl_cv_cc_visibility, [
+      gl_save_CFLAGS="$CFLAGS"
+      CFLAGS="$CFLAGS -fvisibility=hidden"
+      AC_TRY_COMPILE(
+        [extern __attribute__((__visibility__("hidden"))) int hiddenvar;
+         extern __attribute__((__visibility__("default"))) int exportedvar;
+         extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
+         extern __attribute__((__visibility__("default"))) int exportedfunc (void);],
+        [],
+        gl_cv_cc_visibility=yes,
+        gl_cv_cc_visibility=no)
+      CFLAGS="$gl_save_CFLAGS"])
+    AC_MSG_RESULT([$gl_cv_cc_visibility])
+    if test $gl_cv_cc_visibility = yes; then
+      CFLAG_VISIBILITY="-fvisibility=hidden"
+      HAVE_VISIBILITY=1
+    fi
+  fi
+  AC_SUBST([CFLAG_VISIBILITY])
+  AC_SUBST([HAVE_VISIBILITY])
+  AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$HAVE_VISIBILITY],
+    [Define to 1 or 0, depending whether the compiler supports simple visibility declarations.])
+])
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define to 1 or 0, depending whether the compiler supports simple visibility
+   declarations. */
+#undef HAVE_VISIBILITY
+
 /* Define as const if the declaration of iconv() needs const. */
 #undef ICONV_CONST
 
 #endif /* WIN32 */
 
 #ifdef NONDLL
-# define BGD_DECLARE(rt) extern rt
+# ifdef HAVE_VISIBILITY
+#  define BGD_DECLARE(rt) __attribute__ ((visibility ("default"))) rt
+# else
+#  define BGD_DECLARE(rt) rt
+# endif
 #else
 # ifdef BGDWIN32
 #  define BGD_DECLARE(rt) __declspec(dllexport) rt __stdcall