Re: [Sablevm-developer] building out-of-the-box on non-Linux platform
Brought to you by:
egagnon
From: Patrick C. <er...@ps...> - 2004-01-19 07:32:41
|
Also sprach Grzegorz B. Prokopski zu "17.01.2004 11:08" Anno Domini: > W liście z sob, 17-01-2004, godz. 04:17, David Bélanger pisze: > >>Hi, >> >>I think it would be great if SableVM could be built out-of-the-box on >>all platforms including the non-Linuxian FreeBSD and OS X. It will >>simplify my life as I want to build and test on these platforms. >>Currently source code is not an issue, it is more a configure/Makefile >>isssue. >> >>src/libsablevm/Makefile.am has some line like: >>libsablevm_la_LIBADD = -lpthread -lm -lffi -lltdl -lrt >> >>FreeBSD does not like -lpthread. >>OS X does not like -lrt. >> >>This is because functionnality is located elsewhere and there are >>no such libXX.so file... (Actually, on OS X, there is a single >>libSystem that includes implementation of libc, libm, libpthread and >>probably others. libc etc. are only symlinks to libSystem. But there >>are no librt symlinks in the default installation) >> >>A long time ago, I had: >>if REQ_LPTHREAD >>REQ_LIBS = -lpthread -lm -lffi -lltdl -lrt >>else >>REQ_LIBS = -lc_r -lm -lffi -lltdl -lrt >>endif >>libsablevm_la_LIBADD = ${REQ_LIBS} >> >>where REQ_LPTHREAD was set in ./configure.ac. >> >>This was ok for FreeBSD but will become more complex with -lrt on/off. >>Note: I tried first with simpler things but automake/conf tools didn't >>like it. There are some restriction of what the right hand side arg >>of libsablevm_la_LIBADD can be for the autoconf/make tools, don't >>remember which one. > > > svn diff -r 1204:HEAD \ > svn://svn.sablevm.org/developers/mlord/sandbox/sablevm-staging |less > > will show you what was changed for cygwin port (not yet merged) > It also didn't like -lrt (only Solaris requires it apparently) > but it wasn't solved nicely. > > But if we take a look at these parts: > > +++ configure.ac (revision 1385) > +dnl defining macro (platform_win32) only for Cygwin or Mingw > +AC_MSG_CHECKING([for some Win32 platform]) > + > +case "$host" in > + *-*-mingw*|*-*-cygwin*) > + platform_win32=yes > + ;; > + *) > + platform_win32=no > + ;; > +esac > +AC_MSG_RESULT([$platform_win32]) > +AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes") > + > +++ src/libsablevm/Makefile.am (revision 1385) > +if PLATFORM_WIN32 > +no_undefined = -no-undefined > +endif > + > [...] > +libsablevm_la_LDFLAGS = -version-info @LIBRARY_VERSION@ $(no_undefined) > > One could add detection of other platforms in configure.ac and > accordignly add in makefiles ex. > +if PLATFORM_SOLARIS > +lrt=-lrt > +endif > and so on... > > But I don't think I like this stuff, first because it'd require us to > create PLATOFORM_* defines for maaaany platforms, second - this config > info (what to link with or not) looks like global stuff, so why would > it reside in one Makefile.am and not in the other one(s)? We should > save ourselves coding and do maximum of it in one place (configure), > while minimizing changes in other places (Makefiles). > > Ideally, I think we'd have in configure.ac sth. like: > +AC_MSG_CHECKING([if we need -no-undefined]) > + > +case "$host" in > + *-*-mingw*|*-*-cygwin*) > + no_undefined=-no-undefined > + AC_MSG_RESULT([yes]) > + ;; > + *) > + AC_MSG_RESULT([no]) > + ;; > +esac > > +AC_MSG_CHECKING([if we need -lrt]) > + > +case "$host" in > + *solaris*) > + lrt=-lrt > + AC_MSG_RESULT([yes]) > + ;; > + *) > + AC_MSG_RESULT([no]) > + ;; > +esac > > +AC_MSG_CHECKING([if we need -lpthread]) > + > +case "$host" in > + *freebsd*) > + AC_MSG_RESULT([no]) > + ;; > + *) > + lpthread=-lpthread > + AC_MSG_RESULT([yes]) > + ;; > +esac > > (system id strings, besides cygwin/mingw should probably be narowed) > > and then use @no_undefined@, @lrt@ and @lpthread@ in Makefiles - where > needed. They either would contain respective params or be empty. That's exactly what you should do in configure! For that reason, there are more macros provided by autoconf that only "AC_MSG_*". Your last case for example could be simpliefied to a simple one-liner using AC_CHECK_LIB! Have a look at the autoconf info pages for a complete overview. A call of autoscan in your sources could also be helpful (have a look at the generated configure.scan template). On Debian, there exists a package named autobook with a quiet complete html documentation about auto*. Last but not least, three pointers: http://seul.org/docs/autotut/ http://www.amath.washington.edu/~lf/tutorials/autoconf/ http://nis-www.lanl.gov/~rosalia/mydocs/autoconf_tutorial_toc.html Hope this help! CU -- Patrick Cernko | mailto:er...@er... | http://www.errror.de Quote of the Week: "Quis custodit custodes? Ceterum censeo Microsoftem esse delendam!" (anonyum) |