1 # Configure paths for ARTS
2 # Philip Stadermann 2001-06-21
4 # adapted and scrubbed by thomas
6 dnl AM_PATH_ARTS([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
7 dnl Test for ARTS, and define ARTS_CFLAGS and ARTS_LIBS
9 AC_DEFUN([AM_PATH_ARTS],
11 dnl Get the cflags and libraries from the artsc-config script
13 AC_ARG_WITH(arts-prefix,[ --with-arts-prefix=PFX Prefix where ARTS is installed (optional)],
14 arts_prefix="$withval", arts_prefix="")
15 AC_ARG_WITH(arts-exec-prefix,[ --with-arts-exec-prefix=PFX Exec prefix where ARTS is installed (optional)],
16 arts_exec_prefix="$withval", arts_exec_prefix="")
17 AC_ARG_ENABLE(artstest, [ --disable-artstest Do not try to compile and run a test ARTS program],
18 , enable_artstest=yes)
20 if test x$arts_exec_prefix != x ; then
21 arts_args="$arts_args --exec-prefix=$arts_exec_prefix"
22 if test x${ARTS_CONFIG+set} != xset ; then
23 ARTS_CONFIG=$arts_exec_prefix/bin/artsc-config
26 if test x$arts_prefix != x ; then
27 arts_args="$arts_args --prefix=$arts_prefix"
28 if test x${ARTS_CONFIG+set} != xset ; then
29 ARTS_CONFIG=$arts_prefix/bin/artsc-config
33 AC_PATH_PROG(ARTS_CONFIG, artsc-config, no)
34 min_arts_version=ifelse([$1], ,0.9.5,$1)
35 AC_MSG_CHECKING(for ARTS artsc - version >= $min_arts_version)
37 if test "$ARTS_CONFIG" = "no" ; then
40 # FIXME : thomas added this sed to get arts path instead of artsc
41 ARTS_CFLAGS=`$ARTS_CONFIG $artsconf_args --cflags | sed 's/artsc$/arts/'`
42 ARTS_LIBS=`$ARTS_CONFIG $artsconf_args --libs | sed 's/artsc$/arts/'`
44 arts_major_version=`$ARTS_CONFIG $arts_args --version | \
45 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
46 arts_minor_version=`$ARTS_CONFIG $arts_args --version | \
47 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
48 arts_micro_version=`$ARTS_CONFIG $arts_config_args --version | \
49 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
50 if test "x$enable_artstest" = "xyes" ; then
51 ac_save_CFLAGS="$CFLAGS"
53 CFLAGS="$CFLAGS $ARTS_CFLAGS"
54 LIBS="$LIBS $ARTS_LIBS"
56 dnl Now check if the installed ARTS is sufficiently new. (Also sanity
57 dnl checks the results of artsc-config to some extent)
59 dnl thomas: ask nicely for C++ compilation
61 AC_SUBST(CPPFLAGS,"$CPPFLAGS $ARTS_CFLAGS")
62 AC_SUBST(LDFLAGS,"$LDFLAGS $ARTS_CLIBS")
77 // thomas: the original test did not have the typecast
78 new_str = (char *) malloc ((strlen (str) + 1) * sizeof(char));
79 strcpy (new_str, str);
89 int major, minor, micro;
92 system ("touch conf.artstest");
94 /* HP/UX 9 (%@#!) writes to sscanf strings */
95 tmp_version = my_strdup("$min_arts_version");
96 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
97 printf("%s, bad version string\n", "$min_arts_version");
101 if (($arts_major_version > major) ||
102 (($arts_major_version == major) && ($arts_minor_version > minor)) ||
103 (($arts_major_version == major) && ($arts_minor_version == minor) && ($arts_micro_version >= micro)))
109 printf("\n*** 'artsc-config --version' returned %d.%d.%d, but the minimum version\n", $arts_major_version, $arts_minor_version, $arts_micro_version);
110 printf("*** of ARTS required is %d.%d.%d. If artsc-config is correct, then it is\n", major, minor, micro);
111 printf("*** best to upgrade to the required version.\n");
112 printf("*** If artsc-config was wrong, set the environment variable ARTS_CONFIG\n");
113 printf("*** to point to the correct copy of artsc-config, and remove the file\n");
114 printf("*** config.cache before re-running configure\n");
119 ],, no_arts=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
120 CFLAGS="$ac_save_CFLAGS"
124 if test "x$no_arts" = x ; then
126 ifelse([$2], , :, [$2])
129 if test "$ARTS_CONFIG" = "no" ; then
130 echo "*** The artsc-config script installed by ARTS could not be found"
131 echo "*** If ARTS was installed in PREFIX, make sure PREFIX/bin is in"
132 echo "*** your path, or set the ARTS_CONFIG environment variable to the"
133 echo "*** full path to artsc-config."
135 if test -f conf.artstest ; then
138 echo "*** Could not run ARTS test program, checking why..."
139 CFLAGS="$CFLAGS $ARTS_CFLAGS"
140 LIBS="$LIBS $ARTS_LIBS"
143 #include <artsflow.h>
145 [ echo "*** The test program compiled, but did not run. This usually means"
146 echo "*** that the run-time linker is not finding ARTS or finding the wrong"
147 echo "*** version of ARTS. If it is not finding ARTS, you'll need to set your"
148 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
149 echo "*** to the installed location Also, make sure you have run ldconfig if that"
150 echo "*** is required on your system"
152 echo "*** If you have an old version installed, it is best to remove it, although"
153 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
154 [ echo "*** The test program failed to compile or link. See the file config.log for the"
155 echo "*** exact error that occured. This usually means ARTS was incorrectly installed"
156 echo "*** or that you have moved ARTS since it was installed. In the latter case, you"
157 echo "*** may want to edit the artsc-config script: $ARTS_CONFIG" ])
158 CFLAGS="$ac_save_CFLAGS"
164 ifelse([$3], , :, [$3])
166 AC_SUBST(ARTS_CFLAGS)
170 dnl release C++ question