4 dnl new version of FUNC_SELECT
5 dnl - submitted to autoconf maintainer; expected to appear in next version
7 AC_DEFUN(AC_FUNC_SELECT,
8 [AC_CHECK_FUNCS(select)
9 if test "$ac_cv_func_select" = yes; then
10 AC_CHECK_HEADERS(unistd.h sys/types.h sys/time.h sys/select.h sys/socket.h)
11 AC_MSG_CHECKING([argument types of select()])
12 AC_CACHE_VAL(ac_cv_type_fd_set_size_t,dnl
13 [AC_CACHE_VAL(ac_cv_type_fd_set,dnl
14 [for ac_cv_type_fd_set in 'fd_set' 'int' 'void'; do
15 for ac_cv_type_fd_set_size_t in 'int' 'size_t' 'unsigned long' 'unsigned'; do
16 for ac_type_timeval in 'struct timeval' 'const struct timeval'; do
18 [#ifdef HAVE_SYS_TIME_H
21 #ifdef HAVE_SYS_TYPES_H
22 #include <sys/types.h>
27 #ifdef HAVE_SYS_SELECT_H
28 #include <sys/select.h>
30 #ifdef HAVE_SYS_SOCKET_H
31 #include <sys/socket.h>
33 [extern select ($ac_cv_type_fd_set_size_t,
34 $ac_cv_type_fd_set *, $ac_cv_type_fd_set *, $ac_cv_type_fd_set *,
35 $ac_type_timeval *);],
36 [ac_found=yes ; break 3],ac_found=no)
42 if test "$ac_found" = no; then
43 AC_MSG_ERROR([can't determine argument types])
46 AC_MSG_RESULT([select($ac_cv_type_fd_set_size_t,$ac_cv_type_fd_set *,...)])
47 AC_DEFINE_UNQUOTED(fd_set_size_t, $ac_cv_type_fd_set_size_t)
49 if test "$ac_cv_type_fd_set" != fd_set; then
50 # Arguments 2-4 are not fd_set. Some weirdo systems use fd_set type for
51 # FD_SET macros, but insist that you cast the argument to select. I don't
52 # understand why that might be, but it means we cannot define fd_set.
55 <<(^|[^a-zA-Z_0-9])fd_set[^a-zA-Z_0-9]>>dnl
57 [#ifdef HAVE_SYS_TIME_H
60 #ifdef HAVE_SYS_TYPES_H
61 #include <sys/types.h>
66 #ifdef HAVE_SYS_SELECT_H
67 #include <sys/select.h>
69 #ifdef HAVE_SYS_SOCKET_H
70 #include <sys/socket.h>
72 # We found fd_set type in a header, need special cast
73 ac_cast="($ac_cv_type_fd_set *)",dnl
74 # No fd_set type; it is safe to define it
75 AC_DEFINE_UNQUOTED(fd_set,$ac_cv_type_fd_set))
77 AC_DEFINE_UNQUOTED(SELECT_FD_SET_CAST,$ac_cast)
83 dnl Checking for typedefs, with extra headers
86 dnl pds_CHECK_TYPE(TYPE, DEFAULT, [HEADERS])
87 AC_DEFUN(pds_CHECK_TYPE,
88 [AC_REQUIRE([AC_HEADER_STDC])dnl
89 AC_MSG_CHECKING(for $1)
90 AC_CACHE_VAL(ac_cv_type_$1,
93 <<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl
94 changequote([,]), [#include <sys/types.h>
99 $3], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
100 AC_MSG_RESULT($ac_cv_type_$1)
101 if test $ac_cv_type_$1 = no; then
107 dnl Configure-time switch with default
109 dnl Each switch defines an --enable-FOO and --disable-FOO option in
110 dnl the resulting configure script.
113 dnl smr_SWITCH(name, description, default, pos-def, neg-def)
117 dnl name name of switch; generates --enable-name & --disable-name
119 dnl description help string is set to this prefixed by "enable" or
120 dnl "disable", whichever is the non-default value
121 dnl default either "on" or "off"; specifies default if neither
122 dnl --enable-name nor --disable-name is specified
123 dnl pos-def a symbol to AC_DEFINE if switch is on (optional)
124 dnl neg-def a symbol to AC_DEFINE if switch is off (optional)
126 AC_DEFUN(smr_SWITCH, [
127 AC_MSG_CHECKING(whether to enable $2)
131 [ --disable-[$1]substr([ ], len([$1])) disable [$2]],
132 [ --enable-[$1] substr([ ], len([$1])) enable [$2]]),
133 [ if test "$enableval" = yes; then
135 ifelse($4, , , AC_DEFINE($4))
138 ifelse($5, , , AC_DEFINE($5))
142 ifelse($4, , , AC_DEFINE($4)) ],
144 ifelse($5, , , AC_DEFINE($5))]))])
147 dnl Allow argument for optional libraries; wraps AC_ARG_WITH, to
148 dnl provide a "--with-foo-library" option in the configure script, where foo
149 dnl is presumed to be a library name. The argument given by the user
150 dnl (i.e. "bar" in ./configure --with-foo-library=bar) may be one of three
152 dnl * boolean (no, yes or blank): whether to use library or not
153 dnl * file: assumed to be the name of the library
154 dnl * directory: assumed to *contain* the library
156 dnl The argument is sanity-checked. If all is well, two variables are
157 dnl set: "with_foo" (value is yes, no, or maybe), and "foo_LIBS" (value
158 dnl is either blank, a file, -lfoo, or '-L/some/dir -lfoo'). The idea
159 dnl is: the first tells you whether the library is to be used or not
160 dnl (or the user didn't specify one way or the other) and the second
161 dnl to put on the command line for linking with the library.
164 dnl smr_ARG_WITHLIB(name, libname, description)
166 dnl name name for --with argument ("foo" for libfoo)
167 dnl libname (optional) actual name of library,
168 dnl if different from name
169 dnl description (optional) used to construct help string
171 AC_DEFUN(smr_ARG_WITHLIB, [
173 ifelse($2, , smr_lib=[$1], smr_lib=[$2])
175 AC_ARG_WITH([$1]-library,
177 [ --with-$1-library[=PATH] use $1 library],
178 [ --with-$1-library[=PATH] use $1 library ($3)]),
180 if test "$withval" = yes; then
182 [$1]_LIBS="-l${smr_lib}"
183 elif test "$withval" = no; then
188 if test -f "$withval"; then
190 elif test -d "$withval"; then
191 [$1]_LIBS="-L$withval -l${smr_lib}"
193 AC_MSG_ERROR(argument must be boolean, file, or directory)
198 [$1]_LIBS="-l${smr_lib}"
202 dnl Check if the include files for a library are accessible, and
203 dnl define the variable "name_CFLAGS" with the proper "-I" flag for
204 dnl the compiler. The user has a chance to specify the includes
205 dnl location, using "--with-foo-includes".
207 dnl This should be used *after* smr_ARG_WITHLIB *and* AC_CHECK_LIB are
211 dnl smr_ARG_WITHINCLUDES(name, header, extra-flags)
213 dnl name library name, MUST same as used with smr_ARG_WITHLIB
214 dnl header a header file required for using the lib
215 dnl extra-flags (optional) flags required when compiling the
216 dnl header, typically more includes; for ex. X_CFLAGS
218 AC_DEFUN(smr_ARG_WITHINCLUDES, [
220 AC_ARG_WITH([$1]-includes,
221 [ --with-$1-includes=DIR set directory for $1 headers],
223 if test -d "$withval"; then
224 [$1]_CFLAGS="-I${withval}"
226 AC_MSG_ERROR(argument must be a directory)
229 dnl We need to put the given include directory into CPPFLAGS temporarily, but
230 dnl then restore CPPFLAGS to its old value.
232 smr_save_CPPFLAGS="$CPPFLAGS"
233 CPPFLAGS="$CPPFLAGS ${[$1]_CFLAGS}"
234 ifelse($3, , , CPPFLAGS="$CPPFLAGS [$3]")
238 CPPFLAGS=$smr_save_CPPFLAGS
242 dnl Probe for an optional library. This macro creates both
243 dnl --with-foo-library and --with-foo-includes options for the configure
244 dnl script. If --with-foo-library is *not* specified, the default is to
245 dnl probe for the library, and use it if found.
248 dnl smr_CHECK_LIB(name, libname, desc, func, header, x-libs, x-flags)
250 dnl name name for --with options
251 dnl libname (optional) real name of library, if different from
253 dnl desc (optional) short descr. of library, for help string
254 dnl func function of library, to probe for
255 dnl header (optional) header required for using library
256 dnl x-libs (optional) extra libraries, if needed to link with lib
257 dnl x-flags (optional) extra flags, if needed to include header files
259 AC_DEFUN(smr_CHECK_LIB,
261 ifelse($2, , smr_lib=[$1], smr_lib=[$2])
262 ifelse($5, , , smr_header=[$5])
263 smr_ARG_WITHLIB($1,$2,$3)
264 if test "$with_$1" != no; then
265 AC_CHECK_LIB(${smr_lib}, $4,
267 smr_havelib=no; problem_$1=": Can't find required lib$smr_lib",
268 ifelse($6, , ${$1_LIBS}, [${$1_LIBS} $6]))
269 if test "$smr_havelib" = yes -a "$smr_header" != ""; then
270 smr_ARG_WITHINCLUDES($1, $smr_header, $7)
271 smr_safe=`echo "$smr_header" | sed 'y%./+-%__p_%'`
272 if eval "test \"`echo '$ac_cv_header_'$smr_safe`\" != yes"; then
274 problem_$1=": Can't find required $smr_header"
277 if test "$smr_havelib" = yes; then
286 problem_$1=": Explicitly disabled"
290 dnl Defines a boolean variable good for acconfig.h depending on a condition.
293 dnl mg_DEFINE_IF_NOT(c-code, cpp-if-cond, var-name, extra-flags)
295 dnl c-code the first code part inside main()
296 dnl cpp-if-cond boolean preprocessor condition
297 dnl var-name this variable will be defined if the given condition is false
298 dnl extra-flags (optional) extra flags for compiling, typically more -I glags
301 dnl mg_DEFINE_IF_NOT([#include <features.h>], [defined __USE_BSD], [NON_BSD])
303 AC_DEFUN(mg_DEFINE_IF_NOT, [
304 mg_save_CPPFLAGS="$CPPFLAGS"
305 ifelse($4, , , CPPFLAGS="$CPPFLAGS [$4]")
309 int main(int c, char **v) {
317 ], [:], [AC_DEFINE($3)])
319 CPPFLAGS="$mg_save_CPPFLAGS"
323 dnl --------------------------------------------------------------------------
324 dnl contents of gtk.m4
326 # Configure paths for GTK+
327 # Owen Taylor 97-11-3
329 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
330 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
332 AC_DEFUN(AM_PATH_GTK,
334 dnl Get the cflags and libraries from the gtk-config script
336 AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX prefix for GTK files (optional)],
337 gtk_config_prefix="$withval", gtk_config_prefix="")
338 AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX exec prefix for GTK files (optional)],
339 gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
340 AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK program],
341 , enable_gtktest=yes)
343 if test x$gtk_config_exec_prefix != x ; then
344 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
345 if test x${GTK_CONFIG+set} != xset ; then
346 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
349 if test x$gtk_config_prefix != x ; then
350 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
351 if test x${GTK_CONFIG+set} != xset ; then
352 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
356 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
357 min_gtk_version=ifelse([$1], ,0.99.7,$1)
358 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
360 if test "$GTK_CONFIG" = "no" ; then
363 GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
364 GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
365 gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
366 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
367 gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
368 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
369 gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
370 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
371 if test "x$enable_gtktest" = "xyes" ; then
372 ac_save_CFLAGS="$CFLAGS"
374 CFLAGS="$CFLAGS $GTK_CFLAGS"
375 LIBS="$LIBS $GTK_LIBS"
377 dnl Now check if the installed GTK is sufficiently new. (Also sanity
378 dnl checks the results of gtk-config to some extent
389 int major, minor, micro;
392 system ("touch conf.gtktest");
394 /* HP/UX 9 (%@#!) writes to sscanf strings */
395 tmp_version = g_strdup("$min_gtk_version");
396 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
397 printf("%s, bad version string\n", "$min_gtk_version");
401 if ((gtk_major_version != $gtk_config_major_version) ||
402 (gtk_minor_version != $gtk_config_minor_version) ||
403 (gtk_micro_version != $gtk_config_micro_version))
405 printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
406 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
407 gtk_major_version, gtk_minor_version, gtk_micro_version);
408 printf ("*** was found! If gtk-config was correct, then it is best\n");
409 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
410 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
411 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
412 printf("*** required on your system.\n");
413 printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
414 printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
415 printf("*** before re-running configure\n");
417 #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
418 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
419 (gtk_minor_version != GTK_MINOR_VERSION) ||
420 (gtk_micro_version != GTK_MICRO_VERSION))
422 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
423 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
424 printf("*** library (version %d.%d.%d)\n",
425 gtk_major_version, gtk_minor_version, gtk_micro_version);
427 #endif /* defined (GTK_MAJOR_VERSION) ... */
430 if ((gtk_major_version > major) ||
431 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
432 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
438 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
439 gtk_major_version, gtk_minor_version, gtk_micro_version);
440 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
441 major, minor, micro);
442 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
444 printf("*** If you have already installed a sufficiently new version, this error\n");
445 printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
446 printf("*** being found. The easiest way to fix this is to remove the old version\n");
447 printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
448 printf("*** correct copy of gtk-config. (In this case, you will have to\n");
449 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
450 printf("*** so that the correct libraries are found at run-time))\n");
455 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
456 CFLAGS="$ac_save_CFLAGS"
460 if test "x$no_gtk" = x ; then
462 ifelse([$2], , :, [$2])
465 if test "$GTK_CONFIG" = "no" ; then
466 echo "*** The gtk-config script installed by GTK could not be found"
467 echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
468 echo "*** your path, or set the GTK_CONFIG environment variable to the"
469 echo "*** full path to gtk-config."
471 if test -f conf.gtktest ; then
474 echo "*** Could not run GTK test program, checking why..."
475 CFLAGS="$CFLAGS $GTK_CFLAGS"
476 LIBS="$LIBS $GTK_LIBS"
480 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
481 [ echo "*** The test program compiled, but did not run. This usually means"
482 echo "*** that the run-time linker is not finding GTK or finding the wrong"
483 echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
484 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
485 echo "*** to the installed location Also, make sure you have run ldconfig if that"
486 echo "*** is required on your system"
488 echo "*** If you have an old version installed, it is best to remove it, although"
489 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
491 echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
492 echo "*** came with the system with the command"
494 echo "*** rpm --erase --nodeps gtk gtk-devel" ],
495 [ echo "*** The test program failed to compile or link. See the file config.log for the"
496 echo "*** exact error that occured. This usually means GTK was incorrectly installed"
497 echo "*** or that you have moved GTK since it was installed. In the latter case, you"
498 echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
499 CFLAGS="$ac_save_CFLAGS"
505 ifelse([$3], , :, [$3])
513 dnl --------------------------------------------------------------------------
514 dnl contents of imlib.m4
515 dnl modified by migo - write diagnostics to >&5 (i.e. config.log) not stdout
517 # Configure paths for IMLIB
518 # Frank Belew 98-8-31
519 # stolen from Manish Singh
520 # Shamelessly stolen from Owen Taylor
522 dnl AM_PATH_IMLIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
523 dnl Test for IMLIB, and define IMLIB_CFLAGS and IMLIB_LIBS
525 AC_DEFUN(AM_PATH_IMLIB,
527 dnl Get the cflags and libraries from the imlib-config script
529 AC_ARG_WITH(imlib-prefix,[ --with-imlib-prefix=PFX prefix for IMLIB files (optional)],
530 imlib_prefix="$withval", imlib_prefix="")
531 AC_ARG_WITH(imlib-exec-prefix,[ --with-imlib-exec-prefix=PFX exec prefix for IMLIB files (optional)],
532 imlib_exec_prefix="$withval", imlib_exec_prefix="")
533 AC_ARG_ENABLE(imlibtest, [ --disable-imlibtest do not try to compile and run a test IMLIB program],
534 , enable_imlibtest=yes)
536 if test x$imlib_exec_prefix != x ; then
537 imlib_args="$imlib_args --exec-prefix=$imlib_exec_prefix"
538 if test x${IMLIBCONF+set} != xset ; then
539 IMLIBCONF=$imlib_exec_prefix/bin/imlib-config
542 if test x$imlib_prefix != x ; then
543 imlib_args="$imlib_args --prefix=$imlib_prefix"
544 if test x${IMLIBCONF+set} != xset ; then
545 IMLIBCONF=$imlib_prefix/bin/imlib-config
549 AC_PATH_PROG(IMLIBCONF, imlib-config, no)
550 min_imlib_version=ifelse([$1], ,1.8.1,$1)
551 AC_MSG_CHECKING(for IMLIB - version >= $min_imlib_version)
553 if test "$IMLIBCONF" = "no" ; then
556 IMLIB_CFLAGS=`$IMLIBCONF $imlibconf_args --cflags`
557 IMLIB_LIBS=`$IMLIBCONF $imlibconf_args --libs`
559 imlib_major_version=`$IMLIBCONF $imlib_args --version | \
560 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
561 imlib_minor_version=`$IMLIBCONF $imlib_args --version | \
562 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
563 if test "x$enable_imlibtest" = "xyes" ; then
564 ac_save_CFLAGS="$CFLAGS"
566 CFLAGS="$CFLAGS $IMLIB_CFLAGS"
567 LIBS="$LIBS $IMLIB_LIBS"
569 dnl Now check if the installed IMLIB is sufficiently new. (Also sanity
570 dnl checks the results of imlib-config to some extent
578 ImlibImage testimage;
585 system ("touch conf.imlibtest");
587 /* HP/UX 9 (%@#!) writes to sscanf strings */
588 tmp_version = strdup("$min_imlib_version");
589 if (sscanf(tmp_version, "%d.%d", &major, &minor) != 2) {
590 printf("%s, bad version string\n", "$min_imlib_version");
594 if (($imlib_major_version > major) ||
595 (($imlib_major_version == major) && ($imlib_minor_version > minor)))
601 printf("\n*** 'imlib-config --version' returned %d.%d, but the minimum version\n", $imlib_major_version, $imlib_minor_version);
602 printf("*** of IMLIB required is %d.%d. If imlib-config is correct, then it is\n", major, minor);
603 printf("*** best to upgrade to the required version.\n");
604 printf("*** If imlib-config was wrong, set the environment variable IMLIBCONF\n");
605 printf("*** to point to the correct copy of imlib-config, and remove the file\n");
606 printf("*** config.cache before re-running configure\n");
611 ],, no_imlib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
612 CFLAGS="$ac_save_CFLAGS"
616 if test "x$no_imlib" = x ; then
618 ifelse([$2], , :, [$2])
621 if test "$IMLIBCONF" = "no" ; then
622 echo "*** The imlib-config script installed by IMLIB could not be found"
623 echo "*** If IMLIB was installed in PREFIX, make sure PREFIX/bin is in"
624 echo "*** your path, or set the IMLIBCONF environment variable to the"
625 echo "*** full path to imlib-config."
627 if test -f conf.imlibtest ; then
630 echo "*** Could not run IMLIB test program, checking why..."
631 CFLAGS="$CFLAGS $IMLIB_CFLAGS"
632 LIBS="$LIBS $IMLIB_LIBS"
637 [ echo "*** The test program compiled, but did not run. This usually means"
638 echo "*** that the run-time linker is not finding IMLIB or finding the wrong"
639 echo "*** version of IMLIB. If it is not finding IMLIB, you'll need to set your"
640 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
641 echo "*** to the installed location Also, make sure you have run ldconfig if that"
642 echo "*** is required on your system"
644 echo "*** If you have an old version installed, it is best to remove it, although"
645 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
646 [ echo "*** The test program failed to compile or link. See the file config.log for the"
647 echo "*** exact error that occured. This usually means IMLIB was incorrectly installed"
648 echo "*** or that you have moved IMLIB since it was installed. In the latter case, you"
649 echo "*** may want to edit the imlib-config script: $IMLIBCONF" ])
650 CFLAGS="$ac_save_CFLAGS"
656 ifelse([$3], , :, [$3])
658 AC_SUBST(IMLIB_CFLAGS)
663 # Check for gdk-imlib
664 AC_DEFUN(AM_PATH_GDK_IMLIB,
666 dnl Get the cflags and libraries from the imlib-config script
668 AC_ARG_WITH(imlib-prefix,[ --with-imlib-prefix=PFX prefix for IMLIB files (optional)],
669 imlib_prefix="$withval", imlib_prefix="")
670 AC_ARG_WITH(imlib-exec-prefix,[ --with-imlib-exec-prefix=PFX exec prefix for IMLIB files (optional)],
671 imlib_exec_prefix="$withval", imlib_exec_prefix="")
672 AC_ARG_ENABLE(imlibtest, [ --disable-imlibtest do not try to compile and run a test IMLIB program],
673 , enable_imlibtest=yes)
675 if test x$imlib_exec_prefix != x ; then
676 imlib_args="$imlib_args --exec-prefix=$imlib_exec_prefix"
677 if test x${IMLIBCONF+set} != xset ; then
678 IMLIBCONF=$imlib_exec_prefix/bin/imlib-config
681 if test x$imlib_prefix != x ; then
682 imlib_args="$imlib_args --prefix=$imlib_prefix"
683 if test x${IMLIBCONF+set} != xset ; then
684 IMLIBCONF=$imlib_prefix/bin/imlib-config
688 AC_PATH_PROG(IMLIBCONF, imlib-config, no)
689 min_imlib_version=ifelse([$1], ,1.8.1,$1)
690 AC_MSG_CHECKING(for GDK IMLIB - version >= $min_imlib_version)
692 if test "$IMLIBCONF" = "no" ; then
695 GDK_IMLIB_CFLAGS=`$IMLIBCONF $imlibconf_args --cflags-gdk`
696 GDK_IMLIB_LIBS=`$IMLIBCONF $imlibconf_args --libs-gdk`
698 imlib_major_version=`$IMLIBCONF $imlib_args --version | \
699 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
700 imlib_minor_version=`$IMLIBCONF $imlib_args --version | \
701 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
702 if test "x$enable_imlibtest" = "xyes" ; then
703 ac_save_CFLAGS="$CFLAGS"
705 CFLAGS="$CFLAGS $GDK_IMLIB_CFLAGS"
706 LIBS="$LIBS $GDK_IMLIB_LIBS"
708 dnl Now check if the installed IMLIB is sufficiently new. (Also sanity
709 dnl checks the results of imlib-config to some extent
716 #include <gdk_imlib.h>
718 /* migo: originally it was GdkImLibColor with incorrect spelling */
719 GdkImlibImage testimage;
726 system ("touch conf.gdkimlibtest");
728 /* HP/UX 9 (%@#!) writes to sscanf strings */
729 tmp_version = g_strdup("$min_imlib_version");
730 if (sscanf(tmp_version, "%d.%d", &major, &minor) != 2) {
731 printf("%s, bad version string\n", "$min_imlib_version");
735 if (($imlib_major_version > major) ||
736 (($imlib_major_version == major) && ($imlib_minor_version > minor)))
742 printf("\n*** 'imlib-config --version' returned %d.%d, but the minimum version\n", $imlib_major_version, $imlib_minor_version);
743 printf("*** of IMLIB required is %d.%d. If imlib-config is correct, then it is\n", major, minor);
744 printf("*** best to upgrade to the required version.\n");
745 printf("*** If imlib-config was wrong, set the environment variable IMLIBCONF\n");
746 printf("*** to point to the correct copy of imlib-config, and remove the file\n");
747 printf("*** config.cache before re-running configure\n");
752 ],, no_imlib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
753 CFLAGS="$ac_save_CFLAGS"
757 if test "x$no_imlib" = x ; then
759 ifelse([$2], , :, [$2])
762 if test "$IMLIBCONF" = "no" ; then
763 (echo "*** The imlib-config script installed by IMLIB could not be found" >&5) 2>/dev/null || \
764 echo "*** The imlib-config script installed by IMLIB could not be found"
765 (echo "*** If IMLIB was installed in PREFIX, make sure PREFIX/bin is in" >&5) 2>/dev/null || \
766 echo "*** If IMLIB was installed in PREFIX, make sure PREFIX/bin is in"
767 (echo "*** your path, or set the IMLIBCONF environment variable to the" >&5) 2>/dev/null || \
768 echo "*** your path, or set the IMLIBCONF environment variable to the"
769 (echo "*** full path to imlib-config." >&5) 2>/dev/null || \
770 echo "*** full path to imlib-config."
772 if test -f conf.gdkimlibtest ; then
775 (echo "*** Could not run IMLIB test program, checking why..." >&5) 2>/dev/null || \
776 echo "*** Could not run IMLIB test program, checking why..."
777 CFLAGS="$CFLAGS $GDK_IMLIB_CFLAGS"
778 LIBS="$LIBS $GDK_IMLIB_LIBS"
782 #include <gdk_imlib.h>
784 [ (echo "*** The test program compiled, but did not run. This usually means" >&5) 2>/dev/null || \
785 echo "*** The test program compiled, but did not run. This usually means"
786 (echo "*** that the run-time linker is not finding IMLIB or finding the wrong" >&5) 2>/dev/null || \
787 echo "*** that the run-time linker is not finding IMLIB or finding the wrong"
788 (echo "*** version of IMLIB. If it is not finding IMLIB, you'll need to set your" >&5) 2>/dev/null || \
789 echo "*** version of IMLIB. If it is not finding IMLIB, you'll need to set your"
790 (echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" >&5) 2>/dev/null || \
791 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
792 (echo "*** to the installed location Also, make sure you have run ldconfig if that" >&5) 2>/dev/null || \
793 echo "*** to the installed location Also, make sure you have run ldconfig if that"
794 (echo "*** is required on your system" >&5) 2>/dev/null || \
795 echo "*** is required on your system"
796 (echo "***" >&5) 2>/dev/null || \
798 (echo "*** If you have an old version installed, it is best to remove it, although" >&5) 2>/dev/null || \
799 echo "*** If you have an old version installed, it is best to remove it, although"
800 (echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" >&5) 2>/dev/null || \
801 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
802 [ (echo "*** The test program failed to compile or link. See the file config.log for the" >&5) 2>/dev/null || \
803 echo "*** The test program failed to compile or link. See the file config.log for the"
804 (echo "*** exact error that occured. This usually means IMLIB was incorrectly installed" >&5) 2>/dev/null || \
805 echo "*** exact error that occured. This usually means IMLIB was incorrectly installed"
806 (echo "*** or that you have moved IMLIB since it was installed. In the latter case, you" >&5) 2>/dev/null || \
807 echo "*** or that you have moved IMLIB since it was installed. In the latter case, you"
808 (echo "*** may want to edit the imlib-config script: $IMLIBCONF" >&5) 2>/dev/null || \
809 echo "*** may want to edit the imlib-config script: $IMLIBCONF"])
810 CFLAGS="$ac_save_CFLAGS"
816 ifelse([$3], , :, [$3])
818 AC_SUBST(GDK_IMLIB_CFLAGS)
819 AC_SUBST(GDK_IMLIB_LIBS)
820 rm -f conf.gdkimlibtest
824 dnl --------------------------------------------------------------------------
825 dnl from gnome.m4, modified by migo
828 dnl GNOME_INIT_HOOK (script-if-gnome-enabled, [failflag])
830 dnl if failflag is "fail" then GNOME_INIT_HOOK will abort if gnomeConf.sh
834 AC_DEFUN([GNOME_INIT_HOOK],[
836 AC_SUBST(GNOMEUI_LIBS)
837 AC_SUBST(GNOME_LIBDIR)
838 AC_SUBST(GNOME_INCLUDEDIR)
840 AC_ARG_WITH(gnome-includes,
841 [ --with-gnome-includes location of GNOME headers],[
842 CFLAGS="$CFLAGS -I$withval"
845 AC_ARG_WITH(gnome-libs,
846 [ --with-gnome-libs location of GNOME libs],[
847 LDFLAGS="$LDFLAGS -L$withval"
848 gnome_prefix=$withval
852 [ --with-gnome no, yes or prefix for GNOME files (FvwmGtk only)],
853 if test x$withval = xyes; then
855 dnl Note that an empty true branch is not
857 ifelse([$1], [], :, [$1])
859 if test "x$withval" = xno; then
861 problem_gnomelibs=": Explicitly disabled"
864 LDFLAGS="$LDFLAGS -L$withval/lib"
865 CFLAGS="$CFLAGS -I$withval/include"
866 gnome_prefix=$withval/lib
871 if test "x$with_gnomelibs" = xyes; then
872 problem_gnomelibs=": Can't find working gnome-config"
874 AC_PATH_PROG(GNOME_CONFIG,gnome-config,no)
875 if test "$GNOME_CONFIG" = "no"; then
876 no_gnome_config="yes"
878 AC_MSG_CHECKING(whether $GNOME_CONFIG works)
879 if $GNOME_CONFIG --libs-only-l gnome >/dev/null 2>&1; then
881 GNOME_LIBS="`$GNOME_CONFIG --libs-only-l gnome`"
882 GNOMEUI_LIBS="`$GNOME_CONFIG --libs-only-l gnomeui`"
883 GNOME_LIBDIR="`$GNOME_CONFIG --libs-only-L gnorba gnomeui`"
884 GNOME_INCLUDEDIR="`$GNOME_CONFIG --cflags gnorba gnomeui`"
888 no_gnome_config="yes"
892 if test x$exec_prefix = xNONE; then
893 if test x$prefix = xNONE; then
894 gnome_prefix=$ac_default_prefix/lib
896 gnome_prefix=$prefix/lib
899 gnome_prefix=`eval echo \`echo $libdir\``
902 if test "$no_gnome_config" = "yes"; then
903 AC_MSG_CHECKING(for gnomeConf.sh file in $gnome_prefix)
904 if test -f $gnome_prefix/gnomeConf.sh; then
906 echo "loading gnome configuration from" \
907 "$gnome_prefix/gnomeConf.sh"
908 . $gnome_prefix/gnomeConf.sh
911 AC_MSG_RESULT(not found)
912 if test x$2 = xfail; then
913 AC_MSG_ERROR(Could not find the gnomeConf.sh file that is generated by gnome-libs install)
920 # test whether gnome can be compiled
921 if test "x$with_gnomelibs" = xyes; then
922 problem_gnomelibs=": Can't compile trivial gnome app"
924 AC_MSG_CHECKING(whether trivial gnome compilation works)
925 my_CPPFLAGS="$CPPFLAGS"
927 CPPFLAGS="$CPPFLAGS $GNOME_INCLUDEDIR $GTK_CFLAGS"
928 LIBS="$LIBS $GNOME_LIBDIR $GNOMEUI_LIBS"
931 int main(int c, char **v) {
932 /* we can't really run this outside of X */
933 if (!c) gnome_init("test-app", "0.0", c, v);
936 [with_gnomelibs=yes],
939 AC_MSG_RESULT($with_gnomelibs)
940 CPPFLAGS="$my_CPPFLAGS"
947 if test "x$with_gnomelibs" = xyes; then