1# Configure paths for XDELTA 2# Owen Taylor 97-11-3 3 4dnl AM_PATH_XDELTA([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) 5dnl Test for XDELTA, and define XDELTA_CFLAGS and XDELTA_LIBS, if "gmodule" or 6dnl 7AC_DEFUN(AM_PATH_XDELTA, 8[dnl 9dnl Get the cflags and libraries from the xdelta-config script 10dnl 11AC_ARG_WITH(xdelta-prefix,[ --with-xdelta-prefix=PFX Prefix where XDELTA is installed (optional)], 12 xdelta_config_prefix="$withval", xdelta_config_prefix="") 13AC_ARG_WITH(xdelta-exec-prefix,[ --with-xdelta-exec-prefix=PFX Exec prefix where XDELTA is installed (optional)], 14 xdelta_config_exec_prefix="$withval", xdelta_config_exec_prefix="") 15AC_ARG_ENABLE(xdeltatest, [ --disable-xdeltatest Do not try to compile and run a test XDELTA program], 16 , enable_xdeltatest=yes) 17 18 if test x$xdelta_config_exec_prefix != x ; then 19 xdelta_config_args="$xdelta_config_args --exec-prefix=$xdelta_config_exec_prefix" 20 if test x${XDELTA_CONFIG+set} != xset ; then 21 XDELTA_CONFIG=$xdelta_config_exec_prefix/bin/xdelta-config 22 fi 23 fi 24 if test x$xdelta_config_prefix != x ; then 25 xdelta_config_args="$xdelta_config_args --prefix=$xdelta_config_prefix" 26 if test x${XDELTA_CONFIG+set} != xset ; then 27 XDELTA_CONFIG=$xdelta_config_prefix/bin/xdelta-config 28 fi 29 fi 30 31 AC_PATH_PROG(XDELTA_CONFIG, xdelta-config, no) 32 min_xdelta_version=ifelse([$1], ,1.0.0,$1) 33 AC_MSG_CHECKING(for XDELTA - version >= $min_xdelta_version) 34 no_xdelta="" 35 if test "$XDELTA_CONFIG" = "no" ; then 36 no_xdelta=yes 37 else 38 XDELTA_CFLAGS=`$XDELTA_CONFIG $xdelta_config_args --cflags` 39 XDELTA_LIBS=`$XDELTA_CONFIG $xdelta_config_args --libs` 40 xdelta_config_major_version=`$XDELTA_CONFIG $xdelta_config_args --version | \ 41 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` 42 xdelta_config_minor_version=`$XDELTA_CONFIG $xdelta_config_args --version | \ 43 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` 44 xdelta_config_micro_version=`$XDELTA_CONFIG $xdelta_config_args --version | \ 45 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` 46 if test "x$enable_xdeltatest" = "xyes" ; then 47 ac_save_CFLAGS="$CFLAGS" 48 ac_save_LIBS="$LIBS" 49 CFLAGS="$CFLAGS $XDELTA_CFLAGS" 50 LIBS="$LIBS $XDELTA_LIBS" 51dnl 52dnl Now check if the installed XDELTA is sufficiently new. (Also sanity 53dnl checks the results of xdelta-config to some extent 54dnl 55 rm -f conf.xdeltatest 56 AC_TRY_RUN([ 57#include <xdelta.h> 58#include <stdio.h> 59#include <stdlib.h> 60 61int 62main () 63{ 64 int major, minor, micro; 65 char *tmp_version; 66 67 system ("touch conf.xdeltatest"); 68 69 /* HP/UX 9 (%@#!) writes to sscanf strings */ 70 tmp_version = g_strdup("$min_xdelta_version"); 71 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { 72 printf("%s, bad version string\n", "$min_xdelta_version"); 73 exit(1); 74 } 75 76 if ((xdelta_major_version != $xdelta_config_major_version) || 77 (xdelta_minor_version != $xdelta_config_minor_version) || 78 (xdelta_micro_version != $xdelta_config_micro_version)) 79 { 80 printf("\n*** 'xdelta-config --version' returned %d.%d.%d, but XDELTA (%d.%d.%d)\n", 81 $xdelta_config_major_version, $xdelta_config_minor_version, $xdelta_config_micro_version, 82 xdelta_major_version, xdelta_minor_version, xdelta_micro_version); 83 printf ("*** was found! If xdelta-config was correct, then it is best\n"); 84 printf ("*** to remove the old version of XDELTA. You may also be able to fix the error\n"); 85 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); 86 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); 87 printf("*** required on your system.\n"); 88 printf("*** If xdelta-config was wrong, set the environment variable XDELTA_CONFIG\n"); 89 printf("*** to point to the correct copy of xdelta-config, and remove the file config.cache\n"); 90 printf("*** before re-running configure\n"); 91 } 92 else if ((xdelta_major_version != XDELTA_MAJOR_VERSION) || 93 (xdelta_minor_version != XDELTA_MINOR_VERSION) || 94 (xdelta_micro_version != XDELTA_MICRO_VERSION)) 95 { 96 printf("*** XDELTA header files (version %d.%d.%d) do not match\n", 97 XDELTA_MAJOR_VERSION, XDELTA_MINOR_VERSION, XDELTA_MICRO_VERSION); 98 printf("*** library (version %d.%d.%d)\n", 99 xdelta_major_version, xdelta_minor_version, xdelta_micro_version); 100 } 101 else 102 { 103 if ((xdelta_major_version > major) || 104 ((xdelta_major_version == major) && (xdelta_minor_version > minor)) || 105 ((xdelta_major_version == major) && (xdelta_minor_version == minor) && (xdelta_micro_version >= micro))) 106 { 107 return 0; 108 } 109 else 110 { 111 printf("\n*** An old version of XDELTA (%d.%d.%d) was found.\n", 112 xdelta_major_version, xdelta_minor_version, xdelta_micro_version); 113 printf("*** You need a version of XDELTA newer than %d.%d.%d. The latest version of\n", 114 major, minor, micro); 115 printf("*** XDELTA is always available from ftp://ftp.gtk.org.\n"); 116 printf("***\n"); 117 printf("*** If you have already installed a sufficiently new version, this error\n"); 118 printf("*** probably means that the wrong copy of the xdelta-config shell script is\n"); 119 printf("*** being found. The easiest way to fix this is to remove the old version\n"); 120 printf("*** of XDELTA, but you can also set the XDELTA_CONFIG environment to point to the\n"); 121 printf("*** correct copy of xdelta-config. (In this case, you will have to\n"); 122 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); 123 printf("*** so that the correct libraries are found at run-time))\n"); 124 } 125 } 126 return 1; 127} 128],, no_xdelta=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) 129 CFLAGS="$ac_save_CFLAGS" 130 LIBS="$ac_save_LIBS" 131 fi 132 fi 133 if test "x$no_xdelta" = x ; then 134 AC_MSG_RESULT(yes) 135 ifelse([$2], , :, [$2]) 136 else 137 AC_MSG_RESULT(no) 138 if test "$XDELTA_CONFIG" = "no" ; then 139 echo "*** The xdelta-config script installed by XDELTA could not be found" 140 echo "*** If XDELTA was installed in PREFIX, make sure PREFIX/bin is in" 141 echo "*** your path, or set the XDELTA_CONFIG environment variable to the" 142 echo "*** full path to xdelta-config." 143 else 144 if test -f conf.xdeltatest ; then 145 : 146 else 147 echo "*** Could not run XDELTA test program, checking why..." 148 CFLAGS="$CFLAGS $XDELTA_CFLAGS" 149 LIBS="$LIBS $XDELTA_LIBS" 150 AC_TRY_LINK([ 151#include <xdelta.h> 152#include <stdio.h> 153], [ return ((xdelta_major_version) || (xdelta_minor_version) || (xdelta_micro_version)); ], 154 [ echo "*** The test program compiled, but did not run. This usually means" 155 echo "*** that the run-time linker is not finding XDELTA or finding the wrong" 156 echo "*** version of XDELTA. If it is not finding XDELTA, you'll need to set your" 157 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" 158 echo "*** to the installed location Also, make sure you have run ldconfig if that" 159 echo "*** is required on your system" 160 echo "***" 161 echo "*** If you have an old version installed, it is best to remove it, although" 162 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" 163 echo "***" 164 echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" 165 echo "*** came with the system with the command" 166 echo "***" 167 echo "*** rpm --erase --nodeps gtk gtk-devel" ], 168 [ echo "*** The test program failed to compile or link. See the file config.log for the" 169 echo "*** exact error that occured. This usually means XDELTA was incorrectly installed" 170 echo "*** or that you have moved XDELTA since it was installed. In the latter case, you" 171 echo "*** may want to edit the xdelta-config script: $XDELTA_CONFIG" ]) 172 CFLAGS="$ac_save_CFLAGS" 173 LIBS="$ac_save_LIBS" 174 fi 175 fi 176 XDELTA_CFLAGS="" 177 XDELTA_LIBS="" 178 ifelse([$3], , :, [$3]) 179 fi 180 AC_SUBST(XDELTA_CFLAGS) 181 AC_SUBST(XDELTA_LIBS) 182 rm -f conf.xdeltatest 183]) 184