aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDhiru Kholia <kholia@kth.se>2015-11-04 11:00:21 +0100
committerPeter Wu <peter@lekensteyn.nl>2015-11-04 12:16:17 +0000
commit58528f6d911c7dfec3c8c550abc5d717861c60ee (patch)
tree146f98b0043f67dfff6e9bf848525ecd99bdbfe6
parentcde99ec5354d95960a52e1fd49bc68e108e918d7 (diff)
Fix AddressSanitizer (./configure --enable-asan) builds
"./configure --enable-asan" currently fails to detect installed libraries because aclocal-fallback/* built programs have memory leaks in them. configure:34516: checking for GTK+ - version >= 3.0.0 configure:34626: gcc -o conftest ... ... configure:34626: $? = 0 configure:34626: ./conftest ================================================================= ==29007==ERROR: LeakSanitizer: detected memory leaks Direct leak of 6 byte(s) in 1 object(s) allocated from: #0 0x7fa5c95dd9aa in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x989aa) #1 0x7fa5c8995578 in g_malloc (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4f578) SUMMARY: AddressSanitizer: 6 byte(s) leaked in 1 allocation(s). configure:34626: $? = 23 configure: program exited with status 23 ... configure:34649: result: no configure:34699: error: GTK+ 3 is not available ... This system is running 64-bit Ubuntu Linux 15.10 with GCC 5.2.1 compiler. The glib-2-0.m4 leak, and the gtk-3.0.m4 leak are fixed by updating "glib-2.0.m4" to the latest upstream version. Whitespace errors are fixed locally to keep the BuildBot happy. Change-Id: I01a5f4c494a59ae6d0ee19cd2611fab163ebf9b4 Reviewed-on: https://code.wireshark.org/review/11283 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
-rw-r--r--aclocal-fallback/glib-2.0.m456
-rw-r--r--aclocal-fallback/gtk-2.0.m45
-rw-r--r--aclocal-fallback/gtk-3.0.m464
3 files changed, 73 insertions, 52 deletions
diff --git a/aclocal-fallback/glib-2.0.m4 b/aclocal-fallback/glib-2.0.m4
index f0ae170e0e..f6b58396b1 100644
--- a/aclocal-fallback/glib-2.0.m4
+++ b/aclocal-fallback/glib-2.0.m4
@@ -1,11 +1,12 @@
# Configure paths for GLIB
# Owen Taylor 1997-2001
+
dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
-dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject or
-dnl gthread is specified in MODULES, pass to pkg-config
+dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject,
+dnl gthread, or gio is specified in MODULES, pass to pkg-config
dnl
AC_DEFUN([AM_PATH_GLIB_2_0],
-[dnl
+[dnl
dnl Get the cflags and libraries from pkg-config
dnl
AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program],
@@ -15,32 +16,31 @@ AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run
for module in . $4
do
case "$module" in
- gmodule)
+ gmodule)
pkg_config_args="$pkg_config_args gmodule-2.0"
;;
- gobject)
+ gmodule-no-export)
+ pkg_config_args="$pkg_config_args gmodule-no-export-2.0"
+ ;;
+ gobject)
pkg_config_args="$pkg_config_args gobject-2.0"
;;
- gthread)
+ gthread)
pkg_config_args="$pkg_config_args gthread-2.0"
;;
+ gio*)
+ pkg_config_args="$pkg_config_args $module-2.0"
+ ;;
esac
done
- AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+ PKG_PROG_PKG_CONFIG([0.16])
no_glib=""
- if test x$PKG_CONFIG != xno ; then
- if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then
- :
- else
- echo *** pkg-config too old; version 0.7 or better required.
- no_glib=yes
- PKG_CONFIG=no
- fi
- else
+ if test "x$PKG_CONFIG" = x ; then
no_glib=yes
+ PKG_CONFIG=no
fi
min_glib_version=ifelse([$1], ,2.0.0,$1)
@@ -64,6 +64,7 @@ AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run
GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0`
GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
+ GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable=glib_compile_resources gio-2.0`
GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args`
GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args`
@@ -88,17 +89,14 @@ dnl
#include <stdio.h>
#include <stdlib.h>
-int
+int
main ()
{
- int major, minor, micro;
- char *tmp_version;
+ unsigned int major, minor, micro;
- system ("touch conf.glibtest");
+ fclose (fopen ("conf.glibtest", "w"));
- /* HP/UX 9 (%@#!) writes to sscanf strings */
- tmp_version = g_strdup("$min_glib_version");
- if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+ if (sscanf("$min_glib_version", "%u.%u.%u", &major, &minor, &micro) != 3) {
printf("%s, bad version string\n", "$min_glib_version");
exit(1);
}
@@ -107,7 +105,7 @@ main ()
(glib_minor_version != $glib_config_minor_version) ||
(glib_micro_version != $glib_config_micro_version))
{
- printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n",
+ printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n",
$glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
glib_major_version, glib_minor_version, glib_micro_version);
printf ("*** was found! If pkg-config was correct, then it is best\n");
@@ -117,7 +115,7 @@ main ()
printf("*** required on your system.\n");
printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
printf("*** to point to the correct configuration files\n");
- }
+ }
else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
(glib_minor_version != GLIB_MINOR_VERSION) ||
(glib_micro_version != GLIB_MICRO_VERSION))
@@ -137,9 +135,9 @@ main ()
}
else
{
- printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n",
+ printf("\n*** An old version of GLIB (%u.%u.%u) was found.\n",
glib_major_version, glib_minor_version, glib_micro_version);
- printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n",
+ printf("*** You need a version of GLIB newer than %u.%u.%u. The latest version of\n",
major, minor, micro);
printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
printf("***\n");
@@ -161,7 +159,7 @@ main ()
fi
if test "x$no_glib" = x ; then
AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version))
- ifelse([$2], , :, [$2])
+ ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test "$PKG_CONFIG" = "no" ; then
@@ -200,6 +198,7 @@ main ()
GLIB_GENMARSHAL=""
GOBJECT_QUERY=""
GLIB_MKENUMS=""
+ GLIB_COMPILE_RESOURCES=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(GLIB_CFLAGS)
@@ -207,5 +206,6 @@ main ()
AC_SUBST(GLIB_GENMARSHAL)
AC_SUBST(GOBJECT_QUERY)
AC_SUBST(GLIB_MKENUMS)
+ AC_SUBST(GLIB_COMPILE_RESOURCES)
rm -f conf.glibtest
])
diff --git a/aclocal-fallback/gtk-2.0.m4 b/aclocal-fallback/gtk-2.0.m4
index 1c9321d56a..3ad85f69e8 100644
--- a/aclocal-fallback/gtk-2.0.m4
+++ b/aclocal-fallback/gtk-2.0.m4
@@ -80,13 +80,10 @@ int
main ()
{
int major, minor, micro;
- char *tmp_version;
system ("touch conf.gtktest");
- /* HP/UX 9 (%@#!) writes to sscanf strings */
- tmp_version = g_strdup("$min_gtk_version");
- if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+ if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, &micro) != 3) {
printf("%s, bad version string\n", "$min_gtk_version");
exit(1);
}
diff --git a/aclocal-fallback/gtk-3.0.m4 b/aclocal-fallback/gtk-3.0.m4
index 4706b60244..68c169f1df 100644
--- a/aclocal-fallback/gtk-3.0.m4
+++ b/aclocal-fallback/gtk-3.0.m4
@@ -6,17 +6,21 @@ dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified i
dnl pass to pkg-config
dnl
AC_DEFUN([AM_PATH_GTK_3_0],
-[dnl
+[m4_warn([obsolete], [AM_PATH_GTK_3_0 is deprecated, use PKG_CHECK_MODULES([GTK], [gtk+-3.0]) instead])
dnl Get the cflags and libraries from pkg-config
dnl
AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program],
, enable_gtktest=yes)
+ min_gtk_version=ifelse([$1], [], [3.0.0], [$1])
- pkg_config_module=gtk+-3.0
+ pkg_config_args="gtk+-3.0 >= $min_gtk_version"
for module in . $4
do
- # No modules to check for now
- :
+ case "$module" in
+ gthread)
+ pkg_config_args="$pkg_config_args gthread-2.0"
+ ;;
+ esac
done
no_gtk=""
@@ -35,17 +39,16 @@ AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run
no_gtk=yes
fi
- min_gtk_version=ifelse([$1], ,3.0.0,$1)
AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version)
if test x$PKG_CONFIG != xno ; then
## don't try to run the test against uninstalled libtool libs
- if $PKG_CONFIG --uninstalled $pkg_config_module; then
+ if $PKG_CONFIG --uninstalled $pkg_config_args; then
echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH"
enable_gtktest=no
fi
- if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_module; then
+ if $PKG_CONFIG $pkg_config_args; then
:
else
no_gtk=yes
@@ -53,13 +56,13 @@ AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run
fi
if test x"$no_gtk" = x ; then
- GTK_CFLAGS=`$PKG_CONFIG $pkg_config_module --cflags`
- GTK_LIBS=`$PKG_CONFIG $pkg_config_module --libs`
- gtk_config_major_version=`$PKG_CONFIG --modversion $pkg_config_module | \
+ GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
+ GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
+ gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
- gtk_config_minor_version=`$PKG_CONFIG --modversion $pkg_config_module | \
+ gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
- gtk_config_micro_version=`$PKG_CONFIG --modversion $pkg_config_module | \
+ gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test "x$enable_gtktest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
@@ -79,14 +82,11 @@ dnl
int
main ()
{
- int major, minor, micro;
- char *tmp_version;
+ unsigned int major, minor, micro;
fclose (fopen ("conf.gtktest", "w"));
- /* HP/UX 9 (%@#!) writes to sscanf strings */
- tmp_version = g_strdup("$min_gtk_version");
- if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+ if (sscanf("$min_gtk_version", "%u.%u.%u", &major, &minor, &micro) != 3) {
printf("%s, bad version string\n", "$min_gtk_version");
exit(1);
}
@@ -95,7 +95,7 @@ main ()
(gtk_minor_version != $gtk_config_minor_version) ||
(gtk_micro_version != $gtk_config_micro_version))
{
- printf("\n*** 'pkg-config --modversion $pkg_config_module' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
+ printf("\n*** 'pkg-config --modversion gtk+-3.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
$gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
gtk_major_version, gtk_minor_version, gtk_micro_version);
printf ("*** was found! If pkg-config was correct, then it is best\n");
@@ -125,9 +125,9 @@ main ()
}
else
{
- printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
+ printf("\n*** An old version of GTK+ (%u.%u.%u) was found.\n",
gtk_major_version, gtk_minor_version, gtk_micro_version);
- printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
+ printf("*** You need a version of GTK+ newer than %u.%u.%u. The latest version of\n",
major, minor, micro);
printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
printf("***\n");
@@ -191,3 +191,27 @@ main ()
AC_SUBST(GTK_LIBS)
rm -f conf.gtktest
])
+
+dnl GTK_CHECK_BACKEND(BACKEND-NAME [, MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+dnl Tests for BACKEND-NAME in the GTK targets list
+dnl
+AC_DEFUN([GTK_CHECK_BACKEND],
+[m4_warn([obsolete], [GTK_CHECK_BACKEND is deprecated, use PKG_CHECK_MODULES([GTK_X11], [gtk+-x11-3.0]) or similar instead])
+ pkg_config_args=ifelse([$1],,gtk+-3.0, gtk+-$1-3.0)
+ min_gtk_version=ifelse([$2],,3.0.0,$2)
+ pkg_config_args="$pkg_config_args >= $min_gtk_version"
+
+ AC_PATH_PROG(PKG_CONFIG, [pkg-config], [AC_MSG_ERROR([No pkg-config found])])
+
+ if $PKG_CONFIG $pkg_config_args ; then
+ target_found=yes
+ else
+ target_found=no
+ fi
+
+ if test "x$target_found" = "xno"; then
+ ifelse([$4],,[AC_MSG_ERROR([Backend $backend not found.])],[$4])
+ else
+ ifelse([$3],,[:],[$3])
+ fi
+])