Commit Graph

123 Commits (da8c62f75d893449e232944fc62566c020b4d010)

Author SHA1 Message Date
grischka 762a43877b configure: pass CONFIG_xxxDIR/PATH options via commandline
- except for CONFIG_SYSROOT and CONFIG_TCCDIR

Strictly neccessary it is only for CONFIG_MULTIARCHDIR
because otherwise if it's in config.h it is impossible to
leave it undefined.

But it is also nicer not to use these definitions for
cross-compilers.

- Also:
lib/Makefile : include ../Makefile for CFLAGS
lib/libtcc1.c : fix an issue compiling tcc with tcc on x64
2013-02-14 17:43:24 +01:00
Thomas Preud'homme 99b801dafc Add missing heading slash to detect /lib64 systems 2013-02-14 16:57:27 +01:00
Thomas Preud'homme b1a8233562 Another attempt to "detect" multiarch 2013-02-14 15:39:35 +01:00
grischka 944627c479 configure: cleanup
- add quotes: eval opt=\"$opt\"
- use $source_path/conftest.c for OOT build
- add fn_makelink() for OOT build
- do not check lddir etc. on Windows/MSYS
- formatting

config-print.c
- rename to conftest.c (for consistency)
- change option e to b
- change output from that from "yes" to "no"
- remove inttypes.h dependency
- simpify version output

Makefile:
- improve GCC warning flag checks

tcc.h:
- add back default CONFIG_LDDIR
- add default CONFIG_TCCDIR also (just for fun)

tccpp.c:
- fix Christian's last warning
  tccpp.c: In function ‘macro_subst’:
  tccpp.c:2803:12: warning: ‘*((void *)&cval+4)’ is used uninitialized
     in this function [-Wuninitialized]
  That the change fixes the warning doesn't make sense but anyway.

libtcc.c:
- tcc_error/warning: print correct source filename/line for
  token :paste: (also inline :asm:)

lddir and multiarch logic still needs fixing.
2013-02-14 06:53:07 +01:00
Thomas Preud'homme e298f60838 Create config-print program to test $cc
Create a helper program called config-print to print informations
relative to the BUILD/HOST environment in the case of native
compilation.
2013-02-13 22:35:36 +01:00
Thomas Preud'homme a4cbd9b002 Various fixes for f9ac2013 2013-02-13 22:28:41 +01:00
Thomas Preud'homme f9ac201377 Detect multiarch triplet and lddir from ldd output 2013-02-13 20:14:13 +01:00
Thomas Preud'homme af4b27f0fd Fix previous commit
Fix commit f6cfaa6d25
2013-02-13 17:58:58 +01:00
Thomas Preud'homme f6cfaa6d25 Improve multiarch detection
* Detect multiarch at configure time
* Detect based on the place where crti.o is
* Define multiarch triplet in tcc.h
2013-02-13 17:03:30 +01:00
Thomas Preud'homme 4b8e7f1f39 Fix fn_dirname in configure script
Use ${parameter%word} construct to fix fn_dirname in configure script.
Bonus: on less fork.
2013-02-08 11:07:22 +01:00
grischka d5f4df09ff tests: cleanup
tests:
- add "hello" to test first basic compilation to file/memory
- add "more" test (tests2 suite)
- remove some tests

tests2:
- move into tests dir
- Convert some files from DOS to unix LF
- remove 2>&1 redirection

