configure.ac 110 KB
Newer Older
1
# Process this file with autoconf to produce a configure script.
2
AC_PREREQ([2.62])
3

4 5 6
dnl ***********************************
dnl *** include special GLib macros ***
dnl ***********************************
7

8
m4_define(glib_configure_ac)
Owen Taylor's avatar
Owen Taylor committed
9

10
#
Matthias Clasen's avatar
Matthias Clasen committed
11 12 13
# The following version number definitions apply to GLib, GModule, GObject,
# GThread and GIO as a whole, so if changes occurred in any of them, they are
# all treated with the same interface and binary age.
14
#
Owen Taylor's avatar
Owen Taylor committed
15
# Making releases:
16 17 18 19
#   glib_micro_version += 1;
#   glib_interface_age += 1;
#   glib_binary_age += 1;
# if any functions have been added, set glib_interface_age to 0.
Owen Taylor's avatar
Owen Taylor committed
20
# if backwards compatibility has been broken,
21
# set glib_binary_age _and_ glib_interface_age to 0.
Owen Taylor's avatar
Owen Taylor committed
22
#
23 24 25 26
# remember to add a GLIB_VERSION_2_xx macro every time the minor version is
# bumped, as well as the GLIB_DEPRECATED_IN and GLIB_AVAILABLE_IN macros
# for that version - see gversion.h for further information.
#
27 28 29 30 31
# in easier to understand terms:
#
# <mclasen> on the stable branch, interface age == micro
# <mclasen> on the unstable (ie master), interface age = 0

32
m4_define([glib_major_version], [2])
33
m4_define([glib_minor_version], [39])
Allison Karlitskaya's avatar
Allison Karlitskaya committed
34
m4_define([glib_micro_version], [2])
Matthias Clasen's avatar
Matthias Clasen committed
35
m4_define([glib_interface_age], [0])
36 37 38
m4_define([glib_binary_age],
          [m4_eval(100 * glib_minor_version + glib_micro_version)])
m4_define([glib_version],
39
          [glib_major_version.glib_minor_version.glib_micro_version])
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58

# libtool version related macros
m4_define([glib_lt_release], [glib_major_version.glib_minor_version])
m4_define([glib_lt_current],
          [m4_eval(100 * glib_minor_version + glib_micro_version - glib_interface_age)])
m4_define([glib_lt_revision], [glib_interface_age])
m4_define([glib_lt_age], [m4_eval(glib_binary_age - glib_interface_age)])
m4_define([glib_lt_current_minus_age],
          [m4_eval(glib_lt_current - glib_lt_age)])

# if the minor version number is odd, then we want debugging.  Otherwise
# we only want minimal debugging support.
m4_define([glib_debug_default],
          [m4_if(m4_eval(glib_minor_version % 2), [1], [yes], [minimum])])dnl


AC_INIT(glib, [glib_version],
        [http://bugzilla.gnome.org/enter_bug.cgi?product=glib])

59
AC_CONFIG_HEADERS([config.h])
60
AC_CONFIG_SRCDIR([glib/glib.h])
61
AC_CONFIG_MACRO_DIR([m4macros])
62 63 64 65

# Save this value here, since automake will set cflags later
cflags_set=${CFLAGS+set}

66
AM_INIT_AUTOMAKE([1.11 -Wno-portability no-define no-dist-gzip dist-xz tar-ustar])
67
AM_MAINTAINER_MODE([enable])
68

69
# Support silent build rules. Disable
70
# by either passing --disable-silent-rules to configure or passing V=1
71
# to make
72
AM_SILENT_RULES([yes])
73 74 75 76 77 78 79

GLIB_MAJOR_VERSION=glib_major_version
GLIB_MINOR_VERSION=glib_minor_version
GLIB_MICRO_VERSION=glib_micro_version
GLIB_INTERFACE_AGE=glib_interface_age
GLIB_BINARY_AGE=glib_binary_age
GLIB_VERSION=glib_version
80

81 82
AC_SUBST(GLIB_MAJOR_VERSION)
AC_SUBST(GLIB_MINOR_VERSION)
83
AC_SUBST(GLIB_MICRO_VERSION)
Owen Taylor's avatar
Owen Taylor committed
84
AC_SUBST(GLIB_VERSION)
85 86
AC_SUBST(GLIB_INTERFACE_AGE)
AC_SUBST(GLIB_BINARY_AGE)
Owen Taylor's avatar
Owen Taylor committed
87

88 89 90 91 92 93 94 95 96 97 98
AC_DEFINE(GLIB_MAJOR_VERSION, [glib_major_version],
	  [Define to the GLIB major version])
AC_DEFINE(GLIB_MINOR_VERSION, [glib_minor_version],
	  [Define to the GLIB minor version])
AC_DEFINE(GLIB_MICRO_VERSION, [glib_micro_version],
	  [Define to the GLIB micro version])
AC_DEFINE(GLIB_INTERFACE_AGE, [glib_interface_age],
	  [Define to the GLIB interface age])
AC_DEFINE(GLIB_BINARY_AGE, [glib_binary_age],
	  [Define to the GLIB binary age])

Owen Taylor's avatar
Owen Taylor committed
99
# libtool versioning
100 101 102 103 104
LT_RELEASE=glib_lt_release
LT_CURRENT=glib_lt_current
LT_REVISION=glib_lt_revision
LT_AGE=glib_lt_age
LT_CURRENT_MINUS_AGE=glib_lt_current_minus_age
Owen Taylor's avatar
Owen Taylor committed
105 106 107 108
AC_SUBST(LT_RELEASE)
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)
109
AC_SUBST(LT_CURRENT_MINUS_AGE)
Owen Taylor's avatar
Owen Taylor committed
110

111 112 113
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP
114
AC_USE_SYSTEM_EXTENSIONS
115

116 117
AM_CONDITIONAL(HAVE_GCC, [test "$GCC" = "yes"])

Owen Taylor's avatar
Owen Taylor committed
118 119
AC_CANONICAL_HOST

120
dnl
121

122
AC_MSG_CHECKING([for Win32])
123
LIB_EXE_MACHINE_FLAG=X86
124 125
case "$host" in
  *-*-mingw*)
126
    glib_native_win32=yes
Owen Taylor's avatar
Owen Taylor committed
127
    glib_pid_type='void *'
128
    glib_cv_stack_grows=no
129 130 131 132 133 134 135 136 137
    # Unfortunately the mingw implementations of C99-style snprintf and vsnprintf
    # don't seem to be quite good enough, at least not in mingw-runtime-3.14.
    # (Sorry, I don't know exactly what is the problem, but it is related to
    # floating point formatting and decimal point vs. comma.)
    # The simple tests in AC_FUNC_VSNPRINTF_C99 and AC_FUNC_SNPRINTF_C99 aren't
    # rigorous enough to notice, though.
    # So preset the autoconf cache variables.
    ac_cv_func_vsnprintf_c99=no
    ac_cv_func_snprintf_c99=no
138 139 140 141 142
    case "$host" in
    x86_64-*-*)
      LIB_EXE_MACHINE_FLAG=X64
      ;;
    esac
143 144

    AC_DEFINE([_WIN32_WINNT], [0x0501], [Target the Windows XP API])
145 146
    ;;
  *)
147
    glib_native_win32=no
148
    glib_pid_type=int
149 150
    ;;
esac
151 152 153 154 155 156
case $host in
  *-*-linux*)
    glib_os_linux=yes
    ;;
esac

157
AC_MSG_RESULT([$glib_native_win32])
158

159 160 161 162 163 164 165 166 167 168 169
AC_MSG_CHECKING([for the Android])
case $host in
  *android*)
    glib_native_android="yes"
    ;;
  *)
    glib_native_android="no"
    ;;
esac
AC_MSG_RESULT([$glib_native_android])

170 171
AC_SUBST(LIB_EXE_MACHINE_FLAG)

172 173 174 175 176 177 178 179 180
glib_have_carbon=no
AC_MSG_CHECKING([for Mac OS X Carbon support])
AC_TRY_CPP([
#include <Carbon/Carbon.h>
#include <CoreServices/CoreServices.h>
], glib_have_carbon=yes)

AC_MSG_RESULT([$glib_have_carbon])

181 182 183
glib_have_cocoa=no
AC_MSG_CHECKING([for Mac OS X Cocoa support])
AC_TRY_CPP([
184
#include <Cocoa/Cocoa.h>
185 186 187
#ifdef GNUSTEP_BASE_VERSION
#error "Detected GNUstep, not Cocoa"
#endif
188 189 190 191
], glib_have_cocoa=yes)

AC_MSG_RESULT([$glib_have_cocoa])

