1 dnl Test for the ArtsC interface.
3 AC_DEFUN([AM_PATH_ARTSC],
5 AC_ARG_ENABLE(artsc-test,
6 [ --disable-artsc-test Do not compile and run a test ArtsC program.],
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)
16 if test "x$ARTSC_CONFIG" != "xno"; then
17 ARTSC_CFLAGS=`$ARTSC_CONFIG --cflags`
18 ARTSC_LIBS=`$ARTSC_CONFIG --libs`
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/'`
27 # Test if a simple ArtsC program can be created.
28 if test "x$artsc_test" = "xyes"; then
29 ac_save_CFLAGS="$CFLAGS"
31 CFLAGS="$CFLAGS $ARTSC_CFLAGS"
32 LIBS="$LIBS $ARTSC_LIBS"
48 new_str = malloc((strlen(str) + 1) * sizeof(char));
59 int major, minor, micro;
62 system ("touch conf.artsc");
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");
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))) {
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");
86 ],, no_artsc=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
87 CFLAGS="$ac_save_CFLAGS"
94 if test "x$no_artsc" != "xyes"; then
96 ifelse([$2], , :, [$2])
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."
106 if test -f conf.artsc ; then
109 echo "*** Could not run ArtsC test program, checking why..."
110 CFLAGS="$CFLAGS $ARTSC_CFLAGS"
111 LIBS="$LIBS $ARTSC_LIBS"
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"
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"
135 ifelse([$3], , :, [$3])
138 AC_SUBST(ARTSC_CFLAGS)