From 8d969f679864fdebecb9d7aab3e1ce0bd29f7214 Mon Sep 17 00:00:00 2001 From: okuji Date: Mon, 13 Sep 1999 04:31:52 +0000 Subject: [PATCH] fix some curses problems and improve the configure script. --- ChangeLog | 11 ++ Makefile.in | 72 +++++++++---- acconfig.h | 11 ++ acinclude.m4 | 35 +++---- aclocal.m4 | 58 +++++++---- configure | 249 +++++++++++++++++++++++++++++++-------------- configure.in | 11 +- debian/Makefile.in | 1 + docs/Makefile.in | 1 + grub/Makefile.in | 3 +- stage1/Makefile.in | 3 +- stage2/Makefile.in | 3 +- stage2/shared.h | 15 ++- 13 files changed, 331 insertions(+), 142 deletions(-) create mode 100644 acconfig.h diff --git a/ChangeLog b/ChangeLog index 825a2b3a9..128534499 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +1999-09-11 Pavel Roskin + + * acconfig.h: New file for autoheader support. + * acinclude.m4 (grub_ASM_EXT_C) Renamed to ... + (grub_ASM_USCORE): ... this. Define HAVE_ASM_USCORE if a C + symbol gets an underscore after compiling to assembler. + * configure.in: Added AM_CONFIG_HEADER. Autoconf 2.13 is now + required. Test for wgetch(), not getch() in -l[n]curses. + * stage2/shared.h (EXT_C): Defined. + Include the best existing header for [n]curses. + 1999-09-12 OKUJI Yoshinori * stage2/boot.c (load_image): Use CURRENT_DRIVE and diff --git a/Makefile.in b/Makefile.in index 6b76be5f7..a5b2ab6ae 100644 --- a/Makefile.in +++ b/Makefile.in @@ -84,11 +84,13 @@ EXTRA_DIST = BUGS subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = DIST_SOURCES = -DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \ -Makefile.in NEWS THANKS TODO acinclude.m4 aclocal.m4 config.guess \ -config.sub configure configure.in install-sh missing mkinstalldirs +DIST_COMMON = README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \ +Makefile.am Makefile.in NEWS THANKS TODO acconfig.h acinclude.m4 \ +aclocal.m4 config.guess config.sub configure configure.in install-sh \ +missing mkinstalldirs DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -111,6 +113,38 @@ config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) cd $(srcdir) && $(AUTOCONF) +config.h: stamp-h + @if test ! -f $@; then \ + rm -f stamp-h; \ + $(MAKE) stamp-h; \ + else :; fi +stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h stamp-hT + @echo timestamp > stamp-hT 2> /dev/null + cd $(top_builddir) \ + && CONFIG_FILES= CONFIG_HEADERS=config.h \ + $(SHELL) ./config.status + @mv stamp-hT stamp-h +$(srcdir)/config.h.in: $(srcdir)/./stamp-h.in + @if test ! -f $@; then \ + rm -f $(srcdir)/./stamp-h.in; \ + $(MAKE) $(srcdir)/./stamp-h.in; \ + else :; fi +$(srcdir)/./stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h + @rm -f $(srcdir)/./stamp-h.in $(srcdir)/./stamp-h.inT + @echo timestamp > $(srcdir)/./stamp-h.inT 2> /dev/null + cd $(top_srcdir) && $(AUTOHEADER) + @mv $(srcdir)/./stamp-h.inT $(srcdir)/./stamp-h.in + +mostlyclean-hdr: + +clean-hdr: + +distclean-hdr: + -rm -f config.h + +maintainer-clean-hdr: + # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, @@ -177,7 +211,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) END { for (i in files) print i; }'`; \ mkid -f$$here/ID $$unique $(LISP) -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ @@ -192,8 +226,8 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) + test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \ + || etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) mostlyclean-tags: @@ -279,6 +313,9 @@ check-am: all-am check: check-recursive installcheck-am: installcheck: installcheck-recursive +all-recursive-am: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + install-exec-am: install-exec: install-exec-recursive @@ -290,8 +327,8 @@ install-am: all-am install: install-recursive uninstall-am: uninstall: uninstall-recursive -all-am: Makefile -all-redirect: all-recursive +all-am: Makefile config.h +all-redirect: all-recursive-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install installdirs: installdirs-recursive @@ -307,37 +344,38 @@ distclean-generic: -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: -mostlyclean-am: mostlyclean-tags mostlyclean-generic +mostlyclean-am: mostlyclean-hdr mostlyclean-tags mostlyclean-generic mostlyclean: mostlyclean-recursive -clean-am: clean-tags clean-generic mostlyclean-am +clean-am: clean-hdr clean-tags clean-generic mostlyclean-am clean: clean-recursive -distclean-am: distclean-tags distclean-generic clean-am +distclean-am: distclean-hdr distclean-tags distclean-generic clean-am distclean: distclean-recursive -rm -f config.status -maintainer-clean-am: maintainer-clean-tags maintainer-clean-generic \ - distclean-am +maintainer-clean-am: maintainer-clean-hdr maintainer-clean-tags \ + maintainer-clean-generic distclean-am @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." maintainer-clean: maintainer-clean-recursive -rm -f config.status -.PHONY: install-recursive uninstall-recursive install-data-recursive \ +.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \ +install-recursive uninstall-recursive install-data-recursive \ uninstall-data-recursive install-exec-recursive \ uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \ all-recursive check-recursive installcheck-recursive info-recursive \ dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ -dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ -install-exec install-data-am install-data install-am install \ -uninstall-am uninstall all-redirect all-am all install-strip \ +dvi-am dvi check check-am installcheck-am installcheck all-recursive-am \ +install-exec-am install-exec install-data-am install-data install-am \ +install uninstall-am uninstall all-redirect all-am all install-strip \ installdirs-am installdirs mostlyclean-generic distclean-generic \ clean-generic maintainer-clean-generic clean mostlyclean distclean \ maintainer-clean diff --git a/acconfig.h b/acconfig.h new file mode 100644 index 000000000..4ffb9ea7c --- /dev/null +++ b/acconfig.h @@ -0,0 +1,11 @@ +/* This file is still needed because the defines below are + AC_DEFINEd in more than one place. */ + +/* Defined it to "addr32" or "addr32;" to make GAS happy. */ +#undef ADDR32 + +/* Defined it to "data32" or "data32;" to make GAS happy. */ +#undef DATA32 + +/* Defined if you have a curses library (ncurses preferred). */ +#undef HAVE_LIBCURSES diff --git a/acinclude.m4 b/acinclude.m4 index 5428bae05..e507e0114 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1,10 +1,11 @@ -dnl grub_ASM_EXT_C checks what name gcc will use for C symbol. -dnl Originally written by Erich Boleyn, the author of GRUB, and modified -dnl by OKUJI Yoshinori to autoconfiscate the test. -AC_DEFUN(grub_ASM_EXT_C, +dnl grub_ASM_USCORE checks if C symbols get an underscore after +dnl compiling to assembler. +dnl Written by Pavel Roskin. Based on grub_ASM_EXT_C written by +dnl Erich Boleyn and modified by OKUJI Yoshinori +AC_DEFUN(grub_ASM_USCORE, [AC_REQUIRE([AC_PROG_CC]) -AC_MSG_CHECKING([symbol names produced by ${CC-cc}]) -AC_CACHE_VAL(grub_cv_asm_ext_c, +AC_MSG_CHECKING([if C symbols get an underscore after compilation]) +AC_CACHE_VAL(grub_cv_asm_uscore, [cat > conftest.c <<\EOF int func (int *list) @@ -19,23 +20,17 @@ else AC_MSG_ERROR([${CC-cc} failed to produce assembly code]) fi -set dummy `grep \.globl conftest.s | grep func | sed -e s/\\.globl// | sed -e s/func/\ sym\ /` -shift -if test -z "[$]1"; then - AC_MSG_ERROR([C symbol not found]) +if grep _func conftest.s >/dev/null 2>&1; then + grub_cv_asm_uscore=yes + AC_DEFINE_UNQUOTED([HAVE_ASM_USCORE], $grub_cv_asm_uscore, + [Define if C symbols get an underscore after compilation]) +else + grub_cv_asm_uscore=no fi -grub_cv_asm_ext_c="[$]1" -while test [$]# != 0; do - shift - dummy=[$]1 - if test ! -z ${dummy}; then - grub_cv_asm_ext_c="$grub_cv_asm_ext_c ## $dummy" - fi -done + rm -f conftest*]) -AC_MSG_RESULT([$grub_cv_asm_ext_c]) -AC_DEFINE_UNQUOTED([EXT_C(sym)], $grub_cv_asm_ext_c) +AC_MSG_RESULT([$grub_cv_asm_uscore]) ]) diff --git a/aclocal.m4 b/aclocal.m4 index 18b1fdf9e..c8ca7f238 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -10,13 +10,14 @@ dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A dnl PARTICULAR PURPOSE. -dnl grub_ASM_EXT_C checks what name gcc will use for C symbol. -dnl Originally written by Erich Boleyn, the author of GRUB, and modified -dnl by OKUJI Yoshinori to autoconfiscate the test. -AC_DEFUN(grub_ASM_EXT_C, +dnl grub_ASM_USCORE checks if C symbols get an underscore after +dnl compiling to assembler. +dnl Written by Pavel Roskin. Based on grub_ASM_EXT_C written by +dnl Erich Boleyn and modified by OKUJI Yoshinori +AC_DEFUN(grub_ASM_USCORE, [AC_REQUIRE([AC_PROG_CC]) -AC_MSG_CHECKING([symbol names produced by ${CC-cc}]) -AC_CACHE_VAL(grub_cv_asm_ext_c, +AC_MSG_CHECKING([if C symbols get an underscore after compilation]) +AC_CACHE_VAL(grub_cv_asm_uscore, [cat > conftest.c <<\EOF int func (int *list) @@ -31,23 +32,17 @@ else AC_MSG_ERROR([${CC-cc} failed to produce assembly code]) fi -set dummy `grep \.globl conftest.s | grep func | sed -e s/\\.globl// | sed -e s/func/\ sym\ /` -shift -if test -z "[$]1"; then - AC_MSG_ERROR([C symbol not found]) +if grep _func conftest.s >/dev/null 2>&1; then + grub_cv_asm_uscore=yes + AC_DEFINE_UNQUOTED([HAVE_ASM_USCORE], $grub_cv_asm_uscore, + [Define if C symbols get an underscore after compilation]) +else + grub_cv_asm_uscore=no fi -grub_cv_asm_ext_c="[$]1" -while test [$]# != 0; do - shift - dummy=[$]1 - if test ! -z ${dummy}; then - grub_cv_asm_ext_c="$grub_cv_asm_ext_c ## $dummy" - fi -done + rm -f conftest*]) -AC_MSG_RESULT([$grub_cv_asm_ext_c]) -AC_DEFINE_UNQUOTED([EXT_C(sym)], $grub_cv_asm_ext_c) +AC_MSG_RESULT([$grub_cv_asm_uscore]) ]) @@ -255,6 +250,29 @@ else fi AC_SUBST($1)]) +# Like AC_CONFIG_HEADER, but automatically create stamp file. + +AC_DEFUN(AM_CONFIG_HEADER, +[AC_PREREQ([2.12]) +AC_CONFIG_HEADER([$1]) +dnl When config.status generates a header, we must update the stamp-h file. +dnl This file resides in the same directory as the config header +dnl that is generated. We must strip everything past the first ":", +dnl and everything past the last "/". +AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl +ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, +<>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, +<>; do + case " <<$>>CONFIG_HEADERS " in + *" <<$>>am_file "*<<)>> + echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx + ;; + esac + am_indx=`expr "<<$>>am_indx" + 1` +done<<>>dnl>>) +changequote([,]))]) + # Define a conditional. AC_DEFUN(AM_CONDITIONAL, diff --git a/configure b/configure index 621311c4e..d69e42fb9 100644 --- a/configure +++ b/configure @@ -544,6 +544,10 @@ for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break fi done if test -z "$ac_aux_dir"; then @@ -565,7 +569,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:569: checking for a BSD compatible install" >&5 +echo "configure:573: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"\${ac_cv_path_install+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -622,7 +626,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:626: checking whether build environment is sane" >&5 +echo "configure:630: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile @@ -683,7 +687,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:687: checking for $ac_word" >&5 +echo "configure:691: checking for $ac_word" >&5 if eval "test \"\${ac_cv_prog_AWK+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -713,7 +717,7 @@ test -n "$AWK" && break done echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:717: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:721: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -762,7 +766,7 @@ EOF missing_dir=`cd $ac_aux_dir && pwd` echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:766: checking for working aclocal" >&5 +echo "configure:770: checking for working aclocal" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -775,7 +779,7 @@ else fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:779: checking for working autoconf" >&5 +echo "configure:783: checking for working autoconf" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -788,7 +792,7 @@ else fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:792: checking for working automake" >&5 +echo "configure:796: checking for working automake" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -801,7 +805,7 @@ else fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:805: checking for working autoheader" >&5 +echo "configure:809: checking for working autoheader" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -814,7 +818,7 @@ else fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:818: checking for working makeinfo" >&5 +echo "configure:822: checking for working makeinfo" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -834,7 +838,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:838: checking for $ac_word" >&5 +echo "configure:842: checking for $ac_word" >&5 if eval "test \"\${ac_cv_prog_AMTAR+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -874,8 +878,11 @@ fi + + + echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:879: checking host system type" >&5 +echo "configure:886: checking host system type" >&5 if test "x$ac_cv_host" = "x" || (test "x$host" != "xNONE" && test "x$host" != "x$ac_cv_host_alias"); then # Make sure we can run config.sub. @@ -960,7 +967,7 @@ fi echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:964: checking build system type" >&5 +echo "configure:971: checking build system type" >&5 if test "x$ac_cv_build" = "x" || (test "x$build" != "xNONE" && test "x$build" != "x$ac_cv_build_alias"); then # Make sure we can run config.sub. @@ -1007,7 +1014,7 @@ fi # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1011: checking for $ac_word" >&5 +echo "configure:1018: checking for $ac_word" >&5 if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1039,7 +1046,7 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1043: checking for $ac_word" >&5 +echo "configure:1050: checking for $ac_word" >&5 if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1069,7 +1076,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1073: checking for $ac_word" >&5 +echo "configure:1080: checking for $ac_word" >&5 if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1120,7 +1127,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1124: checking for $ac_word" >&5 +echo "configure:1131: checking for $ac_word" >&5 if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1152,7 +1159,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1156: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works" >&5 +echo "configure:1163: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1163,12 +1170,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 1167 "configure" +#line 1174 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1172: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1194,12 +1201,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1198: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1205: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1203: checking whether we are using GNU C" >&5 +echo "configure:1210: checking whether we are using GNU C" >&5 if eval "test \"\${ac_cv_prog_gcc+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1208,7 +1215,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1212: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1219: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1227,7 +1234,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1231: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1238: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"\${ac_cv_prog_cc_g+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1261,7 +1268,7 @@ fi # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1265: checking for $ac_word" >&5 +echo "configure:1272: checking for $ac_word" >&5 if eval "test \"\${ac_cv_prog_RANLIB+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1296,7 +1303,7 @@ if test "x$ac_cv_prog_gcc" = xyes; then STAGE1_CFLAGS="-O2" GRUB_CFLAGS="-O2" echo $ac_n "checking whether optimization for size works""... $ac_c" 1>&6 -echo "configure:1300: checking whether optimization for size works" >&5 +echo "configure:1307: checking whether optimization for size works" >&5 if eval "test \"\${size_flag+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1304,14 +1311,14 @@ else saved_CFLAGS=$CFLAGS CFLAGS="-Os -g" cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1322: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* size_flag=yes else @@ -1344,7 +1351,7 @@ CPPFLAGS="$CPPFLAGS -Wall -Wmissing-prototypes -Wunused" # Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args. set dummy ${ac_tool_prefix}ld; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1348: checking for $ac_word" >&5 +echo "configure:1355: checking for $ac_word" >&5 if eval "test \"\${ac_cv_prog_LD+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1376,7 +1383,7 @@ fi # Extract the first word of "${ac_tool_prefix}objcopy", so it can be a program name with args. set dummy ${ac_tool_prefix}objcopy; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1380: checking for $ac_word" >&5 +echo "configure:1387: checking for $ac_word" >&5 if eval "test \"\${ac_cv_prog_OBJCOPY+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1408,9 +1415,9 @@ fi # Defined in acinclude.m4. -echo $ac_n "checking symbol names produced by ${CC-cc}""... $ac_c" 1>&6 -echo "configure:1413: checking symbol names produced by ${CC-cc}" >&5 -if eval "test \"\${grub_cv_asm_ext_c+set}\" = set"; then +echo $ac_n "checking if C symbols get an underscore after compilation""... $ac_c" 1>&6 +echo "configure:1420: checking if C symbols get an underscore after compilation" >&5 +if eval "test \"\${grub_cv_asm_uscore+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <<\EOF @@ -1422,33 +1429,26 @@ func (int *list) } EOF -if { ac_try='${CC-cc} -S conftest.c'; { (eval echo configure:1426: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.s; then : +if { ac_try='${CC-cc} -S conftest.c'; { (eval echo configure:1433: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.s; then : else { echo "configure: error: ${CC-cc} failed to produce assembly code" 1>&2; exit 1; } fi -set dummy `grep \.globl conftest.s | grep func | sed -e s/\\.globl// | sed -e s/func/\ sym\ /` -shift -if test -z "$1"; then - { echo "configure: error: C symbol not found" 1>&2; exit 1; } +if grep _func conftest.s >/dev/null 2>&1; then + grub_cv_asm_uscore=yes + cat >> confdefs.h <&6 -cat >> confdefs.h <&6 echo $ac_n "checking whether ${OBJCOPY} works for absolute addresses""... $ac_c" 1>&6 echo "configure:1455: checking whether ${OBJCOPY} works for absolute addresses" >&5 @@ -1558,9 +1558,9 @@ EOF fi # Check for curses libraries. -echo $ac_n "checking for getch in -lncurses""... $ac_c" 1>&6 -echo "configure:1563: checking for getch in -lncurses" >&5 -ac_lib_var=`echo ncurses'_'getch | sed 'y%./+-:%__p__%'` +echo $ac_n "checking for wgetch in -lncurses""... $ac_c" 1>&6 +echo "configure:1563: checking for wgetch in -lncurses" >&5 +ac_lib_var=`echo ncurses'_'wgetch | sed 'y%./+-:%__p__%'` if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1572,10 +1572,10 @@ cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then @@ -1600,9 +1600,9 @@ EOF else echo "$ac_t""no" 1>&6 -echo $ac_n "checking for getch in -lcurses""... $ac_c" 1>&6 -echo "configure:1605: checking for getch in -lcurses" >&5 -ac_lib_var=`echo curses'_'getch | sed 'y%./+-:%__p__%'` +echo $ac_n "checking for wgetch in -lcurses""... $ac_c" 1>&6 +echo "configure:1605: checking for wgetch in -lcurses" >&5 +ac_lib_var=`echo curses'_'wgetch | sed 'y%./+-:%__p__%'` if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1614,10 +1614,10 @@ cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then @@ -1729,7 +1729,7 @@ else fi echo "$ac_t""$CPP" 1>&6 -for ac_hdr in string.h strings.h +for ac_hdr in string.h strings.h ncurses/curses.h ncurses.h curses.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 @@ -1895,19 +1895,7 @@ fi trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -cat > conftest.defs <<\EOF -s%#define \([^ ][^ ]*\) *\(.*\)%-D\1=\2%g -s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g -s%\[%\\&%g -s%\]%\\&%g -s%\$%$$%g -EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` -rm -f conftest.defs - +DEFS=-DHAVE_CONFIG_H # Without the "./", some shells look in PATH for config.status. : ${CONFIG_STATUS=./config.status} @@ -1946,7 +1934,7 @@ ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" trap 'rm -fr `echo "Makefile stage1/Makefile stage2/Makefile docs/Makefile \ - debian/Makefile grub/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 + debian/Makefile grub/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + +EOF + +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. And first: +# Protect against being on the right side of a sed subst in config.status. +# Protect against being in an unquoted here document in config.status. +rm -f conftest.vals +cat > conftest.hdr <<\EOF +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >> conftest.vals <<\EOF +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +EOF + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h exit 0 EOF diff --git a/configure.in b/configure.in index df623e11f..3eb02da64 100644 --- a/configure.in +++ b/configure.in @@ -17,7 +17,8 @@ dnl Grab the package and version from the top debian/changelog entry. AM_INIT_AUTOMAKE( esyscmd([sed 's/ .*$//; q' debian/changelog]), esyscmd([sed 's/^.*(\(.*\)).*$/\1/; q' debian/changelog]))dnl -AC_PREREQ(2.12) +AM_CONFIG_HEADER(config.h) +AC_PREREQ(2.13) AC_CANONICAL_HOST @@ -87,7 +88,7 @@ AC_CHECK_TOOL(LD, ld) AC_CHECK_TOOL(OBJCOPY, objcopy) # Defined in acinclude.m4. -grub_ASM_EXT_C +grub_ASM_USCORE grub_PROG_OBJCOPY_ABSOLUTE if test "x$grub_cv_prog_objcopy_absolute" != xyes; then AC_MSG_ERROR([GRUB requires a working absolute objcopy; upgrade your binutils]) @@ -108,14 +109,14 @@ else fi # Check for curses libraries. -AC_CHECK_LIB(ncurses, getch, [GRUB_LIBS="$GRUB_LIBS -lncurses" +AC_CHECK_LIB(ncurses, wgetch, [GRUB_LIBS="$GRUB_LIBS -lncurses" AC_DEFINE(HAVE_LIBCURSES)], - [AC_CHECK_LIB(curses, getch, [GRUB_LIBS="$GRUB_LIBS -lcurses" + [AC_CHECK_LIB(curses, wgetch, [GRUB_LIBS="$GRUB_LIBS -lcurses" AC_DEFINE(HAVE_LIBCURSES)])]) AC_SUBST(GRUB_LIBS) # Check for headers. -AC_CHECK_HEADERS(string.h strings.h) +AC_CHECK_HEADERS(string.h strings.h ncurses/curses.h ncurses.h curses.h) # Check for user options. diff --git a/debian/Makefile.in b/debian/Makefile.in index ac7762c93..0b95a104b 100644 --- a/debian/Makefile.in +++ b/debian/Makefile.in @@ -82,6 +82,7 @@ install_sh = @install_sh@ EXTRA_DIST = README.debian changelog control copyright rules subdir = debian mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DIST_COMMON = Makefile.am Makefile.in diff --git a/docs/Makefile.in b/docs/Makefile.in index a3a0c5797..e6e5af690 100644 --- a/docs/Makefile.in +++ b/docs/Makefile.in @@ -87,6 +87,7 @@ noinst_SCRIPTS = $(HELP2MAN) EXTRA_DIST = menu.lst $(man_MANS) $(noinst_SCRIPTS) subdir = docs mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../config.h CONFIG_CLEAN_FILES = SCRIPTS = $(noinst_SCRIPTS) diff --git a/grub/Makefile.in b/grub/Makefile.in index 2b514e5ed..bd4473667 100644 --- a/grub/Makefile.in +++ b/grub/Makefile.in @@ -90,11 +90,12 @@ grub_SOURCES = main.c asmstub.c getopt.c getopt1.c getopt.h grub_LDADD = ../stage2/libgrub.a $(GRUB_LIBS) subdir = grub mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../config.h CONFIG_CLEAN_FILES = PROGRAMS = $(sbin_PROGRAMS) -DEFS = @DEFS@ -I. -I$(srcdir) +DEFS = @DEFS@ -I. -I$(srcdir) -I.. CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ diff --git a/stage1/Makefile.in b/stage1/Makefile.in index 82463dd6b..0111ff98c 100644 --- a/stage1/Makefile.in +++ b/stage1/Makefile.in @@ -90,11 +90,12 @@ stage1_exec_SOURCES = stage1.S stage1.h stage1_lba_exec_SOURCES = stage1_lba.S stage1.h subdir = stage1 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../config.h CONFIG_CLEAN_FILES = PROGRAMS = $(noinst_PROGRAMS) -DEFS = @DEFS@ -I. -I$(srcdir) +DEFS = @DEFS@ -I. -I$(srcdir) -I.. CPPFLAGS = @CPPFLAGS@ LIBS = @LIBS@ am_stage1_exec_OBJECTS = stage1.o diff --git a/stage2/Makefile.in b/stage2/Makefile.in index 2ccaa2950..ae54521f5 100644 --- a/stage2/Makefile.in +++ b/stage2/Makefile.in @@ -166,11 +166,12 @@ minix_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_MINIX=1 \ minix_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) subdir = stage2 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../config.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) -DEFS = @DEFS@ -I. -I$(srcdir) +DEFS = @DEFS@ -I. -I$(srcdir) -I.. CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ diff --git a/stage2/shared.h b/stage2/shared.h index b59c742dc..6d4ed4612 100644 --- a/stage2/shared.h +++ b/stage2/shared.h @@ -23,6 +23,15 @@ * Generic defines to use anywhere */ +#include + +/* Add an underscore to a C symbol in assembler code if needed. */ +#ifdef HAVE_ASM_USCORE +# define EXT_C(sym) _ ## sym +#else +# define EXT_C(sym) sym +#endif + /* Maybe redirect memory requests through grub_scratch_mem. */ #ifdef GRUB_UTIL extern char *grub_scratch_mem; @@ -226,7 +235,11 @@ extern char *grub_scratch_mem; # define KEY_PPAGE 0x5100 # define A_NORMAL 0x7 # define A_REVERSE 0x70 -#else +#elif defined(HAVE_NCURSES_CURSES_H) +# include +#elif defined(HAVE_NCURSES_H) +# include +#elif defined(HAVE_CURSES_H) # include #endif