win32:
- tccrun.c: modify exception filter to exit correctly (needed for btest)
- tcctest.c: exclude weak_test() (feature does not exist on win32)
2013-02-05 14:27:38 +01:00
grischka 17cf0dcf70 configure: use relative paths for in-tree build
Also
- move CPPFLAGS to Makefile
- Use top_srcdir in lib/Makefile
2013-01-30 18:39:09 +01:00
Thomas Preud'homme f7b417723e Fix out-of-tree build with relative path to root
Fix path of Makefile symlinks in a out-of-tree build where the root
directory of the source is given as a relative path.
2013-01-14 18:18:27 +01:00
Akim Demaille 017bbbfee1 configure: support absolete out-of-tree builds
configure: handle the case of absolute paths.
Reported by grishka.
2012-12-21 13:57:22 +01:00
Akim Demaille d7264e0218 configure: style changes
* configure: use more here-documents.
2012-12-21 13:49:15 +01:00
Akim Demaille ba49862de6 configure: prefer here-documents
* configure: use here-documents to improve readability and
reduce the clutter.
2012-12-21 13:47:00 +01:00
Akim Demaille 9c9ca2032b configure: style changes
* configure (case $targetos): Improve readibility.
(case $cpu): New, to improve readability compare to if + test.
2012-12-21 13:45:22 +01:00
Akim Demaille 3f09b90d21 build: fix VPATH builds
* configure (fn_dirname): New.
Use it to ensure the creation of proper symlinks to Makefiles.
(config.mak): Define top_builddir and top_srcdir.
(CPPFLAGS): Be sure to find the headers.
* Makefile, lib/Makefile, tests/Makefile, tests2/Makefile: Adjust
to set VPATH properly.
Fix confusion between top_builddir and top_srcdir.
2012-12-18 10:06:20 +01:00
Thomas Preud'homme c4a18f47a2 Detect ARM CPU version in configure
Instead of guessing the ARM CPU version to compile for from tcc.h, we
now detect it in configure and output the value in config.h
2012-12-04 11:17:51 +01:00
Thomas Preud'homme 3c986eeae3 Add armv6l to ARM supported processors
Add armv6l to the list of supported ARM architecture (as returned by
uname -m) in ./configure
2012-11-11 20:01:01 +01:00
Thomas Preud'homme 2e7a1af5d5 Evaluate configure arguments
Evaluate configure arguments to reproduce autotools behavior. Autotools
actually only expands a few variable and do it at make time but it makes
the change much simpler.
2012-06-12 20:48:01 +02:00
Thomas Preud'homme 731e07f175 Only warn for unknown options in configure script
This follows discussion started at
http://lists.nongnu.org/archive/html/tinycc-devel/2012-05/msg00015.html
2012-05-28 21:16:39 +02:00
Andrew Mulbrook 5775911dad Revert "Multiple fixes for 64 bit sections"
This reverts commit d7a7c3769d.
2012-03-03 10:12:06 -06:00
mob d7a7c3769d Multiple fixes for 64 bit sections
This changeset attempts to fix a few problems when giving using
the high 32bits of a 64bit section offset. There are likely more
issues (or perhaps regressions) lurking in the muck here. In general,
this moves a few data type declarations to use uplong.  Also, add
support for 64bit mingw32 building under cygwin.  Because native
types are used for 64 bit offsets, this won't fix challenges with
cross compiling from 32bit -> 64bit.

Tested under cygwin, against binary compiled with
-Wl,-Ttext=0xffffff8000000000

Signed-off-by: Andrew Mulbrook <andrew262@gmail.com>
2012-02-26 19:02:51 -06:00
Milutin Jovanovic 8ca8b08890 Patch attempting to build OSX TinyCC.
Applied patch found on stackoverflow (link below). I also found some
related changes that looked like logically needed. The stackoverflow
changes addressed only two registers which were breaking a compile.
However reading the code in the same file shows two other register
accesses that, while not breaking the build, should have the same fix.

http://stackoverflow.com/questions/3712902/problems-compiling-tcc-on-os-x/3713144#3713144

The test driver was changed by changing 'cp -u' into 'cp' as '-u' is not
supported on mac osx.

I found that osx build required the WITHOUT_LIBTCC define. I suspect the
reason for this is tcc unability to handle mach-o files. In order to
properly address this I had to change 'configure' to propagate target os
name to Makefile.

Current state is that simple tests work, but not the whole 'make test'
suite runs.

To the best of my knowledge, these changes should not impact other
platforms.
2012-02-09 12:53:17 -05:00
grischka 74a24d77fd libtcc: minor adjustments
- use {B} to substitute tcc_lih_path (instead of \b)

- expand CONFIG_TCC_CRTPREFIX in CONFIG_TCC_LIBPATHS
  which fixes duplicate CONFIG_SYSROOT.

- put default CONFIG_SYSROOT ("") into tcc.h

- remove hack from commit db6fcce78f
  because $(tccdir)/include is already in sysincludes

- configure: error out for unrecognized options.

- win32/build-tcc.bat: put libtcc into base dir where it will
  find lib/include automatically, and build libtcc_test example.
