Merge pull request #31 from bapt/master

add --with-system-includedir and --with-system-libdir
pull/36/head
William Pitcock 2012-07-24 13:27:43 -07:00
commit f7496747a5
3 changed files with 32 additions and 19 deletions

View File

@ -5,6 +5,8 @@ libdir = @libdir@
datarootdir = @datarootdir@ datarootdir = @datarootdir@
datadir = @datadir@ datadir = @datadir@
includedir = @includedir@ includedir = @includedir@
system_includedir = @SYSTEM_INCLUDEDIR@
system_libdir = @SYSTEM_LIBDIR@
pkgconfigdir = @PKGCONFIGDIR@ pkgconfigdir = @PKGCONFIGDIR@
CC = @CC@ CC = @CC@
@ -13,7 +15,7 @@ SRCS = main.c pkg.c bsdstubs.c getopt_long.c fragment.c argvsplit.c fileio.c tu
OBJS = ${SRCS:.c=.o} OBJS = ${SRCS:.c=.o}
CFLAGS = @CFLAGS@ CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
CFLAGS += -DLIBDIR=\"${libdir}\" -DINCLUDEDIR=\"${includedir}\" -DPKG_DEFAULT_PATH=\"${pkgconfigdir}\" -Wall -Wextra -Wformat=2 -std=gnu99 -D_FORTIFY_SOURCE=2 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 all: build
build: ${PROG} build: ${PROG}

View File

@ -41,6 +41,17 @@ AC_ARG_WITH([pkg-config-dir],[AC_HELP_STRING([--with-pkg-config-dir],[specify
AC_SUBST([PKGCONFIGDIR]) 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_CPP
AC_PROG_CC AC_PROG_CC

8
main.c
View File

@ -59,10 +59,10 @@ fragment_has_system_dir(pkg_fragment_t *frag)
switch (frag->type) switch (frag->type)
{ {
case 'L': case 'L':
if (!want_keep_system_libs && !strcasecmp(LIBDIR, frag->data)) if (!want_keep_system_libs && !strcasecmp(SYSTEM_LIBDIR, frag->data))
return true; return true;
case 'I': case 'I':
if (!want_keep_system_cflags && !strcasecmp(INCLUDEDIR, frag->data)) if (!want_keep_system_cflags && !strcasecmp(SYSTEM_INCLUDEDIR, frag->data))
return true; return true;
default: default:
break; break;
@ -469,8 +469,8 @@ usage(void)
printf(" linking to stdout\n"); printf(" linking to stdout\n");
printf(" --print-variables print all known variables in module 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(" --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-cflags keep -I%s entries in cflags output\n", SYSTEM_INCLUDEDIR);
printf(" --keep-system-libs keep -L%s entries in libs output\n", LIBDIR); printf(" --keep-system-libs keep -L%s entries in libs output\n", SYSTEM_LIBDIR);
printf("\nreport bugs to <%s>.\n", PACKAGE_BUGREPORT); printf("\nreport bugs to <%s>.\n", PACKAGE_BUGREPORT);
} }