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 ])
|