192
AM_CONDITIONAL(OS_WIN32, [test "$glib_native_win32" = "yes"])
193
AM_CONDITIONAL(OS_WIN32_X64, [test "$LIB_EXE_MACHINE_FLAG" = "X64"])
194
AM_CONDITIONAL(OS_UNIX, [test "$glib_native_win32" != "yes"])
195
AM_CONDITIONAL(OS_LINUX, [test "$glib_os_linux" = "yes"])
196
AM_CONDITIONAL(OS_CARBON, [test "$glib_have_carbon" = "yes"])
197
AM_CONDITIONAL(OS_COCOA, [test "$glib_have_cocoa" = "yes"])
198

199
AS_IF([test "$glib_native_win32" = "yes"], [
200 201 202 203
  AC_CHECK_TOOL(WINDRES, windres, no)
  if test "$WINDRES" = no; then
    AC_MSG_ERROR([*** Could not find an implementation of windres in your PATH.])
  fi
204
  AC_CHECK_TOOL(NM, nm, no)
205
  if test "$NM" = no; then
206 207 208
    AC_MSG_ERROR([*** Could not find an implementation of nm in your PATH.])
  fi
  AC_CHECK_TOOL(RANLIB, ranlib, :)
209
  AC_CHECK_TOOL(DLLTOOL, dlltool, :)
210
  AC_CHECK_PROG(ms_librarian, [lib.exe], [yes], [no])
211
])
212
AM_CONDITIONAL(MS_LIB_AVAILABLE, [test x$ms_librarian = xyes])
213

214
AS_IF([test "x$glib_have_carbon" = "xyes"], [
215
  AC_DEFINE(HAVE_CARBON, 1, [define to 1 if Carbon is available])
216
  LDFLAGS="$LDFLAGS -Wl,-framework,Carbon"
217
])
218

219 220
if test "x$glib_have_cocoa" = "xyes"; then
  AC_DEFINE(HAVE_COCOA, 1, [define to 1 if Cocoa is available])
221
  LDFLAGS="$LDFLAGS -Wl,-framework,Foundation"
222 223
fi

224
dnl declare --enable-* args and collect ac_help strings
225
AC_ARG_ENABLE(debug,
226
              AS_HELP_STRING([--enable-debug=@<:@no/minimum/yes@:>@],
227 228 229 230
                             [turn on debugging @<:@default=glib_debug_default@:>@]),,
              enable_debug=glib_debug_default)

AC_ARG_ENABLE(gc_friendly,
231
              [AS_HELP_STRING([--enable-gc-friendly],
232 233 234
                              [turn on garbage collector friendliness [default=no]])],,
              [enable_gc_friendly=no])
AC_ARG_ENABLE(mem_pools,
235
              [AS_HELP_STRING([--disable-mem-pools],
236 237 238
			      [disable all glib memory pools])],,
	      [disable_mem_pools=no])
AC_ARG_ENABLE(rebuilds,
239
              [AS_HELP_STRING([--disable-rebuilds],
240 241
                              [disable all source autogeneration rules])],,
              [enable_rebuilds=yes])
242 243

GLIB_TESTS
244

245
AC_MSG_CHECKING([whether to enable garbage collector friendliness])
246
AS_IF([test "x$enable_gc_friendly" = "xyes"], [
247
  AC_DEFINE(ENABLE_GC_FRIENDLY_DEFAULT, 1, [Whether to enable GC friendliness by default])
248
  AC_MSG_RESULT([yes])
249
], [ AC_MSG_RESULT([no]) ])
250

251
AC_MSG_CHECKING([whether to disable memory pools])
252
AS_IF([test "x$disable_mem_pools" = "xno"], [
253
  AC_MSG_RESULT([no])
254
], [
255 256
  AC_DEFINE(DISABLE_MEM_POOLS, [1], [Whether to disable memory pools])
  AC_MSG_RESULT([yes])
257
])
258

259 260 261
dnl location to install runtime libraries, e.g. ../../lib to install
dnl to /lib if libdir is /usr/lib
AC_ARG_WITH(runtime-libdir,
262
           [AS_HELP_STRING([--with-runtime-libdir=RELPATH],
Matthias Clasen's avatar
Matthias Clasen committed
263
                           [install runtime libraries relative to libdir])],
264 265
           [],
	   [with_runtime_libdir=""])
266 267
GLIB_RUNTIME_LIBDIR="$with_runtime_libdir"
ABS_GLIB_RUNTIME_LIBDIR="`readlink -f $libdir/$with_runtime_libdir`"
268
AC_SUBST(GLIB_RUNTIME_LIBDIR)
269
AC_SUBST(ABS_GLIB_RUNTIME_LIBDIR)
270 271
AM_CONDITIONAL(HAVE_GLIB_RUNTIME_LIBDIR, [test "x$with_runtime_libdir" != "x"])

272
dnl Check for a working C++ compiler, but do not bail out, if none is found.
273
AC_CHECK_TOOLS(CXX, [$CCC c++ g++ gcc CC cxx cc++ cl], [gcc])
274 275 276
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE(,[class a { int b; } c;], ,CXX=)
277
AM_CONDITIONAL(HAVE_CXX, [test "$CXX" != ""])
278
AC_LANG_RESTORE
Owen Taylor's avatar
Owen Taylor committed
279

Matthias Clasen's avatar
Matthias Clasen committed
280
AM_PROG_CC_C_O
281 282
AC_PROG_INSTALL

Owen Taylor's avatar
Owen Taylor committed
283 284
AC_SYS_LARGEFILE

285
PKG_PROG_PKG_CONFIG(0.16)
286

287 288 289 290 291 292 293 294 295
if test "x$enable_debug" = "xyes"; then
  if test x$cflags_set != xset ; then
      case " $CFLAGS " in
      *[[\ \	]]-g[[\ \	]]*) ;;
      *) CFLAGS="$CFLAGS -g" ;;
      esac
  fi
  GLIB_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
else
296 297
  GLIB_DEBUG_FLAGS="-DG_DISABLE_CAST_CHECKS"

298
  if test "x$enable_debug" = "xno"; then
299
    GLIB_DEBUG_FLAGS="$GLIB_DEBUG_FLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
300 301 302
  fi
fi

303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326
# Ensure MSVC-compatible struct packing convention is used when
# compiling for Win32 with gcc.
# What flag to depends on gcc version: gcc3 uses "-mms-bitfields", while
# gcc2 uses "-fnative-struct".
if test x"$glib_native_win32" = xyes; then
  if test x"$GCC" = xyes; then
    msnative_struct=''
    AC_MSG_CHECKING([how to get MSVC-compatible struct packing])
    if test -z "$ac_cv_prog_CC"; then
      our_gcc="$CC"
    else
      our_gcc="$ac_cv_prog_CC"
    fi
    case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in
      2.)
	if $our_gcc -v --help 2>/dev/null | grep fnative-struct >/dev/null; then
	  msnative_struct='-fnative-struct'
	fi
	;;
      *)
	if $our_gcc -v --help 2>/dev/null | grep ms-bitfields >/dev/null; then
	  msnative_struct='-mms-bitfields'
	fi
	;;
327
    esac
328 329 330 331 332 333 334
    if test x"$msnative_struct" = x ; then
      AC_MSG_RESULT([no way])
      AC_MSG_WARN([produced libraries might be incompatible with MSVC-compiled code])
    else
      CFLAGS="$CFLAGS $msnative_struct"
      AC_MSG_RESULT([${msnative_struct}])
    fi
335 336
  fi
fi
337 338
GLIB_EXTRA_CFLAGS="${msnative_struct}"
AC_SUBST(GLIB_EXTRA_CFLAGS)
339

340 341
AC_EXEEXT

342 343 344
# define a MAINT-like variable REBUILD which is set if Perl
# and awk are found, so autogenerated sources can be rebuilt
AC_PROG_AWK
345
AC_CHECK_PROGS(PERL, [perl5 perl])
346 347 348 349 350 351 352 353 354 355 356
# We would like indent, but don't require it.
AC_CHECK_PROG(INDENT, indent, indent)
REBUILD=\#
if test "x$enable_rebuilds" = "xyes" && \
     test -n "$PERL" && \
     $PERL -e 'exit !($] >= 5.002)' > /dev/null 2>&1 && \
     test -n "$AWK" ; then
  REBUILD=
fi
AC_SUBST(REBUILD)

357 358 359
# Need full path to Perl for glib-mkenums
#
if test "x$PERL" != x ; then
360
  AC_PATH_PROG(PERL_PATH, [$PERL])
361 362
fi
if test "x$PERL_PATH" = x ; then
363 364 365
  PERL_PATH="/usr/bin/env perl"
fi
AC_SUBST(PERL_PATH)
Owen Taylor's avatar
Owen Taylor committed
366

367 368 369 370 371 372 373 374 375 376
# option to specify python interpreter to use; this just sets $PYTHON, so that
# we will fallback to reading $PYTHON if --with-python is not given, and
# python.m4 will get the expected input
AC_ARG_WITH(python,
            AS_HELP_STRING([--with-python=PATH],
                           [Path to Python interpreter; searches $PATH if only a program name is given; if not given, searches for a few standard names such as "python3" or "python2"]),
            [PYTHON="$withval"], [])
