History

Detect multiarch triplet and lddir from ldd output

Thomas Preud'homme committed 13 years ago

Commit f9ac2011 parent af4b27f2 files · +8 −44Browse files

Unified · Split

2 files
  1. configure +8 −8
  2. tcc.h +0 −36
configure+8−8
@@ -261,12 +261,12 @@ if $cc -o $TMPO $TMPC 2> /dev/null ; then · 260 unmodified lines
261fi261fi
262 262
263if test -z "$cross_prefix" ; then263if test -z "$cross_prefix" ; then
264 if test -f "/usr/lib64" ; then264 libc_dir="$(ldd ./print_env_info | grep libc.so | sed 's|[^/]*/\(.*/\)[^/]*|\1|')"
265 lddir="lib64"265 multiarch_triplet=${libc_dir#*/}
266 elif test -z "$tcc_crtprefix" ; then # check if system is multiarch266 multiarch_triplet=${multiarch_triplet%/}
267 if test ! -f $sysroot/usr/lib/crti.o -o -L $sysroot/usr/lib/crti.o ; then267 lddir="${libc_dir%%/*}"
268 use_multiarch="yes"268 if test -n "$multiarch_triplet" ; then
269 fi269 lddir="$lddir/$multiarch_triplet"
270 fi270 fi
271fi271fi
272 272
@@ -501,8 +501,8 @@ if test "$have_selinux" = "yes" ; then · 228 unmodified lines
501 echo "#define HAVE_SELINUX" >> $TMPH501 echo "#define HAVE_SELINUX" >> $TMPH
502 echo "HAVE_SELINUX=yes" >> config.mak502 echo "HAVE_SELINUX=yes" >> config.mak
503fi503fi
504if test "$use_multiarch" = "yes" ; then504if test -n "$multiarch_triplet" ; then
505 echo "#define CONFIG_TCC_MULTIARCH" >> $TMPH505 echo "#define CONFIG_MULTIARCHDIR \"$multiarch_triplet\"" >> $TMPH
506fi506fi
507if test -n "$lddir" ; then507if test -n "$lddir" ; then
508 echo "#define CONFIG_LDDIR \"$lddir\"" >> $TMPH508 echo "#define CONFIG_LDDIR \"$lddir\"" >> $TMPH
tcc.h+0−36
@@ -156,42 +156,6 @@ · 155 unmodified lines
156# define CONFIG_SYSROOT ""156# define CONFIG_SYSROOT ""
157#endif157#endif
158 158
159#if defined(CONFIG_TCC_MULTIARCH) && defined(TCC_IS_NATIVE)
160/* Define architecture */
161# if defined(TCC_TARGET_I386)
162# define TRIPLET_ARCH "i386"
163# elif defined(TCC_TARGET_X86_64)
164# define TRIPLET_ARCH "x86_64"
165# elif defined(TCC_TARGET_ARM)
166# define TRIPLET_ARCH "arm"
167# else
168# define TRIPLET_ARCH "unknown"
169# endif
170/* Define OS */
171# if defined (__linux__)
172# define TRIPLET_OS "linux"
173# elif defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
174# define TRIPLET_OS "kfreebsd"
175# elif !defined (__GNU__)
176# define TRIPLET_OS "unknown"
177# endif
178/* Define calling convention and ABI */
179# define TRIPLET_ABI "gnu"
180# ifdef __GNU__
181# define CONFIG_MULTIARCHDIR TRIPLET_ARCH "-" TRIPLET_ABI
182# else
183# define CONFIG_MULTIARCHDIR TRIPLET_ARCH "-" TRIPLET_OS "-" TRIPLET_ABI
184# endif
185#endif
186
187#ifndef CONFIG_LDDIR
188# ifdef CONFIG_MULTIARCHDIR
189# define CONFIG_LDDIR "lib/" CONFIG_MULTIARCHDIR
190# else
191# define CONFIG_LDDIR "lib"
192# endif
193#endif
194
195/* path to find crt1.o, crti.o and crtn.o */159/* path to find crt1.o, crti.o and crtn.o */
196#ifndef CONFIG_TCC_CRTPREFIX160#ifndef CONFIG_TCC_CRTPREFIX
197# define CONFIG_TCC_CRTPREFIX CONFIG_SYSROOT "/usr/" CONFIG_LDDIR161# define CONFIG_TCC_CRTPREFIX CONFIG_SYSROOT "/usr/" CONFIG_LDDIR

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t