automake
[Top][All Lists]
Advanced

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

Re: Makefile works in Ubuntu Maverick but not anymore in Ubuntu Natty


From: Stefano Lattarini
Subject: Re: Makefile works in Ubuntu Maverick but not anymore in Ubuntu Natty
Date: Tue, 7 Jun 2011 11:24:58 +0200
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

On Tuesday 07 June 2011, Victor henri wrote:
> 
> Hello
> 
> I have a problem with my automake generated Makefile : what worked perfectly 
> on Ubuntu Maverick 10.10 doesn't work anymore on Ubuntu Natty 11.04. My 
> program displays harmonics of the sound in Ubuntu Linux, using Gstreamer, 
> SDL, OpenGL an Gtk; it uses Jack, and geis (and libbamf) for multitouch input
> 
> 1. on Ubuntu Maverick 10.10, everything was just fine : it compiles and works 
> perfectly;
> 
> 2. on Ubuntu Natty (the latest version untill now) with exactly the same 
> 'configure.ac' and 'makefiles.am' files
>
Have you used also the same Automake-generated Makefile.in and
autoconf-generated configure on both systems, or have you regenerated
them on the newer system?  If yes, what are the versions of automake
and autoconf on Maverick and Natty, and how does the Makefile.in and
configure generated on the two systems differ?

> (everything, including the sources files, is exacltly the same): it compiles 
> good, but does not work at all; however, when I compile without a makefile 
> (as I used to do before), with the following line :
> 
> gcc  -Wall display.c events.c geis.c main.c mainwindow.c menu.c onclick.c 
> scale.c testrtpool.c -o spectrum3d `pkg-config jack gstreamer-0.10 gtk+-2.0 
> libbamf --libs --cflags` -lSDL -lSDL_ttf -lGL -lGLU -lutouch-geis
> 
> it works perfectly on Natty!!! I don't have a clue why...
>

I can see few issues with your files; I don't know which of them (if any)
is causing your problems, but pointing them out can only help IMHO (and
maybe fixing them will cause your problems to disappear).

> 
> This is my configure.ac :
> 
> #                                               -*- Autoconf -*-
> # Process this file with autoconf to produce a configure script.
> 
> ############### INITIALIZE EVERYTHING ######################
> 
> AC_PREREQ([2.67])
> AC_INIT([spectrum3d],
>     [0.2.3],
>     address@hidden, 
>     [spectrum3d])
> AC_CONFIG_SRCDIR([Makefile.am])
> 
> AM_INIT_AUTOMAKE([-Wall, -Werror])
>
Using a comma to separate the options (as you did) wrong, the correct
(and documented) way is to separate different options with whitespace;
e.g.:
  AM_INIT_AUTOMAKE([-Wall -Werror])

> AM_MAINTAINER_MODE
> 
> AC_PROG_CC
> AM_PROG_CC_C_O
> 
> ################ CREATE A CONFIG.H FILE #####################
> 
> > src/include.h
> 
> echo "/* This file was automatically generated by the 'configure' script */
> 
> #ifndef DEFINE_DEFINES
> #define DEFINE_DEFINES
> ">> src/include.h
> 
> AC_ARG_ENABLE([jack], AS_HELP_STRING[--enable-jack], [
>                 JACK=1
>                 echo "#define JACK " >> src/include.h
>                 jack="jack" ], [])
>
Is the lack of a parenthesis after `AS_HELP_STRING' a copy & paste
error?  Anyway, adding a parenthesis is not enough, since you would
be still left with an underquoted macro call in the AC_ARG_ENABLE
arguments, and with an argument to AS_HELP_STRING missing; what you
probably want to do is someting similar to this:

  AC_ARG_ENABLE([jack],
                [AS_HELP_STRING([--enable-jack],
                                [<explanin this option>])],
                [JACK=1
                 echo "#define JACK " >> src/include.h
                 jack="jack"],
                [])

And this is still not completely right, since it doesn't account
for the case your user passes `--enable-jack=no' do disable (clearly
not to enable!) the use of Jack; also, it doesn't allow the user to
override an earlier `--enable-jack' wuth a later `--disable-jack'.
 I'd suggest you use something like this (warning: untested!):

  AC_ARG_ENABLE(
    [jack],
    [AS_HELP_STRING([--enable-jack],
                    [<explanin this option>])],
    [case $enableval in
       yes) JACK=1;;
        no) JACK=;;
         *) AC_MSG_ERROR([bad value $enableval for --enable-jack option]);;
     esac],
     [JACK=])
  if test -n "$JACK"; then
    echo "#define JACK " >> src/include.h
    jack="jack"
  fi

You can find more documentation about the AC_ARG_ENABLE macro here:
 <http://www.gnu.org/software/autoconf/manual/html_node/Package-Options.html>

> AC_ARG_ENABLE([geis], AS_HELP_STRING[--enable-jack], [ 
>                 GEIS=1
>                 echo "#define GEIS " >> src/include.h
>                 geis="-lutouch-geis" ], [])
>
Comments simalar to the above apply.