if test x"$PYTHON" = xyes; then
  AC_MSG_ERROR([--with-python option requires a path or program argument])
fi
377
AM_PATH_PYTHON(2.5,,PYTHON="/usr/bin/env python2.5")
378 379


380 381 382 383 384 385
dnl ***********************
dnl *** Tests for iconv ***
dnl ***********************
dnl
dnl We do this before the gettext checks, to avoid distortion

386
dnl On Windows we use a native implementation
387

388
AS_IF([ test x"$glib_native_win32" = xyes], [
389
  with_libiconv=native
390
], [
391
  AC_ARG_WITH(libiconv,
392
	      [AS_HELP_STRING([--with-libiconv=@<:@no/gnu/native@:>@],
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413
			      [use the libiconv library])],,
	      [with_libiconv=maybe])

  found_iconv=no
  case $with_libiconv in
    maybe)
      # Check in the C library first
      AC_CHECK_FUNC(iconv_open, [with_libiconv=no; found_iconv=yes])
      # Check if we have GNU libiconv
      if test $found_iconv = "no"; then
	AC_CHECK_LIB(iconv, libiconv_open, [with_libiconv=gnu; found_iconv=yes])
      fi
      # Check if we have a iconv in -liconv, possibly from vendor
      if test $found_iconv = "no"; then
	AC_CHECK_LIB(iconv, iconv_open, [with_libiconv=native; found_iconv=yes])
      fi
      ;;
    no)
      AC_CHECK_FUNC(iconv_open, [with_libiconv=no; found_iconv=yes])
      ;;
    gnu|yes)
414
      AC_CHECK_LIB(iconv, libiconv_open, [with_libiconv=gnu; found_iconv=yes])
415 416
      ;;
    native)
417
      AC_CHECK_LIB(iconv, iconv_open, [with_libiconv=native; found_iconv=yes])
418 419
      ;;
  esac
420

421 422 423
  if test "x$found_iconv" = "xno" ; then
     AC_MSG_ERROR([*** No iconv() implementation found in C library or libiconv])
  fi
424
])
425

426 427 428
dnl
dnl zlib support
dnl
429
PKG_CHECK_MODULES([ZLIB], [zlib], [found_zlib=yes], [found_zlib=no])
430
AS_IF([test "x$found_zlib" = "xno"], [
431 432 433 434 435 436
  AC_CHECK_LIB(z, inflate, [AC_CHECK_HEADER(zlib.h, found_zlib=yes)])
  if test "x$found_zlib" = "xno" ; then
    AC_MSG_ERROR([*** Working zlib library and headers not found ***])
  fi
  ZLIB_LIBS='-lz'
  AC_SUBST(ZLIB_LIBS)
437
])
438

439 440 441 442
PKG_CHECK_MODULES(LIBFFI, [libffi >= 3.0.0])
AC_SUBST(LIBFFI_CFLAGS)
AC_SUBST(LIBFFI_LIBS)

Owen Taylor's avatar
Owen Taylor committed
443 444 445
dnl
dnl gettext support
dnl
446 447 448 449 450 451 452 453 454 455 456

ALL_LINGUAS="`grep -v '^#' "$srcdir/po/LINGUAS" | tr '\n' ' '`"
AC_SUBST([CONFIG_STATUS_DEPENDENCIES],['$(top_srcdir)/po/LINGUAS'])
GLIB_GNU_GETTEXT

if test "$gt_cv_have_gettext" != "yes" ; then
  AC_MSG_ERROR([
*** You must have either have gettext support in your C library, or use the 
*** GNU gettext library. (http://www.gnu.org/software/gettext/gettext.html
])
fi
457

458
LIBS="$INTLLIBS $LIBS"
Owen Taylor's avatar
Owen Taylor committed
459 460 461

GETTEXT_PACKAGE=glib20
AC_SUBST(GETTEXT_PACKAGE)
462
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, ["$GETTEXT_PACKAGE"], 
463
  [Define the gettext package to be used])
Owen Taylor's avatar
Owen Taylor committed
464

465 466
GLIB_DEFINE_LOCALEDIR(GLIB_LOCALE_DIR)

467 468 469 470
dnl
dnl Now we are done with gettext checks, figure out ICONV_LIBS
dnl

471
AS_IF([test x"$glib_native_win32" != xyes], [
472 473 474 475 476 477
  if test x$with_libiconv != xno ; then
    case " $INTLLIBS " in
    *[[\ \	]]-liconv[[\ \	]]*) ;;
    *) ICONV_LIBS="-liconv" ;;
    esac
  fi
478
])
479 480 481 482
AC_SUBST(ICONV_LIBS)

case $with_libiconv in
  gnu)
483
    AC_DEFINE(USE_LIBICONV_GNU, 1, [Using GNU libiconv])
484 485
    ;;
  native)
486
    AC_DEFINE(USE_LIBICONV_NATIVE, 1, [Using a native implementation of iconv in a separate library])
487 488 489
    ;;
esac

490
dnl Initialize libtool
491 492
LT_PREREQ([2.2])
LT_INIT([disable-static win32-dll])
493 494 495
dnl when using libtool 2.x create libtool early, because it's used in configure
m4_ifdef([LT_OUTPUT], [LT_OUTPUT])

496

497
AS_IF([test "$glib_native_win32" = "yes"], [
498 499 500 501 502
  if test x$enable_static = xyes -a x$enable_shared = xyes; then
    AC_MSG_ERROR([Can not build both shared and static at the same time on Windows.])
  fi
  if test x$enable_static = xyes; then
    glib_win32_static_compilation=yes
503 504
    GLIB_WIN32_STATIC_COMPILATION_DEFINE="#define GLIB_STATIC_COMPILATION 1
#define GOBJECT_STATIC_COMPILATION 1"
505
    AC_SUBST(GLIB_WIN32_STATIC_COMPILATION_DEFINE)
506
  fi
507
])
508
AM_CONDITIONAL(OS_WIN32_AND_DLL_COMPILATION, [test x$glib_native_win32 = xyes -a x$glib_win32_static_compilation != xyes])
509

510 511
# Checks for library functions.
AC_FUNC_VPRINTF
512
AC_FUNC_ALLOCA
513
AC_CHECK_FUNCS(mmap posix_memalign memalign valloc fsync pipe2 issetugid)
514 515
AC_CHECK_FUNCS(atexit on_exit timegm gmtime_r)

516 517 518 519 520 521 522 523 524 525 526
AC_CACHE_CHECK([for __libc_enable_secure], glib_cv_have_libc_enable_secure,
  [AC_TRY_LINK([#include <unistd.h>
    extern int __libc_enable_secure;],
    [return __libc_enable_secure;],
   glib_cv_have_libc_enable_secure=yes,
   glib_cv_have_libc_enable_secure=no)])
AS_IF([test x$glib_cv_have_libc_enable_secure = xyes], [
   AC_DEFINE(HAVE_LIBC_ENABLE_SECURE, 1,
     [Define if you have the __libc_enable_secure variable (GNU libc, eglibc)])
])

527 528 529 530 531 532
AC_CHECK_SIZEOF(char)
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(void *)
AC_CHECK_SIZEOF(long long)
533
AC_CHECK_SIZEOF(__int64)
534

535 536 537 538 539 540 541 542 543 544 545 546
AC_CACHE_CHECK([for sig_atomic_t], ac_cv_type_sig_atomic_t,
  [AC_TRY_LINK([#include <signal.h>
     #include <sys/types.h>
     sig_atomic_t val = 42;],
    [return val == 42 ? 0 : 1],
   ac_cv_type_sig_atomic_t=yes,
   ac_cv_type_sig_atomic_t=no)])
if test x$ac_cv_type_sig_atomic_t = xyes; then
   AC_DEFINE(HAVE_SIG_ATOMIC_T, 1,
     [Define if you have the 'sig_atomic_t' type.])
fi

547
if test x$ac_cv_sizeof_long = x8 || test x$ac_cv_sizeof_long_long = x8 || test x$ac_cv_sizeof___int64 = x8 ; then
548 549 550 551 552 553 554 555
  :
else
  AC_MSG_ERROR([
*** GLib requires a 64 bit type. You might want to consider
*** using the GNU C compiler.
])
fi

