Commit 544e945d authored by Boris Boesler's avatar Boris Boesler
Browse files

all the autoconfig stuff

[r110]
parent a63062db
5.3.2001 Boris
added lots of #ifdef HAVE_CONFIG_G #include "config.h" #endif
replaced some C++ style comments (//) by standard C comments /**/
added autoconf stuff
worked this night:
- configure (with some features, see --help for more)
- make [depend | tags | install]
- make [run] in testprograms
did not work:
- compilation on SunOS
- make dist
- automatic call of autoconf if required
5.3.2001 Goetz
More colours in vcg output.
Fixed bug: cse found that start block equals it's
......
# Hey Emacs, this is a -*- makefile -*-
#
# libFIRM Project
#
# $Id$
#
VPATH = $(srcdir)
CC = @CC@
CFLAGS := @CFLAGS@
CPPFLAGS := -I. -I$(topdir) -I$(srcdir) -I$(top_srcdir) @CPPFLAGS@
INSTALL = @INSTALL@
INCLUDEDIR = @includedir@
LIBDIR = @libdir@
DEFS = @DEFS@
LD := @LD@
LDFLAGS := @LDFLAGS@
LD_R := @libfirm_cv_prog_ld_r@
# profiling enabled?
ifeq (@enable_profile_libfirm@,yes)
LDFLAGS += -g -pg
endif
AR := @AR@
ARFLAGS := rc
RANLIB := @RANLIB@
DISTFILES = $(SOURCES)
CFILES = $(filter %.c,$(SOURCES) $(GENFILES))
HFILES = $(filter %.h,$(SOURCES) $(GENFILES))
OFILES = $(CFILES:.c=.o)
TAGFILES = $(CFILES) $(HFILES)
LDLIBS=$(LIBS) -lm -lc
COMPILE.c = $(CC) -c $(DEFS) $(CPPFLAGS) $(CDEBUG) $(CFLAGS) $(XCFLAGS)
COMPILE.s = $(CC) -S $(DEFS) $(CPPFLAGS) $(CDEBUG) $(CFLAGS) $(XCFLAGS)
%.o: %.c
$(COMPILE.c) -o $@ $<
%.s: %.c
$(COMPILE.s) -o $@ $<
%.i: %.c
$(CPP) $(DEFS) $(CPPFLAGS) -o $@ $<
%.c: %.dot
$(DT) $(DTFLAGS) <$^ >$@ || $(fail)
define fail
{ $(RM) $@; false; }
endef
# make target given by $@ recursively in $^ ...
ifeq (,$(findstring k,$(MAKEFLAGS)))
# ... and immediately stop on errors
define recurse
+@for i in $^ ""; do if test $$i; then $(MAKE) -C $$i $(subst subdir_,,$@) || exit $$?; fi; done
endef
else
# ... and keep going after errors
define recurse
+@fail=; \
for i in $^ ""; do if test $$i; then $(MAKE) -C $$i $(subst subdir_,,$@) || fail=y; fi; done; \
test -z "$$fail"
endef
endif
targets = all clean depend echodist echogen echosrc realclean tags install
# Hey Emacs, this is a -*- makefile -*-
#
# libFIRM Project
#
# $Id$
#
.PHONY: subdir_all
all : subdir_all
# partial linking of a subdir's $(OFILES) into one file
subdir.o: $(OFILES)
rm -f $@
$(LD) $(LDFLAGS) -r -o $@ $^
clean: subdir_clean local_clean
.PHONY: local_clean
local_clean:
$(RM) $(OFILES) subdir.o core
realclean: subdir_realclean local_clean
$(RM) $(GENFILES) .depend TAGS
depend: subdir_depend local_depend
.PHONY: local_depend
local_depend: $(CFILES) $(filter %.h,$(SOURCES) $(GENFILES))
ifeq ($(strip $(CFILES)),)
>.depend
else
$(CC) -M $(DEFS) $(CPPFLAGS) $(filter %.c,$^) >.depend || { $(RM) .depend; false; }
endif
# Recurse into $(subdirs) for $(targets)
$(addprefix subdir_,$(targets)): $(subdirs)
+$(recurse)
Makefile: $(srcdir)/Makefile.in $(topdir)/config.status
cd $(topdir) && \
CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status >&2
# generate TAGS
tags: subdir_tags local_tags
.PHONY: local_tags
local_tags: $(TAGFILES)
etags -C $^
# installation
install: subdir_install local_install
local_install:
ifneq ($(strip $(INSTALL_HEADERS)),)
$(INSTALL) -m u+rw,a+r $(addprefix $(srcdir)/,$(INSTALL_HEADERS)) $(INCLUDEDIR)
endif
ifneq ($(strip $(INSTALL_LIBS)),)
$(INSTALL) -m u+rw,a+r $(addprefix $(topdir)/,$(INSTALL_LIBS)) $(LIBDIR)
endif
# include dependencies
-include .depend
# Hey Emacs, this is a -*- makefile -*-
#
# libFIRM Project
#
# Top level Makefile
# $Id$
#
# top directory of the source tree
top_srcdir := @top_srcdir@
# directory with the sources for this directory
srcdir := @srcdir@
# top directory of the configured tree
topdir := .
# subdirectory under topdir
subdir := .
prefix := @prefix@
exec_prefix := @exec_prefix@
bindir = $(exec_prefix)/bin
datadir = $(prefix)/lib
subdirs := ir/adt ir/debug ir/tv ir/common ir/ident ir/ir ir/tr
SOURCES := Makefile.in MakeRules.in MakeTargets\
aclocal.m4 config.h.in\
config.guess config.sub configure.in \
stamp-h.in
INSTALL_LIBS = libfirm.a
GENFILES := config.h stamp-h config.log config.cache
# config.status config.h.in $(srcdir)/stamp-h.in
include $(topdir)/MakeRules
XOFILES += $(addsuffix /subdir.o, $(subdirs))
include $(top_srcdir)/MakeTargets
all: config.h Makefile libfirm.a
libfirm.a: subdir_all $(XOFILES) $(OFILES)
$(AR) $(ARFLAGS) $@.new $(XOFILES) $(OFILES)
$(RANLIB) $@.new
mv -f $@.new $@
testprograms: libfirm.a
$(MAKE) -C testprograms
#${srcdir}/configure: configure.in aclocal.m4
$(srcdir)/configure: configure.in
cd $(srcdir) && autoconf
# autoheader might not change config.h.in, so touch a stamp file.
$(srcdir)/config.h.in: stamp-h.in
#${srcdir2/stamp-h.in: configure.in aclocal.m4 acconfig.h \
$(srcdir)/stamp-h.in: configure.in
cd $(srcdir) && autoheader
echo timestamp > $(srcdir)/stamp-h.in
config.h: stamp-h
stamp-h: config.h.in config.status
./config.status
config.status: configure
./config.status --recheck
......@@ -2,17 +2,22 @@
This is a library implementing the intermediate representation
FIRM developed at IPD Goos, Uni Karlsruhe.
Call make lib to construct the library. This creates a file
libfirm.a and extracts all necessary header files to ./include.
Create an architecture dependent directory (eg 'mkdir i686-linux') an cd
to it. Call ../configure with wanted features (see ../configure --help
for more hints). Call 'make depend; make' to construct the library. This
creates a file libfirm.a
To test the library goto ./testprograms and make and run the
test examples placed there:
make lib
make depend; make
cd testprograms
make
make run
if you have set up the include and libdir using configure you can install
the library and its headers by 'make install'
For more documentation see /include/firm.h.
To generate FIRM code from a compiler frontend read the documentation
in ./include/ircons.h.
......
dnl libFIRM Project
dnl Macros for autoconf
dnl $Id$
dnl Set variable `LD' to the name of the linker program.
AC_DEFUN(LIBFIRM_PROG_LD,
dnl AC_REQUIRE([AC_PROG_CC])
[if test -z "$LD" && test "$GCC" = yes; then
AC_CHECK_TOOL(LD, gld, "")
fi
if test -z "$LD"; then
AC_CHECK_TOOL(LD, ld)
fi
])
dnl Set variable `libfirm_cv_prog_ld_r' to yes if the linker accepts -r, else to no.
AC_DEFUN(LIBFIRM_PROG_LD_R,
[AC_CACHE_CHECK(whether $LD accepts -r, libfirm_cv_prog_ld_r,
[AC_REQUIRE([LIBFIRM_PROG_LD])
libfirm_cv_prog_ld_r=no
if test "$LD"; then
cat > conftest.$ac_ext <<EOF
int foo() { return 0; }
EOF
if eval $ac_compile && mv conftest.o conftest2.o; then
cat > conftest.$ac_ext <<EOF
int main() { return foo(); }
EOF
if eval $ac_compile; then
if $LD -r -o conftest conftest.o conftest2.o; then
libfirm_cv_prog_ld_r=yes
fi
fi
fi
fi
rm -f conftest*])
AC_SUBST(libfirm_cv_prog_ld_r)
])
dnl end of aclocal.m
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Written by Per Bothner <bothner@cygnus.com>.
# The master version of this file is at the FSF in /home/gd/gnu/lib.
#
# This script attempts to guess a canonical system name similar to
# config.sub. If it succeeds, it prints the system name on stdout, and
# exits with 0. Otherwise, it exits with 1.
#
# The plan is that this can be called by configure scripts if you
# don't specify an explicit system type (host/target name).
#
# Only a few systems have been added to this list; please add others
# (but try to keep the structure clean).
#
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 8/24/94.)
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
PATH=$PATH:/.attbin ; export PATH
fi
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
alpha:OSF1:V*:*)
# After 1.2, OSF1 uses "V1.3" for uname -r.
echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^V//'`
exit 0 ;;
alpha:OSF1:*:*)
# 1.2 uses "1.2" for uname -r.
echo alpha-dec-osf${UNAME_RELEASE}
exit 0 ;;
21064:Windows_NT:50:3)
echo alpha-dec-winnt3.5
exit 0 ;;
amiga:NetBSD:*:*)
echo m68k-cbm-netbsd${UNAME_RELEASE}
exit 0 ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit 0;;
Pyramid*:OSx*:*:*)
if test "`(/bin/universe) 2>/dev/null`" = att ; then
echo pyramid-pyramid-sysv3
else
echo pyramid-pyramid-bsd
fi
exit 0 ;;
sun4*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
i86pc:SunOS:5.*:*)
echo i386-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
# it's likely to be more like Solaris than SunOS4.
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:*:*)
case "`/usr/bin/arch -k`" in
Series*|S4*)
UNAME_RELEASE=`uname -v`
;;
esac
# Japanese Language versions have a version number like `4.1.3-JL'.
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
exit 0 ;;
sun3*:SunOS:*:*)
echo m68k-sun-sunos${UNAME_RELEASE}
exit 0 ;;
atari*:NetBSD:*:*)
echo m68k-atari-netbsd${UNAME_RELEASE}
exit 0 ;;
sun3*:NetBSD:*:*)
echo m68k-sun-netbsd${UNAME_RELEASE}
exit 0 ;;
mac68k:NetBSD:*:*)
echo m68k-apple-netbsd${UNAME_RELEASE}
exit 0 ;;
RISC*:ULTRIX:*:*)
echo mips-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
mips:*:5*:RISCos)
echo mips-mips-riscos${UNAME_RELEASE}
exit 0 ;;
m88k:CX/UX:7*:*)
echo m88k-harris-cxux7
exit 0 ;;
m88k:*:4*:R4*)
echo m88k-motorola-sysv4
exit 0 ;;
m88k:*:3*:R3*)
echo m88k-motorola-sysv3
exit 0 ;;
AViiON:dgux:*:*)
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
-o ${TARGET_BINARY_INTERFACE}x = x ] ; then
echo m88k-dg-dgux${UNAME_RELEASE}
else
echo m88k-dg-dguxbcs${UNAME_RELEASE}
fi
exit 0 ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
echo m88k-dolphin-sysv3
exit 0 ;;
M88*:*:R3*:*)
# Delta 88k system running SVR3
echo m88k-motorola-sysv3
exit 0 ;;
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
echo m88k-tektronix-sysv3
exit 0 ;;
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
echo m68k-tektronix-bsd
exit 0 ;;
*:IRIX*:*:*)
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
exit 0 ;;
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
i[34]86:AIX:*:*)
echo i386-ibm-aix
exit 0 ;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
sed 's/^ //' << EOF >dummy.c
#include <sys/systemcfg.h>
main()
{
if (!__power_pc())
exit(1);
puts("powerpc-ibm-aix3.2.5");
exit(0);
}
EOF
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
echo rs6000-ibm-aix3.2.5
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4
else
echo rs6000-ibm-aix3.2
fi
exit 0 ;;
*:AIX:*:4)
if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
IBM_ARCH=rs6000
else
IBM_ARCH=powerpc
fi
if grep bos410 /usr/include/stdio.h >/dev/null 2>&1; then
IBM_REV=4.1
elif grep bos411 /usr/include/stdio.h >/dev/null 2>&1; then
IBM_REV=4.1.1
else
IBM_REV=4.${UNAME_RELEASE}
fi
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
exit 0 ;;
*:AIX:*:*)
echo rs6000-ibm-aix
exit 0 ;;
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
echo romp-ibm-bsd4.4
exit 0 ;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
exit 0 ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
echo rs6000-bull-bosx
exit 0 ;;
DPX/2?00:B.O.S.:*:*)
echo m68k-bull-sysv3
exit 0 ;;
9000/[34]??:4.3bsd:1.*:*)
echo m68k-hp-bsd
exit 0 ;;
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
echo m68k-hp-bsd4.4
exit 0 ;;
9000/[3478]??:HP-UX:*:*)
case "${UNAME_MACHINE}" in
9000/31? ) HP_ARCH=m68000 ;;
9000/[34]?? ) HP_ARCH=m68k ;;
9000/7?? | 9000/8?7 ) HP_ARCH=hppa1.1 ;;
9000/8?? ) HP_ARCH=hppa1.0 ;;
esac
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
exit 0 ;;
3050*:HI-UX:*:*)
sed 's/^ //' << EOF >dummy.c
#include <unistd.h>
int
main ()
{
long cpu = sysconf (_SC_CPU_VERSION);
/* The order matters, because CPU_IS_HP_MC68K erroneously returns
true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
results, however. */
if (CPU_IS_PA_RISC (cpu))
{
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
default: puts ("hppa-hitachi-hiuxwe2"); break;
}
}
else if (CPU_IS_HP_MC68K (cpu))
puts ("m68k-hitachi-hiuxwe2");
else puts ("unknown-hitachi-hiuxwe2");
exit (0);
}
EOF
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
echo unknown-hitachi-hiuxwe2
exit 0 ;;
9000/7??:4.3bsd:*:* | 9000/8?7:4.3bsd:*:* )
echo hppa1.1-hp-bsd
exit 0 ;;
9000/8??:4.3bsd:*:*)
echo hppa1.0-hp-bsd
exit 0 ;;
hp7??:OSF1:*:* | hp8?7:OSF1:*:* )
echo hppa1.1-hp-osf
exit 0 ;;
hp8??:OSF1:*:*)
echo hppa1.0-hp-osf
exit 0 ;;
parisc*:Lites*:*:*)
echo hppa1.1-hp-lites
exit 0 ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
exit 0 ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit 0 ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
echo c34-convex-bsd
exit 0 ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
echo c38-convex-bsd
exit 0 ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd
exit 0 ;;
CRAY*X-MP:*:*:*)
echo xmp-cray-unicos
exit 0 ;;
CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE}
exit 0 ;;
CRAY*C90:*:*:*)
echo c90-cray-unicos${UNAME_RELEASE}
exit 0 ;;
CRAY-2:*:*:*)
echo cray2-cray-unicos
exit 0 ;;
hp3[0-9][05]:NetBSD:*:*)
echo m68k-hp-netbsd${UNAME_RELEASE}
exit 0 ;;
i[34]86:BSD/386:*:* | *:BSD/OS:*:*)
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit 0 ;;
*:FreeBSD:*:*)
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit 0 ;;
*:NetBSD:*:*)
echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
exit 0 ;;
*:GNU:*:*)
echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit 0 ;;
*:Linux:*:*)
# Systems without a BFD linker
if test -d /usr/lib/ldscripts/. ; then
:
else
echo "${UNAME_MACHINE}-unknown-linuxoldld"
exit 0
fi
# Determine whether the default compiler is a.out or elf
cat >dummy.c <<EOF
main(argc, argv)
int argc;
char *argv[];
{
#ifdef __ELF__
printf ("%s-unknown-linux\n", argv[1]);
#else
printf ("%s-unknown-linuxaout\n", argv[1]);
#endif
return 0;
}
EOF
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
rm -f dummy.c dummy;;