1dnl aclocal.m4 generated automatically by aclocal 1.4-p5 2 3dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. 4dnl This file is free software; the Free Software Foundation 5dnl gives unlimited permission to copy and/or distribute it, 6dnl with or without modifications, as long as this notice is preserved. 7 8dnl This program is distributed in the hope that it will be useful, 9dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without 10dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A 11dnl PARTICULAR PURPOSE. 12 13# Do all the work for Automake. This macro actually does too much -- 14# some checks are only needed if your package does certain things. 15# But this isn't really a big deal. 16 17# serial 1 18 19dnl Usage: 20dnl AM_INIT_AUTOMAKE(package,version, [no-define]) 21 22AC_DEFUN([AM_INIT_AUTOMAKE], 23[AC_REQUIRE([AC_PROG_INSTALL]) 24PACKAGE=[$1] 25AC_SUBST(PACKAGE) 26VERSION=[$2] 27AC_SUBST(VERSION) 28dnl test to see if srcdir already configured 29if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then 30 AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) 31fi 32ifelse([$3],, 33AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) 34AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) 35AC_REQUIRE([AM_SANITY_CHECK]) 36AC_REQUIRE([AC_ARG_PROGRAM]) 37dnl FIXME This is truly gross. 38missing_dir=`cd $ac_aux_dir && pwd` 39AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) 40AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) 41AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) 42AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) 43AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) 44AC_REQUIRE([AC_PROG_MAKE_SET])]) 45 46# 47# Check to make sure that the build environment is sane. 48# 49 50AC_DEFUN([AM_SANITY_CHECK], 51[AC_MSG_CHECKING([whether build environment is sane]) 52# Just in case 53sleep 1 54echo timestamp > conftestfile 55# Do `set' in a subshell so we don't clobber the current shell's 56# arguments. Must try -L first in case configure is actually a 57# symlink; some systems play weird games with the mod time of symlinks 58# (eg FreeBSD returns the mod time of the symlink's containing 59# directory). 60if ( 61 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` 62 if test "[$]*" = "X"; then 63 # -L didn't work. 64 set X `ls -t $srcdir/configure conftestfile` 65 fi 66 if test "[$]*" != "X $srcdir/configure conftestfile" \ 67 && test "[$]*" != "X conftestfile $srcdir/configure"; then 68 69 # If neither matched, then we have a broken ls. This can happen 70 # if, for instance, CONFIG_SHELL is bash and it inherits a 71 # broken ls alias from the environment. This has actually 72 # happened. Such a system could not be considered "sane". 73 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken 74alias in your environment]) 75 fi 76 77 test "[$]2" = conftestfile 78 ) 79then 80 # Ok. 81 : 82else 83 AC_MSG_ERROR([newly created file is older than distributed files! 84Check your system clock]) 85fi 86rm -f conftest* 87AC_MSG_RESULT(yes)]) 88 89dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) 90dnl The program must properly implement --version. 91AC_DEFUN([AM_MISSING_PROG], 92[AC_MSG_CHECKING(for working $2) 93# Run test in a subshell; some versions of sh will print an error if 94# an executable is not found, even if stderr is redirected. 95# Redirect stdin to placate older versions of autoconf. Sigh. 96if ($2 --version) < /dev/null > /dev/null 2>&1; then 97 $1=$2 98 AC_MSG_RESULT(found) 99else 100 $1="$3/missing $2" 101 AC_MSG_RESULT(missing) 102fi 103AC_SUBST($1)]) 104 105# Define a conditional. 106 107AC_DEFUN([AM_CONDITIONAL], 108[AC_SUBST($1_TRUE) 109AC_SUBST($1_FALSE) 110if $2; then 111 $1_TRUE= 112 $1_FALSE='#' 113else 114 $1_TRUE='#' 115 $1_FALSE= 116fi]) 117 118# Configure paths for GIMP 119# Manish Singh 98-6-11 120# Shamelessly stolen from Owen Taylor 121 122dnl AM_PATH_GIMP([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) 123dnl Test for GIMP, and define GIMP_CFLAGS and GIMP_LIBS 124dnl 125AC_DEFUN(AM_PATH_GIMP, 126[dnl 127dnl Get the cflags and libraries from the gimptool script 128dnl 129AC_ARG_WITH(gimp-prefix,[ --with-gimp-prefix=PFX Prefix where GIMP is installed (optional)], 130 gimptool_prefix="$withval", gimptool_prefix="") 131AC_ARG_WITH(gimp-exec-prefix,[ --with-gimp-exec-prefix=PFX Exec prefix where GIMP is installed (optional)], 132 gimptool_exec_prefix="$withval", gimptool_exec_prefix="") 133AC_ARG_ENABLE(gimptest, [ --disable-gimptest Do not try to compile and run a test GIMP program], 134 , enable_gimptest=yes) 135 136 if test x$gimptool_exec_prefix != x ; then 137 gimptool_args="$gimptool_args --exec-prefix=$gimptool_exec_prefix" 138 if test x${GIMPTOOL+set} != xset ; then 139 GIMPTOOL=$gimptool_exec_prefix/bin/gimptool 140 fi 141 fi 142 if test x$gimptool_prefix != x ; then 143 gimptool_args="$gimptool_args --prefix=$gimptool_prefix" 144 if test x${GIMPTOOL+set} != xset ; then 145 GIMPTOOL=$gimptool_prefix/bin/gimptool 146 fi 147 fi 148 149 AC_PATH_PROG(GIMPTOOL, gimptool, no) 150 min_gimp_version=ifelse([$1], ,1.0.0,$1) 151 AC_MSG_CHECKING(for GIMP - version >= $min_gimp_version) 152 no_gimp="" 153 if test "$GIMPTOOL" = "no" ; then 154 no_gimp=yes 155 else 156 GIMP_CFLAGS=`$GIMPTOOL $gimptool_args --cflags` 157 GIMP_LIBS=`$GIMPTOOL $gimptool_args --libs` 158 159 GIMP_CFLAGS_NOUI=`$GIMPTOOL $gimptool_args --cflags-noui` 160 noui_test=`echo $GIMP_CFLAGS_NOUI | sed 's/^\(Usage\).*/\1/'` 161 if test "$noui_test" = "Usage" ; then 162 GIMP_CFLAGS_NOUI=$GIMP_CFLAGS 163 GIMP_LIBS_NOUI=$GIMP_LIBS 164 else 165 GIMP_LIBS_NOUI=`$GIMPTOOL $gimptool_args --libs-noui` 166 fi 167 168 GIMP_DATA_DIR=`$GIMPTOOL $gimptool_args --gimpdatadir` 169 GIMP_PLUGIN_DIR=`$GIMPTOOL $gimptool_args --gimpplugindir` 170 nodatadir_test=`echo $GIMP_DATA_DIR | sed 's/^\(Usage\).*/\1/'` 171 if test "$nodatadir_test" = "Usage" ; then 172 GIMP_DATA_DIR="" 173 GIMP_PLUGIN_DIR="" 174 fi 175 176 gimptool_major_version=`$GIMPTOOL $gimptool_args --version | \ 177 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` 178 gimptool_minor_version=`$GIMPTOOL $gimptool_args --version | \ 179 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` 180 gimptool_micro_version=`$GIMPTOOL $gimptool_args --version | \ 181 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` 182 if test "x$enable_gimptest" = "xyes" ; then 183 ac_save_CFLAGS="$CFLAGS" 184 ac_save_LIBS="$LIBS" 185 CFLAGS="$CFLAGS $GIMP_CFLAGS" 186 LIBS="$LIBS $GIMP_LIBS" 187dnl 188dnl Now check if the installed GIMP is sufficiently new. (Also sanity 189dnl checks the results of gimptool to some extent 190dnl 191 rm -f conf.gimptest 192 AC_TRY_RUN([ 193#include <stdio.h> 194#include <stdlib.h> 195 196#include <libgimp/gimp.h> 197 198#ifndef GIMP_CHECK_VERSION 199#define GIMP_CHECK_VERSION(major, minor, micro) \ 200 (GIMP_MAJOR_VERSION > (major) || \ 201 (GIMP_MAJOR_VERSION == (major) && GIMP_MINOR_VERSION > (minor)) || \ 202 (GIMP_MAJOR_VERSION == (major) && GIMP_MINOR_VERSION == (minor) && \ 203 GIMP_MICRO_VERSION >= (micro))) 204#endif 205 206#if GIMP_CHECK_VERSION(1,1,24) 207GimpPlugInInfo 208#else 209GPlugInInfo 210#endif 211PLUG_IN_INFO = 212{ 213 NULL, /* init_proc */ 214 NULL, /* quit_proc */ 215 NULL, /* query_proc */ 216 NULL /* run_proc */ 217}; 218 219int main () 220{ 221 int major, minor, micro; 222 char *tmp_version; 223 224 system ("touch conf.gimptest"); 225 226 /* HP/UX 9 (%@#!) writes to sscanf strings */ 227 tmp_version = g_strdup("$min_gimp_version"); 228 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { 229 printf("%s, bad version string\n", "$min_gimp_version"); 230 exit(1); 231 } 232 233 if (($gimptool_major_version > major) || 234 (($gimptool_major_version == major) && ($gimptool_minor_version > minor)) || 235 (($gimptool_major_version == major) && ($gimptool_minor_version == minor) && ($gimptool_micro_version >= micro))) 236 { 237 return 0; 238 } 239 else 240 { 241 printf("\n*** 'gimptool --version' returned %d.%d.%d, but the minimum version\n", $gimptool_major_version, $gimptool_minor_version, $gimptool_micro_version); 242 printf("*** of GIMP required is %d.%d.%d. If gimptool is correct, then it is\n", major, minor, micro); 243 printf("*** best to upgrade to the required version.\n"); 244 printf("*** If gimptool was wrong, set the environment variable GIMPTOOL\n"); 245 printf("*** to point to the correct copy of gimptool, and remove the file\n"); 246 printf("*** config.cache before re-running configure\n"); 247 return 1; 248 } 249} 250 251],, no_gimp=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) 252 CFLAGS="$ac_save_CFLAGS" 253 LIBS="$ac_save_LIBS" 254 fi 255 fi 256 if test "x$no_gimp" = x ; then 257 AC_MSG_RESULT(yes) 258 ifelse([$2], , :, [$2]) 259 else 260 AC_MSG_RESULT(no) 261 if test "$GIMPTOOL" = "no" ; then 262 echo "*** The gimptool script installed by GIMP could not be found" 263 echo "*** If GIMP was installed in PREFIX, make sure PREFIX/bin is in" 264 echo "*** your path, or set the GIMPTOOL environment variable to the" 265 echo "*** full path to gimptool." 266 else 267 if test -f conf.gimptest ; then 268 : 269 else 270 echo "*** Could not run GIMP test program, checking why..." 271 CFLAGS="$CFLAGS $GIMP_CFLAGS" 272 LIBS="$LIBS $GIMP_LIBS" 273 AC_TRY_LINK([ 274#include <stdio.h> 275#include <libgimp/gimp.h> 276 277#ifndef GIMP_CHECK_VERSION 278#define GIMP_CHECK_VERSION(major, minor, micro) \ 279 (GIMP_MAJOR_VERSION > (major) || \ 280 (GIMP_MAJOR_VERSION == (major) && GIMP_MINOR_VERSION > (minor)) || \ 281 (GIMP_MAJOR_VERSION == (major) && GIMP_MINOR_VERSION == (minor) && \ 282 GIMP_MICRO_VERSION >= (micro))) 283#endif 284 285#if GIMP_CHECK_VERSION(1,1,24) 286GimpPlugInInfo 287#else 288GPlugInInfo 289#endif 290PLUG_IN_INFO = 291{ 292 NULL, /* init_proc */ 293 NULL, /* quit_proc */ 294 NULL, /* query_proc */ 295 NULL /* run_proc */ 296}; 297], [ return 0; ], 298 [ echo "*** The test program compiled, but did not run. This usually means" 299 echo "*** that the run-time linker is not finding GIMP or finding the wrong" 300 echo "*** version of GIMP. If it is not finding GIMP, you'll need to set your" 301 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" 302 echo "*** to the installed location Also, make sure you have run ldconfig if that" 303 echo "*** is required on your system" 304 echo "***" 305 echo "*** If you have an old version installed, it is best to remove it, although" 306 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], 307 [ echo "*** The test program failed to compile or link. See the file config.log for the" 308 echo "*** exact error that occured. This usually means GIMP was incorrectly installed" 309 echo "*** or that you have moved GIMP since it was installed. In the latter case, you" 310 echo "*** may want to edit the gimptool script: $GIMPTOOL" ]) 311 CFLAGS="$ac_save_CFLAGS" 312 LIBS="$ac_save_LIBS" 313 fi 314 fi 315 GIMP_CFLAGS="" 316 GIMP_LIBS="" 317 GIMP_CFLAGS_NOUI="" 318 GIMP_LIBS_NOUI="" 319 ifelse([$3], , :, [$3]) 320 fi 321 AC_SUBST(GIMP_CFLAGS) 322 AC_SUBST(GIMP_LIBS) 323 AC_SUBST(GIMP_CFLAGS_NOUI) 324 AC_SUBST(GIMP_LIBS_NOUI) 325 AC_SUBST(GIMP_DATA_DIR) 326 AC_SUBST(GIMP_PLUGIN_DIR) 327 rm -f conf.gimptest 328]) 329 330# Configure paths for GTK+ 331# Owen Taylor 1997-2001 332 333dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) 334dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES, 335dnl pass to pkg-config 336dnl 337AC_DEFUN(AM_PATH_GTK_2_0, 338[dnl 339dnl Get the cflags and libraries from pkg-config 340dnl 341AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program], 342 , enable_gtktest=yes) 343 344 pkg_config_args=gtk+-2.0 345 for module in . $4 346 do 347 case "$module" in 348 gthread) 349 pkg_config_args="$pkg_config_args gthread-2.0" 350 ;; 351 esac 352 done 353 354 no_gtk="" 355 356 AC_PATH_PROG(PKG_CONFIG, pkg-config, no) 357 358 if test x$PKG_CONFIG != xno ; then 359 if pkg-config --atleast-pkgconfig-version 0.7 ; then 360 : 361 else 362 echo *** pkg-config too old; version 0.7 or better required. 363 no_gtk=yes 364 PKG_CONFIG=no 365 fi 366 else 367 no_gtk=yes 368 fi 369 370 min_gtk_version=ifelse([$1], ,2.0.0,$1) 371 AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version) 372 373 if test x$PKG_CONFIG != xno ; then 374 ## don't try to run the test against uninstalled libtool libs 375 if $PKG_CONFIG --uninstalled $pkg_config_args; then 376 echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH" 377 enable_gtktest=no 378 fi 379 380 if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then 381 : 382 else 383 no_gtk=yes 384 fi 385 fi 386 387 if test x"$no_gtk" = x ; then 388 GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags` 389 GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs` 390 gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ 391 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` 392 gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ 393 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` 394 gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ 395 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` 396 if test "x$enable_gtktest" = "xyes" ; then 397 ac_save_CFLAGS="$CFLAGS" 398 ac_save_LIBS="$LIBS" 399 CFLAGS="$CFLAGS $GTK_CFLAGS" 400 LIBS="$GTK_LIBS $LIBS" 401dnl 402dnl Now check if the installed GTK+ is sufficiently new. (Also sanity 403dnl checks the results of pkg-config to some extent) 404dnl 405 rm -f conf.gtktest 406 AC_TRY_RUN([ 407#include <gtk/gtk.h> 408#include <stdio.h> 409#include <stdlib.h> 410 411int 412main () 413{ 414 int major, minor, micro; 415 char *tmp_version; 416 417 system ("touch conf.gtktest"); 418 419 /* HP/UX 9 (%@#!) writes to sscanf strings */ 420 tmp_version = g_strdup("$min_gtk_version"); 421 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { 422 printf("%s, bad version string\n", "$min_gtk_version"); 423 exit(1); 424 } 425 426 if ((gtk_major_version != $gtk_config_major_version) || 427 (gtk_minor_version != $gtk_config_minor_version) || 428 (gtk_micro_version != $gtk_config_micro_version)) 429 { 430 printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", 431 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, 432 gtk_major_version, gtk_minor_version, gtk_micro_version); 433 printf ("*** was found! If pkg-config was correct, then it is best\n"); 434 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); 435 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); 436 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); 437 printf("*** required on your system.\n"); 438 printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); 439 printf("*** to point to the correct configuration files\n"); 440 } 441 else if ((gtk_major_version != GTK_MAJOR_VERSION) || 442 (gtk_minor_version != GTK_MINOR_VERSION) || 443 (gtk_micro_version != GTK_MICRO_VERSION)) 444 { 445 printf("*** GTK+ header files (version %d.%d.%d) do not match\n", 446 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); 447 printf("*** library (version %d.%d.%d)\n", 448 gtk_major_version, gtk_minor_version, gtk_micro_version); 449 } 450 else 451 { 452 if ((gtk_major_version > major) || 453 ((gtk_major_version == major) && (gtk_minor_version > minor)) || 454 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) 455 { 456 return 0; 457 } 458 else 459 { 460 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", 461 gtk_major_version, gtk_minor_version, gtk_micro_version); 462 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", 463 major, minor, micro); 464 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); 465 printf("***\n"); 466 printf("*** If you have already installed a sufficiently new version, this error\n"); 467 printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); 468 printf("*** being found. The easiest way to fix this is to remove the old version\n"); 469 printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n"); 470 printf("*** correct copy of pkg-config. (In this case, you will have to\n"); 471 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); 472 printf("*** so that the correct libraries are found at run-time))\n"); 473 } 474 } 475 return 1; 476} 477],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) 478 CFLAGS="$ac_save_CFLAGS" 479 LIBS="$ac_save_LIBS" 480 fi 481 fi 482 if test "x$no_gtk" = x ; then 483 AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version)) 484 ifelse([$2], , :, [$2]) 485 else 486 AC_MSG_RESULT(no) 487 if test "$PKG_CONFIG" = "no" ; then 488 echo "*** A new enough version of pkg-config was not found." 489 echo "*** See http://pkgconfig.sourceforge.net" 490 else 491 if test -f conf.gtktest ; then 492 : 493 else 494 echo "*** Could not run GTK+ test program, checking why..." 495 CFLAGS="$CFLAGS $GTK_CFLAGS" 496 LIBS="$LIBS $GTK_LIBS" 497 AC_TRY_LINK([ 498#include <gtk/gtk.h> 499#include <stdio.h> 500], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ], 501 [ echo "*** The test program compiled, but did not run. This usually means" 502 echo "*** that the run-time linker is not finding GTK+ or finding the wrong" 503 echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your" 504 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" 505 echo "*** to the installed location Also, make sure you have run ldconfig if that" 506 echo "*** is required on your system" 507 echo "***" 508 echo "*** If you have an old version installed, it is best to remove it, although" 509 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], 510 [ echo "*** The test program failed to compile or link. See the file config.log for the" 511 echo "*** exact error that occured. This usually means GTK+ was incorrectly installed" 512 echo "*** or that you have moved GTK+ since it was installed. In the latter case, you" 513 echo "*** may want to edit the pkg-config script: $PKG_CONFIG" ]) 514 CFLAGS="$ac_save_CFLAGS" 515 LIBS="$ac_save_LIBS" 516 fi 517 fi 518 GTK_CFLAGS="" 519 GTK_LIBS="" 520 ifelse([$3], , :, [$3]) 521 fi 522 AC_SUBST(GTK_CFLAGS) 523 AC_SUBST(GTK_LIBS) 524 rm -f conf.gtktest 525]) 526 527# Configure paths for GLIB 528# Owen Taylor 1997-2001 529 530dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) 531dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject or 532dnl gthread is specified in MODULES, pass to pkg-config 533dnl 534AC_DEFUN(AM_PATH_GLIB_2_0, 535[dnl 536dnl Get the cflags and libraries from pkg-config 537dnl 538AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program], 539 , enable_glibtest=yes) 540 541 pkg_config_args=glib-2.0 542 for module in . $4 543 do 544 case "$module" in 545 gmodule) 546 pkg_config_args="$pkg_config_args gmodule-2.0" 547 ;; 548 gobject) 549 pkg_config_args="$pkg_config_args gobject-2.0" 550 ;; 551 gthread) 552 pkg_config_args="$pkg_config_args gthread-2.0" 553 ;; 554 esac 555 done 556 557 AC_PATH_PROG(PKG_CONFIG, pkg-config, no) 558 559 no_glib="" 560 561 if test x$PKG_CONFIG != xno ; then 562 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then 563 : 564 else 565 echo *** pkg-config too old; version 0.7 or better required. 566 no_glib=yes 567 PKG_CONFIG=no 568 fi 569 else 570 no_glib=yes 571 fi 572 573 min_glib_version=ifelse([$1], ,2.0.0,$1) 574 AC_MSG_CHECKING(for GLIB - version >= $min_glib_version) 575 576 if test x$PKG_CONFIG != xno ; then 577 ## don't try to run the test against uninstalled libtool libs 578 if $PKG_CONFIG --uninstalled $pkg_config_args; then 579 echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH" 580 enable_glibtest=no 581 fi 582 583 if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then 584 : 585 else 586 no_glib=yes 587 fi 588 fi 589 590 if test x"$no_glib" = x ; then 591 GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` 592 GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0` 593 GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` 594 595 GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` 596 GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args` 597 glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \ 598 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` 599 glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \ 600 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` 601 glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \ 602 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` 603 if test "x$enable_glibtest" = "xyes" ; then 604 ac_save_CFLAGS="$CFLAGS" 605 ac_save_LIBS="$LIBS" 606 CFLAGS="$CFLAGS $GLIB_CFLAGS" 607 LIBS="$GLIB_LIBS $LIBS" 608dnl 609dnl Now check if the installed GLIB is sufficiently new. (Also sanity 610dnl checks the results of pkg-config to some extent) 611dnl 612 rm -f conf.glibtest 613 AC_TRY_RUN([ 614#include <glib.h> 615#include <stdio.h> 616#include <stdlib.h> 617 618int 619main () 620{ 621 int major, minor, micro; 622 char *tmp_version; 623 624 system ("touch conf.glibtest"); 625 626 /* HP/UX 9 (%@#!) writes to sscanf strings */ 627 tmp_version = g_strdup("$min_glib_version"); 628 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { 629 printf("%s, bad version string\n", "$min_glib_version"); 630 exit(1); 631 } 632 633 if ((glib_major_version != $glib_config_major_version) || 634 (glib_minor_version != $glib_config_minor_version) || 635 (glib_micro_version != $glib_config_micro_version)) 636 { 637 printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", 638 $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, 639 glib_major_version, glib_minor_version, glib_micro_version); 640 printf ("*** was found! If pkg-config was correct, then it is best\n"); 641 printf ("*** to remove the old version of GLib. You may also be able to fix the error\n"); 642 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); 643 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); 644 printf("*** required on your system.\n"); 645 printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); 646 printf("*** to point to the correct configuration files\n"); 647 } 648 else if ((glib_major_version != GLIB_MAJOR_VERSION) || 649 (glib_minor_version != GLIB_MINOR_VERSION) || 650 (glib_micro_version != GLIB_MICRO_VERSION)) 651 { 652 printf("*** GLIB header files (version %d.%d.%d) do not match\n", 653 GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); 654 printf("*** library (version %d.%d.%d)\n", 655 glib_major_version, glib_minor_version, glib_micro_version); 656 } 657 else 658 { 659 if ((glib_major_version > major) || 660 ((glib_major_version == major) && (glib_minor_version > minor)) || 661 ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro))) 662 { 663 return 0; 664 } 665 else 666 { 667 printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n", 668 glib_major_version, glib_minor_version, glib_micro_version); 669 printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n", 670 major, minor, micro); 671 printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); 672 printf("***\n"); 673 printf("*** If you have already installed a sufficiently new version, this error\n"); 674 printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); 675 printf("*** being found. The easiest way to fix this is to remove the old version\n"); 676 printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n"); 677 printf("*** correct copy of pkg-config. (In this case, you will have to\n"); 678 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); 679 printf("*** so that the correct libraries are found at run-time))\n"); 680 } 681 } 682 return 1; 683} 684],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) 685 CFLAGS="$ac_save_CFLAGS" 686 LIBS="$ac_save_LIBS" 687 fi 688 fi 689 if test "x$no_glib" = x ; then 690 AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)) 691 ifelse([$2], , :, [$2]) 692 else 693 AC_MSG_RESULT(no) 694 if test "$PKG_CONFIG" = "no" ; then 695 echo "*** A new enough version of pkg-config was not found." 696 echo "*** See http://www.freedesktop.org/software/pkgconfig/" 697 else 698 if test -f conf.glibtest ; then 699 : 700 else 701 echo "*** Could not run GLIB test program, checking why..." 702 CFLAGS="$CFLAGS $GLIB_CFLAGS" 703 LIBS="$LIBS $GLIB_LIBS" 704 AC_TRY_LINK([ 705#include <glib.h> 706#include <stdio.h> 707], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ], 708 [ echo "*** The test program compiled, but did not run. This usually means" 709 echo "*** that the run-time linker is not finding GLIB or finding the wrong" 710 echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your" 711 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" 712 echo "*** to the installed location Also, make sure you have run ldconfig if that" 713 echo "*** is required on your system" 714 echo "***" 715 echo "*** If you have an old version installed, it is best to remove it, although" 716 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], 717 [ echo "*** The test program failed to compile or link. See the file config.log for the" 718 echo "*** exact error that occured. This usually means GLIB was incorrectly installed" 719 echo "*** or that you have moved GLIB since it was installed. In the latter case, you" 720 echo "*** may want to edit the pkg-config script: $PKG_CONFIG" ]) 721 CFLAGS="$ac_save_CFLAGS" 722 LIBS="$ac_save_LIBS" 723 fi 724 fi 725 GLIB_CFLAGS="" 726 GLIB_LIBS="" 727 GLIB_GENMARSHAL="" 728 GOBJECT_QUERY="" 729 GLIB_MKENUMS="" 730 ifelse([$3], , :, [$3]) 731 fi 732 AC_SUBST(GLIB_CFLAGS) 733 AC_SUBST(GLIB_LIBS) 734 AC_SUBST(GLIB_GENMARSHAL) 735 AC_SUBST(GOBJECT_QUERY) 736 AC_SUBST(GLIB_MKENUMS) 737 rm -f conf.glibtest 738]) 739 740