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