2179
+ ��膩��� 1 dnl Test for the ArtsC interface.
+ ��膩��� 2
+ ��膩��� 3 AC_DEFUN([AM_PATH_ARTSC],
+ ��膩��� 4 [
+ ��膩��� 5 AC_ARG_ENABLE(artsc-test,
+ ��膩��� 6 [ --disable-artsc-test Do not compile and run a test ArtsC program.],
+ ��膩��� 7 [artsc_test="yes"],
+ ��膩��� 8 [artsc_test="no"])
+ ��膩��� 9
+ ��膩��� 10 dnl Search for the arts-config program.
+ ��膩��� 11 AC_PATH_PROG(ARTSC_CONFIG, artsc-config, no)
+ ��膩��� 12 min_artsc_version=ifelse([$1],,0.9.5,$1)
+ ��膩��� 13 AC_MSG_CHECKING(for ArtsC - version >= $min_artsc_version)
+ ��膩��� 14
+ ��膩��� 15 no_artsc=""
+ ��膩��� 16 if test "x$ARTSC_CONFIG" != "xno"; then
+ ��膩��� 17 ARTSC_CFLAGS=`$ARTSC_CONFIG --cflags`
+ ��膩��� 18 ARTSC_LIBS=`$ARTSC_CONFIG --libs`
+ ��膩��� 19
+ ��膩��� 20 artsc_major_version=`$ARTSC_CONFIG $artsc_args --version | \
+ ��膩��� 21 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+ ��膩��� 22 artsc_minor_version=`$ARTSC_CONFIG $artsc_args --version | \
+ ��膩��� 23 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+ ��膩��� 24 artsc_micro_version=`$ARTSC_CONFIG $artsc_config_args --version | \
+ ��膩��� 25 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+ ��膩��� 26
+ ��膩��� 27 # Test if a simple ArtsC program can be created.
+ ��膩��� 28 if test "x$artsc_test" = "xyes"; then
+ ��膩��� 29 ac_save_CFLAGS="$CFLAGS"
+ ��膩��� 30 ac_save_LIBS="$LIBS"
+ ��膩��� 31 CFLAGS="$CFLAGS $ARTSC_CFLAGS"
+ ��膩��� 32 LIBS="$LIBS $ARTSC_LIBS"
+ ��膩��� 33
+ ��膩��� 34 rm -f conf.artsc
+ ��膩��� 35 AC_TRY_RUN([
+ ��膩��� 36 #include <stdio.h>
+ ��膩��� 37 #include <stdlib.h>
+ ��膩��� 38 #include <string.h>
+ ��膩��� 39
+ ��膩��� 40 #include <artsc.h>
+ ��膩��� 41
+ ��膩��� 42 char*
+ ��膩��� 43 my_strdup(char *str)
+ ��膩��� 44 {
+ ��膩��� 45 char *new_str;
+ ��膩��� 46
+ ��膩��� 47 if (str) {
+ ��膩��� 48 new_str = malloc((strlen(str) + 1) * sizeof(char));
+ ��膩��� 49 strcpy(new_str, str);
+ ��膩��� 50 } else {
+ ��膩��� 51 new_str = NULL;
+ ��膩��� 52 }
+ ��膩��� 53
+ ��膩��� 54 return new_str;
+ ��膩��� 55 }
+ ��膩��� 56
+ ��膩��� 57 int main()
+ ��膩��� 58 {
+ ��膩��� 59 int major, minor, micro;
+ ��膩��� 60 char *tmp_version;
+ ��膩��� 61
+ ��膩��� 62 system ("touch conf.artsc");
+ ��膩��� 63
+ ��膩��� 64 /* HP/UX 9 writes to sscanf strings */
+ ��膩��� 65 tmp_version = my_strdup("$min_artsc_version");
+ ��膩��� 66 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
+ ��膩��� 67 printf("%s, bad version string\n", "$min_artsc_version");
+ ��膩��� 68 exit(1);
+ ��膩��� 69 }
+ ��膩��� 70
+ ��膩��� 71 if (($artsc_major_version > major) ||
+ ��膩��� 72 (($artsc_major_version == major) && ($artsc_minor_version > minor)) ||
+ ��膩��� 73 (($artsc_major_version == major) && ($artsc_minor_version == minor)
+ ��膩��� 74 && ($artsc_micro_version >= micro))) {
+ ��膩��� 75 return 0;
+ ��膩��� 76 } else {
+ ��膩��� 77 printf("\n*** 'artsc-config --version' returned %d.%d.%d, but the minimum version\n", $artsc_major_version, $artsc_minor_version, $artsc_micro_version);
+ ��膩��� 78 printf("*** of ARTSC required is %d.%d.%d. If artsc-config is correct, then it is\n", major, minor, micro);
+ ��膩��� 79 printf("*** best to upgrade to the required version.\n");
+ ��膩��� 80 printf("*** If artsc-config was wrong, set the environment variable ARTSC_CONFIG\n");
+ ��膩��� 81 printf("*** to point to the correct copy of artsc-config, and remove the file\n");
+ ��膩��� 82 printf("*** config.cache before re-running configure\n");
+ ��膩��� 83 return 1;
+ ��膩��� 84 }
+ ��膩��� 85 }
+ ��膩��� 86 ],, no_artsc=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+ ��膩��� 87 CFLAGS="$ac_save_CFLAGS"
+ ��膩��� 88 LIBS="$ac_save_LIBS"
+ ��膩��� 89 fi
+ ��膩��� 90 else
+ ��膩��� 91 no_artsc=yes
+ ��膩��� 92 fi
+ ��膩��� 93
+ ��膩��� 94 if test "x$no_artsc" != "xyes"; then
+ ��膩��� 95 AC_MSG_RESULT(yes)
+ ��膩��� 96 ifelse([$2], , :, [$2])
+ ��膩��� 97 else
+ ��膩��� 98 AC_MSG_RESULT(no)
+ ��膩��� 99
+ ��膩��� 100 if test "x$ARTSC_CONFIG" = "xno" ; then
+ ��膩��� 101 echo "*** The artsc-config script installed by ArtsC could not be found"
+ ��膩��� 102 echo "*** If ArtsC was installed in PREFIX, make sure PREFIX/bin is in"
+ ��膩��� 103 echo "*** your path, or set the ARTSC_CONFIG environment variable to the"
+ ��膩��� 104 echo "*** full path to artsc-config."
+ ��膩��� 105 else
+ ��膩��� 106 if test -f conf.artsc ; then
+ ��膩��� 107 :
+ ��膩��� 108 else
+ ��膩��� 109 echo "*** Could not run ArtsC test program, checking why..."
+ ��膩��� 110 CFLAGS="$CFLAGS $ARTSC_CFLAGS"
+ ��膩��� 111 LIBS="$LIBS $ARTSC_LIBS"
+ ��膩��� 112 AC_TRY_LINK([
+ ��膩��� 113 #include <stdio.h>
+ ��膩��� 114 #include <artsc.h>
+ ��膩��� 115 ],[return 0;],
+ ��膩��� 116 [ echo "*** The test program compiled, but did not run. This usually means"
+ ��膩��� 117 echo "*** that the run-time linker is not finding ArtsC or finding the wrong"
+ ��膩��� 118 echo "*** version of ArtsC. If it is not finding ArtsC, you'll need to set your"
+ ��膩��� 119 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+ ��膩��� 120 echo "*** to the installed location Also, make sure you have run ldconfig if that"
+ ��膩��� 121 echo "*** is required on your system"
+ ��膩��� 122 echo "***"
+ ��膩��� 123 echo "*** If you have an old version installed, it is best to remove it, although"
+ ��膩��� 124 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
+ ��膩��� 125 [ echo "*** The test program failed to compile or link. See the file config.log for the"
+ ��膩��� 126 echo "*** exact error that occured. This usually means ArtsC was incorrectly installed"
+ ��膩��� 127 echo "*** or that you have moved ArtsC since it was installed. In the latter case, you"
+ ��膩��� 128 echo "*** may want to edit the artsc-config script: $ARTSC_CONFIG" ])
+ ��膩��� 129 CFLAGS="$ac_save_CFLAGS"
+ ��膩��� 130 LIBS="$ac_save_LIBS"
+ ��膩��� 131 fi
+ ��膩��� 132 fi
+ ��膩��� 133 ARTSC_CFLAGS=""
+ ��膩��� 134 ARTSC_LIBS=""
+ ��膩��� 135 ifelse([$3], , :, [$3])
+ ��膩��� 136 fi
+ ��膩��� 137
+ ��膩��� 138 AC_SUBST(ARTSC_CFLAGS)
+ ��膩��� 139 AC_SUBST(ARTSC_LIBS)
+ ��膩��� 140 rm -f conf.artsc
+ ��膩��� 141
+ ��膩��� 142 ])