Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split stlkos into library + executable REPL, and we'd have embedded STklos #262

Open
jpellegrini opened this issue Sep 4, 2021 · 3 comments

Comments

@jpellegrini
Copy link
Contributor

Hi @egallesio !

I was trying to do what I mentioned in the subject. stklos.c is very small, and a simple C program embedding STklos couldbe even smaller, since it wouldn't need to process command line options.

But I found a problem:
Currnetly it seems that the STklos build process doesn't use libtool. If I change src/Makefile.am to build libstklos and add LT_INIT to configure.ac, the configure script stops detecting the OS (???):

SUMMARY
*******
               System:  -
              OS nick:  _
              OS type: 
      Install prefix :  /usr/local
           C compiler:  gcc
    Compilation flags:  -g -O2
               Loader:  /usr/bin/ld -m elf_x86_64
       Thread support:  pthreads
     Case sensitivity:  true (by default)
Control fx parameters:  yes
System libraries used:  libffi libpcre libgmp libgc
   Compiled libraries: 

And then (of course) compilation fails, because it depends on those variables.

I tried to understand how configure.ac detects the operating system, and I really don't get it: as far as I understand, the "OS" variable is not available, except on Windows (is that correct). But it is used in configure.ac:

BUILD_OS=$os-$version
BUILD_ARCH=`uname -m`
OS_NAME=$OS
case $OS in
   LINUX) ...

The only variables related to operating systems that I thought would come from autotools would be $host_os and $build_os, which people ten do recommend using as follows:

AC_CANONICAL_HOST

build_linux=no
build_windows=no
build_mac=no

case "${host_os}" in
    linux*)
        build_linux=yes
        ;;
    cygwin*|mingw*)
        build_windows=yes
        ;;
    darwin*)
        build_mac=yes
        ;;
    *)
        AC_MSG_ERROR(["$host_os is not supported"])
        ;;
esac

AM_CONDITIONAL([LINUX], [test "$build_linux" = "yes"])
AM_CONDITIONAL([WINDOWS], [test "$build_windows" = "yes"])
AM_CONDITIONAL([OSX], [test "$build_mac" = "yes"])

But I'm really no autotools expert.

How's the status of supported platforms today, and how can we make configure.ac better?
It would be really nice to have a libstklos separate from the binary.

@jpellegrini
Copy link
Contributor Author

Ah, I see - utils/shlib-options sets those variables! I put LT_INIT after utils/shlib-options is used, and it seems to work. I'll keep working on this, maybe we'll have embedded STklos soon.

@jpellegrini
Copy link
Contributor Author

@egallesio I got it working!

But there's one small problem: the new STklos would install include files that could conflict with others in the system, like

/usr/include/socket.h
/usr/include/extraconf.h

and we should probably offer some other header files from src to the user.

I think we should either:

  • Put all needed definitions for embedded programming in stklos.h (but it may get too large), or
  • Give some of those files different names

What do you think?

I'll make a PR so you can see what I've been doing.

@jpellegrini
Copy link
Contributor Author

jpellegrini commented Sep 4, 2021

See PR #263

@jpellegrini jpellegrini changed the title Split stlkos into library + exacutable REPL, and we'd have embedded STklos Split stlkos into library + executable REPL, and we'd have embedded STklos Sep 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant