This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Macro works OK,but aclocal says "macro `AM_PATH_GSL' not found in library"


"Steve M. Robbins" wrote:
> 
> On Mon, Apr 07, 2003 at 05:09:30PM +0100, Dr. David Kirkby wrote:
> 
> > > I had never heard of "sinclude()".  That appears to be an m4 thing.
> > > You should never need to use m4 commands.  Remove this line.
> >
> > How is one supposed to include a macro then, which has the extension .m4 ?
> 
> While generating the configure script, autoconf reads the file
> aclocal.m4.
> 
> The script "aclocal" creates this file by scanning configure.in
> looking for macros used, and then searching a bunch of .m4 files
> (including those in the current directory, or directories specified by
> "-I") for macro definitions.
> 
> The automake manual has a number of sections dealing with aclocal.
> 
> But it is a general truth that you needn't be programming in m4 unless
> you're doing something really hairy.  I've been using autoconf &
> automake for years and years and have never had to do anything so
> hairy.  ;-)
> 
> -S

Perhaps I am missing the point here. I must admit I'm pretty lost with
autoconf/automake, spending more time worrying about automake/autoconf
issues than actually writing the C for the program!

But I have found several m4 macros of use, that are on the web for
autoconf. There is a whole bunch of them at
http://www.gnu.org/software/ac-archive/htmldoc/index.html
that are useful. 

I'm using 3 - one to find gtk
(can't recall where that came from)
another to find the right compiler and compiler switches for
multi-threded programs 
http://www.gnu.org/software/ac-archive/htmldoc/acx_pthread.html
another to check the correct version of gsl exists (the one that is
causing me grief). 

I'm likely to add another one to determine how to compile code to use
the MPI library for distributed processing. 
http://www.gnu.org/software/ac-archive/htmldoc/acx_mpi.html

All these have .m4 extensions and are reasonably well documented. i.e. 
ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
with full documentation. Just what I want. 

How am I supposed to use these ? The gtk.m4 and acx_pthread.m4 seemed
to work okay with the 'sinclude(filename.m4)' but not the one for the
gsl library, which is part of the latest GNU gsl-1.3 distribution. 

Reading around the web I see sinclude should not be used any more, and
references to m4_sinclude. But that don't seem to work much better.

There is a section in the autoconf manual on m4 programing
http://www.gnu.org/manual/autoconf/html_node/autoconf_89.html#SEC89
but it don't make it too clear to me how to use the macros once they
are written. 

Here are my current set of error messages and the complete
configure.ac file. Any help appreciated. 

sparrow /export/home/davek/atlc % autoreconf
configure.ac:68: error: possibly undefined macro: AC_ARG_WITH
      If this token and others are legitimate, please use
m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:85: error: possibly undefined macro: AC_SUBST
configure:6662: error: possibly undefined macro: AC_ARG_ENABLE
configure:6674: error: possibly undefined macro: AC_PATH_PROG
configure:6676: error: possibly undefined macro: AC_MSG_CHECKING
configure:6709: error: possibly undefined macro: AC_TRY_RUN
configure:6774: error: possibly undefined macro: AC_MSG_RESULT
configure:6790: error: possibly undefined macro: AC_TRY_LINK
autoreconf:
/usr/local/stow/autoconf-2.57-build-cc-Xc-fast/bin/autoconf failed
with exit status: 1

#############################################
#############################################
# Process this file with autoconf to produce a configure script.

# Order of itmes is suggested in the autoconf documentation to be that
# below, to be as below. Let's try to stick to it.

# checks for programs
# checks for libraries
# checks for header files
# checks for typedefs
# checks for structures
# checks for compiler characteristics
# checks for library functions
# checks for system services
# AC_OUTPUT([file...])

AC_PREREQ(2.57)
AC_INIT(atlc, 4.2.12, drkirkby at ntlworld dot com)
AM_INIT_AUTOMAKE(atlc, 4.2.12, drkirkby at ntlworld dot com)
ACLOCAL_AMFLAGS = -I .

# Checks for programs.
AC_PROG_CXX
AC_ISC_POSIX

# AC_OUTPUT_COMMANDS([exit])

# Checks for libraries.
AC_CHECK_LIB(m,main)
AC_CHECK_LIB(c,memalign, AC_DEFINE(HAVE_MEMALIGN))


# check for optimised math library on SPARC
# AC_CHECK_LIB(mopt,main)
# check for the optimised
# AC_CHECK_LIB(copt,main)

# Checks for header files.

# AC_STDC_HEADERS
# AC_HAVE_HEADERS(stdio.h math.h errno.h stdlib.h string.h)
AC_CHECK_HEADERS([stdio.h math.h malloc.h stdlib.h string.h
strings.h])

# Checks for typedefs
AC_HEADER_STDBOOL
AC_C_CONST
AC_TYPE_SIZE_T

# checks for structures (none need to be tested)

# checks for compiler characteristics
AC_C_BIGENDIAN
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(size_t)

# checks for library functions
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_STRTOD
AC_CHECK_FUNCS([memset strchr strtol])
#AC_CHECK_FUNCS([memset pow sqrt strchr strtol])

# checks for system services

# Check if the user wants a GUI. If so makes sure GTK and wxWindows
are around.
# The macro is in the file gtk.m4, so it must be read it here. 
m4_sinclude(gtk.m4)
AC_ARG_WITH(gui, AC_HELP_STRING([--with-gui=[no]],[Add a GUI (needs
GTK >= 1.2.7 installed) but the GUI does not work!! ]))
if test "x$with_gui" = "xyes"; then
        AC_PATH_GTK(1.2.7, GTK127=1)
        if test "$GTK127" != 1; then
            AC_MSG_ERROR([
                Please check that gtk-config is in path, the directory
                where GTK+ libraries are installed (returned by
                'gtk-config --libs' command) is in LD_LIBRARY_PATH or
                equivalent variable and GTK+ is version 1.2.7 or
above.
            ])
        fi
        AC_CHECK_PROG(WXWINDOWS,wx-config, 1, 0)   
        if test "$WXWINDOWS" != 1; then
            AC_MSG_ERROR([
               wxWindows must be installed to use the GUI version of
atlc
        ])
        fi
        AC_SUBST(EXTRA_WXWINDOWS_LIBS,`wx-config --libs`)
        AC_SUBST(EXTRA_WXWINDOWS_CFLAGS,`wx-config --cflags`)
        AC_SUBST(GUI_DIRECTORY,gui)
fi
AC_LANG_C
m4_sinclude(gsl.m4)
AM_PATH_GSL([1.0])
LIBS="$GSL_LIBS $LIBS"
CFLAGS="$GSL_CFLAGS $CFLAGS"

#- some self-tests will fail if gsl library is not available.
#ail]
# AC_ARG_WITH(gsl=yes,[  --without-gsl           disable use of gsl
library (by default it's enabled)])
# if test "x$with_gsl" = "xno"; then
# AC_MSG_WARN([Use of the gsl library has been disabled - some
self-tests will fail])
# else
# AC_CHECK_LIB(m,main)
# AC_CHECK_LIB(gslcblas,main)
# AC_CHECK_LIB(gsl,main,,AC_MSG_WARN([To get full functionality you
should link atlc with the GNU Scientific Library (gsl)
# available at http://sources.redhat.com/gsl. Some self-tests will
fail without gsl.]))
# fi  



