ICU-3933 Use icu-config when -O option is not given.

X-SVN-Rev: 25022
This commit is contained in:
Michael Ow 2008-12-01 21:57:14 +00:00
parent 112c1493df
commit aa19a5bae0
10 changed files with 129 additions and 12 deletions

1
.gitattributes vendored
View file

@ -51,6 +51,7 @@ README text !eol
icu4c/source/common/dtintrv.cpp -text
icu4c/source/common/mutex.cpp -text
icu4c/source/common/unicode/dtintrv.h -text
icu4c/source/config/pkgdataMakefile.in -text
icu4c/source/data/coll/bn_IN.txt -text
icu4c/source/data/coll/pa_Arab.txt -text
icu4c/source/data/coll/pa_Arab_PK.txt -text

View file

@ -38,7 +38,7 @@ DOCZIP = icu-docs.zip
CLEANFILES = *~
## Files built (autoconfed) and installed
INSTALLED_BUILT_FILES = $(top_builddir)/config/Makefile.inc $(top_builddir)/config/icu-config @platform_make_fragment@ $(EXTRA_DATA:%=$(DESTDIR)$(pkglibdir)/%)
INSTALLED_BUILT_FILES = $(top_builddir)/config/Makefile.inc $(top_builddir)/config/pkgdata.inc $(top_builddir)/config/icu-config @platform_make_fragment@ $(EXTRA_DATA:%=$(DESTDIR)$(pkglibdir)/%)
## Files built (autoconfed) but not installed
LOCAL_BUILT_FILES = icudefs.mk
@ -134,9 +134,11 @@ install-icu: $(INSTALLED_BUILT_FILES)
$(INSTALL_DATA) $(top_srcdir)/../license.html $(DESTDIR)$(pkgdatadir)/license.html
$(INSTALL_SCRIPT) $(top_builddir)/config/icu-config $(DESTDIR)$(bindir)/icu-config
$(INSTALL_DATA) $(top_builddir)/config/Makefile.inc $(DESTDIR)$(pkglibdir)/Makefile.inc
$(INSTALL_DATA) $(top_builddir)/config/pkgdata.inc $(DESTDIR)$(pkglibdir)/pkgdata.inc
cd $(DESTDIR)$(pkglibdir)/..; \
$(RM) current && ln -s $(VERSION) current; \
$(RM) Makefile.inc && ln -s current/Makefile.inc Makefile.inc
$(RM) Makefile.inc && ln -s current/Makefile.inc Makefile.inc; \
$(RM) pkgdata.inc && ln -s current/pkgdata.inc pkgdata.inc
ifeq ($(DOXYGEN),)
install-doc:
@ -161,11 +163,11 @@ clean-local:
$(RMV) Doxyfile doc $(DOCZIP)
distclean-local: clean-local
$(RMV) $(top_builddir)/config/Makefile.inc $(top_builddir)/config/icu-config
$(RMV) $(top_builddir)/config/Makefile.inc $(top_builddir)/config/pkgdata.inc $(top_builddir)/config/icu-config
$(RMV) config.cache config.log config.status
$(RMV) Makefile config/Makefile icudefs.mk $(LIBDIR) $(BINDIR)
check-local: $(top_builddir)/config/icu-config $(top_builddir)/config/Makefile.inc
check-local: $(top_builddir)/config/icu-config $(top_builddir)/config/Makefile.inc $(top_builddir)/config/pkgdata.inc
@echo verifying that icu-config --selfcheck can operate
@test "passed" = "$(shell $(top_builddir)/config/icu-config --selfcheck 2>&1)" || (echo "FAIL: icu-config could not run properly." ; exit 1)
@echo verifying that $(MAKE) -f Makefile.inc selfcheck can operate
@ -187,6 +189,14 @@ $(top_builddir)/config/Makefile.inc: $(srcdir)/config/Makefile.inc.in $(top_bui
cd $(top_builddir) \
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
$(top_builddir)/config/pkgdata.inc: icudefs.mk $(top_builddir)/config/pkgdataMakefile
cd $(top_builddir)/config; \
$(MAKE) -f pkgdataMakefile
$(top_builddir)/config/pkgdataMakefile:
cd $(top_builddir) \
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
$(top_builddir)/config/icu-config: $(top_builddir)/Makefile $(top_srcdir)/config/icu-config-top $(top_srcdir)/config/icu-config-bottom $(top_builddir)/config/Makefile.inc @platform_make_fragment@ $(top_srcdir)/config/make2sh.sed
-$(RMV) $@
$(INSTALL_SCRIPT) $(top_srcdir)/config/icu-config-top $@

View file

@ -58,7 +58,8 @@ allflags()
echo " --sysconfdir Print system config (etc) path"
echo " --unicode-version Print version of Unicode data used in ICU ($UNICODE_VERSION)"
echo " --version Print ICU version ($VERSION)"
echo " --incfile Print path to Makefile.inc (for -O option of pkgdata)"
echo " --incfile Print path to Makefile.inc"
echo " --incpkgdatafile Print path to pkgdata.inc (for -O option of pkgdata)"
echo " --install Print path to install-sh"
echo " --mkinstalldirs Print path to mkinstalldirs"
}
@ -303,6 +304,10 @@ do
echo $ECHO_N "${pkglibdir}/Makefile.inc${ECHO_C} "
;;
--incpkgdatafile)
echo $ECHO_N "${pkglibdir}/pkgdata.inc${ECHO_C} "
;;
--icudata)
echo $ECHO_N "${ICUDATA_NAME}${ECHO_C} "
;;