2011-08-11 16:55:30 +02:00
grischka e844fb11c2 libtcc: support more than one crtprefix
Looks like gcc has that.  Oh Deer!
2011-08-06 16:49:30 +02:00
grischka 81cd0cf6fd configure: add switches to set search paths
--sysincludepaths=.. specify system include paths, colon separated"
     Sets CONFIG_TCC_SYSINCLUDEPATHS

   --libpaths=...       specify system library paths, colon separated"
     Sets CONFIG_TCC_LIBPATHS

   --crtprefix=...      specify location of crt?.o"
     Sets CONFIG_TCC_CRTPREFIX

   --elfinterp=...      specify elf interpreter"
     Sets CONFIG_TCC_ELFINTERP

Also the CONFIG_TCC_XXX were renamed to make them look
more consistent.

Also move the elf_interp definitions to tcc.h.
2011-08-06 16:11:12 +02:00
Thomas Preud'homme 0b6652003c Revert "Add a --multiarch-triplet switch to configure"
This reverts commit 76adc5770f.
2011-08-03 22:26:39 +02:00
Thomas Preud'homme 76adc5770f Add a --multiarch-triplet switch to configure
Add a --multiarch-triplet switch to configure. The switch will allow
files to be search for each default path in path/<triplet> and then
path.
Default paths handled that way:
- CONFIG_TCC_SYSINCLUDE_PATHS
- CONFIG_TCC_LIBPATH
- path to crt*.o
- path to libgcc_s.so.1

Path missing: elf interpreter path (will be handled in another commit)
2011-08-02 00:31:17 +02:00
Joe Soroka 436c1a734f allow defining sysroot at compile-time 2011-07-11 00:20:48 -07:00
Thomas Preud'homme f8656fbc3c Remove useless changes from 31ca000d in configure
After commit 4d6a4a26e0, the changes in
configure are no longer needed.
2011-07-07 15:32:20 +02:00
Thomas Preud'homme 38de06e334 Fix commit 31ca000d
* CONFIG_TCC_*LDDIR should not be exported if no --*lddir option is used.
* Don't write a : at the beginning of extralddir
2011-07-05 23:49:53 +02:00
Thomas Preud'homme 31ca000d72 Add multiarch dirs to linker search path
By default, tcc search libraries in /lib and /usr/local/lib while crt*.o
files are searched in /usr/lib and ld.so is searched in /lib.
Unfortunetely the path are hardcoded in source code. This patch allow
tcc to look in an other directory and also to look in extra directories.
It's then possible to make tcc search libraries in /lib/x86_64-linux-gnu
and /usr/local/lib/x86_64-linux-gnu while crt*.o files are searched in
/usr/lib/x86_64-linux-gnu and ld.so is searched in
/lib/x86_64-linux-gnu.
2011-07-05 11:16:12 +02:00
Thomas Preud'homme 3511e6e2a8 Default to create progs with symbols (incl. debug)
* Set CFLAGS entirely in configure if not already set.
* Compile bcheck.c with the same flags as the other source files
* Don't strip binaries by default (GB are cheap now) but provide a
  --strip-binaries option in configure script.
2011-06-17 22:22:04 +02:00
Thomas Preud'homme 8123e334e9 Support scratchbox, Nokia N900 and qemu arm archs
Add arm, armv5tejl and armv7l to the list of supported arm architectures
2011-05-16 15:30:52 +02:00
Henry Kroll III 48e325df3c configure: --sharedir defaults to /usr/local/share 2010-12-23 06:36:07 -08:00
Henry Kroll III f449f98dec configure: --sharedir documentation root 2010-12-22 04:42:39 -08:00
Henry Kroll III 90355c78ed configure: add --disable-rpath option (Fedora) 2010-12-20 05:55:54 -08:00
Henry Kroll III 3b3a7cc8ba configure: improvements to option --tccdir 2010-12-20 05:38:59 -08:00
grischka 86ffc48129 make: new lib/Makefile for libtcc1.a on more platforms
win32/64 cross-compilers now build libtcc1.a and install it
together with the windows headers in a 'win32' sub-directory
of TCCDIR.
2010-12-04 16:47:08 +01:00
Henry Kroll III 3b8b290a45 make cross compilers an expert option in configure --help 2010-12-02 20:33:11 -08:00
Henry Kroll III 94e72b16e7 Add --enable-cygwin option to build on windows with cygwin+mingw32 2010-12-02 20:16:32 -08:00
Henry Kroll III a2779556b4 split cross libtcc1.a to separate directories 2010-12-02 03:08:57 -08:00
Henry Kroll III 9a986f374e configure: allow changing installation directory 2010-11-28 15:54:27 -08:00
Sergei Trofimovich 872cc430c0 info doc: fix --infodir to respect DESTDIR for 'make install'
info files are introduced by commit 3f829d11ff

