apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Erenkrantz <jerenkra...@ebuilt.com>
Subject [PATCH] add apr-config
Date Tue, 11 Dec 2001 09:29:02 GMT
In the style of glib-config, neon-config, and countless others.
This greatly eases the burden of parsing APRVARS from external
programs.  It is by no means complete, but I can get flood building
with this (and removes major headaches for us there).  And, I'm 
about to try my hand at SVN's configure script.

For now, it has access to all of the variables in APRVARS, but
doesn't have command line options for each one as I'm not sure 
what each of these oddball variables do. 

So, I think this is a good thing.  Comments?  I'll probably
commit tomorrow (err, later today) unless someone objects.  -- justin

Index: configure.in
===================================================================
RCS file: /home/cvs/apr/configure.in,v
retrieving revision 1.384
diff -u -r1.384 configure.in
--- configure.in	2001/12/07 15:48:05	1.384
+++ configure.in	2001/12/11 09:21:45
@@ -1427,6 +1427,7 @@
 	include/apr.h
 	APRVARS
 	build/rules.mk
+	apr-config
 ],[
 for i in $SAVE_FILES; do
   if cmp -s $i $i.save 2>/dev/null; then
@@ -1436,6 +1437,8 @@
   rm -f $i.save
 done
 ])
+
+chmod +x apr-config
 
 dnl #----------------------------- Fixup Makefiles for VPATH support
 
Index: Makefile.in
===================================================================
RCS file: /home/cvs/apr/Makefile.in,v
retrieving revision 1.63
diff -u -r1.63 Makefile.in
--- Makefile.in	2001/12/11 01:42:10	1.63
+++ Makefile.in	2001/12/11 09:21:45
@@ -32,12 +32,13 @@
 CLEAN_TARGETS = 
 DISTCLEAN_TARGETS = config.cache config.log config.status \
 	include/apr.h include/arch/unix/apr_private.h \
-	APRVARS libtool apr.exp
+	APRVARS libtool apr.exp apr-config
 EXTRACLEAN_TARGETS = configure aclocal.m4 include/arch/unix/apr_private.h.in \
 	exports.c export_vars.h
 
 prefix=@prefix@
 exec_prefix=@exec_prefix@
+bindir=@bindir@
 libdir=@libdir@
 includedir=@includedir@
 srcdir=@srcdir@
@@ -68,6 +69,8 @@
 	$(LIBTOOL) --mode=install cp $(TARGET_LIB) $(libdir)
 	$(LIBTOOL) --mode=install cp APRVARS $(libdir)
 	$(LIBTOOL) --mode=install cp apr.exp $(libdir)
+	$(LIBTOOL) --mode=install cp apr-config $(bindir)
+	chmod 755 $(bindir)/apr-config
 	@if [ $(INSTALL_SUBDIRS) != "none" ]; then \
             for i in $(INSTALL_SUBDIRS); do \
 	        ( cd $$i ; $(MAKE) install ); \

======
apr-config.in
======
#!/bin/sh

PREFIX="@prefix@"
EXEC_PREFIX="@exec_prefix@"
LIBDIR="@libdir@"
INCLUDEDIR="@includedir@"
CC="@CC@"
CPP="@CPP@"
SHELL="@SHELL@"
CPPFLAGS="@EXTRA_CPPFLAGS@"
CFLAGS="@EXTRA_CFLAGS@"
LDFLAGS="@EXTRA_LDFLAGS@"
LIBS="@EXTRA_LIBS@"
INCLUDES="@EXTRA_INCLUDES@"
LIBTOOL_LIBS="@LIBTOOL_LIBS@"
SHLIBPATH_VAR="@shlibpath_var@"
APR_SOURCE_DIR="@abs_srcdir@"
APR_SO_EXT="@so_ext@"
APR_LIB_TARGET="@export_lib_target@"

show_usage()
{
    cat << EOF
Usage: apr-config [OPTION]

Known values for OPTION are:
  --prefix=DIR      change prefix to DIR
  --cflags          print C compiler flags
  --cppflags        print cpp flags
  --includes        print include information
  --ldflags         print linker flags
  --libs            print library information
  --help            print this help
EOF
}

if test $# -eq 0; then
    show_usage
    exit 1
fi

while test $# -gt 0; do
    # Split out the options.
    case "$1" in
    -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
    *) optarg= ;;
    esac

    case "$1" in
    # It is possible for the user to override our prefix.
    --prefix=*)
    prefix=$optarg
    ;;
    --prefix)
    echo $PREFIX
    ;;
    --cflags)
    echo $CFLAGS
    ;;
    --cppflags)
    echo $CPPFLAGS
    ;;
    --libs)
    echo $LIBS
    ;;
    --ldflags)
    echo $LDFLAGS
    ;;
    --includes)
    echo $INCLUDES
    ;;
    --help)
    show_usage
    exit 1
    ;;
    *)
    show_usage
    exit 1
    ;;
    esac

    # Next please.
    shift
done

exit 0


Mime
View raw message