556
AS_IF([test x$glib_native_win32 != xyes && test x$ac_cv_sizeof_long_long = x8], [
557
	# long long is a 64 bit integer.
558
	AC_MSG_CHECKING(for format to printf and scanf a guint64)
559
	AC_CACHE_VAL(glib_cv_long_long_format,[
560
		for format in ll q I64; do
561
		  AC_TRY_RUN([#include <stdio.h>  
562 563 564 565
			int main()
			{
			  long long b, a = -0x3AFAFAFAFAFAFAFALL;
			  char buffer[1000];
566 567
			  sprintf (buffer, "%${format}u", a);
  			  sscanf (buffer, "%${format}u", &b);
568 569 570
			  exit (b!=a);
			}
			],
571 572 573
			[glib_cv_long_long_format=${format}
			break],
			[],[:])
574
		done])
575
	AS_IF([ test -n "$glib_cv_long_long_format"], [
576
	  AC_MSG_RESULT(%${glib_cv_long_long_format}u)
577
	  AC_DEFINE(HAVE_LONG_LONG_FORMAT,1,[define if system printf can print long long])
578 579
	  if test x"$glib_cv_long_long_format" = xI64; then
	    AC_DEFINE(HAVE_INT64_AND_I64,1,[define to support printing 64-bit integers with format I64])
580 581 582
          fi
	], [AC_MSG_RESULT(none)])
],[ test x$ac_cv_sizeof___int64 = x8], [
583
	# __int64 is a 64 bit integer.
584
	AC_MSG_CHECKING(for format to printf and scanf a guint64)
585
	# We know this is MSVCRT.DLL, and what the formats are
586 587
	glib_cv_long_long_format=I64
	AC_MSG_RESULT(%${glib_cv_long_long_format}u)
588
        AC_DEFINE(HAVE_LONG_LONG_FORMAT,1,[define if system printf can print long long])
589
	AC_DEFINE(HAVE_INT64_AND_I64,1,[define to support printing 64-bit integers with format I64])
590
])
591 592 593

AC_C_CONST

594 595 596 597 598 599 600 601 602 603 604 605 606 607 608
dnl
dnl check in which direction the stack grows
dnl
AC_CACHE_CHECK([for growing stack pointer],glib_cv_stack_grows,[
        AC_TRY_RUN([
	volatile int *a = 0, *b = 0;
	void foo (void);
	int main () { volatile int y = 7; a = &y; foo (); return b > a; }
	void foo (void) { volatile int x = 5; b = &x; }
       	],
	glib_cv_stack_grows=no
        ,
	glib_cv_stack_grows=yes
        ,)
])
609

610 611 612
dnl AC_C_INLINE is useless to us since it bails out too early, we need to
dnl truely know which ones of `inline', `__inline' and `__inline__' are
dnl actually supported.
613
AC_CACHE_CHECK([for __inline],glib_cv_has__inline,[
Dan Winship's avatar
Dan Winship committed
614
        AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
615 616
	__inline int foo () { return 0; }
	int main () { return foo (); }
Dan Winship's avatar
Dan Winship committed
617
	]])],
618 619 620 621 622 623
	glib_cv_has__inline=yes
        ,
	glib_cv_has__inline=no
        ,)
])
case x$glib_cv_has__inline in
624
xyes) AC_DEFINE(G_HAVE___INLINE,1,[Have __inline keyword])
625
esac
626
AC_CACHE_CHECK([for __inline__],glib_cv_has__inline__,[
Dan Winship's avatar
Dan Winship committed
627
        AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
628 629
	__inline__ int foo () { return 0; }
	int main () { return foo (); }
Dan Winship's avatar
Dan Winship committed
630
	]])],
631 632 633 634 635 636
	glib_cv_has__inline__=yes
        ,
	glib_cv_has__inline__=no
        ,)
])
case x$glib_cv_has__inline__ in
637
xyes) AC_DEFINE(G_HAVE___INLINE__,1,[Have __inline__ keyword])
638
esac
639
AC_CACHE_CHECK([for inline], glib_cv_hasinline,[
Dan Winship's avatar
Dan Winship committed
640
        AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
641
	#undef inline
642 643
	inline int foo () { return 0; }
	int main () { return foo (); }
Dan Winship's avatar
Dan Winship committed
644
	]])],
645 646 647 648 649 650
	glib_cv_hasinline=yes
        ,
	glib_cv_hasinline=no
        ,)
])
case x$glib_cv_hasinline in
651
xyes) AC_DEFINE(G_HAVE_INLINE,1,[Have inline keyword])
652 653
esac

654 655
# if we can use inline functions in headers
AC_MSG_CHECKING(if inline functions in headers work)
Dan Winship's avatar
Dan Winship committed
656
AC_LINK_IFELSE([AC_LANG_SOURCE([[
657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678
#if defined (G_HAVE_INLINE) && defined (__GNUC__) && defined (__STRICT_ANSI__)
#  undef inline
#  define inline __inline__
#elif !defined (G_HAVE_INLINE)
#  undef inline
#  if defined (G_HAVE___INLINE__)
#    define inline __inline__
#  elif defined (G_HAVE___INLINE)
#    define inline __inline
#  endif
#endif

int glib_test_func2 (int);

static inline int
glib_test_func1 (void) {
  return glib_test_func2 (1);
}

int
main (void) {
  int i = 1;
Dan Winship's avatar
Dan Winship committed
679
}]])],[g_can_inline=yes],[g_can_inline=no])
680 681
AC_MSG_RESULT($g_can_inline)

682
dnl *** check for working do while(0) macros ***
683
AC_CACHE_CHECK([for working do while(0) macros], g_cv_support_dowhile_macros, [
684 685 686 687 688
	AC_TRY_COMPILE([],[
	#define STMT_START do
	#define STMT_END while(0)
	#define STMT_TEST STMT_START { i = 0; } STMT_END
	int main(void) { int i = 1; STMT_TEST; return i; }],
689 690 691
	[g_cv_support_dowhile_macros=yes],
	[g_cv_support_dowhile_macros=no],
	[g_cv_support_dowhile_macros=yes])
692
])
693
if test x$g_cv_support_dowhile_macros = xyes; then
694 695 696
  AC_DEFINE(HAVE_DOWHILE_MACROS, 1, [define for working do while(0) macros])
fi

697
# check for flavours of varargs macros
698
AC_MSG_CHECKING(for ISO C99 varargs macros in C)
699 700 701 702
AC_TRY_COMPILE([],[
int a(int p1, int p2, int p3);
#define call_a(...) a(1,__VA_ARGS__)
call_a(2,3);
703 704 705 706
],g_have_iso_c_varargs=yes,g_have_iso_c_varargs=no)
AC_MSG_RESULT($g_have_iso_c_varargs)

AC_MSG_CHECKING(for ISO C99 varargs macros in C++)
707
AS_IF([test "$CXX" = ""], [
708 709 710 711 712 713 714 715 716 717
dnl No C++ compiler
  g_have_iso_cxx_varargs=no
else
  AC_LANG_CPLUSPLUS
  AC_TRY_COMPILE([],[
int a(int p1, int p2, int p3);
#define call_a(...) a(1,__VA_ARGS__)
call_a(2,3);
],g_have_iso_cxx_varargs=yes,g_have_iso_cxx_varargs=no)
  AC_LANG_C
718
])
719
AC_MSG_RESULT($g_have_iso_cxx_varargs)
720 721 722 723 724 725 726 727 728

AC_MSG_CHECKING(for GNUC varargs macros)
AC_TRY_COMPILE([],[
int a(int p1, int p2, int p3);
#define call_a(params...) a(1,params)
call_a(2,3);
],g_have_gnuc_varargs=yes,g_have_gnuc_varargs=no)
AC_MSG_RESULT($g_have_gnuc_varargs)

729 730
# check for GNUC visibility support
AC_MSG_CHECKING(for GNUC visibility attribute)
Dan Winship's avatar
Dan Winship committed
731
GLIB_CHECK_COMPILE_WARNINGS([AC_LANG_SOURCE([[
732 733
void
__attribute__ ((visibility ("hidden")))
734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749
     f_hidden (void)
{
}
void
__attribute__ ((visibility ("internal")))
     f_internal (void)
{
}
void
__attribute__ ((visibility ("protected")))
     f_protected (void)
{
}
void
__attribute__ ((visibility ("default")))
     f_default (void)
750 751
{
}
752
int main (void)
753
{
754 755 756 757
	f_hidden();
	f_internal();
	f_protected();
	f_default();
758 759
	return 0;
}
Dan Winship's avatar
Dan Winship committed
760
]])],g_have_gnuc_visibility=yes,g_have_gnuc_visibility=no)
761
AC_MSG_RESULT($g_have_gnuc_visibility)
762
AM_CONDITIONAL(HAVE_GNUC_VISIBILITY, [test x$g_have_gnuc_visibility = xyes])
763

764 765 766 767 768 769 770 771 772
AC_MSG_CHECKING([whether using Sun Studio C compiler])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if defined(__SUNPRO_C) || (__SUNPRO_C >= 0x550)
#else
# include "error: this is not Sun Studio."
#endif
]], [[]])], [ g_have_sunstudio_visibility=yes ], [ g_have_sunstudio_visibility=no ])
AC_MSG_RESULT($g_have_sunstudio_visibility)
AM_CONDITIONAL(HAVE_SUNSTUDIO_VISIBILITY, [test x$g_have_sunstudio_visibility = xyes])