View file

@ -0,0 +1,40 @@
## pkgdataMakefile.in for ICU data
## Copyright (c) 2008, International Business Machines Corporation and
## others. All Rights Reserved.
## Source directory information
srcdir = @srcdir@
top_srcdir = @top_srcdir@
# So that you have $(top_builddir)/config.status
top_builddir = ..
## All the flags and other definitions are included here.
include $(top_builddir)/icudefs.mk
OUTPUTFILE=pkgdata.inc
MIDDLE_SO_TARGET=
all : clean
@echo GENCCODE_ASSEMBLY_TYPE=$(GENCCODE_ASSEMBLY) >> $(OUTPUTFILE)
@echo SO=$(SO) >> $(OUTPUTFILE)
@echo SOBJ=$(SOBJ) >> $(OUTPUTFILE)
@echo A=$(A) >> $(OUTPUTFILE)
@echo LIBPREFIX=$(LIBPREFIX) >> $(OUTPUTFILE)
@echo LIB_EXT_ORDER=$(FINAL_SO_TARGET) >> $(OUTPUTFILE)
@echo COMPILE="$(COMPILE.c)" >> $(OUTPUTFILE)
@echo LIBFLAGS="-I$(prefix)/include $(SHAREDLIBCPPFLAGS) $(SHAREDLIBCFLAGS)" >> $(OUTPUTFILE)
@echo GENLIB="$(SHLIB.c)" >> $(OUTPUTFILE)
@echo LDICUDTFLAGS=$(LDFLAGSICUDT) >> $(OUTPUTFILE)
@echo LD_SONAME=$(LD_SONAME) >> $(OUTPUTFILE)
@echo RPATH_FLAGS=$(RPATH_FLAGS) >> $(OUTPUTFILE)
@echo BIR_LDFLAGS=$(BIR_LDFLAGS) >> $(OUTPUTFILE)
@echo AR=$(AR) >> $(OUTPUTFILE)
@echo ARFLAGS=$(ARFLAGS) >> $(OUTPUTFILE)
@echo RANLIB=$(RANLIB) >> $(OUTPUTFILE)
@echo INSTALL_CMD=$(INSTALL-L) >> $(OUTPUTFILE)
clean :
$(RMV) $(OUTPUTFILE)

View file

@ -10078,7 +10078,7 @@ then
fi
# output the Makefiles
ac_config_files="$ac_config_files icudefs.mk Makefile data/pkgdataMakefile config/Makefile.inc data/Makefile stubdata/Makefile common/Makefile i18n/Makefile layout/Makefile layoutex/Makefile io/Makefile extra/Makefile extra/uconv/Makefile extra/uconv/pkgdataMakefile extra/scrptrun/Makefile tools/Makefile tools/ctestfw/Makefile tools/toolutil/Makefile tools/makeconv/Makefile tools/genrb/Makefile tools/genuca/Makefile tools/genccode/Makefile tools/gencmn/Makefile tools/gencnval/Makefile tools/genctd/Makefile tools/gennames/Makefile tools/gentest/Makefile tools/gennorm/Makefile tools/genprops/Makefile tools/gencase/Makefile tools/genbidi/Makefile tools/genpname/Makefile tools/genbrk/Makefile tools/gensprep/Makefile tools/icupkg/Makefile tools/icuswap/Makefile tools/pkgdata/Makefile tools/tzcode/Makefile test/Makefile test/compat/Makefile test/testdata/Makefile test/testdata/pkgdataMakefile test/hdrtst/Makefile test/intltest/Makefile test/cintltst/Makefile test/iotest/Makefile test/letest/Makefile test/perf/Makefile test/perf/collationperf/Makefile test/perf/ubrkperf/Makefile test/perf/charperf/Makefile test/perf/convperf/Makefile test/perf/normperf/Makefile test/perf/strsrchperf/Makefile test/perf/unisetperf/Makefile test/perf/usetperf/Makefile test/perf/ustrperf/Makefile test/perf/utfperf/Makefile test/perf/utrie2perf/Makefile samples/Makefile samples/date/Makefile samples/cal/Makefile samples/layout/Makefile common/unicode/platform.h"
ac_config_files="$ac_config_files icudefs.mk Makefile data/pkgdataMakefile config/Makefile.inc config/pkgdataMakefile data/Makefile stubdata/Makefile common/Makefile i18n/Makefile layout/Makefile layoutex/Makefile io/Makefile extra/Makefile extra/uconv/Makefile extra/uconv/pkgdataMakefile extra/scrptrun/Makefile tools/Makefile tools/ctestfw/Makefile tools/toolutil/Makefile tools/makeconv/Makefile tools/genrb/Makefile tools/genuca/Makefile tools/genccode/Makefile tools/gencmn/Makefile tools/gencnval/Makefile tools/genctd/Makefile tools/gennames/Makefile tools/gentest/Makefile tools/gennorm/Makefile tools/genprops/Makefile tools/gencase/Makefile tools/genbidi/Makefile tools/genpname/Makefile tools/genbrk/Makefile tools/gensprep/Makefile tools/icupkg/Makefile tools/icuswap/Makefile tools/pkgdata/Makefile tools/tzcode/Makefile test/Makefile test/compat/Makefile test/testdata/Makefile test/testdata/pkgdataMakefile test/hdrtst/Makefile test/intltest/Makefile test/cintltst/Makefile test/iotest/Makefile test/letest/Makefile test/perf/Makefile test/perf/collationperf/Makefile test/perf/ubrkperf/Makefile test/perf/charperf/Makefile test/perf/convperf/Makefile test/perf/normperf/Makefile test/perf/strsrchperf/Makefile test/perf/unisetperf/Makefile test/perf/usetperf/Makefile test/perf/ustrperf/Makefile test/perf/utfperf/Makefile test/perf/utrie2perf/Makefile samples/Makefile samples/date/Makefile samples/cal/Makefile samples/layout/Makefile common/unicode/platform.h"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@ -10680,6 +10680,7 @@ do
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"data/pkgdataMakefile") CONFIG_FILES="$CONFIG_FILES data/pkgdataMakefile" ;;
"config/Makefile.inc") CONFIG_FILES="$CONFIG_FILES config/Makefile.inc" ;;
"config/pkgdataMakefile") CONFIG_FILES="$CONFIG_FILES config/pkgdataMakefile" ;;
"data/Makefile") CONFIG_FILES="$CONFIG_FILES data/Makefile" ;;
"stubdata/Makefile") CONFIG_FILES="$CONFIG_FILES stubdata/Makefile" ;;
"common/Makefile") CONFIG_FILES="$CONFIG_FILES common/Makefile" ;;

