Skript in configure.in



  • Hallo zusammen,

    ich habe ein kleines Programm mit GTK+ UI geschrieben. Jetzt soll im configure.in Skript getestet werden, ob die Anwendung innerhalb dem Cross-Development Kit Scratchbox ausgeführt wird oder nicht. Je nachdem sollen unterschiedliche Dinge passieren. Ich denke durch den Code wird es klar:

    echo "check if we are inside scratchbox...";
    if test -f "/targets/links/scratchbox.config"; then
    	echo " yes";
    	PKG_CHECK_MODULES(PACKAGE, [gtk+-2.0 gdk-2.0 gthread-2.0 hildon-lgpl])
    	CFLAGS="-DSB_BUILD $CFLAGS"
    	CXXFLAGS="-DSB_BUILD $CXXFLAGS"
    else
    	echo " no";
    	PKG_CHECK_MODULES(PACKAGE, [gtk+-2.0 gdk-2.0 gthread-2.0])
    fi
    AC_SUBST(PACKAGE_CFLAGS)
    AC_SUBST(PACKAGE_LIBS)
    

    Das funktioniert soweit auch in Scratchbox, nur direkt unter Ubuntu Linux bekomme ich einen Fehler, sobald im true Bereich der If Abfrage die Zeile mit PKG_CHECK_MODULES(...) drin steht.

    check if we are inside scratchbox...
    no
    checking for PACKAGE... configure: error: The pkg-config script could not be found or is too old. Make sure it
    is in your PATH or set the PKG_CONFIG environment variable to the full
    path to pkg-config.

    Alternatively you may set the PACKAGE_CFLAGS and PACKAGE_LIBS environment variables
    to avoid the need to call pkg-config. See the pkg-config man page for
    more details.

    To get pkg-config, see http://www.freedesktop.org/software/pkgconfig.
    See `config.log' for more details.

    Wenn sie auskommentiert ist, funktioniert alles. Wo ist das Problem?
    In Scratchbox nutz ich Autoconf 2.13, Ubuntu 2.59 und Automake 1.8.5 in beidem.

    Ciao,

    Timo



  • er findet die Module nicht, weil sie entweder nicht installiert sind oder pkg-config das nicht weiß



  • Hi kingruedi,

    die muss er aber finden. Wie gesagt, wenn ich es so schreibe funktioniert es und in den true Teil springt er ja gar nicht unter Ubuntu Linux, da dort nicht diese Datei existiert.

    echo "check if we are inside scratchbox...";
    if test -f "/targets/links/scratchbox.config"; then
    	echo " yes";
    dnl	PKG_CHECK_MODULES(PACKAGESB, [gtk+-2.0 gdk-2.0 gthread-2.0 hildon-lgpl])
    	CFLAGS="-DSB_BUILD $CFLAGS"
    	CXXFLAGS="-DSB_BUILD $CXXFLAGS"
    else
    	echo " no";
    	PKG_CHECK_MODULES(PACKAGE, [gtk+-2.0 gdk-2.0 gthread-2.0])
    	AC_SUBST(PACKAGE_CFLAGS)
    	AC_SUBST(PACKAGE_LIBS)
    fi
    

    Und das passiert dann beim Aufruf von autogen.sh unter Ubuntu:

    check if we are inside scratchbox...
    no
    checking for pkg-config... /usr/bin/pkg-config
    checking pkg-config is at least version 0.9.0... yes
    checking for PACKAGE... yes
    configure: creating ./config.status
    config.status: creating Makefile
    config.status: creating po/Makefile.in
    config.status: creating include/Makefile
    config.status: creating src/Makefile
    config.status: creating config.h
    config.status: config.h is unchanged
    config.status: executing depfiles commands
    config.status: executing default-1 commands
    Now type `make' to compile.

    Ciao,

    Timo



  • Gib mal in deinem Ubuntu folgendes in deine Shell ein:

    pkg-config gtk+-2.0 --libs --cflags
    

    Ich schätzte mal, du wirst einen fehler bekommen. Ist das der fall, ist das GTK+ pkg-config script nicht installiert.



  • Hi ProgChild,

    ne klappt. Ist ja auch logisch, da es ja bisher auch ging und wenn man die eine Zeile auskommentiert - in den Trueteil für Scratchbox springt er ja eh nicht rein - funktioniert es ja immer noch.

    timo@ubuntu:/$ pkg-config gtk+-2.0 gdk-2.0 gthread-2.0 --libs --cflags
    -pthread -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -pthread -lgtk-x11-2.0 -latk-1.0 -lgdk-x11-2.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lfontconfig -lXinerama -lXi -lXrandr -lXext -lXcursor -lXfixes -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lXrender -lX11 -ldl -lgthread-2.0 -lglib-2.0

    Ciao,

    Timo


Anmelden zum Antworten