773 774
# check for bytesex stuff
AC_C_BIGENDIAN
Matthias Clasen's avatar
Matthias Clasen committed
775 776 777 778 779 780 781 782 783 784 785 786 787 788
if test x$ac_cv_c_bigendian = xuniversal ; then
AC_TRY_COMPILE([#include <endian.h>], [#if __BYTE_ORDER == __BIG_ENDIAN
#else
#error Not a big endian. 
#endif],
    ac_cv_c_bigendian=yes
    ,AC_TRY_COMPILE([#include <endian.h>], [#if __BYTE_ORDER == __LITTLE_ENDIAN
#else
#error Not a little endian. 
#endif],
    ac_cv_c_bigendian=no
    ,AC_MSG_WARN([Could not determine endianness.])))
fi

789

Tim Janik's avatar
Tim Janik committed
790
# check for header files
791
AC_CHECK_HEADERS([dirent.h float.h limits.h pwd.h grp.h sys/param.h sys/poll.h sys/resource.h])
792
AC_CHECK_HEADERS([sys/time.h sys/times.h sys/wait.h unistd.h values.h])
Matthias Clasen's avatar
Matthias Clasen committed
793
AC_CHECK_HEADERS([sys/select.h sys/types.h stdint.h inttypes.h sched.h malloc.h])
794
AC_CHECK_HEADERS([sys/vfs.h sys/vmount.h sys/statfs.h sys/statvfs.h sys/filio.h])
795
AC_CHECK_HEADERS([mntent.h sys/mnttab.h sys/vfstab.h sys/mntctl.h fstab.h])
796
AC_CHECK_HEADERS([sys/uio.h])
797
AC_CHECK_HEADERS([linux/magic.h])
798
AC_CHECK_HEADERS([sys/prctl.h])
799

800 801 802 803 804
AC_CHECK_HEADERS([sys/mount.h sys/sysctl.h], [], [],
[#if HAVE_SYS_PARAM_H
 #include <sys/param.h>
 #endif
])
805
AC_CHECK_FUNCS(sysctlbyname)
806

807
AC_HEADER_MAJOR
808 809
AC_CHECK_HEADERS([xlocale.h])

810 811
# check for structure fields
AC_CHECK_MEMBERS([struct stat.st_mtimensec, struct stat.st_mtim.tv_nsec, struct stat.st_atimensec, struct stat.st_atim.tv_nsec, struct stat.st_ctimensec, struct stat.st_ctim.tv_nsec])
812
AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_blocks, struct statfs.f_fstypename, struct statfs.f_bavail],,, [#include <sys/types.h>
Matthias Clasen's avatar
Matthias Clasen committed
813 814
#include <sys/stat.h>
#include <unistd.h>
815
#ifdef HAVE_SYS_STATFS_H
816
#include <sys/statfs.h>
817
#endif
818
#ifdef HAVE_SYS_PARAM_H
819 820
#include <sys/param.h>
#endif
821
#ifdef HAVE_SYS_MOUNT_H
822 823
#include <sys/mount.h>
#endif])
824 825
# struct statvfs.f_basetype is available on Solaris but not for Linux. 
AC_CHECK_MEMBERS([struct statvfs.f_basetype],,, [#include <sys/statvfs.h>])
Patrick Welche's avatar
Patrick Welche committed
826
AC_CHECK_MEMBERS([struct statvfs.f_fstypename],,, [#include <sys/statvfs.h>])
827
AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.__tm_gmtoff],,,[#include <time.h>])
828

829 830
AC_STRUCT_DIRENT_D_TYPE

831
# Checks for libcharset
832
AM_LANGINFO_CODESET
833 834
AC_CHECK_HEADERS([stddef.h stdlib.h string.h])
AC_CHECK_FUNCS(setlocale)
835
gl_GLIBC21
836

837
# check additional type sizes
838
AC_CHECK_SIZEOF(size_t)
839

840
dnl Try to figure out whether gsize should be long or int
841 842
AC_MSG_CHECKING([for the appropriate definition for size_t])

843
case $ac_cv_sizeof_size_t in
844 845 846 847 848 849 850 851 852
  $ac_cv_sizeof_short) 
      glib_size_type=short
      ;;
  $ac_cv_sizeof_int) 
      glib_size_type=int
      ;;
  $ac_cv_sizeof_long) 
      glib_size_type=long
      ;;
853 854 855 856 857 858
  $ac_cv_sizeof_long_long)
      glib_size_type='long long'
      ;;
  $ac_cv_sizeof__int64)
      glib_size_type='__int64'
      ;;
859 860 861 862 863 864 865 866
  *)  AC_MSG_ERROR([No type matching size_t in size])
      ;;
esac

dnl If int/long are the same size, we see which one produces
dnl warnings when used in the location as size_t. (This matters
dnl on AIX with xlc)
dnl
867 868
AS_IF([test $ac_cv_sizeof_size_t = $ac_cv_sizeof_int &&
       test $ac_cv_sizeof_size_t = $ac_cv_sizeof_long], [
Dan Winship's avatar
Dan Winship committed
869
  GLIB_CHECK_COMPILE_WARNINGS([AC_LANG_SOURCE([[
870
#if defined(_AIX) && !defined(__GNUC__)
871 872
#pragma options langlvl=stdc89
#endif
873 874 875 876 877 878 879
#include <stddef.h> 
int main ()
{
  size_t s = 1;
  unsigned int *size_int = &s;
  return (int)*size_int;
}
Dan Winship's avatar
Dan Winship committed
880 881
    ]])],glib_size_type=int,
      [GLIB_CHECK_COMPILE_WARNINGS([AC_LANG_SOURCE([[
Matthias Clasen's avatar
Matthias Clasen committed
882
#if defined(_AIX) && !defined(__GNUC__)
883 884
#pragma options langlvl=stdc89
#endif
885 886 887 888 889 890 891
#include <stddef.h> 
int main ()
{
   size_t s = 1;
   unsigned long *size_long = &s;
   return (int)*size_long;
}
Dan Winship's avatar
Dan Winship committed
892
        ]])],glib_size_type=long)])
893
])
894 895 896

AC_MSG_RESULT(unsigned $glib_size_type)

897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979
AC_CHECK_SIZEOF(ssize_t)

dnl Try to figure out whether gssize should be long or int
AC_MSG_CHECKING([for the appropriate definition for ssize_t])

case $ac_cv_sizeof_ssize_t in
  $ac_cv_sizeof_short) 
      glib_ssize_type=short
      ;;
  $ac_cv_sizeof_int) 
      glib_ssize_type=int
      ;;
  $ac_cv_sizeof_long) 
      glib_ssize_type=long
      ;;
  $ac_cv_sizeof_long_long)
      glib_ssize_type='long long'
      ;;
  $ac_cv_sizeof__int64)
      glib_ssize_type='__int64'
      ;;
  *)  AC_MSG_ERROR([No type matching ssize_t in size])
      ;;
esac

dnl If int/long are the same size, we see which one produces
dnl warnings when used in the location as ssize_t. (This matters
dnl on Android where ssize_t is long and size_t is unsigned int)
dnl
AS_IF([test $ac_cv_sizeof_ssize_t = $ac_cv_sizeof_int &&
       test $ac_cv_sizeof_ssize_t = $ac_cv_sizeof_long], [
  GLIB_CHECK_COMPILE_WARNINGS([AC_LANG_SOURCE([[
#if defined(_AIX) && !defined(__GNUC__)
#pragma options langlvl=stdc89
#endif
#include <stddef.h>
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#ifdef HAVE_STDINT_H
# include <stdint.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
int main ()
{
  ssize_t s = 1;
  int *size_int = &s;
  return (int)*size_int;
}
    ]])],glib_ssize_type=int,
      [GLIB_CHECK_COMPILE_WARNINGS([AC_LANG_SOURCE([[
#if defined(_AIX) && !defined(__GNUC__)
#pragma options langlvl=stdc89
#endif
#include <stddef.h> 
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#ifdef HAVE_STDINT_H
# include <stdint.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
int main ()
{
   ssize_t s = 1;
   long *size_long = &s;
   return (int)*size_long;
}
        ]])],glib_ssize_type=long)])
])

AC_MSG_RESULT($glib_ssize_type)

980
# Check for some functions
981
AC_CHECK_FUNCS(lstat strerror strsignal memmove vsnprintf stpcpy strcasecmp strncasecmp poll getcwd vasprintf setenv unsetenv getc_unlocked readlink symlink fdwalk memmem)
982
AC_CHECK_FUNCS(chown lchmod lchown fchmod fchown link utimes getgrgid getpwuid getresuid)
983
AC_CHECK_FUNCS(getmntent_r setmntent endmntent hasmntopt getfsstat getvfsstat fallocate)
984
# Check for high-resolution sleep functions
985
case $host_os in aix*) ac_cv_func_splice=no ;; esac # AIX splice() is something else
986
AC_CHECK_FUNCS(splice)
987
AC_CHECK_FUNCS(prlimit)
988

