diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | Makefile.in | 40 | ||||
-rw-r--r-- | Makefile.pamphlet | 54 | ||||
-rw-r--r-- | config/axiom-c-macros.h.in | 6 | ||||
-rwxr-xr-x | configure | 109 | ||||
-rw-r--r-- | configure.ac | 34 | ||||
-rw-r--r-- | configure.ac.pamphlet | 34 | ||||
-rw-r--r-- | src/ChangeLog | 7 | ||||
-rw-r--r-- | src/Makefile.in | 7 | ||||
-rw-r--r-- | src/Makefile.pamphlet | 7 | ||||
-rw-r--r-- | src/driver/Makefile.in | 69 | ||||
-rw-r--r-- | src/driver/main.c | 220 | ||||
-rw-r--r-- | src/scripts/axiom.in | 192 |
13 files changed, 489 insertions, 299 deletions
@@ -0,0 +1,9 @@ +2008-01-05 Gabriel Dos Reis <gdr@cs.tamu.edu> + + * configure.ac.pamphlet: For mingw host, default $prefix to + C:/Program Files/OpenAxiom. + Don't instantiate src/script/axiom. + Instantiate src/driver/Makefile. Tidy. + * Makefile.pamphlet: Tidy. + * config/axiom-c-macros.h.in: Update. + diff --git a/Makefile.in b/Makefile.in index 75102046..3a13a37f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -16,13 +16,13 @@ build_srcdir = $(builddir)/src AXIOM_SRC_TARGETS = all-algebra all-asq all-axiomsys all-boot \ all-clef all-doc all-graph all-hyper all-input all-interpsys \ - all-lib all-lisp all-sman all-src + all-lib all-lisp all-sman all-driver all-src .PHONY: all $(AXIOM_SRC_TARGETS) all: all-ax all-ax: all-src - @echo finished system build on `date` | tee >lastBuildDate + @echo finished system build on `date` | tee > lastBuildDate all-src: stamp-rootdirs @axiom_all_prerequisites@ @@ -32,10 +32,10 @@ all-boot all-lisp all-interpsys all-axiomsys \ endif $(AXIOM_SRC_TARGETS): - cd $(build_srcdir) && $(MAKE) $@ + cd "$(build_srcdir)" && $(MAKE) $@ stamp-rootdirs: $(axiom_build_document) - @mkdir -p ${TMP} + @mkdir -p "${TMP}" @$(STAMP) stamp-rootdirs @@ -50,20 +50,20 @@ maybe-cp-noweb-srcdir: $(srcdir)/noweb ## We try to be nice to those who chose otherwise ## to build directly from the OpenAxiom source dir. if test "$(srcdir)" != "$(builddir)" -a ! -d noweb; then \ - cp -r $(srcdir)/noweb $(builddir); \ + cp -r "$(srcdir)"/noweb "$(builddir)"; \ fi $(addprefix $(axiom_build_bindir)/, notangle noweave): maybe-cp-noweb-srcdir ## Noweb would like to install many things even if we ## are not interested in those. Prepare the ground. - $(mkinstalldirs) $(axiom_build_bindir) - $(mkinstalldirs) $(axiom_build_libdir) - $(mkinstalldirs) $(axiom_build_texdir) - $(mkinstalldirs) $(axiom_build_mandir) + $(mkinstalldirs) "$(axiom_build_bindir)" + $(mkinstalldirs) "$(axiom_build_libdir)" + $(mkinstalldirs) "$(axiom_build_texdir)" + $(mkinstalldirs) "$(axiom_build_mandir)" $(TOUCH) $(addprefix noweb/src/shell/, \ noweave notangle noweb noroff toroff) \ - $(wildcard $(builddir)/noweb/src/c/*.h) \ - $(wildcard $(builddir)/noweb/src/c/*.c) + $(wildcard "$(builddir)"/noweb/src/c/*.h) \ + $(wildcard "$(builddir)"/noweb/src/c/*.c) ## noweb's Makefile needs editing before we can build to suit ## our needs. In particular, we must say when helper programs go, ## where the noweb style file goes, where the man pages go (even though @@ -91,17 +91,17 @@ all-gcl: $(axiom_build_bindir)/gcl$(EXEEXT) $(axiom_build_bindir)/gcl$(EXEEXT): if test "$(srcdir)" != "$(builddir)" -a ! -d gcl; then \ - cp -r $(srcdir)/gcl $(builddir); \ + cp -r "$(srcdir)"/gcl "$(builddir)"; \ fi; cd gcl; \ - ./configure --prefix=$(axiom_abs_builddir) ${GCLOPTS} && \ + ./configure --prefix="$(axiom_abs_builddir)" ${GCLOPTS} && \ $(MAKE) && $(MAKE) install install: @echo Installing OpenAxiom in $(prefix) - @$(mkinstalldirs) $(DESTDIR)$(open_axiom_installdir) - cp -pr $(builddir)/$(target)/* $(DESTDIR)$(open_axiom_installdir) - rm -f $(bindir)/axiom - @$(mkinstalldirs) $(bindir) - $(INSTALL_PROGRAM) src/scripts/axiom $(bindir) + @$(mkinstalldirs) "$(DESTDIR)$(open_axiom_installdir)" + cp -pr "$(builddir)"/$(target)/* "$(DESTDIR)$(open_axiom_installdir)" + rm -f "$(bindir)"/axiom + @$(mkinstalldirs) "$(bindir)" + $(INSTALL_PROGRAM) src/driver/axiom$(EXEEXT) "$(bindir)" @echo OpenAxiom installation finished. .PHONY: check @@ -113,13 +113,13 @@ mostlyclean-local: @-rm -f lastBuildDate clean-local: mostlyclean-local - @rm -fr $(axiom_build_nowebdir) + @rm -fr "$(axiom_build_nowebdir)" @ rm -f stamp-* @ rm -rf int distclean-local: clean-local @-rm -rf build - @-rm -rf $(axiom_targetdir) + @-rm -rf "$(axiom_targetdir)" @-rm -f config.status config.log @-rm -f Makefile diff --git a/Makefile.pamphlet b/Makefile.pamphlet index 8b633966..7f55b280 100644 --- a/Makefile.pamphlet +++ b/Makefile.pamphlet @@ -241,7 +241,8 @@ FIXME: To be written \section{The Build Flow} \label{sec:build-flow} -The build flow of \Tool{OpenAxiom} seems, first, a bit intricate to describe. +The build flow of \Tool{OpenAxiom} seems, at first sight, a bit +intricate to describe. This description is STILL IN WORK IN PROGRESS. Therefore it is incorrekt, incomplet, and iNconSiStenT. @@ -251,11 +252,11 @@ being possible build of \Tool{GCL}. Second, we need a Lisp runtime system. If one is available from the build environment, we are done. In fact, currently we do insist that -the Lisp runtime system is \Tool{GCL}. Otherwise, we have to build one. +the Lisp runtime system is \Tool{GCL}. -Third, we have to make the subdirectory \File{src/} where all the +Third, we have to `make' the subdirectory \File{src/} where all the work actually happens. Part of \Tool{OpenAxiom} is written in Boot, part -in Common Lisp, part in C, and the rest in SPAD. The SPAD compiler +in Common Lisp, part in C, and the rest in Spad. The Spad compiler is written partly in Boot, thefore \File{src/algebra/}, \File{src/input/}, \File{src/interp/} depend on \File{src/boot/}. The rest is mostly written in C and depends only on \File{src/lib/}. The @@ -273,6 +274,7 @@ The \File{src/} directory looks like this: boot/ clef/ doc/ + driver/ etc/ graph/ hyper/ @@ -287,7 +289,7 @@ The \File{src/} directory looks like this: \end{verbatim} \File{src/algebra/}, \File{src/input/} depend on \File{src/interp}, -\File{src/interp/} depend on \File{src/boot}. +\File{src/interp/} depends on \File{src/boot}. Hue. This discussion is better done in src/Makefile. Move it there. @@ -299,7 +301,7 @@ the previous section. They can be built individually by invoking [[make all-xxx]] where [[xxx]] is one of \begin{verbatim} algebra asq axiomsys book boot clef doc graph hyper - input interpsys lib lisp sman src + input interpsys lib lisp sman driver src \end{verbatim} The \Tool{OpenAxiom} source files reside in \File{src/}. The directory @@ -320,13 +322,13 @@ build_srcdir = $(builddir)/src AXIOM_SRC_TARGETS = all-algebra all-asq all-axiomsys all-boot \ all-clef all-doc all-graph all-hyper all-input all-interpsys \ - all-lib all-lisp all-sman all-src + all-lib all-lisp all-sman all-driver all-src .PHONY: all $(AXIOM_SRC_TARGETS) all: all-ax all-ax: all-src - @echo finished system build on `date` | tee >lastBuildDate + @echo finished system build on `date` | tee > lastBuildDate all-src: stamp-rootdirs @axiom_all_prerequisites@ @@ -336,7 +338,7 @@ all-boot all-lisp all-interpsys all-axiomsys \ endif $(AXIOM_SRC_TARGETS): - cd $(build_srcdir) && $(MAKE) $@ + cd "$(build_srcdir)" && $(MAKE) $@ <<rootdirs>> @@ -353,13 +355,13 @@ mostlyclean-local: @-rm -f lastBuildDate clean-local: mostlyclean-local - @rm -fr $(axiom_build_nowebdir) + @rm -fr "$(axiom_build_nowebdir)" @ rm -f stamp-* @ rm -rf int distclean-local: clean-local @-rm -rf build - @-rm -rf $(axiom_targetdir) + @-rm -rf "$(axiom_targetdir)" @-rm -f config.status config.log @-rm -f Makefile @@ -453,7 +455,7 @@ directories as well if they don't exist. <<rootdirs>>= stamp-rootdirs: $(axiom_build_document) - @mkdir -p ${TMP} + @mkdir -p "${TMP}" @$(STAMP) stamp-rootdirs @ @@ -492,9 +494,9 @@ all-gcl: $(axiom_build_bindir)/gcl$(EXEEXT) $(axiom_build_bindir)/gcl$(EXEEXT): if test "$(srcdir)" != "$(builddir)" -a ! -d gcl; then \ - cp -r $(srcdir)/gcl $(builddir); \ + cp -r "$(srcdir)"/gcl "$(builddir)"; \ fi; cd gcl; \ - ./configure --prefix=$(axiom_abs_builddir) ${GCLOPTS} && \ + ./configure --prefix="$(axiom_abs_builddir)" ${GCLOPTS} && \ $(MAKE) && $(MAKE) install @ @@ -518,20 +520,20 @@ maybe-cp-noweb-srcdir: $(srcdir)/noweb ## We try to be nice to those who chose otherwise ## to build directly from the OpenAxiom source dir. if test "$(srcdir)" != "$(builddir)" -a ! -d noweb; then \ - cp -r $(srcdir)/noweb $(builddir); \ + cp -r "$(srcdir)"/noweb "$(builddir)"; \ fi $(addprefix $(axiom_build_bindir)/, notangle noweave): maybe-cp-noweb-srcdir ## Noweb would like to install many things even if we ## are not interested in those. Prepare the ground. - $(mkinstalldirs) $(axiom_build_bindir) - $(mkinstalldirs) $(axiom_build_libdir) - $(mkinstalldirs) $(axiom_build_texdir) - $(mkinstalldirs) $(axiom_build_mandir) + $(mkinstalldirs) "$(axiom_build_bindir)" + $(mkinstalldirs) "$(axiom_build_libdir)" + $(mkinstalldirs) "$(axiom_build_texdir)" + $(mkinstalldirs) "$(axiom_build_mandir)" $(TOUCH) $(addprefix noweb/src/shell/, \ noweave notangle noweb noroff toroff) \ - $(wildcard $(builddir)/noweb/src/c/*.h) \ - $(wildcard $(builddir)/noweb/src/c/*.c) + $(wildcard "$(builddir)"/noweb/src/c/*.h) \ + $(wildcard "$(builddir)"/noweb/src/c/*.c) ## noweb's Makefile needs editing before we can build to suit ## our needs. In particular, we must say when helper programs go, ## where the noweb style file goes, where the man pages go (even though @@ -561,11 +563,11 @@ $(addprefix $(axiom_build_bindir)/, notangle noweave): maybe-cp-noweb-srcdir <<install>>= install: @echo Installing OpenAxiom in $(prefix) - @$(mkinstalldirs) $(DESTDIR)$(open_axiom_installdir) - cp -pr $(builddir)/$(target)/* $(DESTDIR)$(open_axiom_installdir) - rm -f $(bindir)/axiom - @$(mkinstalldirs) $(bindir) - $(INSTALL_PROGRAM) src/scripts/axiom $(bindir) + @$(mkinstalldirs) "$(DESTDIR)$(open_axiom_installdir)" + cp -pr "$(builddir)"/$(target)/* "$(DESTDIR)$(open_axiom_installdir)" + rm -f "$(bindir)"/axiom + @$(mkinstalldirs) "$(bindir)" + $(INSTALL_PROGRAM) src/driver/axiom$(EXEEXT) "$(bindir)" @echo OpenAxiom installation finished. @ diff --git a/config/axiom-c-macros.h.in b/config/axiom-c-macros.h.in index fed512d5..a2ab84a5 100644 --- a/config/axiom-c-macros.h.in +++ b/config/axiom-c-macros.h.in @@ -92,6 +92,12 @@ /* MS */ #undef MSYSplatform +/* Extension of executable file. */ +#undef OPENAXIOM_EXEEXT + +/* Whether to use the session manager as driver. */ +#undef OPENAXIOM_USE_SMAN + /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.60 for OpenAxiom 1.1.0-2007-12-27. +# Generated by GNU Autoconf 2.60 for OpenAxiom 1.1.0-2008-01-05. # # Report bugs to <open-axiom-bugs@lists.sf.net>. # @@ -713,8 +713,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='OpenAxiom' PACKAGE_TARNAME='openaxiom' -PACKAGE_VERSION='1.1.0-2007-12-27' -PACKAGE_STRING='OpenAxiom 1.1.0-2007-12-27' +PACKAGE_VERSION='1.1.0-2008-01-05' +PACKAGE_STRING='OpenAxiom 1.1.0-2008-01-05' PACKAGE_BUGREPORT='open-axiom-bugs@lists.sf.net' ac_unique_file="src/Makefile.pamphlet" @@ -854,7 +854,6 @@ axiom_fasl_type axiom_all_prerequisites axiom_c_runtime axiom_c_runtime_extra -axiom_use_sman XMKMF X_CFLAGS X_PRE_LIBS @@ -1388,7 +1387,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures OpenAxiom 1.1.0-2007-12-27 to adapt to many kinds of systems. +\`configure' configures OpenAxiom 1.1.0-2008-01-05 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1458,7 +1457,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of OpenAxiom 1.1.0-2007-12-27:";; + short | recursive ) echo "Configuration of OpenAxiom 1.1.0-2008-01-05:";; esac cat <<\_ACEOF @@ -1562,7 +1561,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -OpenAxiom configure 1.1.0-2007-12-27 +OpenAxiom configure 1.1.0-2008-01-05 generated by GNU Autoconf 2.60 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1576,7 +1575,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by OpenAxiom $as_me 1.1.0-2007-12-27, which was +It was created by OpenAxiom $as_me 1.1.0-2008-01-05, which was generated by GNU Autoconf 2.60. Invocation command line was $ $0 $@ @@ -3773,7 +3772,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3776 "configure"' > conftest.$ac_ext + echo '#line 3775 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -6628,11 +6627,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6631: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6630: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6635: \$? = $ac_status" >&5 + echo "$as_me:6634: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -6896,11 +6895,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6899: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6898: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6903: \$? = $ac_status" >&5 + echo "$as_me:6902: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7000,11 +6999,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7003: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7002: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7007: \$? = $ac_status" >&5 + echo "$as_me:7006: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -9452,7 +9451,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 9455 "configure" +#line 9454 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -9552,7 +9551,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 9555 "configure" +#line 9554 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11920,11 +11919,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11923: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11922: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11927: \$? = $ac_status" >&5 + echo "$as_me:11926: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -12024,11 +12023,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12027: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12026: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12031: \$? = $ac_status" >&5 + echo "$as_me:12030: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -13594,11 +13593,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13597: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13596: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13601: \$? = $ac_status" >&5 + echo "$as_me:13600: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -13698,11 +13697,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13701: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13700: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13705: \$? = $ac_status" >&5 + echo "$as_me:13704: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15928,11 +15927,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15931: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15930: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15935: \$? = $ac_status" >&5 + echo "$as_me:15934: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16196,11 +16195,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16199: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16198: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16203: \$? = $ac_status" >&5 + echo "$as_me:16202: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16300,11 +16299,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16303: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16302: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16307: \$? = $ac_status" >&5 + echo "$as_me:16306: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -19063,6 +19062,10 @@ test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- + +open_axiom_installdir=$libdir/open-axiom/$target/$PACKAGE_VERSION + + if test $build != $target; then { echo "$as_me:$LINENO: WARNING: Cross build is not supported." >&5 echo "$as_me: WARNING: Cross build is not supported." >&2;} @@ -19072,8 +19075,17 @@ fi ## Where tools for the build platform are sequestered axiom_build_sharedir=$axiom_builddir/share -open_axiom_installdir=$libdir/open-axiom/$target/$PACKAGE_VERSION - +## On Windows system, we prefer the default installation +## location to be 'C:/Program Files/OpenAxiom', following Windows +## convention. We cannot use AC_PREFIX_DEFAULT directly as it seems +## to operate unconditionally. Therefore, we resort to this dirty +## trick stepping over Autoconf's internals. +case $host in + *mingw*) + ac_default_prefix="C:/Program Files/OpenAxiom" + ;; + *) ;; +esac ## Accumulate list of utils needed for the build platform ## It is vital that noweb is present in the build environement. @@ -19956,6 +19968,13 @@ axiom_cflags="-O2 -fno-strength-reduce -Wall -D_GNU_SOURCE" ## What is the extension of object files on this platform? + +cat >>confdefs.h <<_ACEOF +#define OPENAXIOM_EXEEXT "$ac_cv_exeext" +_ACEOF + + + # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: @@ -22661,7 +22680,7 @@ fi -axiom_use_sman=yes +axiom_use_sman=1 if test x"$ac_cv_have_decl_fork" = xyes \ -a x"$ac_cv_have_decl_wait" = xyes; then \ axiom_c_runtime="$axiom_c_runtime terminal_io" @@ -22672,11 +22691,17 @@ if test x"$ac_cv_have_decl_fork" = xyes \ ac_config_files="$ac_config_files src/sman/Makefile:config/var-def.mk:src/sman/Makefile.in:config/setup-dep.mk" else - axiom_use_sman=no + axiom_use_sman=0 { echo "$as_me:$LINENO: Superman component is disabled." >&5 echo "$as_me: Superman component is disabled." >&6;} fi + +cat >>confdefs.h <<_ACEOF +#define OPENAXIOM_USE_SMAN $axiom_use_sman +_ACEOF + + axiom_src_all="all-input $axiom_src_all" { echo "$as_me:$LINENO: checking for X" >&5 @@ -24791,6 +24816,8 @@ ac_config_files="$ac_config_files src/Makefile:config/var-def.mk:src/Makefile.in ac_config_files="$ac_config_files src/lib/Makefile:config/var-def.mk:src/lib/Makefile.in:config/setup-dep.mk" +ac_config_files="$ac_config_files src/driver/Makefile:config/var-def.mk:src/driver/Makefile.in:config/setup-dep.mk" + ac_config_files="$ac_config_files src/lisp/Makefile:config/var-def.mk:src/lisp/Makefile.in:config/setup-dep.mk" ac_config_files="$ac_config_files src/boot/Makefile:config/var-def.mk:src/boot/Makefile.in:config/setup-dep.mk" @@ -24807,8 +24834,6 @@ ac_config_files="$ac_config_files src/etc/Makefile:config/var-def.mk:src/etc/Mak ac_config_files="$ac_config_files src/doc/Makefile:config/var-def.mk:src/doc/Makefile.in:config/setup-dep.mk" -ac_config_files="$ac_config_files src/scripts/axiom" - ## We now generate the "document" script and support files at configure time. @@ -25200,7 +25225,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by OpenAxiom $as_me 1.1.0-2007-12-27, which was +This file was extended by OpenAxiom $as_me 1.1.0-2008-01-05, which was generated by GNU Autoconf 2.60. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -25249,7 +25274,7 @@ Report bugs to <bug-autoconf@gnu.org>." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -OpenAxiom config.status 1.1.0-2007-12-27 +OpenAxiom config.status 1.1.0-2008-01-05 configured by $0, generated by GNU Autoconf 2.60, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" @@ -25370,6 +25395,7 @@ do "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile:config/var-def.mk:Makefile.in:config/setup-dep.mk" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile:config/var-def.mk:src/Makefile.in:config/setup-dep.mk" ;; "src/lib/Makefile") CONFIG_FILES="$CONFIG_FILES src/lib/Makefile:config/var-def.mk:src/lib/Makefile.in:config/setup-dep.mk" ;; + "src/driver/Makefile") CONFIG_FILES="$CONFIG_FILES src/driver/Makefile:config/var-def.mk:src/driver/Makefile.in:config/setup-dep.mk" ;; "src/lisp/Makefile") CONFIG_FILES="$CONFIG_FILES src/lisp/Makefile:config/var-def.mk:src/lisp/Makefile.in:config/setup-dep.mk" ;; "src/boot/Makefile") CONFIG_FILES="$CONFIG_FILES src/boot/Makefile:config/var-def.mk:src/boot/Makefile.in:config/setup-dep.mk" ;; "src/interp/Makefile") CONFIG_FILES="$CONFIG_FILES src/interp/Makefile:config/var-def.mk:src/interp/Makefile.in:config/setup-dep.mk" ;; @@ -25378,7 +25404,6 @@ do "src/input/Makefile") CONFIG_FILES="$CONFIG_FILES src/input/Makefile:config/var-def.mk:src/input/Makefile.in:config/setup-dep.mk" ;; "src/etc/Makefile") CONFIG_FILES="$CONFIG_FILES src/etc/Makefile:config/var-def.mk:src/etc/Makefile.in:config/setup-dep.mk" ;; "src/doc/Makefile") CONFIG_FILES="$CONFIG_FILES src/doc/Makefile:config/var-def.mk:src/doc/Makefile.in:config/setup-dep.mk" ;; - "src/scripts/axiom") CONFIG_FILES="$CONFIG_FILES src/scripts/axiom" ;; "build/scripts/document") CONFIG_FILES="$CONFIG_FILES build/scripts/document:$srcdir/src/scripts/document.in" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 @@ -25582,7 +25607,6 @@ for ac_last_try in false false false false false :; do axiom_all_prerequisites!$axiom_all_prerequisites$ac_delim axiom_c_runtime!$axiom_c_runtime$ac_delim axiom_c_runtime_extra!$axiom_c_runtime_extra$ac_delim -axiom_use_sman!$axiom_use_sman$ac_delim XMKMF!$XMKMF$ac_delim X_CFLAGS!$X_CFLAGS$ac_delim X_PRE_LIBS!$X_PRE_LIBS$ac_delim @@ -25600,7 +25624,7 @@ LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 19; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 18; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 @@ -26001,7 +26025,6 @@ echo "$as_me: $ac_file is unchanged" >&6;} case $ac_file$ac_mode in - "src/scripts/axiom":F) chmod +x src/scripts/axiom ;; "build/scripts/document":F) \ chmod +x build/scripts/document ;; diff --git a/configure.ac b/configure.ac index 6c9b447c..501476a8 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ sinclude(config/open-axiom.m4) sinclude(config/aclocal.m4) -AC_INIT([OpenAxiom], [1.1.0-2007-12-27], +AC_INIT([OpenAxiom], [1.1.0-2008-01-05], [open-axiom-bugs@lists.sf.net]) AC_CONFIG_AUX_DIR(config) @@ -33,6 +33,10 @@ axiom_src_subdirs="lib lisp boot interp share algebra input etc doc" AC_SUBST(axiom_src_subdirs) AC_CANONICAL_SYSTEM + +open_axiom_installdir=$libdir/open-axiom/$target/$PACKAGE_VERSION +AC_SUBST(open_axiom_installdir) + if test $build != $target; then AC_MSG_WARN([Cross build is not supported.]) AC_MSG_WARN([Please notify open-axiom-devel@open-axiom.org if you succeed.]) @@ -40,8 +44,17 @@ fi ## Where tools for the build platform are sequestered axiom_build_sharedir=$axiom_builddir/share -open_axiom_installdir=$libdir/open-axiom/$target/$PACKAGE_VERSION -AC_SUBST(open_axiom_installdir) +## On Windows system, we prefer the default installation +## location to be 'C:/Program Files/OpenAxiom', following Windows +## convention. We cannot use AC_PREFIX_DEFAULT directly as it seems +## to operate unconditionally. Therefore, we resort to this dirty +## trick stepping over Autoconf's internals. +case $host in + *mingw*) + ac_default_prefix="C:/Program Files/OpenAxiom" + ;; + *) ;; +esac ## Accumulate list of utils needed for the build platform ## It is vital that noweb is present in the build environement. @@ -74,6 +87,10 @@ AC_SUBST(axiom_cflags) ## What is the extension of object files on this platform? AC_OBJEXT +AC_DEFINE_UNQUOTED([OPENAXIOM_EXEEXT], ["$ac_cv_exeext"], + [Extension of executable file.]) + + AC_PROG_INSTALL # AC_PROG_LN_S AC_CHECK_PROG([TOUCH], [touch], @@ -368,7 +385,7 @@ AC_CHECK_DECLS([fork], [], [#include <unistd.h>]) -axiom_use_sman=yes +axiom_use_sman=1 if test x"$ac_cv_have_decl_fork" = xyes \ -a x"$ac_cv_have_decl_wait" = xyes; then \ axiom_c_runtime="$axiom_c_runtime terminal_io" @@ -377,12 +394,15 @@ if test x"$ac_cv_have_decl_fork" = xyes \ AXIOM_MAKEFILE([src/clef/Makefile]) AXIOM_MAKEFILE([src/sman/Makefile]) else - axiom_use_sman=no + axiom_use_sman=0 AC_MSG_NOTICE([Superman component is disabled.]) fi +AC_DEFINE_UNQUOTED([OPENAXIOM_USE_SMAN], [$axiom_use_sman], + [Whether to use the session manager as driver.]) + axiom_src_all="all-input $axiom_src_all" -AC_SUBST(axiom_use_sman) + AC_PATH_XTRA ## Output directives for the C compiler AC_SUBST(X_CLFAGS) @@ -488,6 +508,7 @@ AC_SUBST(GCLOPTS) AXIOM_MAKEFILE([Makefile]) AXIOM_MAKEFILE([src/Makefile]) AXIOM_MAKEFILE([src/lib/Makefile]) +AXIOM_MAKEFILE([src/driver/Makefile]) AXIOM_MAKEFILE([src/lisp/Makefile]) AXIOM_MAKEFILE([src/boot/Makefile]) AXIOM_MAKEFILE([src/interp/Makefile]) @@ -496,7 +517,6 @@ AXIOM_MAKEFILE([src/algebra/Makefile]) AXIOM_MAKEFILE([src/input/Makefile]) AXIOM_MAKEFILE([src/etc/Makefile]) AXIOM_MAKEFILE([src/doc/Makefile]) -AC_CONFIG_FILES([src/scripts/axiom], [chmod +x src/scripts/axiom]) ## We now generate the "document" script and support files at configure time. diff --git a/configure.ac.pamphlet b/configure.ac.pamphlet index f50a3c31..89bba2ac 100644 --- a/configure.ac.pamphlet +++ b/configure.ac.pamphlet @@ -112,6 +112,10 @@ or \textsl{kernel--system} (such as [[linux-gnu]]). Here is how we get the canonical names for the above three platforms: <<host build target platfoms>>= AC_CANONICAL_SYSTEM + +open_axiom_installdir=$libdir/open-axiom/$target/$PACKAGE_VERSION +AC_SUBST(open_axiom_installdir) + @ After that call, the configuration names of the three platforms are available in the shell variables [[build]], [[host]], and [[target]]. @@ -312,7 +316,7 @@ AC_CHECK_DECLS([fork], [], [#include <unistd.h>]) -axiom_use_sman=yes +axiom_use_sman=1 if test x"$ac_cv_have_decl_fork" = xyes \ -a x"$ac_cv_have_decl_wait" = xyes; then \ axiom_c_runtime="$axiom_c_runtime terminal_io" @@ -321,12 +325,15 @@ if test x"$ac_cv_have_decl_fork" = xyes \ AXIOM_MAKEFILE([src/clef/Makefile]) AXIOM_MAKEFILE([src/sman/Makefile]) else - axiom_use_sman=no + axiom_use_sman=0 AC_MSG_NOTICE([Superman component is disabled.]) fi +AC_DEFINE_UNQUOTED([OPENAXIOM_USE_SMAN], [$axiom_use_sman], + [Whether to use the session manager as driver.]) + axiom_src_all="all-input $axiom_src_all" -AC_SUBST(axiom_use_sman) + @ @@ -626,6 +633,10 @@ AC_SUBST(axiom_cflags) ## What is the extension of object files on this platform? AC_OBJEXT + +AC_DEFINE_UNQUOTED([OPENAXIOM_EXEEXT], ["$ac_cv_exeext"], + [Extension of executable file.]) + @ \paragraph{File utils} @@ -1008,7 +1019,7 @@ information: <<Autoconf init>>= sinclude(config/open-axiom.m4) sinclude(config/aclocal.m4) -AC_INIT([OpenAxiom], [1.1.0-2007-12-27], +AC_INIT([OpenAxiom], [1.1.0-2008-01-05], [open-axiom-bugs@lists.sf.net]) @ @@ -1077,6 +1088,7 @@ build start --- or else, it will fail. AXIOM_MAKEFILE([Makefile]) AXIOM_MAKEFILE([src/Makefile]) AXIOM_MAKEFILE([src/lib/Makefile]) +AXIOM_MAKEFILE([src/driver/Makefile]) AXIOM_MAKEFILE([src/lisp/Makefile]) AXIOM_MAKEFILE([src/boot/Makefile]) AXIOM_MAKEFILE([src/interp/Makefile]) @@ -1085,7 +1097,6 @@ AXIOM_MAKEFILE([src/algebra/Makefile]) AXIOM_MAKEFILE([src/input/Makefile]) AXIOM_MAKEFILE([src/etc/Makefile]) AXIOM_MAKEFILE([src/doc/Makefile]) -AC_CONFIG_FILES([src/scripts/axiom], [chmod +x src/scripts/axiom]) ## We now generate the "document" script and support files at configure time. @@ -1163,8 +1174,17 @@ AC_SUBST(axiom_src_subdirs) <<host build target platfoms>> -open_axiom_installdir=$libdir/open-axiom/$target/$PACKAGE_VERSION -AC_SUBST(open_axiom_installdir) +## On Windows system, we prefer the default installation +## location to be 'C:/Program Files/OpenAxiom', following Windows +## convention. We cannot use AC_PREFIX_DEFAULT directly as it seems +## to operate unconditionally. Therefore, we resort to this dirty +## trick stepping over Autoconf's internals. +case $host in + *mingw*) + ac_default_prefix="C:/Program Files/OpenAxiom" + ;; + *) ;; +esac <<build utils>> diff --git a/src/ChangeLog b/src/ChangeLog index e69de29b..55e167f6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -0,0 +1,7 @@ +2008-01-05 Gabriel Dos Reis <gdr@cs.tamu.edu> + + * scripts/axiom.in: Remove. + * driver: New directory. + * driver/main.c: New. Now implement driver as native + application. + diff --git a/src/Makefile.in b/src/Makefile.in index bc2835dd..4ba18c17 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -5,17 +5,20 @@ subdir = src/ SUBDIRS = @axiom_src_subdirs@ -.PHONY: all all-ax all-src all-clef all-sman +.PHONY: all all-ax all-src all-clef all-sman all-driver all: all-ax all-ax all-src: stamp @echo finished $(builddir) -stamp: @axiom_src_all@ +stamp: @axiom_src_all@ all-driver -rm -f stamp $(STAMP) stamp +all-driver: + @cd driver && $(MAKE) $@ + all-clef: all-lib @$(mkinstalldirs) $(axiom_target_bindir) cd clef && ${MAKE} diff --git a/src/Makefile.pamphlet b/src/Makefile.pamphlet index 06029371..f2f86358 100644 --- a/src/Makefile.pamphlet +++ b/src/Makefile.pamphlet @@ -246,17 +246,20 @@ subdir = src/ SUBDIRS = @axiom_src_subdirs@ -.PHONY: all all-ax all-src all-clef all-sman +.PHONY: all all-ax all-src all-clef all-sman all-driver all: all-ax all-ax all-src: stamp @echo finished $(builddir) -stamp: @axiom_src_all@ +stamp: @axiom_src_all@ all-driver -rm -f stamp $(STAMP) stamp +all-driver: + @cd driver && $(MAKE) $@ + <<clefdir>> <<smandir>> <<hyperdir>> diff --git a/src/driver/Makefile.in b/src/driver/Makefile.in new file mode 100644 index 00000000..0a1ba801 --- /dev/null +++ b/src/driver/Makefile.in @@ -0,0 +1,69 @@ +# Copyright (C) 2007, Gabriel Dos Reis. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# +# - Neither the name of The Numerical Algorithms Group Ltd. nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +bin_PROGRAMS = axiom$(EXEEXT) + +axiom_SOURCES = main.c + +axiom_objects = $(axiom_SOURCES:.c=.lo) + +.PHONY: all all-ax all-driver + +all: all-ax + +all-ax all-driver: stamp + +stamp: $(bin_PROGRAMS) + -rm -f stamp + $(STAMP) stamp + +.SUFFIXES: +.SUFFIXES: .c .h .lo .$(OBJEXT) +.PRECIOUS: %.lo %.obj + +%.lo: %.c + $(COMPILE) ${CCF} -o $@ \ + -DOPENAXIOM_ROOT_DIRECTORY="\"$(open_axiom_installdir)\"" \ + $(axiom_includes) $< + +axiom$(EXEEXT): $(axiom_objects) + $(LINK) -o $@ $< + +mostlyclean-local: + @rm -f $(axiom_objects) + @rm -f *~ core + +clean-local: mostlyclean-local + @rm -f $(bin_PROGRAMS) + +distclean-local: clean-local + diff --git a/src/driver/main.c b/src/driver/main.c new file mode 100644 index 00000000..12e8434a --- /dev/null +++ b/src/driver/main.c @@ -0,0 +1,220 @@ +/* + Copyright (C) 2008, Gabriel Dos Reis. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of The Numerical ALgorithms Group Ltd. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* This program is a driver for the OpenAxiom core executable. + It pretends to be the OpenAxiom interpreter when, in fact, the actual + work is done by the Core Executable. It also occasionally masquerades + as the seesion manager. */ + + +#include "axiom-c-macros.h" +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <stdio.h> +#if HAVE_UNISTD_H +# include <unistd.h> +#endif +#ifdef __WIN32__ +# include <windows.h> +#endif + +/* The basename of the file holding the OpenAxiom core executable. */ +#define OPENAXIOM_CORE_EXECUTABLE \ + "AXIOMsys" OPENAXIOM_EXEEXT + +/* The basename of the file holding the session manager executable. */ +#define OPENAXIOM_SMAN_EXECUTABLE \ + "sman" OPENAXIOM_EXEEXT + +/* Path to the OpenAxiom executable core, relative to + OPENAXIOM_ROOT_DIRECTORY, or to the system root directory as specified + on command line. */ +#define OPENAXIOM_CORE_PATH \ + "/bin/" OPENAXIOM_CORE_EXECUTABLE + +/* Path to the session manager, relative to OPENAXIOM_ROOT_DIRECTORY, + or to the system root directory as specified on command line. */ +#define OPENAXIOM_SMAN_PATH \ + "/bin/" OPENAXIOM_SMAN_EXECUTABLE + +/* Return a path to the running system, either as specified on command + line through --system=, or as specified at configuration time. */ +static const char* +get_systemdir(int argc, char* argv[]) +{ + int i; + + /* Root directory specified on command line takes precedence + over location specified at configuration time. */ + for (i = 1; i < argc; ++i) + if (strcmp("--", argv[i]) == 0) + break; + else if (strncmp("--system=", argv[i], sizeof("--system=") - 1) == 0) { + return argv[i] + sizeof ("--system=") - 1; + } + + /* Command line did not change the system location to use. + Return what was computed at configuration time. */ + return OPENAXIOM_ROOT_DIRECTORY; +} + + +#define OPENAXIOM_GLOBAL_ENV "AXIOM" + +/* Publish the system exec prefix for use by sub-processes. */ +static void +publish_systemdir(const char* dir) +{ +#ifdef __WIN32__ + if (SetEnvironmentVariable(OPENAXIOM_GLOBAL_ENV, dir) == 0) { + perror("SetEnvironmentVariable"); + abort(); + } +#else /* __WIN32__ */ + const int env_length = sizeof (OPENAXIOM_GLOBAL_ENV) + + 1 /* room for '=' */ + + strlen(dir); + char* env = (char*) malloc (env_length); + strcpy(env, OPENAXIOM_GLOBAL_ENV); + env[sizeof OPENAXIOM_GLOBAL_ENV - 1] = '='; + strcpy(env + sizeof(OPENAXIOM_GLOBAL_ENV), dir); + if (putenv(env) != 0) abort(); +#endif /* __WIN32__ */ +} + + +/* Return a path for PROG specified as a relative path to PREFIX. */ +static const char* +make_path_for(const char* prefix, const char* prog) +{ + const int prefix_length = strlen(prefix); + char* execpath = (char*) malloc(prefix_length + strlen(prog) + 1); + strcpy(execpath, prefix); + strcpy(execpath + prefix_length, prog); + return execpath; +} + + +int +main(int argc, char* argv[]) +{ + const char* root_dir = get_systemdir(argc, argv); + const char* execpath = + make_path_for(root_dir, + OPENAXIOM_USE_SMAN ? + OPENAXIOM_SMAN_PATH : OPENAXIOM_CORE_PATH); +#ifdef __WIN32__ + char* command_line; + int cur = strlen(argv[0]); + int command_line_length = 0; + int i; + PROCESS_INFORMATION procInfo; + STARTUPINFO startupInfo = { 0 }; + DWORD status; /* Exit code for this program masqueraded as + the child created below. */ + + command_line_length += cur; + for (i = 1; i < argc; ++i) + command_line_length += 1 /* blank char as separator */ + + strlen(argv[i]); /* room for each argument */ + + /* Don't forget room for the doubledash string. */ + command_line_length += sizeof("--") - 1; + + command_line = (char*) malloc(command_line_length + 1); + + strcpy(command_line, argv[0]); + command_line[++cur] = ' '; + + /* Now start arguments to the core executable. */ + command_line[++cur] = '-'; + command_line[++cur] = '-'; + + /* Concatenate the arguments into a single string. */ + for (i = 1; i < argc; ++i) { + const int arg_length = strlen(argv[i]); + command_line[++cur] = ' '; + /* Note that strcpy will terminate `command_line' with a NUL + character, and since the next iteration will write the + blank precisely where the NUL character is, the whole command + line string will be a proper C-style string when the loop + normally exits. */ + strcpy(command_line + cur, argv[i]); + cur += arg_length; + } + + publish_systemdir(root_dir); + if(CreateProcess(/* lpApplicationName */ execpath, + /* lpCommandLine */ command_line, + /* lpProcessAttributes */ NULL, + /* lpThreadAttributes */ NULL, + /* bInheritHandles */ TRUE, + /* dwCreationFlags */ 0, + /* lpEnvironment */ NULL, + /* lpCurrentDirectory */ NULL, + /* lpstartupInfo */ &startupInfo, + /* lpProcessInformation */ &procInfo) == 0) { + fprintf(stderr, GetLastError()); + abort(); + } + WaitForSingleObject(procInfo.hProcess, INFINITE); + GetExitCodeProcess(procInfo.hProcess, &status); + CloseHandle(procInfo.hThread); + CloseHandle(procInfo.hProcess); + return status; + +#else /* __WIN32__ */ + int i; + char** args = (char**) malloc(sizeof (char*) * (argc + 2)); + publish_systemdir(root_dir); + + /* Pretend that we are still running the OpenAxiom driver, even if + it is actually the session manager or the core executable running. + We don't want to expose implementation details to users. */ + args[0] = argv[0]; + /* If we are running the core executable, we need to insert a + doubledash to indicate beginning of arguments. The session manager + does not need that temporary necessary obfuscation, and will + be confused. */ + if (!OPENAXIOM_USE_SMAN) + args[1] = "--"; + for (i = 1; i < argc; ++i) + args[i + !OPENAXIOM_USE_SMAN] = argv[i]; + args[argc + !OPENAXIOM_USE_SMAN] = NULL; + + execv(execpath, args); + perror(strerror(errno)); + return -1; +#endif /* __WIN32__ */ +} diff --git a/src/scripts/axiom.in b/src/scripts/axiom.in deleted file mode 100644 index 1fda6803..00000000 --- a/src/scripts/axiom.in +++ /dev/null @@ -1,192 +0,0 @@ -#!/bin/sh - -# Start everything for OpenAxiom. -# -# axiom -# [-ht |-noht] whether to use HyperDoc -# [-gr |-nogr] whether to use Graphics -# [-clef |-noclef] whether to use Clef -# [-nag |-nonag] whether to use NAG -# [-iw |-noiw] start in interpreter window -# [-ihere|-noihere] start an interpreter buffer in the original window -# [-nox] don't use X Windows -# [-go |-nogo] whether to start system -# [-ws wsname] use named workspace -# [-list] list workspaces only -# [-grprog fname] use named program for Graphics -# [-nagprog fname] use named program for Nag -# [-htprog fname] use named program for HyperDoc -# [-clefprog fname] use named program for Clef -# [-sessionprog fname] use named program for session -# [-clientprog fname] use named program for spadclient -# [-h] show usage -# -# - -## Where The OpenAxiom system resides -prefix=@prefix@ -exec_prefix=@exec_prefix@ -AXIOM=@open_axiom_installdir@ -export AXIOM - -## We adjust the value of PATH here because, currently, some OpenAxiom -## programs are called from the executing shell, and relying on the -## fact that the executables are reachable from the PATH. -PATH=$AXIOM/bin:$PATH - -## If the system is built without Superman support, there is -## no point in trying to forcefully use Superman -use_sman=@axiom_use_sman@ - - -MALLOCTYPE=3.1 -export MALLOCTYPE - -# NAGMAN needs to know the hostname -HOST=`hostname` -export HOST - -# 0. Basic utilities - -ciao() { - echo "Goodbye." - exit 1 -} - -needsubopt () { - echo "The $1 option requires an argument." - ciao -} - - -showuse() { -echo "axiom" -echo " [-ht |-noht] whether to use HyperDoc" -echo " [-gr |-nogr] whether to use Graphics" -echo " [-clef |-noclef] whether to use Clef" -echo " [-nag |-nonag] whether to use NAG" -echo " [-iw |-noiw] start in interpreter window" -echo " [-ihere|-noihere] start an interpreter buffer in the original window." -echo " [-nox] don't use X Windows" -echo " [-go |-nogo] whether to start system" -echo " [-ws wsname] use named workspace" -echo " [-list] list workspaces only" -#echo " [-grprog fname] use named program for Graphics" -#echo " [-nagprog fname] use named program for Nag" -#echo " [-htprog fname] use named program for HyperDoc" -#echo " [-clefprog fname] use named program for Clef" -#echo " [-sessionprog fname] use named program for session" -#echo " [-clientprog fname] use named program for spadclient" -echo " [-h] show usage" -} - -# 1. Ensure the environment is set. - -# Just process '-h' - -if [ "$*" = "-h" ] ; then - showuse -fi - -if [ "$AXIOMXLROOT" = "" ] ; then -AXIOMXLROOT=${AXIOM}/compiler -fi -export AXIOMXLROOT -PATH=$AXIOMXLROOT/bin:${PATH} -export PATH - - - -if [ ! -d "$AXIOM" ] ; then - echo "The directory for OpenAxiom, $AXIOM, does not exist." - ciao -fi - -# Name the workspace directories. -rootwsdir=$AXIOM/bin - -# 2. Process command line arguments. - -# Defaults for command-line arguments. -list=no -go=yes -wsname=AXIOMsys - -otheropts="" - -while [ "$*" != "" ] ; do - - case $1 in - -list) list=yes - go=no;; - -go) go=yes ;; - -nogo) go=no ;; - - -ws) - if [ "$2" = "" ] ; then needsubopt "$1" ; fi - shift - wsname="$1" - ;; - - -nagprog|-grprog|-htprog|-clefprog|-sessionprog|-clientprog|-paste|-rm|-rv) - if [ "$2" = "" ] ; then needsubopt "$1" ; fi - otheropts="$otheropts $1 $2" - shift - ;; - -clef|-noclef|-gr|-nogr|-ht|-noht|-iw|-noiw|-ihere|-noihere|-nox|-nag|-nonag) - otheropts="$otheropts $1" - ;; - - -h) - go=no - ;; - - - *) echo "Unknown option: $1" - echo "To use a specific workspace use, e.g.: spad -ws $1" - ciao - ;; - esac - - shift -done - -# 3. List the available workspaces, if asked - -listwspaces() -{ - echo "$1" - ls -l $2 | grep "sys$" - echo "" -} - -if [ $list = yes ] ; then - listwspaces "AXIOM workspaces in \$AXIOM/bin = $rootwsdir: " $rootwsdir -fi - -# 5. Try to ensure a suitable workspace on this host. - -if [ `expr $wsname : '.*/.*'` = 0 ] ; then - serverws=$rootwsdir/$wsname -else - serverws=$wsname -fi - -if [ ! -f $serverws ] ; then - showuse - ciao -fi - -# 6. Start processes - -if [ $go = no ] ; then - echo "Would now start the processes." - echo exec $AXIOM/bin/sman $otheropts -ws $serverws - exit 0 -fi - -if [ $use_sman = "yes" ]; then - exec $AXIOM/bin/sman $otheropts -ws $serverws -else - exec $serverws -fi |