autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How do I make a portable test??


From: Dr. David Kirkby
Subject: How do I make a portable test??
Date: Fri, 14 Feb 2003 02:11:37 +0000

Hi,
        I have written a package
http://atlc.sourceforge.net/
which ideally would like to link in with the gsl scientific library,
although it can be configured without it. I want to:

a) Test for the presence of some gsl library header files
b) Test for the presence of some gsl library files. 

Based on the results of these tests, I want either to print a warning
message saying the gsl library is not installed, or print a message
saying the installation is broken. 

The section below between the two rows of stars works fine on a Sun
workstation running Solaris 9 (tcsh shell), a Sun workstation running
Debian Linux (bash shell), a PC running Redhat 7.3 Linux (tcsh shell),
but *fails* on a Sun workstation running NetBSD 1.6 unix (ksh shell),
with the message:

test: ==: unexpected operator

Further down there are two more instances where the configure script
says 
test: ==: unexpected operator
although I have not at this time isolated where these are. I'd like to
improve the portability of the code (that is after all the aim of
autoconf). Can anyone suggest a way to do this?



dnl Check to see if the gsl library files AND header files are all 
dnl around.

gsl_inc_count=0
AC_HAVE_HEADERS(gsl/gsl_sf_ellint.h,[gsl_inc_count=$(($gsl_inc_count +
1))])
AC_HAVE_HEADERS(gsl/gsl_sf_bessel.h,[gsl_inc_count=$(($gsl_inc_count +
1))])

gsl_lib_count=0
AC_CHECK_LIB(gslcblas,main,[gsl_lib_count=$(($gsl_lib_count + 1))])
AC_CHECK_LIB(gsl,main,[gsl_lib_count=$(($gsl_lib_count +
1))],,-lgslcblas)

gsl_not_installed=0
gsl_incomplete=0

******************************************
dnl something here generates an error:
dnl "test: ==: unexpected operator" on a Sun running NetBSD 1.6 
if test $gsl_inc_count == 0 && test $gsl_lib_count == 0; then
   gsl_not_installed=1
elif test $gsl_inc_count != 2 || test $gsl_lib_count != 2; then  
   gsl_incomplete=1
fi
*******************************************

dnl Print warnings if the gsl installion is missing or incomplete. 

if test $gsl_not_installed == 1; then
  AC_MSG_WARN([To get full functionality you should install the GNU
scientific 
               library (gsl) available at
http://sources.redhat.com/gsl. Without 
gsl
               it will be impossible to evaluate the theoretical
impedance of 
               a coupler  using \"design_coupler\".])
elif test $gsl_incomplete == 1; then
  AC_MSG_WARN([Some of the gsl headers and libraries were found, but
others are
               missing.  Since the installation appears to be broken,
the use
               of gsl will be disabled.  Without gsl, it will be
impossible to
               evaluate the theoretical impedance of a coupler using
\"design_cou
pler\".])
else
  AC_DEFINE(HAVE_GSL)
fi


-- 
Dr. David Kirkby,
Senior Research Fellow,
Department of Medical Physics,
University College London,
11-20 Capper St, London, WC1E 6JA.
Tel: 020 7679 6408 Fax: 020 7679 6269
Internal telephone: ext 46408
e-mail address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]