989 990 991
# To avoid finding a compatibility unusable statfs, which typically
# successfully compiles, but warns to use the newer statvfs interface:
AS_IF([test $ac_cv_header_sys_statvfs_h = yes], [AC_CHECK_FUNCS([statvfs])])
Patrick Welche's avatar
Patrick Welche committed
992
AS_IF([test $ac_cv_header_sys_statfs_h  = yes -o $ac_cv_header_sys_mount_h = yes], [AC_CHECK_FUNCS([statfs])])
993 994 995

AC_MSG_CHECKING([whether to use statfs or statvfs])
# Some systems have both statfs and statvfs, pick the most "native" for these
996
AS_IF([test x$ac_cv_func_statfs = xyes && test x$ac_cv_func_statvfs = xyes],
997 998
   [
   # on solaris and irix, statfs doesn't even have the f_bavail field
999
   AS_IF([test x$ac_cv_member_struct_statfs_f_bavail = xno],
1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016
      [ac_cv_func_statfs=no],
   # else, at least on linux, statfs is the actual syscall
      [ac_cv_func_statvfs=no])
   ])

AS_IF([test x$ac_cv_func_statfs = xyes],
      [
         AC_DEFINE([USE_STATFS], [1], [Define to use statfs()])
         AC_MSG_RESULT([statfs])
      ],
      [test x$ac_cv_func_statvfs = xyes],
      [
         AC_DEFINE([USE_STATVFS], [1], [Define to use statvfs()])
         AC_MSG_RESULT([statvfs])
      ],
      [  AC_MSG_RESULT([neither])])

1017
AC_CHECK_HEADERS(crt_externs.h)
1018
AC_CHECK_FUNCS(_NSGetEnviron)
1019

1020 1021
AC_CHECK_FUNCS(newlocale uselocale strtod_l strtoll_l strtoull_l)

1022
AC_FUNC_VSNPRINTF_C99
1023 1024
AC_FUNC_PRINTF_UNIX98

1025 1026 1027 1028 1029 1030 1031
# Internet address families
if test $glib_native_win32 = yes; then
  glib_inet_includes=["
#include <winsock2.h>
  "]
else
  glib_inet_includes=["
1032
#include <sys/types.h>
1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045
#include <sys/socket.h>
  "]
fi

glib_failed=false
GLIB_CHECK_VALUE(AF_INET, $glib_inet_includes, glib_failed=true)
GLIB_CHECK_VALUE(AF_INET6, $glib_inet_includes, glib_failed=true)
# winsock defines this even though it doesn't support it
GLIB_CHECK_VALUE(AF_UNIX, $glib_inet_includes, glib_failed=true)
if $glib_failed ; then
  AC_MSG_ERROR([Could not determine values for AF_INET* constants])
fi

1046 1047 1048 1049 1050 1051 1052 1053
glib_failed=false
GLIB_CHECK_VALUE(MSG_PEEK, $glib_inet_includes, glib_failed=true)
GLIB_CHECK_VALUE(MSG_OOB, $glib_inet_includes, glib_failed=true)
GLIB_CHECK_VALUE(MSG_DONTROUTE, $glib_inet_includes, glib_failed=true)
if $glib_failed ; then
  AC_MSG_ERROR([Could not determine values for MSG_* constants])
fi

1054
AC_CHECK_FUNCS(getprotobyname_r endservent if_nametoindex if_indextoname)
Dan Winship's avatar
Dan Winship committed
1055

1056 1057 1058 1059 1060 1061 1062
AS_IF([test $glib_native_win32 = yes], [
  # <wspiapi.h> in the Windows SDK and in mingw-w64 has wrappers for
  # inline workarounds for getaddrinfo, getnameinfo and freeaddrinfo if
  # they aren't present at run-time (on Windows 2000).
  AC_CHECK_HEADER([wspiapi.h], [WSPIAPI_INCLUDE="#include <wspiapi.h>"])
  AC_SUBST(WSPIAPI_INCLUDE)
], [
1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076
  # Android does not have C_IN in public headers, we define it wherever necessary
  AS_IF([test $glib_native_android != yes], [
    AC_MSG_CHECKING([if arpa/nameser_compat.h is needed])
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
                                        #include <arpa/nameser.h>],
                                       [int qclass = C_IN;])],
                      [AC_MSG_RESULT([no])],
                      [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
                                                           #include <arpa/nameser.h>
                                                           #include <arpa/nameser_compat.h>],
                                                          [int qclass = C_IN;])],
                                         [AC_MSG_RESULT([yes])
                                          NAMESER_COMPAT_INCLUDE="#include <arpa/nameser_compat.h>"],
                                         [AC_MSG_ERROR([could not compile test program either way])])])])
1077 1078
  AC_SUBST(NAMESER_COMPAT_INCLUDE)

Dan Winship's avatar
Dan Winship committed
1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108
  # We can't just use AC_CHECK_FUNC/AC_CHECK_LIB here. Bug 586150
  NETWORK_LIBS=""
  AC_MSG_CHECKING([for res_query])
  AC_TRY_LINK([#include <sys/types.h>
	       #include <netinet/in.h>
	       #include <arpa/nameser.h>
	       #include <resolv.h>
              ],[
	       res_query("test", 0, 0, (void *)0, 0);
              ],[AC_MSG_RESULT([yes])],
              [save_libs="$LIBS"
               LIBS="-lresolv $LIBS"
               AC_TRY_LINK([#include <sys/types.h>
			    #include <netinet/in.h>
			    #include <arpa/nameser.h>
			    #include <resolv.h>
			   ],[
			    res_query("test", 0, 0, (void *)0, 0);
			   ],[AC_MSG_RESULT([in -lresolv])
                              NETWORK_LIBS="-lresolv $NETWORK_LIBS"],
                           [LIBS="-lbind $save_libs"
                            AC_TRY_LINK([#include <resolv.h>],
                                        [res_query("test", 0, 0, (void *)0, 0);],
                                        [AC_MSG_RESULT([in -lbind])
                                         NETWORK_LIBS="-lbind $NETWORK_LIBS"],
                                        [AC_MSG_ERROR(not found)])])
               LIBS="$save_libs"])
  AC_CHECK_FUNC(socket, :, AC_CHECK_LIB(socket, socket,
				        [NETWORK_LIBS="-lsocket $NETWORK_LIBS"],
				        [AC_MSG_ERROR(Could not find socket())]))
1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121
  save_libs="$LIBS"
  LIBS="$LIBS $NETWORK_LIBS"
  AC_MSG_CHECKING([for res_init])
  AC_TRY_LINK([#include <sys/types.h>
	       #include <netinet/in.h>
	       #include <arpa/nameser.h>
	       #include <resolv.h>
              ],[
	       res_init();
              ],[AC_MSG_RESULT([yes])
	         AC_DEFINE(HAVE_RES_INIT, 1, [Define to 1 if you have the 'res_init' function.])
	      ],[AC_MSG_RESULT([no])])
  LIBS="$save_libs"
1122
])
1123
AC_SUBST(NETWORK_LIBS)
1124

