[OLPC-devel] [PATCH] Don't build xregcomp.c if we don't need it
Jordan Crouse
jordan.crouse at amd.com
Sun Aug 27 21:07:06 EDT 2006
libb/xregcomp.c assumes that <regex.h> exists. Unfortunately, when uclibc
regex support is disabled, uclibc headers install doesn't copy regex.h to the
staging include directory, thereby causing a subsequent busybox compile to
fail.
The attached patch works around this by only building xregcomp.c when it
is needed (ie, for awk, sed, less and devfsd). This may not be the most
correct fix, but it works, and it only touches one file.
Comments, and more intelligent patches welcome.
Jordan
--
Jordan Crouse
Senior Linux Engineer
Advanced Micro Devices, Inc.
<www.amd.com/embeddedprocessors>
-------------- next part --------------
[PATCH] Busybox shouldn't require regex.h unless it needs it
xregcomp.c assumes that regex.h is available. Since uclibc purposely omits
regex.h if regex support is compiled out, this makes busybox fail when
being built under a uclibc with no regex support.
This patch only builds xregcomp when we need it.
Index: busybox-1.1.3/libbb/Makefile.in
===================================================================
--- busybox-1.1.3.orig/libbb/Makefile.in 2006-08-27 18:47:30.000000000 -0600
+++ busybox-1.1.3/libbb/Makefile.in 2006-08-27 18:52:49.000000000 -0600
@@ -29,7 +29,7 @@
safe_strncpy.c setup_environment.c sha1.c simplify_path.c \
trim.c u_signal_names.c vdprintf.c verror_msg.c \
vherror_msg.c vperror_msg.c wfopen.c xconnect.c xgetcwd.c xstat.c \
- xgethostbyname.c xgethostbyname2.c xreadlink.c xregcomp.c xgetlarg.c \
+ xgethostbyname.c xgethostbyname2.c xreadlink.c xgetlarg.c \
get_terminal_width_height.c fclose_nonstdin.c fflush_stdout_and_exit.c \
getopt_ulflags.c default_error_retval.c wfopen_input.c speed_table.c \
perror_nomsg_and_die.c perror_nomsg.c skip_whitespace.c bb_askpass.c \
@@ -48,6 +48,19 @@
LIBBB-$(CONFIG_SU)+= correct_password.c
LIBBB-$(CONFIG_LOGIN)+= correct_password.c
+# We shouldn't build xregcomp.c if we don't need it - this ensures we don't
+# require regex.h to be in the include dir even if we don't need it thereby
+# allowing us to build busybox even if uclibc regex support is disabled.
+
+regex-y=
+
+regex-$(CONFIG_AWK) += xregcomp.c
+regex-$(CONFIG_SED) += xregcomp.c
+regex-$(CONFIG_LESS) += xregcomp.c
+regex-$(CONFIG_DEVFSD) += xregcomp.c
+
+# Sort has the happy side efect of returning a unique list
+LIBBB-y += $(sort $(regex-y))
LIBBB-y:=$(patsubst %,$(srcdir)/%,$(LIBBB-y))
More information about the Devel
mailing list