# Multi-Processor Support
m4_sinclude(acx_pthread.m4)
AC_ARG_WITH(threads, 
[  --with-threads          support thread-based parallel computation -
this 
                          needs a POSIX thread library (pthreads or
similar) 
                          installed])

if test "x$with_threads" = "xyes"; then
AC_CHECK_LIB(thread, thr_setconcurrency,
[AC_DEFINE(HAVE_THR_SETCONCURRENCY)])
ACX_PTHREAD([AC_DEFINE(ENABLE_POSIX_THREADS)])
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"
fi

# MPI and MPE Support - don't work on Solaris, so
# will try m4 macro at 
# http://www.gnu.org/software/ac-archive/htmldoc/acx_mpi.html

AC_ARG_WITH(mpi,
AC_HELP_STRING([--with-mpi=[mpi_install_prefix]],[support MPI-based
parallel computation (needs MPICH installed)]))
AC_ARG_WITH(mpe,
AC_HELP_STRING([--with-mpe=[mpi_install_prefix]],[implies --with-mpi
and additionally links in MPE logging support]))

if test "x$with_mpi" != "x" \
|| test "x$with_mpe" != "x"; then

  if test "x$with_mp" = "xyes"; then
    AC_MSG_ERROR([it does not make sense to use --with-mp with
--with-mpi or --with-mpe])
  fi  
  AC_HAVE_HEADERS(mpi.h)
  AC_DEFINE(ENABLE_MPI)
  AC_CHECK_LIB(socket, getsockopt)
  AC_CHECK_LIB(nsl, xdr_void)
  AC_CHECK_LIB(rt, sched_yield)
  if test "x$with_mpe" != "x"; then 
    if test "x$with_mpe" = "xyes"; then
        path_to_mpe=/usr/local
    else
        path_to_mpe=$with_mpe
    fi
    CFLAGS="$CFLAGS -I$path_to_mpe/include -L$path_to_mpe/lib"
    AC_CHECK_LIB(pmpich,  MPI_Init , , [AC_MSG_ERROR([Could not link
test program with libpmpich.a])])
    AC_CHECK_LIB(mpe,  MPE_Init_log , , [AC_MSG_ERROR([Could not link
test program with libmpe.a])])
    AC_CHECK_LIB(lmpe,  MPE_Init_log , ,[AC_MSG_ERROR([Could not link
test program with liblmpe.a])] , -lmpe)
  else
    if test "x$with_mpi" = "xyes"; then
        path_to_mpi=/usr/local
    else
        path_to_mpi=$with_mpi
    fi
    CFLAGS="$CFLAGS -I$path_to_mpi/include -L$path_to_mpi/lib"
    AC_CHECK_LIB(mpich,  MPI_Init, , [AC_MSG_ERROR([Could not link
test program with libmpich.a])])
  fi
fi
AC_OUTPUT([\
Makefile                                        \
src/Makefile                                    \
src/non_gui/Makefile                            \
src/gui/Makefile                                \
man/Makefile                                    \
man/man1/Makefile                               \
examples/Makefile                               \
tools/Makefile                                  \
tools/src/Makefile                              \
tests/Makefile                                  \
docs/html-docs/Makefile                         \
docs/html-docs/jpgs/Makefile                    \
docs/qex-december-1996/Makefile                 \
docs/theory/Makefile                            \
docs/Makefile                                   ])




-- 
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 davek at medphys dot ucl dot ac dot uk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]