1125
AC_CHECK_HEADER([linux/netlink.h],
1126 1127
		[AC_DEFINE(HAVE_NETLINK, 1, [We have AF_NETLINK sockets])],,
		[#include <sys/socket.h>])
1128 1129
AM_CONDITIONAL(HAVE_NETLINK, [test "$ac_cv_header_linux_netlink_h" = "yes"])

1130 1131 1132 1133
AC_CHECK_TYPE([struct ip_mreqn], [
              AC_DEFINE(HAVE_IP_MREQN,, [Define if we have struct ip_mreqn])],,
              [#include <netinet/in.h>])

1134 1135 1136 1137 1138 1139 1140 1141
case $host in
  *-*-solaris* )
     AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, Needed to get declarations for msg_control and msg_controllen on Solaris)
     AC_DEFINE(_XOPEN_SOURCE,          2, Needed to get declarations for msg_control and msg_controllen on Solaris)
     AC_DEFINE(__EXTENSIONS__,         1, Needed to get declarations for msg_control and msg_controllen on Solaris)
     ;;
esac

1142 1143 1144
dnl
dnl if statfs() takes 2 arguments (Posix) or 4 (Solaris)
dnl
1145
AS_IF([test "$ac_cv_func_statfs" = yes], [
1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180
  AC_MSG_CHECKING([number of arguments to statfs()])
  AC_TRY_COMPILE([#include <unistd.h>
  #ifdef HAVE_SYS_PARAM_H
  #include <sys/param.h>
  #endif
  #ifdef HAVE_SYS_VFS_H
  #include <sys/vfs.h>
  #endif
  #ifdef HAVE_SYS_MOUNT_H
  #include <sys/mount.h>
  #endif
  #ifdef HAVE_SYS_STATFS_H
  #include <sys/statfs.h>
  #endif], [struct statfs st;
  statfs(NULL, &st);],[
    AC_MSG_RESULT([2])
    AC_DEFINE(STATFS_ARGS, 2, [Number of arguments to statfs()])],[
    AC_TRY_COMPILE([#include <unistd.h>
  #ifdef HAVE_SYS_PARAM_H
  #include <sys/param.h>
  #endif
  #ifdef HAVE_SYS_VFS_H
  #include <sys/vfs.h>
  #endif
  #ifdef HAVE_SYS_MOUNT_H
  #include <sys/mount.h>
  #endif
  #ifdef HAVE_SYS_STATFS_H
  #include <sys/statfs.h>
  #endif], [struct statfs st;
  statfs(NULL, &st, sizeof (st), 0);],[
      AC_MSG_RESULT([4])
      AC_DEFINE(STATFS_ARGS, 4, [Number of arguments to statfs()])],[
      AC_MSG_RESULT(unknown)
      AC_MSG_ERROR([unable to determine number of arguments to statfs()])])])
1181
])
1182

1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194
dnl
dnl open takes O_DIRECTORY as an option
dnl
AC_MSG_CHECKING([open() option O_DIRECTORY])
AC_TRY_COMPILE([#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>],
[open(0, O_DIRECTORY, 0);],[
	AC_MSG_RESULT([yes])
	AC_DEFINE(HAVE_OPEN_O_DIRECTORY, 1, [open option O_DIRECTORY])],[
	AC_MSG_RESULT([no])])

1195
#
1196
# Check whether to use an included printf
1197 1198
#

1199
AC_ARG_ENABLE(included-printf,
1200
              [AS_HELP_STRING([--enable-included-printf],
1201
                              [use included printf [default=auto]])],
1202
              enable_included_printf="$enableval")
1203

1204 1205 1206
need_included_printf=no
if test "x$enable_included_printf" = "xyes" ; then
  need_included_printf=yes
1207 1208
fi
if test "$ac_cv_func_vsnprintf_c99" != "yes" ; then
1209
  need_included_printf=yes
1210 1211
fi
if test "$ac_cv_func_printf_unix98" != "yes" ; then
1212
  need_included_printf=yes
1213
fi
1214 1215
if test "x$ac_cv_sizeof_long_long" = "x8" &&
   test -z "$glib_cv_long_long_format" ; then
1216
  need_included_printf=yes
1217 1218
fi

1219 1220
if test "x$enable_included_printf" = "xno" && 
   test "x$need_included_printf" = "xyes" ; then
1221
  AC_MSG_ERROR([
1222
*** Your C library's printf doesn't appear to have the features that
1223
*** GLib needs, but you specified --enable-included-printf=no.])
1224 1225
fi

1226
enable_included_printf=$need_included_printf
1227

1228
AM_CONDITIONAL(HAVE_GOOD_PRINTF, test "$enable_included_printf" != "yes")
1229
AS_IF([test "$enable_included_printf" != "yes"], [
1230
  AC_DEFINE(HAVE_GOOD_PRINTF,1,[define to use system printf])
1231
], [
1232 1233 1234
  if test -z "$glib_cv_long_long_format" ; then
    glib_cv_long_long_format="ll"
  fi
1235
  AC_DEFINE(HAVE_VASPRINTF,1)
1236
])
1237 1238 1239 1240 1241 1242 1243 1244 1245 1246

# Checks needed for gnulib vasnprintf
bh_C_SIGNED
jm_AC_TYPE_LONG_LONG
gt_TYPE_LONGDOUBLE
gt_TYPE_WCHAR_T
gt_TYPE_WINT_T
AC_TYPE_SIZE_T
AC_CHECK_TYPES(ptrdiff_t)
jm_AC_TYPE_INTMAX_T
Matthias Clasen's avatar
Matthias Clasen committed
1247
AC_CHECK_FUNCS([snprintf wcslen])
1248
AC_FUNC_SNPRINTF_C99
1249

1250 1251
# Check if bcopy can be used for overlapping copies, if memmove isn't found.
# The check is borrowed from the PERL Configure script.
1252
AS_IF([test "$ac_cv_func_memmove" != "yes"], [
1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269
  AC_CACHE_CHECK(whether bcopy can handle overlapping copies,
    glib_cv_working_bcopy,[AC_TRY_RUN([
      int main() {
        char buf[128], abc[128], *b;
        int len, off, align;
        bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
        for (align = 7; align >= 0; align--) {
          for (len = 36; len; len--) {
            b = buf+align; bcopy(abc, b, len);
            for (off = 1; off <= len; off++) {
              bcopy(b, b+off, len); bcopy(b+off, b, len);
                if (bcmp(b, abc, len)) return(1);
            }
          }
        }
        return(0);
      }],glib_cv_working_bcopy=yes,glib_cv_working_bcopy=no)])
1270 1271

  GLIB_ASSERT_SET(glib_cv_working_bcopy)
1272
  if test "$glib_cv_working_bcopy" = "yes"; then
1273
    AC_DEFINE(HAVE_WORKING_BCOPY,1,[Have a working bcopy])
1274
  fi
1275
])
1276 1277 1278 1279 1280

# Check if <sys/select.h> needs to be included for fd_set
AC_MSG_CHECKING([for fd_set])
AC_TRY_COMPILE([#include <sys/types.h>],
        [fd_set readMask, writeMask;], gtk_ok=yes, gtk_ok=no)
1281
AS_IF([test "$gtk_ok" = "yes"], [
1282
    AC_MSG_RESULT([yes, found in sys/types.h])
1283
], [
1284
    AC_EGREP_HEADER(fd_set, sys/select.h, gtk_ok=yes)
1285
    if test "$gtk_ok" = "yes"; then
1286 1287
	# *** FIXME: give it a different name
        AC_DEFINE(HAVE_SYS_SELECT_H,1,[found fd_set in sys/select.h])
1288 1289
        AC_MSG_RESULT([yes, found in sys/select.h])
    else
1290
	AC_DEFINE(NO_FD_SET,1,[didn't find fd_set])
1291 1292
	AC_MSG_RESULT(no)
    fi
1293
])
1294

1295
dnl Check for nl_langinfo and CODESET
1296 1297
AC_LANG_SAVE
AC_LANG_C
1298
AC_CACHE_CHECK([for nl_langinfo (CODESET)],glib_cv_langinfo_codeset,[
1299 1300
        AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <langinfo.h>],
                       [char *codeset = nl_langinfo (CODESET);])],
1301 1302 1303 1304 1305
                [glib_cv_langinfo_codeset=yes],
                [glib_cv_langinfo_codeset=no])])
if test x$glib_cv_langinfo_codeset = xyes; then
  AC_DEFINE(HAVE_CODESET,1,[Have nl_langinfo (CODESET)])
fi
1306

1307 1308
dnl Check for nl_langinfo and LC_TIME parts that are needed in gdatetime.c
AC_CACHE_CHECK([for nl_langinfo (PM_STR)],glib_cv_langinfo_time,[
1309 1310
        AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <langinfo.h>],
                 [char *str;
1311
                 str = nl_langinfo (PM_STR);
1312
                 str = nl_langinfo (D_T_FMT);
1313 1314
                 str = nl_langinfo (D_FMT);
                 str = nl_langinfo (T_FMT);
1315
                 str = nl_langinfo (T_FMT_AMPM);
1316 1317 1318
                 str = nl_langinfo (MON_1);
                 str = nl_langinfo (ABMON_12);
                 str = nl_langinfo (DAY_1);
1319
                 str = nl_langinfo (ABDAY_7);])],
1320 1321 1322 1323 1324 1325
                [glib_cv_langinfo_time=yes],
                [glib_cv_langinfo_time=no])])
if test x$glib_cv_langinfo_time = xyes; then
  AC_DEFINE(HAVE_LANGINFO_TIME,1,[Have nl_langinfo (PM_STR)])
fi

1326 1327
dnl Check for nl_langinfo and _NL_CTYPE_OUTDIGITn_MB
AC_CACHE_CHECK([for nl_langinfo (_NL_CTYPE_OUTDIGITn_MB)], glib_cv_langinfo_outdigit,[
1328
        AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <langinfo.h>],
1329
                [char *str;
1330 1331 1332 1333 1334 1335 1336 1337 1338
                 str = nl_langinfo (_NL_CTYPE_OUTDIGIT0_MB);
                 str = nl_langinfo (_NL_CTYPE_OUTDIGIT1_MB);
                 str = nl_langinfo (_NL_CTYPE_OUTDIGIT2_MB);
                 str = nl_langinfo (_NL_CTYPE_OUTDIGIT3_MB);
                 str = nl_langinfo (_NL_CTYPE_OUTDIGIT4_MB);
                 str = nl_langinfo (_NL_CTYPE_OUTDIGIT5_MB);
                 str = nl_langinfo (_NL_CTYPE_OUTDIGIT6_MB);
                 str = nl_langinfo (_NL_CTYPE_OUTDIGIT7_MB);
                 str = nl_langinfo (_NL_CTYPE_OUTDIGIT8_MB);
1339
                 str = nl_langinfo (_NL_CTYPE_OUTDIGIT9_MB);])],
1340 1341 1342
                [glib_cv_langinfo_outdigit=yes],
                [glib_cv_langinfo_outdigit=no])])
