Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. #!/bin/sh
  2. #
  3. # tcc configure script (c) 2003 Fabrice Bellard
  4.  
  5. # set temporary file name
  6. # if test ! -z "$TMPDIR" ; then
  7. #     TMPDIR1="${TMPDIR}"
  8. # elif test ! -z "$TEMPDIR" ; then
  9. #     TMPDIR1="${TEMPDIR}"
  10. # else
  11. #     TMPDIR1="/tmp"
  12. # fi
  13. #
  14. # bashism: TMPN="${TMPDIR1}/tcc-conf-${RANDOM}-$$-${RANDOM}.c"
  15.  
  16. TMPN="./conftest-$$"
  17. TMPH=$TMPN.h
  18.  
  19. # default parameters
  20. build_cross="no"
  21. use_libgcc="no"
  22. enable_assert="no"
  23. prefix=""
  24. execprefix=""
  25. bindir=""
  26. libdir=""
  27. tccdir=""
  28. includedir=""
  29. mandir=""
  30. infodir=""
  31. sysroot=""
  32. cross_prefix=""
  33. cc="gcc"
  34. host_cc="gcc"
  35. ar="ar"
  36. strip="strip"
  37. cygwin="no"
  38. gprof="no"
  39. bigendian="no"
  40. mingw32="no"
  41. LIBSUF=".a"
  42. EXESUF=""
  43. tcc_sysincludepaths=""
  44. tcc_libpaths=""
  45. tcc_crtprefix=""
  46. tcc_elfinterp=""
  47. tcc_lddir=
  48. confvars=
  49. cpu=
  50.  
  51. host_os=`uname`
  52. case $host_os in
  53.   MINGW32*)  host_os=Windows; ;;
  54.   *) ;;
  55. esac
  56.  
  57. # OS specific
  58. targetos=`uname`
  59. case $targetos in
  60.   MINGW32*)  mingw32=yes; host_os=Windows; ;;
  61.   DragonFly) noldl=yes;;
  62.   OpenBSD)   noldl=yes;;
  63.   FreeBSD)   noldl=yes;;
  64.   NetBSD)    noldl=yes;;
  65.   *) ;;
  66. esac
  67.  
  68. # find source path
  69. # XXX: we assume an absolute path is given when launching configure,
  70. # except in './configure' case.
  71. source_path=${0%configure}
  72. source_path=${source_path%/}
  73. source_path_used="yes"
  74. if test -z "$source_path" -o "$source_path" = "." ; then
  75.     source_path=`pwd`
  76.     source_path_used="no"
  77. fi
  78.  
  79. classify_cpu ()
  80. {
  81.   cpu="$1"
  82.  
  83.   case "$cpu" in
  84.     x86|i386|i486|i586|i686|i86pc|BePC|i686-AT386)
  85.       cpu="x86"
  86.     ;;
  87.     x86_64|amd64)
  88.       cpu="x86-64"
  89.     ;;
  90.     arm*)
  91.       case "$cpu" in
  92.         arm|armv4l)
  93.           cpuver=4
  94.         ;;
  95.         armv5tel|armv5tejl)
  96.           cpuver=5
  97.         ;;
  98.         armv6j|armv6l)
  99.           cpuver=6
  100.         ;;
  101.         armv7a|armv7l)
  102.           cpuver=7
  103.         ;;
  104.       esac
  105.       cpu="armv4l"
  106.     ;;
  107.     aarch64)
  108.       cpu="aarch64"
  109.     ;;
  110.     alpha)
  111.       cpu="alpha"
  112.     ;;
  113.     "Power Macintosh"|ppc|ppc64)
  114.       cpu="powerpc"
  115.     ;;
  116.     mips)
  117.       cpu="mips"
  118.     ;;
  119.     s390)
  120.       cpu="s390"
  121.     ;;
  122.     *)
  123.       echo "Unsupported CPU: $cpu"
  124.       exit 1
  125.     ;;
  126.   esac
  127. }
  128.  
  129. for opt do
  130.   eval opt=\"$opt\"
  131.   case "$opt" in
  132.   --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
  133.   ;;
  134.   --exec-prefix=*) execprefix=`echo $opt | cut -d '=' -f 2`
  135.   ;;
  136.   --tccdir=*) tccdir=`echo $opt | cut -d '=' -f 2`
  137.   ;;
  138.   --bindir=*) bindir=`echo $opt | cut -d '=' -f 2`
  139.   ;;
  140.   --libdir=*) libdir=`echo $opt | cut -d '=' -f 2`
  141.   ;;
  142.   --includedir=*) includedir=`echo $opt | cut -d '=' -f 2`
  143.   ;;
  144.   --sharedir=*) sharedir=`echo $opt | cut -d '=' -f 2`
  145.   ;;
  146.   --mandir=*) mandir=`echo $opt | cut -d '=' -f 2`
  147.   ;;
  148.   --infodir=*) infodir=`echo $opt | cut -d '=' -f 2`
  149.   ;;
  150.   --docdir=*) docdir=`echo $opt | cut -d '=' -f 2`
  151.   ;;
  152.   --sysroot=*) sysroot=`echo $opt | cut -d '=' -f 2`
  153.   ;;
  154.   --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
  155.   ;;
  156.   --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
  157.   ;;
  158.   --sysincludepaths=*) tcc_sysincludepaths=`echo $opt | cut -d '=' -f 2`
  159.   ;;
  160.   --libpaths=*) tcc_libpaths=`echo $opt | cut -d '=' -f 2`
  161.   ;;
  162.   --crtprefix=*) tcc_crtprefix=`echo $opt | cut -d '=' -f 2`
  163.   ;;
  164.   --elfinterp=*) tcc_elfinterp=`echo $opt | cut -d '=' -f 2`
  165.   ;;
  166.   --cc=*) cc=`echo $opt | cut -d '=' -f 2`
  167.   ;;
  168.   --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
  169.   ;;
  170.   --extra-ldflags=*) LDFLAGS="${opt#--extra-ldflags=}"
  171.   ;;
  172.   --extra-libs=*) extralibs=${opt#--extra-libs=}
  173.   ;;
  174.   --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
  175.   ;;
  176.   --enable-gprof) gprof="yes"
  177.   ;;
  178.   --enable-mingw32) mingw32="yes" ; cross_prefix="i686-pc-mingw32-" ; cpu=x86; targetos=Windows;
  179.   ;;
  180.   --enable-cygwin) mingw32="yes" ; cygwin="yes" ; cross_prefix="mingw32-" ; cpu=x86; targetos=Windows;
  181.   ;;
  182.   --enable-tcc32-mingw) mingw32="yes" ; cross_prefix="i386-win-" ; cpu=x86; cc=tcc; targetos=Windows;
  183.   ;;
  184.   --enable-tcc64-mingw) mingw32="yes" ; cross_prefix="x86_64-win-" ; cpu=x86_64; cc=tcc; targetos=Windows;
  185.   ;;
  186.   --enable-cross) build_cross="yes"
  187.   ;;
  188.   --enable-assert) enable_assert="yes"
  189.   ;;
  190.   --disable-static) disable_static="yes"
  191.   ;;
  192.   --disable-rpath) disable_rpath="yes"
  193.   ;;
  194.   --strip-binaries) strip_binaries="yes"
  195.   ;;
  196.   --with-libgcc) use_libgcc="yes"
  197.   ;;
  198.   --with-selinux) have_selinux="yes"
  199.   ;;
  200.   --help|-h) show_help="yes"
  201.   ;;
  202.   *) echo "configure: WARNING: unrecognized option $opt"
  203.   ;;
  204.   esac
  205. done
  206.  
  207. if test -z "$cpu" ; then
  208.     if test -n "$ARCH" ; then
  209.         cpu="$ARCH"
  210.     else
  211.         cpu=`uname -m`
  212.     fi
  213. fi
  214. classify_cpu "$cpu"
  215.  
  216. # Checking for CFLAGS
  217. if test -z "$CFLAGS"; then
  218.     CFLAGS="-Wall -g -O0"
  219. fi
  220.  
  221. if test "$mingw32" = "yes" ; then
  222.     if test x"$tccdir" = x""; then
  223.     tccdir="tcc"
  224.     fi
  225.     if test -z "$prefix" ; then
  226.     prefix="C:/Program Files/${tccdir}"
  227.     fi
  228.     if test -z "$sharedir" ; then
  229.     sharedir="${prefix}"
  230.     fi
  231.     execprefix="$prefix"
  232.     bindir="${prefix}"
  233.     tccdir="${prefix}"
  234.     libdir="${prefix}/lib"
  235.     docdir="${sharedir}/doc"
  236.     mandir="${sharedir}/man"
  237.     infodir="${sharedir}/info"
  238.     LIBSUF=".lib"
  239.     EXESUF=".exe"
  240. else
  241.     if test -z "$prefix" ; then
  242.     prefix="/usr/local"
  243.     fi
  244.     if test -z "$sharedir" ; then
  245.     sharedir="${prefix}/share"
  246.     fi
  247.     if test x"$execprefix" = x""; then
  248.     execprefix="${prefix}"
  249.     fi
  250.     if test x"$tccdir" = x""; then
  251.     tccdir="tcc"
  252.     fi
  253.     if test x"$libdir" = x""; then
  254.         libdir="${execprefix}/lib"
  255.         if test -n "${tccdir}"; then
  256.             tccdir="${libdir}/${tccdir}"
  257.         else
  258.             tccdir="${libdir}"
  259.         fi
  260.         if test "$cpu" = "x86-64"; then
  261.             libdir="${execprefix}/lib64"
  262.         fi
  263.     else
  264.         tccdir="${libdir}/${tccdir}"
  265.     fi
  266.     if test x"$bindir" = x""; then
  267.     bindir="${execprefix}/bin"
  268.     fi
  269.     if test x"$docdir" = x""; then
  270.     docdir="${sharedir}/doc/${tccdir}"
  271.     fi
  272.     if test x"$mandir" = x""; then
  273.     mandir="${sharedir}/man"
  274.     fi
  275.     if test x"$infodir" = x""; then
  276.     infodir="${sharedir}/info"
  277.     fi
  278. fi # mingw32
  279.  
  280. if test x"$includedir" = x""; then
  281. includedir="${prefix}/include"
  282. fi
  283.  
  284. if test x"$show_help" = "xyes" ; then
  285. cat << EOF
  286. Usage: configure [options]
  287. Options: [defaults in brackets after descriptions]
  288.  
  289. Standard options:
  290.   --help                   print this message
  291.   --prefix=PREFIX          install in PREFIX [$prefix]
  292.   --exec-prefix=EPREFIX    install architecture-dependent files in EPREFIX
  293.                            [same as prefix]
  294.   --bindir=DIR             user executables in DIR [EPREFIX/bin]
  295.   --libdir=DIR             object code libraries in DIR [EPREFIX/lib]
  296.   --tccdir=DIR             installation directory [EPREFIX/lib/tcc]
  297.   --includedir=DIR         C header files in DIR [PREFIX/include]
  298.   --sharedir=DIR           documentation root DIR [PREFIX/share]
  299.   --docdir=DIR             documentation in DIR [SHAREDIR/doc/tcc]
  300.   --mandir=DIR             man documentation in DIR [SHAREDIR/man]
  301.   --infodir=DIR            info documentation in DIR [SHAREDIR/info]
  302.  
  303. Advanced options (experts only):
  304.   --source-path=PATH       path of source code [$source_path]
  305.   --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]
  306.   --sysroot=PREFIX         prepend PREFIX to library/include paths []
  307.   --cc=CC                  use C compiler CC [$cc]
  308.   --extra-cflags=          specify compiler flags [$CFLAGS]
  309.   --extra-ldflags=         specify linker options []
  310.   --cpu=CPU                CPU [$cpu]
  311.   --strip-binaries         strip symbol tables from resulting binaries
  312.   --disable-static         make libtcc.so instead of libtcc.a
  313.   --disable-rpath          disable use of -rpath with the above
  314.   --with-libgcc            use libgcc_s.so.1 instead of libtcc1.a in dynamic link
  315.   --enable-tcc64-mingw     build windows version on linux with x86_64-win-tcc
  316.   --enable-tcc32-mingw     build windows version on linux with i386-win-tcc
  317.   --enable-mingw32         build windows version on linux with mingw32
  318.   --enable-cygwin          build windows version on windows with cygwin
  319.   --enable-cross           build cross compilers
  320.   --enable-assert          enable debug assertions
  321.   --with-selinux           use mmap for exec mem [needs writable /tmp]
  322.   --sysincludepaths=...    specify system include paths, colon separated
  323.   --libpaths=...           specify system library paths, colon separated
  324.   --crtprefix=...          specify locations of crt?.o, colon separated
  325.   --elfinterp=...          specify elf interpreter
  326. EOF
  327. #echo "NOTE: The object files are build at the place where configure is launched"
  328. exit 1
  329. fi
  330.  
  331. if test "$cc" != "tcc"; then
  332.  ar="${cross_prefix}${ar}"
  333. fi
  334. cc="${cross_prefix}${cc}"
  335. strip="${cross_prefix}${strip}"
  336.  
  337. CONFTEST=./conftest$EXESUF
  338.  
  339. if test -z "$cross_prefix" ; then
  340.   if ! $cc -o $CONFTEST $source_path/conftest.c 2>/dev/null ; then
  341.     echo "configure: error: '$cc' failed to compile conftest.c."
  342.   else
  343.     bigendian="$($CONFTEST bigendian)"
  344.     gcc_major="$($CONFTEST version)"
  345.     gcc_minor="$($CONFTEST minor)"
  346.     if test "$mingw32" = "no" ; then
  347.       triplet="$($CONFTEST triplet)"
  348.       if test -f "/usr/lib/$triplet/crti.o" ; then
  349.         tcc_lddir="lib"
  350.         multiarch_triplet="$triplet"
  351.       elif test "$cpu" != "x86" -a -f "/usr/lib64/crti.o" ; then
  352.         tcc_lddir="lib64"
  353.       fi
  354.  
  355.       if test "$cpu" = "armv4l" ; then
  356.         if test "${triplet%eabihf}" != "$triplet" ; then
  357.            confvars="$confvars arm_eabihf"
  358.         elif test "${triplet%eabi}" != "$triplet" ; then
  359.            confvars="$confvars arm_eabi"
  360.         fi
  361.         if grep -s -q "^Features.* \(vfp\|iwmmxt\) " /proc/cpuinfo ; then
  362.            confvars="$confvars arm_vfp"
  363.         fi
  364.       fi
  365.  
  366. #      multiarch_triplet=${libc_dir#*/}
  367. #      multiarch_triplet=${multiarch_triplet%/}
  368. #      tcc_lddir="${libc_dir%%/*}"
  369. #      if test -n "$multiarch_triplet" ; then
  370. #        tcc_lddir="$tcc_lddir/$multiarch_triplet"
  371. #      fi
  372.  
  373.       if test -f "/lib/ld-uClibc.so.0" ; then
  374.         confvars="$confvars uClibc"
  375.       fi
  376. # gr: maybe for after the release:
  377. #       tcc_elfinterp="$(ldd $CONFTEST | grep 'ld.*.so' | sed 's,\s*\(\S\+\).*,\1,')"
  378.        # echo "elfinterp           $tcc_elfinterp"
  379.  
  380.     fi
  381.   fi
  382. else
  383.   # if cross compiling, cannot launch a program, so make a static guess
  384.   case $cpu in
  385.     powerpc|mips|s390)  bigendian=yes;;
  386.   esac
  387. fi
  388.  
  389. # a final configuration tuning
  390. W_OPTIONS="declaration-after-statement"
  391. for i in $W_OPTIONS; do
  392.     O_PRESENT="$($cc -v --help 2>&1 | grep -- -W$i)"
  393.     if test -n "$O_PRESENT"; then  CFLAGS="$CFLAGS -W$i"; fi
  394. done
  395. W_OPTIONS="deprecated-declarations strict-aliasing pointer-sign sign-compare unused-result uninitialized"
  396. for i in $W_OPTIONS; do
  397.     O_PRESENT="$($cc -v --help 2>&1 | grep -- -W$i)"
  398.     if test -n "$O_PRESENT"; then  CFLAGS="$CFLAGS -Wno-$i"; fi
  399. done
  400. F_OPTIONS="strict-aliasing"
  401. for i in $F_OPTIONS; do
  402.     O_PRESENT="$($cc -v --help 2>&1 | grep -- -f$i)"
  403.     if test -n "$O_PRESENT"; then  CFLAGS="$CFLAGS -fno-$i"; fi
  404. done
  405. if test -z "$tcc_lddir" -a "$cpu" = "x86-64"; then tcc_lddir="lib64"; fi
  406.  
  407. echo "Binary  directory   $bindir"
  408. echo "TinyCC directory    $tccdir"
  409. echo "Library directory   $libdir"
  410. echo "Include directory   $includedir"
  411. echo "Manual directory    $mandir"
  412. echo "Info directory      $infodir"
  413. echo "Doc directory       $docdir"
  414. echo "Target root prefix  $sysroot"
  415. echo "Source path      $source_path"
  416. echo "C compiler       $cc"
  417. echo "cross compilers  $build_cross"
  418. if test "$build_cross" = "no"; then
  419. echo "Target CPU       $cpu"
  420. fi
  421. echo "Host OS          $host_os"
  422. echo "Target OS        $targetos"
  423. echo "Big Endian       $bigendian"
  424. echo "gprof enabled    $gprof"
  425. echo "use libgcc       $use_libgcc"
  426.  
  427. echo "Creating config.mak and config.h"
  428.  
  429. cat >config.mak <<EOF
  430. # Automatically generated by configure - do not modify
  431. prefix=$prefix
  432. bindir=\$(DESTDIR)$bindir
  433. tccdir=\$(DESTDIR)$tccdir
  434. libdir=\$(DESTDIR)$libdir
  435. ln_libdir=$libdir
  436. includedir=\$(DESTDIR)$includedir
  437. mandir=\$(DESTDIR)$mandir
  438. infodir=\$(DESTDIR)$infodir
  439. docdir=\$(DESTDIR)$docdir
  440. CC=$cc
  441. GCC_MAJOR=$gcc_major
  442. GCC_MINOR=$gcc_minor
  443. HOST_CC=$host_cc
  444. AR=$ar
  445. STRIP=$strip -s -R .comment -R .note
  446. CFLAGS=$CFLAGS
  447. LDFLAGS=$LDFLAGS
  448. LIBSUF=$LIBSUF
  449. EXESUF=$EXESUF
  450. HOST_OS=$host_os
  451. EOF
  452. if test "$mingw32" = "yes" -a "$host_os" != "Windows" ; then
  453. cat >>config.mak <<EOF
  454. XCC=$cc
  455. XAR=$ar
  456. EOF
  457. fi
  458.  
  459. print_inc() {
  460.   if test -n "$2"; then
  461.     echo "#ifndef $1" >> $TMPH
  462.     echo "# define $1 \"$2\"" >> $TMPH
  463.     echo "#endif" >> $TMPH
  464.   fi
  465. }
  466. print_mak() {
  467.   if test -n "$2"; then
  468.     echo "NATIVE_DEFINES+=-D$1=\"\\\"$2\\\"\"" >> config.mak
  469.   fi
  470. }
  471.  
  472. echo "/* Automatically generated by configure - do not modify */" > $TMPH
  473.  
  474. print_inc CONFIG_SYSROOT "$sysroot"
  475. print_inc CONFIG_TCCDIR "$tccdir"
  476. if test "$build_cross" = "no"; then
  477. print_inc CONFIG_LDDIR "$tcc_lddir"
  478. fi
  479. print_mak CONFIG_TCC_SYSINCLUDEPATHS "$tcc_sysincludepaths"
  480. print_mak CONFIG_TCC_LIBPATHS "$tcc_libpaths"
  481. print_mak CONFIG_TCC_CRTPREFIX "$tcc_crtprefix"
  482. print_mak CONFIG_TCC_ELFINTERP "$tcc_elfinterp"
  483. print_mak CONFIG_MULTIARCHDIR "$multiarch_triplet"
  484.  
  485. echo "#define GCC_MAJOR $gcc_major" >> $TMPH
  486. echo "#define GCC_MINOR $gcc_minor" >> $TMPH
  487.  
  488. if test "$cpu" = "x86" ; then
  489.   echo "ARCH=i386" >> config.mak
  490. elif test "$cpu" = "x86-64" ; then
  491.   echo "ARCH=x86-64" >> config.mak
  492. elif test "$cpu" = "armv4l" ; then
  493.   echo "ARCH=arm" >> config.mak
  494.   echo "#define TCC_ARM_VERSION $cpuver" >> $TMPH
  495. elif test "$cpu" = "aarch64" ; then
  496.   echo "ARCH=arm64" >> config.mak
  497. elif test "$cpu" = "powerpc" ; then
  498.   echo "ARCH=ppc" >> config.mak
  499. elif test "$cpu" = "mips" ; then
  500.   echo "ARCH=mips" >> config.mak
  501. elif test "$cpu" = "s390" ; then
  502.   echo "ARCH=s390" >> config.mak
  503. elif test "$cpu" = "alpha" ; then
  504.   echo "ARCH=alpha" >> config.mak
  505. else
  506.   echo "Unsupported CPU"
  507.   exit 1
  508. fi
  509.  
  510. echo "TARGETOS=$targetos" >> config.mak
  511.  
  512. for v in $confvars ; do
  513.   echo "CONFIG_$v=yes" >> config.mak
  514. done
  515. if test "$noldl" = "yes" ; then
  516.   echo "CONFIG_NOLDL=yes" >> config.mak
  517. fi
  518. if test "$mingw32" = "yes" ; then
  519.   echo "CONFIG_WIN32=yes" >> config.mak
  520.   echo "#define CONFIG_WIN32 1" >> $TMPH
  521. fi
  522. if test "$cygwin" = "yes" ; then
  523.   echo "#ifndef _WIN32" >> $TMPH
  524.   echo "# define _WIN32" >> $TMPH
  525.   echo "#endif" >> $TMPH
  526.   echo "AR=ar" >> config.mak
  527. fi
  528. if test "$bigendian" = "yes" ; then
  529.   echo "WORDS_BIGENDIAN=yes" >> config.mak
  530.   echo "#define WORDS_BIGENDIAN 1" >> $TMPH
  531. fi
  532. if test "$gprof" = "yes" ; then
  533.   echo "TARGET_GPROF=yes" >> config.mak
  534.   echo "#define HAVE_GPROF 1" >> $TMPH
  535. fi
  536. if test "$build_cross" = "yes" ; then
  537.   echo "CONFIG_CROSS=yes" >> config.mak
  538. fi
  539. if test "$disable_static" = "yes" ; then
  540.   echo "DISABLE_STATIC=yes" >> config.mak
  541. fi
  542. if test "$disable_rpath" = "yes" ; then
  543.   echo "DISABLE_RPATH=yes" >> config.mak
  544. fi
  545. if test "$strip_binaries" = "yes" ; then
  546.   echo "STRIP_BINARIES=yes" >> config.mak
  547. fi
  548. if test "$use_libgcc" = "yes" ; then
  549.   echo "#define CONFIG_USE_LIBGCC" >> $TMPH
  550.   echo "CONFIG_USE_LIBGCC=yes" >> config.mak
  551. fi
  552. if test "$have_selinux" = "yes" ; then
  553.   echo "#define HAVE_SELINUX" >> $TMPH
  554.   echo "HAVE_SELINUX=yes" >> config.mak
  555. fi
  556. if test "$enable_assert" = "yes" ; then
  557.   echo "#define CONFIG_TCC_ASSERT" >> $TMPH
  558. fi
  559.  
  560. version=`head $source_path/VERSION`
  561. echo "VERSION=$version" >>config.mak
  562. echo "#define TCC_VERSION \"$version\"" >> $TMPH
  563. echo "@set VERSION $version" > config.texi
  564. echo "SRC_PATH=$source_path" >>config.mak
  565.  
  566. if test "$source_path_used" = "yes" ; then
  567.     case $source_path in
  568.        /*) echo "top_srcdir=$source_path";;
  569.         *) echo "top_srcdir=\$(TOP)/$source_path";;
  570.      esac >>config.mak
  571. else
  572.      echo 'top_srcdir=$(TOP)' >>config.mak
  573. fi
  574. echo 'top_builddir=$(TOP)' >>config.mak
  575.  
  576. diff $TMPH config.h >/dev/null 2>&1
  577. if test $? -ne 0 ; then
  578.     mv -f $TMPH config.h
  579. else
  580.     echo "config.h is unchanged"
  581. fi
  582.  
  583. rm -f $TMPN* $CONFTEST
  584.  
  585. # ---------------------------------------------------------------------------
  586. # build tree in object directory if source path is different from current one
  587.  
  588. fn_makelink()
  589. {
  590.     tgt=$1/$2
  591.     case $2 in
  592.     */*) dn=${2%/*}
  593.          test -d $dn || mkdir -p $dn
  594.          case $1 in
  595.          /*) ;;
  596.           *) while test $dn ; do
  597.                 tgt=../$tgt; dn=${dn#${dn%%/*}}; dn=${dn#/}
  598.              done
  599.              ;;
  600.          esac
  601.          ;;
  602.     esac
  603.     ln -sfn $tgt $2
  604. }
  605.  
  606. if test "$source_path_used" = "yes" ; then
  607.   FILES="Makefile lib/Makefile tests/Makefile tests/tests2/Makefile"
  608.   for f in $FILES ; do
  609.     fn_makelink $source_path $f
  610.   done
  611. fi
  612.  
  613. # ---------------------------------------------------------------------------
  614.