autoconf
[Top][All Lists]
Advanced

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

Specifying path to headers and libraries with configure


From: Ollie Cook
Subject: Specifying path to headers and libraries with configure
Date: Fri, 5 Apr 2002 11:31:04 +0100
User-agent: Mutt/1.3.25i

Hi,

I am a bit new to autoconf and am having trouble with a fairly simple concept.
I'll tried to find the answer in the 'New Riders' book as well to no avail, so
hope I can find some assistance here.

I have an application which links against librrd and I'd like my configure
script to find where the rrd.h header and librrd.a library files are so that it
can pass the paths to the compiler with -I and -L

I'm currently doing it with this configuration, but it seems quite
a long way around to do something fairly simple:

configure.in:

  dnl Additional include path
  AC_ARG_WITH(includes,
    [  --with-includes=LIST    additional include paths
                            LIST is a colon separated list of include paths
                            e.g. 
--with-includes=/usr/local/rrdtool-1.0.33/include/
    ],
    [ more_includes=`echo "$withval" | sed -e 's/:/ /g'` ;
      for directory in $more_includes; do
        includes="-I$directory $includes"
      done ])

  dnl Additional library path
  AC_ARG_WITH(libraries,
    [  --with-libraries=LIST   additional libraries paths
                           LIST is a colon separated list of libraries paths
                           e.g. --with-libraries=/usr/local/rrdtool-1.0.33/lib
    ],
    [ more_libraries=`echo "$withval" | sed -e 's/:/ /g'` ;
      for directory in $more_libraries; do
        libraries="-L$directory $libraries"
      done ])

  INCLUDES="$includes"
  LDFLAGS="$libraries"
  AC_SUBST(INCLUDES)
  AC_SUBST(LDFLAGS)

Makefile.am:

  address@hidden@

  bin_PROGRAMS = exim_monitor
  sbin_PROGRAMS = exim_monitord
  exim_monitor_SOURCES = exim_monitor.c exim_info.c logging.c process_control.c 
parse_config.c
  exim_monitord_SOURCES = exim_monitord.c logging.c process_control.c
  exim_monitord_LDADD = -lrrd
  address@hidden@

However, I'm pretty sure that I'm now doing this right - and would appreciate
some advice on the proper way to check for libraries and header files in unusual
directories (RRDtool keeps them in /usr/local/rrd-x.y.z/(include|lib)/).

If it's possible I'd also like the configure script to fail if it doesn't find
the files in the specified path, rather than blindly accepting the extra paths
and causing the compile to fail when 'make' is called.

Yours,

Ollie
-- 
Oliver Cook    Systems Administrator, ClaraNET
address@hidden               020 7903 3065



reply via email to

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