if test x$glib_cv_langinfo_outdigit = xyes; then
1343
  AC_DEFINE(HAVE_LANGINFO_OUTDIGIT,1,[Have nl_langinfo (_NL_CTYPE_OUTDIGITn_MB)])
1344
fi
1345
AC_LANG_RESTORE
1346

1347 1348 1349 1350 1351 1352 1353 1354 1355
dnl ****************************************
dnl *** posix_memalign                   ***
dnl ****************************************
AC_MSG_CHECKING(for a compliant posix_memalign() implementation)
AC_CACHE_VAL(glib_cv_compliant_posix_memalign,[
    glib_cv_compliant_posix_memalign=0
    if test "$ac_cv_func_posix_memalign" = "yes" ; then
	AC_TRY_RUN([
                #define _XOPEN_SOURCE 600
1356 1357
                #include <stdlib.h> /* posix_memalign() should be defined here */
                /* some systems break if #include <malloc.h> used */
1358 1359 1360 1361
		static void test_memalign (size_t boundary, size_t size) {
		    void *mem = 0;
		    if (posix_memalign (&mem, boundary, size) != 0 || !mem)
			exit (1);
1362 1363
                    else
                      free (mem);
1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381
		}
		int main() {
		    test_memalign (  128,   128 - 2 * sizeof (void*));
		    test_memalign (  256,   256 - 2 * sizeof (void*));
		    test_memalign (  512,   512 - 2 * sizeof (void*));
		    test_memalign ( 1024,  1024 - 2 * sizeof (void*));
		    test_memalign ( 2048,  2048 - 2 * sizeof (void*));
		    test_memalign ( 4096,  4096 - 2 * sizeof (void*));
		    test_memalign ( 8192,  8192 - 2 * sizeof (void*));
		    test_memalign (16384, 16384 - 2 * sizeof (void*));
		    test_memalign (32768, 32768 - 2 * sizeof (void*));
		    exit (0); /* success */
		}
		],
	    [glib_cv_compliant_posix_memalign=1], [], [:])
      :
    fi
    ])
1382
AS_IF([test "$glib_cv_compliant_posix_memalign" = "1"], [
1383 1384
    AC_MSG_RESULT(yes)
    AC_DEFINE(POSIX_MEMALIGN_WITH_COMPLIANT_ALLOCS, 1, [define if posix_memalign() can allocate any size])
1385
], [
1386
    AC_MSG_RESULT(no)
1387
])
1388 1389


1390 1391 1392 1393
dnl ****************************************
dnl *** strlcpy/strlcat                  ***
dnl ****************************************
# Check for strlcpy
1394 1395
AC_CACHE_CHECK([for OpenBSD strlcpy/strlcat],glib_cv_have_strlcpy,[
AC_TRY_RUN([#include <stdlib.h>
1396 1397
#include <string.h>
int main() {
1398
  char p[10];
1399 1400
  (void) strlcpy (p, "hi", 10);
  if (strlcat (p, "bye", 0) != 3) 
1401
    return 1;
1402
  return 0;
1403 1404 1405 1406
}], glib_cv_have_strlcpy=yes, 
    glib_cv_have_strlcpy=no,
    glib_cv_have_strlcpy=no)])
if test "$glib_cv_have_strlcpy" = "yes"; then
1407
    AC_DEFINE(HAVE_STRLCPY,1,[Have functions strlcpy and strlcat])
1408
fi
1409
  
1410 1411 1412 1413 1414 1415

dnl **********************
dnl *** va_copy checks ***
dnl **********************
dnl we currently check for all three va_copy possibilities, so we get
dnl all results in config.log for bug reports.
1416
AC_CACHE_CHECK([for an implementation of va_copy()],glib_cv_va_copy,[
Dan Winship's avatar
Dan Winship committed
1417
	AC_LINK_IFELSE([AC_LANG_SOURCE([[#include <stdarg.h>
1418
#include <stdlib.h>
1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429
	void f (int i, ...) {
	va_list args1, args2;
	va_start (args1, i);
	va_copy (args2, args1);
	if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
	  exit (1);
	va_end (args1); va_end (args2);
	}
	int main() {
	  f (0, 42);
	  return 0;
Dan Winship's avatar
Dan Winship committed
1430
	}]])],
1431
	[glib_cv_va_copy=yes],
1432
	[glib_cv_va_copy=no])
1433
])
1434
AC_CACHE_CHECK([for an implementation of __va_copy()],glib_cv___va_copy,[
Dan Winship's avatar
Dan Winship committed
1435
	AC_LINK_IFELSE([AC_LANG_SOURCE([[#include <stdarg.h>
1436
#include <stdlib.h>
1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447
	void f (int i, ...) {
	va_list args1, args2;
	va_start (args1, i);
	__va_copy (args2, args1);
	if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
	  exit (1);
	va_end (args1); va_end (args2);
	}
	int main() {
	  f (0, 42);
	  return 0;
Dan Winship's avatar
Dan Winship committed
1448
	}]])],
1449
	[glib_cv___va_copy=yes],
1450
	[glib_cv___va_copy=no])
1451
])
1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464

if test "x$glib_cv_va_copy" = "xyes"; then
  g_va_copy_func=va_copy
else if test "x$glib_cv___va_copy" = "xyes"; then
  g_va_copy_func=__va_copy
fi
fi

if test -n "$g_va_copy_func"; then
  AC_DEFINE_UNQUOTED(G_VA_COPY,$g_va_copy_func,[A 'va_copy' style function])
fi

AC_CACHE_CHECK([whether va_lists can be copied by value],glib_cv_va_val_copy,[
1465
	AC_TRY_RUN([#include <stdarg.h>
1466
#include <stdlib.h> 
1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478
	void f (int i, ...) {
	va_list args1, args2;
	va_start (args1, i);
	args2 = args1;
	if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
	  exit (1);
	va_end (args1); va_end (args2);
	}
	int main() {
	  f (0, 42);
	  return 0;
	}],
1479 1480
	[glib_cv_va_val_copy=yes],
	[glib_cv_va_val_copy=no],
1481
	[glib_cv_va_val_copy=yes])
1482
])
1483

1484
AS_IF([ test "x$glib_cv_va_val_copy" = "xno"], [
1485
  AC_DEFINE(G_VA_COPY_AS_ARRAY,1, ['va_lists' cannot be copies as values])
1486
])
1487 1488 1489 1490 1491 1492 1493

dnl ***********************
dnl *** g_module checks ***
dnl ***********************
G_MODULE_LIBS=
G_MODULE_LIBS_EXTRA=
G_MODULE_PLUGIN_LIBS=
1494 1495 1496 1497
if test x"$glib_native_win32" = xyes; then
  dnl No use for this on Win32
  G_MODULE_LDFLAGS=
else
1498
  export SED
1499 1500
  G_MODULE_LDFLAGS=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`
fi
1501 1502
dnl G_MODULE_IMPL= don't reset, so cmd-line can override
G_MODULE_NEED_USCORE=0
Tim Janik's avatar
Tim Janik committed
1503
G_MODULE_BROKEN_RTLD_GLOBAL=0
1504
G_MODULE_HAVE_DLERROR=0
1505 1506 1507 1508 1509 1510
dnl *** force native WIN32 shared lib loader 
if test -z "$G_MODULE_IMPL"; then
  case "$host" in
  *-*-mingw*|*-*-cygwin*) G_MODULE_IMPL=G_MODULE_IMPL_WIN32 ;;
  esac
fi
1511 1512 1513 1514 1515 1516 1517
dnl *** force native AIX library loader
dnl *** dlopen() filepath must be of the form /path/libname.a(libname.so)
if test -z "$G_MODULE_IMPL"; then
  case "$host" in
  *-*-aix*) G_MODULE_IMPL=G_MODULE_IMPL_AR ;;
  esac
fi
1518
dnl *** dlopen() and dlsym() in system libraries
1519
AS_IF([ test -z "$G_MODULE_IMPL"], [
1520
	AC_CHECK_FUNC(dlopen,
1521 1522 1523
		      [AC_CHECK_FUNC(dlsym,
			             [G_MODULE_IMPL=G_MODULE_IMPL_DL],[])],
		      [])
1524
])
Owen Taylor's avatar
Owen Taylor committed
1525
dnl *** NSLinkModule (dyld) in system libraries (Darwin)
1526
AS_IF([ test -z "$G_MODULE_IMPL" ], [
Owen Taylor's avatar
Owen Taylor committed
1527 1528 1529 1530
 	AC_CHECK_FUNC(NSLinkModule,
		      [G_MODULE_IMPL=G_MODULE_IMPL_DYLD
		       G_MODULE_NEED_USCORE=1],
		      [])
1531
])
1532
dnl *** dlopen() and dlsym() in libdl
1533
AS_IF([ test -z "$G_MODULE_IMPL"], [
1534
	AC_CHECK_LIB(dl, dlopen,
1535 1536 1537 1538