From abcea07a1c72b3b89a53276595d8620c20c5f540 Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Tue, 24 Jul 2012 22:24:52 +0200 Subject: [PATCH] add --with-system-includedir and --with-system-libdir By default they are defined to --includedir and --libdir --- Makefile.in | 32 +++++++++++++++++--------------- configure.ac | 11 +++++++++++ main.c | 8 ++++---- 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/Makefile.in b/Makefile.in index 4dafc46..3086304 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,19 +1,21 @@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -libdir = @libdir@ -datarootdir = @datarootdir@ -datadir = @datadir@ -includedir = @includedir@ -pkgconfigdir = @PKGCONFIGDIR@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +libdir = @libdir@ +datarootdir = @datarootdir@ +datadir = @datadir@ +includedir = @includedir@ +system_includedir = @SYSTEM_INCLUDEDIR@ +system_libdir = @SYSTEM_LIBDIR@ +pkgconfigdir = @PKGCONFIGDIR@ -CC = @CC@ -PROG = pkgconf@EXEEXT@ -SRCS = main.c pkg.c bsdstubs.c getopt_long.c fragment.c argvsplit.c fileio.c tuple.c dependency.c -OBJS = ${SRCS:.c=.o} -CFLAGS = @CFLAGS@ -LDFLAGS = @LDFLAGS@ -CFLAGS += -DLIBDIR=\"${libdir}\" -DINCLUDEDIR=\"${includedir}\" -DPKG_DEFAULT_PATH=\"${pkgconfigdir}\" -Wall -Wextra -Wformat=2 -std=gnu99 -D_FORTIFY_SOURCE=2 +CC = @CC@ +PROG = pkgconf@EXEEXT@ +SRCS = main.c pkg.c bsdstubs.c getopt_long.c fragment.c argvsplit.c fileio.c tuple.c dependency.c +OBJS = ${SRCS:.c=.o} +CFLAGS = @CFLAGS@ +LDFLAGS = @LDFLAGS@ +CFLAGS += -DLIBDIR=\"${libdir}\" -DINCLUDEDIR=\"${includedir}\" -DPKG_DEFAULT_PATH=\"${pkgconfigdir}\" -DSYSTEM_INCLUDEDIR=\"${system_includedir}\" -DSYSTEM_LIBDIR=\"${system_libdir}\" -Wall -Wextra -Wformat=2 -std=gnu99 -D_FORTIFY_SOURCE=2 all: build build: ${PROG} diff --git a/configure.ac b/configure.ac index db2f442..8d039af 100644 --- a/configure.ac +++ b/configure.ac @@ -41,6 +41,17 @@ AC_ARG_WITH([pkg-config-dir],[AC_HELP_STRING([--with-pkg-config-dir],[specify AC_SUBST([PKGCONFIGDIR]) +AC_ARG_WITH([system-libdir],[AC_HELP_STRING([--with-system-libdir],[specify the + system library directory (default LIBDIR)])], + SYSTEM_LIBDIR="$withval", SYSTEM_LIBDIR="${libdir}") + +AC_SUBST([SYSTEM_LIBDIR]) + +AC_ARG_WITH([system-includedir],[AC_HELP_STRING([--with-system-libdir],[specify the + system include directory (default INCLUDEDIR)])], + SYSTEM_INCLUDEDIR="$withval", SYSTEM_INCLUDEDIR="${includedir}") + +AC_SUBST([SYSTEM_INCLUDEDIR]) AC_PROG_CPP AC_PROG_CC diff --git a/main.c b/main.c index 3b10c11..32926e0 100644 --- a/main.c +++ b/main.c @@ -59,10 +59,10 @@ fragment_has_system_dir(pkg_fragment_t *frag) switch (frag->type) { case 'L': - if (!want_keep_system_libs && !strcasecmp(LIBDIR, frag->data)) + if (!want_keep_system_libs && !strcasecmp(SYSTEM_LIBDIR, frag->data)) return true; case 'I': - if (!want_keep_system_cflags && !strcasecmp(INCLUDEDIR, frag->data)) + if (!want_keep_system_cflags && !strcasecmp(SYSTEM_INCLUDEDIR, frag->data)) return true; default: break; @@ -469,8 +469,8 @@ usage(void) printf(" linking to stdout\n"); printf(" --print-variables print all known variables in module to stdout\n"); printf(" --digraph print entire dependency graph in graphviz 'dot' format\n"); - printf(" --keep-system-cflags keep -I%s entries in cflags output\n", INCLUDEDIR); - printf(" --keep-system-libs keep -L%s entries in libs output\n", LIBDIR); + printf(" --keep-system-cflags keep -I%s entries in cflags output\n", SYSTEM_INCLUDEDIR); + printf(" --keep-system-libs keep -L%s entries in libs output\n", SYSTEM_LIBDIR); printf("\nreport bugs to <%s>.\n", PACKAGE_BUGREPORT); }