> echo "
> #endif " >> src/include.h
> 
> ################# CHECK FOR LIBRAIRIES ######################
> 
> PKG_CHECK_MODULES([GTK], [gtk+-2.0], [], [])
> PKG_CHECK_MODULES([GSTREAMER], [gstreamer-0.10], [], [])
> AC_CHECK_LIB([SDL], [SDL_Init], [],[
>          echo "SDL library is required for this program"
>          exit -1])
Two problems here:

  1. "exit -1" is not portable; for example, with Solaris /bin/sh:
       $ /bin/sh -c 'exit -1'
       /bin/sh: -1: bad number
     A simpler "exit 1" would be better IMO.

  2. Error messages should be displayed on standard error, not on
     standard output.

I'd fix both of this problems using the AC_MSG_ERROR autoconf macro:

  AC_CHECK_LIB([SDL], [SDL_Init], [],
               [AC_MSG_ERROR([SDL library is required for this program])])

In case you still want a custom exit status, say `10', for this error, you
can use:

  AC_CHECK_LIB([SDL], [SDL_Init], [],
               [AC_MSG_ERROR([SDL library is required for this program], [10])])

More instances of these problems below.

> AC_CHECK_LIB([SDL_ttf], [TTF_Init], [],[
>          echo "SDL_ttf library is required for this program"
>          exit -1])
> AC_CHECK_LIB([GL], [glClear], [],[
>          echo "OpenGL(gl) library is required for this program"
>          exit -1])
> AC_CHECK_LIB([GLU], [gluBeginCurve], [],[
>          echo "OpenGL(glu) library is required for this program"
>          exit -1])

> if [[ $JACK ]]
>
Not portable to all shells; e.g., with dash 0.5.5.1 on Debian:

  $ dash -c 'a=1; [[ $a ]]'
  dash: [[: not found

with /bin/sh on Solaris 10:

  $ /bin/sh -c 'a=1; [[ $a ]]'
  /bin/sh: [[: not found

and with /bin/ksh on Solaris 10:

  $ /bin/ksh -c 'a=1; [[ $a ]]'
  /bin/ksh: syntax error at line 1 : `]]' unexpected

You should use `` if test -n "$JACK" '' instead.

One more instance below.

>      then
>     AC_CHECK_LIB([jack], [jack_client_open], [],[ 
>         echo "Jack support is enabled but Jack library is not found. Please 
> install libjack."
>         exit -1])
> fi
>


> if [[ $GEIS ]]
>      then
>     AC_CHECK_LIB([utouch-geis], [geis_new], [],[ 
>         echo "Multitouch support is enabled but utouch-geis library is not 
> found. Please install libutouch-geis"
>     exit -1])
>     PKG_CHECK_MODULES([BAMF], [libbamf >= 0.2.53], [],[ 
>         echo "Multitouch support is enabled but libbamf library is not found. 
> Please install libbamf"
>     exit -1])
> fi
> 
> ##############################################################
> 
> AC_CONFIG_FILES([Makefile
>         src/Makefile
>         data/Makefile
>         data/spectrum3d.desktop
>         spectrum3d.pc])
>         
> #AC_CHECK_HEADERS([stdlib.h string.h])
> 
> # Checks for library functions.
> #AC_CHECK_FUNCS([strtol])
> 
> AC_OUTPUT
> 
> 
> 
> This is the 'main' Makefile.am :
> 
> SUBDIRS = src data
> 
> pkgconfigdir = $(libdir)/pkgconfig
> pkgconfig_DATA = spectrum3d.pc
> 
I know almost nothing about pkgconfig, and I'm just taking a wild guess
here, but...  might it be that some change in the latest Ubuntu has made
this lines obsolete/uncorrect, even ife they used to work in older Ubuntu
versions?  This might explain (part of) your problem.

> #INCLUDES = $(top_srcdir)/include/
> 
> .PHONY: INSTALL
> INSTALL:
>     $(INSTALL_CMD)
> 
Where is $(INSTALL_CMD) defined?  What is supposed to do?

> uninstall-hook:
>     rm -f $(HOME)/.spectrum3d.pref
>
What is this supposed to do?  If it is meant to remove a user
configuration file, I think wrong for two reasons:

 - The user might be removing your sofware only temporarily, maybe to
   chase down the reason of some weird failures, or to subsequently
   install a newer version.  In this case, removing its config file
   behind his back is not nice.

 - The above rule doesn't do what is thought for when installation
   and uninstallation are done by the superuer; in this case, it
   removes the file /root/.spectrum3d.pref (which might as well be
   non existent), not the users' config file.

> 
> and this is the Makefile.am from the src directory :
> 
> bin_PROGRAMS = spectrum3d
> 
> spectrum3d_CFLAGS = $(GSTREAMER_CFLAGS) $(GTK_CFLAGS) $(BAMF_CFLAGS)
> spectrum3d_LDADD = $(GSTREAMER_LIBS) $(GTK_LIBS) $(BAMF_LIBS)
>
The various $(FOO_CFLAGS) and $(FOO_LIBS) variables here should be
automatically populated by your calls to PKG_CHECK_MODULES, right?

> spectrum3d_SOURCES = display.c events.c geis.c main.c mainwindow.c \
>                      menu.c onclick.c scale.c testrtpool.c include.h \
>                      display.h events.h geis.h main.h mainwindow.h \
>                      menu.h onclick.h scale.h testrtpool.h
> 
> 
> 
> 
> Could please help to solve this issue...?
> 
> Thank you so much
> 
> Victor
> 
> 

HTH,
  Stefano



reply via email to

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