automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Support for gnu-pascal


From: Ralf Wildenhues
Subject: Re: Support for gnu-pascal
Date: Tue, 15 Sep 2009 06:12:19 +0200
User-agent: Mutt/1.5.20 (2009-08-09)

Hello Martin,

* Martin Kalbfuß wrote on Tue, Sep 15, 2009 at 03:45:26AM CEST:
> I try to build a simple hello world program written in pascal(gpc).
> There's no AC_PROG_GPC or something. So I have to do it on my own. gpc
> supports all gcc options + some pascal specific options. hat I have so
> far:

Automake doesn't support Pascal OOTB yet, but if someone were motivated
to do so, and this language is used more than just occasionally, then we
can add it.

That said, you don't need to wait till then:

> confgure.ac:
> ############
> 
> #                                               -*- Autoconf -*-
> # Process this file with autoconf to produce a configure script.
> 
> AC_PREREQ([2.64])
> AC_INIT([PALLEGRO], [0.1], address@hidden)
> AC_CONFIG_SRCDIR([pallegro.pas])
> AM_INIT_AUTOMAKE([-Wall -Werror foreign])
> 
> AC_PROG_CC
> AC_PATH_TOOL([CC], [gpc])
> if test -z "$CC"; then

I'd make these two lines:
  AC_PATH_TOOL([GPC], [gpc])
  if test -z "$GPC"; then

so that you have both $CC (the C compiler) and $GPC (the Pascal
compiler) available.

>    AC_MSG_ERROR([cannot find gpc.])
> fi
> 
> AC_CONFIG_FILES([Makefile])
> AC_OUTPUT
> 
> 
> Makefile.am:
> ############
> 
> .pas.o:
>       $(CC) $(CFLAGS) -c -o $@ $<

Consequently, I'd make this line
        $(GPC) $(AM_GPCFLAGS) $(GPCFLAGS) -c -o $@ $<

where GPCFLAGS is for the user (the person running ./configure)
and AM_GPCFLAGS is for the developer.

> bin_PROGRAMS = \
>       pallegro
> 
> pallegro_SOURCES = \
>       pallegro.pas

> Result of calling make:
> #######################
> 
> /usr/bin/gpc -g -O2 -c -o pallegro.o pallegro.pas
> pallegro.o  
> /bin/bash: pallegro.o: Kommando nicht gefunden.
> make: *** [pallegro] Fehler 127

This is because $(LINK) is not defined, because automake fails to see
any compiled and linked sources in this Makefile.am.  You can work
around it with something like this:

# Ensure $(LINK) is defined: let automake think we also have C sources.
EXTRA_pallegro_SOURCES = \
        force_c_compiler_defaults.c
# Override the linker to be gpc.
CCLD = $(GPC)

Hope that helps.

Cheers,
Ralf




reply via email to

[Prev in Thread] Current Thread [Next in Thread]