Change website address to www.geda-project.org.
[geda-xgsch2pcb.git] / configure.ac
bloba2cc1e1712a92f293ceaf9a28f6d68fdf7ad556c
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 # xgsch2pcb - a GUI for gsch2pcb
5 # Copyright (C) 2006 University of Cambridge
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24 AC_PREREQ(2.59)
25 AC_INIT([geda-xgsch2pcb], [0.1.3], BUG-REPORT-ADDRESS)
27 AM_INIT_AUTOMAKE([foreign])
30 PYTHON_WANTVERSION=2.4
31 PYTHON_WANTMODULES="commands gettext os os.path re shutil stat subprocess dbus dbus.glib dbus.service string"
32 GTK_WANTVERSION=2.8
35 # Checks for programs.
36 AC_PROG_INSTALL
37 AM_PATH_PYTHON($PYTHON_WANTVERSION)
38 IT_PROG_INTLTOOL(0.35.0)
40 AC_DEFUN([AC_PYTHON_MODULE],[
41     AC_MSG_CHECKING([for python module $1])
42     $PYTHON -c "import $1" 2>&1 | grep -q 'ImportError'
43     if test $? -ne 0; then
44         AC_MSG_RESULT(yes)
45     else
46         AC_MSG_RESULT(no)
47         if test -n "$2"; then
48             AC_MSG_ERROR([python module $1 is required])
49         fi
50     fi
54 ############################################################################
55 # Update desktop database utility start
58 AC_ARG_ENABLE(update-desktop-database,
59    AC_HELP_STRING([--disable-update-desktop-database],
60                    [do not update desktop file database after installation]),,
61                    enable_update_desktop_database=yes)
63 AM_CONDITIONAL(ENABLE_UPDATE_DESKTOP_DATABASE,
64                test x$enable_update_desktop_database = xyes)
66 if test x$enable_update_desktop_database = xyes ; then
67   AC_PATH_PROG(UPDATE_DESKTOP_DATABASE, [update-desktop-database], no)
68   if test $UPDATE_DESKTOP_DATABASE = no; then
69      AC_MSG_ERROR([Cannot find update-desktop-database, make sure it is installed and in your PATH, or configure with --disable-update-desktop-database])
70   fi
74 # Update desktop database utility end
75 ############################################################################
77 # Set USE_NLS
78 AM_NLS
80 # Find GMSGFMT
81 AC_PATH_PROG(GMSGFMT, msgfmt)
83 # Set package name for translations
84 GETTEXT_PACKAGE=$PACKAGE
85 AC_SUBST(GETTEXT_PACKAGE)
87 ##########################################################################
88 # Command line flags start
91 # Change default location for rc files
92 AC_ARG_WITH(templatesdir, [  --with-templatesdir=path       Change where the template projects are found], [templatesdir=$withval],[templatesdir=$datarootdir/$PACKAGE/templates])
94 AC_SUBST(templatesdir)
96 # Change default location for XDG files (.desktop and icons)
97 AC_ARG_WITH(xdgdatadir, [  --with-xdgdatadir=path  Change where the .desktop file and theme icons are installed [[DATADIR]]], [opt_xdgdatadir=$withval])
99 if test x$opt_xdgdatadir = x; then
100         # path was not specified with --with-xdgdatadir
101         XDGDATADIR='${datadir}'
102 else
103         # path WAS specified with --with-xdgdatadir
104         XDGDATADIR="$opt_xdgdatadir"
106 AC_SUBST(XDGDATADIR)
109 # Command line flags end
110 ##########################################################################
112 ##########################################################################
113 # Look for PyGTK
116 AC_PYTHON_MODULE(pygtk, t)
118 AC_MSG_CHECKING(for pygtk 2.0)
119 cat > conftest.py <<[EOF
120 import pygtk
121 pygtk.require("2.0")
122 EOF]
124 if $PYTHON conftest.py > /dev/null 2>&1; then
125     AC_MSG_RESULT(yes)
126 else
127     AC_MSG_RESULT(no)
128     AC_MSG_ERROR([pygtk 2.0 is required])
131 for module in gobject gtk gtk.gdk; do
132     AC_PYTHON_MODULE($module, t)
133 done
135 AC_ARG_ENABLE([gtk-version-check],
136     AS_HELP_STRING([--disable-gtk-version-check], [Disable GTK+ version check, use it only for non-X environment]))
138 AS_IF([test "x$enable_gtk_version_check" != "xno"], [
140 AC_MSG_CHECKING(for gtk+ >= $GTK_WANTVERSION)
141 cat > conftest.py <<[EOF
142 import sys
143 try:
144     import gtk
145     ver = gtk.gtk_version
146     sys.stdout.write(".".join(map(str, ver)))
147     if len(sys.argv) > 1:
148         wantver = sys.argv[1].split(".")
149         wantver = map(int, wantver)
150         for i in range(len(wantver)):
151             if i > len(ver):
152                 break
153             if wantver[i] > ver[i]:
154                 sys.exit(1)
155 except:
156     sys.exit(1)
157 sys.exit(0)
158 EOF]
160 GTK_VERSION=`$PYTHON conftest.py $GTK_WANTVERSION 2> /dev/null`
161 haveversion=$?
162 AC_MSG_RESULT($GTK_VERSION)
163 if test $haveversion -ne 0; then
164   AC_MSG_ERROR([GTK+ >= $GTK_WANTVERSION is required])
171 ##########################################################################
174 ##########################################################################
175 # Look for other Python modules
178 for module in $PYTHON_WANTMODULES; do
179     AC_PYTHON_MODULE($module, t)
180 done
184 ##########################################################################
186 # Checks for system services
187 AC_SYS_INTERPRETER
188 if test $interpval == 'no'; then
189   AC_MSG_ERROR([Your system must support the shell bang syntax]);
192 AC_CONFIG_FILES([Makefile
193                  data/Makefile
194                  po/Makefile.in
195                  po/Makefile])
196 AC_OUTPUT