This patch helps packagers to avoid problems when install to $DESTDIR

    >>> Starting src_install
    make -j3 bindir=/tmp/paludis/dev-lang-tcc-9999/image//usr/bin libdir=/tmp/paludis/dev-lang-tcc-9999/image//usr/lib tccdir=/tmp/paludis/dev-lang-tcc-9999/image//usr/lib/tcc includedir=/tmp/paludis/dev-lang-tcc-9999/image//usr/include docdir=/tmp/paludis/dev-lang-tcc-9999/image//usr/share/doc/tcc-9999 mandir=/tmp/paludis/dev-lang-tcc-9999/image//usr/share/man install
    mkdir -p "/tmp/paludis/dev-lang-tcc-9999/image//usr/bin"
    install -m755 tcc "/tmp/paludis/dev-lang-tcc-9999/image//usr/bin"
    mkdir -p "/tmp/paludis/dev-lang-tcc-9999/image//usr/share/man/man1"
    install tcc.1 "/tmp/paludis/dev-lang-tcc-9999/image//usr/share/man/man1"
    mkdir -p /usr/share/info
    install  tcc-doc.info "/usr/share/info"
    ACCESS DENIED  open_wr:      /usr/share/info/tcc-doc.info
    install: cannot create regular file `/usr/share/info/tcc-doc.info': Permission denied
    make: *** [install] Error 1
    /usr/libexec/paludis/utils/emake: emake returned error 2

Signed-off-by: Sergei Trofimovich <st@anti-virus.by>
2010-09-21 10:04:05 +03:00
Thomas Preud'homme 3f829d11ff Add info file creation into tcc build process
Add info file creation in tcc Makefile
2010-09-10 21:19:01 +02:00
Thomas Preud'homme 2887f40f76 Add support for GNU/Hurd
+ Add i686-AT386 to the list of x86 platform
+ Define SA_SIGINFO is not defined
2010-09-10 20:55:54 +02:00
Thomas Preud'homme 5e6fabefd7 Revert "Use mktemp to generate temp files."
Doesn't seem to work on windows
This reverts commit 27988c5e66.
2010-06-23 14:10:22 +02:00
Thomas Preud'homme 27988c5e66 Use mktemp to generate temp files.
Fix the $RANDOM bashism properly by using mktemp.
mktemp is part of MSYS so this should work on UNIXes and Windows
2010-06-22 18:40:35 +02:00
grischka 10b4802869 Fix "Fix bashims in configure ..." for MSYS
Fixes commit dc265feb63
2010-06-15 17:02:35 +02:00
Thomas Preud'homme dc265feb63 Fix bashims in configure and gcctestsuite.sh.
configure and gcctestsuite.sh shell scripts contains bashisms although being
bourne shell script. This patch fixes the following bashisms:
* Use of $RANDOM variable (replaced by reading in /dev/urandom)
* Use == in tests instead of just =
* Use $[] for arithmetic computation istead of $(())
2010-05-26 14:08:29 +02:00
Henry Kroll III 765992396f Makefile fixup:
* additional make target for lib/tcc1.def on non-win32 builds
  tcc1.def was formerly lib/libtcc1.a but has bee made into its
  own Makefile target, tcc1.def

* use mv instead of cp on config.h
  this fixes a mistake I made which caused Makefile to rebuild
  all targets every time

* make links from libtcc.so.1.0 to libtcc.so.1 and libtcc.so
2010-04-25 13:34:02 -07:00
Henry Kroll III b0b29d8013 put tcc in /usr/lib64/tcc on distros that have it 2010-04-24 03:30:46 -07:00
Henry Kroll III a4ed587f61 add --disable-static option to build libtcc.so instead of libtcc.a
for distros that want static libs
2010-04-24 02:35:43 -07:00
Henry Kroll III 1578322b06 fix typo in configure 2010-04-24 02:32:41 -07:00
Henry Kroll III be7e339d8a Use mmap instead of exec mem for Selinux machines. Fixes crash on Fedora. 2010-04-20 23:43:02 -07:00
Thomas Preud'homme e4ed4e7f4f Support more arm EABI compatible architectures
Add support for:
  - armv5tel
  - armv6j
  - armv7a
2010-04-18 19:29:11 +02:00
Thomas Preud'homme 6d4166df61 Don't prefix $prefix with $(DESTDIR) in configure
Prefixing $prefix with $(DESTDIR) is an error as it could lead for
example to mandir being equal to $(DESTDIR)$prefix/man where
$prefix itself is equal to $(DESTDIR)/usr/local which make man be equal
to $(DESTDIR)$(DESTDIR)/usr/local/man
2010-04-15 19:10:59 +02:00
Bernhard Reutner-Fischer d2e125186f improve handling of --help
Previously ./configure --prefix=/foo --help didn't show the help-text

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2009-12-01 17:59:29 +01:00
grischka c93ddac9aa configure: support DESTDIR for RPM packagers etc.
Suggested by Shlomi Fish
2009-07-18 21:54:43 +02:00
grischka 5829791ffa fix makefiles etc for subdirs 2009-04-18 15:08:03 +02:00
Shinichiro Hamaji 0a9873aa22 Add support of x86-64.
Most change was done in #ifdef TCC_TARGET_X86_64. So, nothing should be broken by this change.

Summary of current status of x86-64 support:

- produces x86-64 object files and executables.
- the x86-64 code generator is based on x86's.
-- for long long integers, we use 64bit registers instead of tcc's generic implementation.
-- for float or double, we use SSE. SSE registers are not utilized well (we only use xmm0 and xmm1).
-- for long double, we use x87 FPU.
- passes make test.
- passes ./libtcc_test.
- can compile tcc.c. The compiled tcc can compile tcc.c, too. (there should be some bugs since the binary size of tcc2 and tcc3 is differ where tcc tcc.c -o tcc2 and tcc2 tcc.c -o tcc3)
- can compile links browser. It seems working.
- not tested well. I tested this work only on my linux box with few programs.
- calling convention of long-double-integer or struct is not exactly the same as GCC's x86-64 ABI.
- implementation of tcc -run is naive (tcc -run tcctest.c works, but tcc -run tcc.c doesn't work). Relocating 64bit addresses seems to be not as simple as 32bit environments.
- shared object support isn't unimplemented
- no bounds checker support
- some builtin functions such as __divdi3 aren't supported
2008-12-02 02:30:47 +01:00
Daniel Glöckner 15e0dc08a6 Allow to use libgcc instead of libtcc1
This patch adds a switch --with-libgcc to configure.
When passed it prevents libtcc1.a from being built and links to
/lib/libgcc_s.so.1 instead of PREFIX/lib/tcc/libtcc1.a.

It will work on ARM when using libgcc from GCC >= 4.2.0.
Prior versions don't have the __floatun[sd]i[sdx]f functions.

It won't work on i386 because of two missing symbols emitted when
floats are cast to integers, but users can provide those symbols
(global short constants) in their code if needed.

  Daniel
2008-09-12 22:22:58 +02:00
Daniel Glöckner 256f6e6200 A prefix for default library/include search paths
This patch is useful for cross compilers. Without this patch tcc
tries to use the host's libraries, crt*.o and include files.
The patch prepends a string to all default paths. The string can
be passed to configure with --sysroot=string.

  Daniel
2008-09-12 22:22:58 +02:00
grischka 2eaa1104f7 Checkin tiny_libmaker (ar replacement) by Timovj Lahde 2008-03-08 19:55:47 +00:00
grischka 6c96c41ee4 Import changesets (part 4) 428,457,460,467: defines for openbsd etc. 2007-12-16 18:24:44 +00:00
bellard 7097268ac5 fixed help 2006-10-28 19:46:55 +00:00
bellard acc4f88e6d build of cross compilers is optional - added tccdir path 2005-04-14 23:51:24 +00:00
bellard aa7ef7919e copy paste abuse 2004-10-08 22:02:01 +00:00
bellard 13affef3f1 win32 configure 2004-10-07 21:11:43 +00:00
bellard fe7bcdef6b added config.texi 2003-04-13 21:55:37 +00:00
bellard dd56ab8c77 added configure support 2003-04-13 19:50:35 +00:00