View file

@ -1043,6 +1043,7 @@ AC_CONFIG_FILES([icudefs.mk \
Makefile \
data/pkgdataMakefile \
config/Makefile.inc \
config/pkgdataMakefile \
data/Makefile \
stubdata/Makefile \
common/Makefile \

View file

@ -574,9 +574,13 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
icupkg.inc:
icupkg.inc: pkgdataMakefile
$(MAKE) -f pkgdataMakefile
pkgdataMakefile:
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
###########
########### 390 (z/OS) support
UCMFILES390=ebcdic-xml-us.ucm ibm-37_P100-1995.ucm ibm-1047_P100-1995.ucm ibm-4909_P100-1999.ucm

View file

@ -118,9 +118,13 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
pkgdata.inc:
pkgdata.inc: pkgdataMakefile
$(MAKE) -f pkgdataMakefile
pkgdataMakefile:
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
$(TARGET_STUB_NAME).$(SECTION): $(srcdir)/$(TARGET_STUB_NAME).$(SECTION).in pkgdata.inc
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$(TARGET_STUB_NAME).$(SECTION) CONFIG_HEADERS= $(SHELL) ./config.status

View file

@ -63,9 +63,13 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
pkgdata.inc:
pkgdata.inc: pkgdataMakefile
$(MAKE) -f pkgdataMakefile
pkgdataMakefile:
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
#########################################################################
############################## Test ## stuff ############################

View file

@ -71,6 +71,7 @@ static int32_t pkg_generateLibraryFile(const char *targetDir, const char mode, c
static int32_t pkg_archiveLibrary(const char *targetDir, const char *version, UBool reverseExt);
static void createFileNames(const char *version_major, const char *version, const char *libName, const UBool reverseExt);
static int32_t pkg_getOptionsFromICUConfig(UOption *option);
/* always have this fcn, just might not do anything */
static void fillInMakefileFromICUConfig(UOption *option);
@ -249,9 +250,11 @@ main(int argc, char* argv[]) {
#ifndef U_WINDOWS
if(!options[BLDOPT].doesOccur) {
fprintf(stderr, " required parameter is missing: -O is required \n");
fprintf(stderr, "Run '%s --help' for help.\n", progname);
return 1;
if (pkg_getOptionsFromICUConfig(&options[BLDOPT]) != 0) {
fprintf(stderr, " required parameter is missing: -O is required \n");
fprintf(stderr, "Run '%s --help' for help.\n", progname);
return 1;
}
}
#else
if(options[BLDOPT].doesOccur) {
@ -1297,6 +1300,50 @@ static void loadLists(UPKGOptions *o, UErrorCode *status)
} /* for each file list file */
}
/* Try calling icu-config directly to get the option file. */
static int32_t pkg_getOptionsFromICUConfig(UOption *option) {
#if U_HAVE_POPEN
FILE *p;
size_t n;
static char buf[512] = "";
const char cmd[] = "icu-config --incpkgdatafile";
p = popen(cmd, "r");
if(p == NULL)
{
fprintf(stderr, "%s: icu-config: No icu-config found. (fix PATH or use -O option)\n", progname);
return -1;
}
n = fread(buf, 1, 511, p);
pclose(p);
if(n<=0)
{
fprintf(stderr,"%s: icu-config: Could not read from icu-config. (fix PATH or use -O option)\n", progname);
return -1;
}
if(buf[strlen(buf)-1]=='\n')
{
buf[strlen(buf)-1]=0;
}
if(buf[0] == 0)
{
fprintf(stderr, "%s: icu-config: invalid response from icu-config (fix PATH or use -O option)\n", progname);
return -1;
}
option->value = buf;
option->doesOccur = TRUE;
return 0;
#endif
return -1;
}
/* Try calling icu-config directly to get information */
static void fillInMakefileFromICUConfig(UOption *option)
{