root/gaphor/tags/gaphor-0.1.0/acinclude.m4

Revision 124, 7.3 kB (checked in by arjanmol, 6 years ago)

Removed GCC and header file checkes from configure script.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 ## this one is commonly used with AM_PATH_PYTHONDIR ...
2 dnl AM_CHECK_PYMOD(MODNAME [,SYMBOL [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]]])
3 dnl Check if a module containing a given symbol is visible to python.
4 AC_DEFUN(AM_CHECK_PYMOD,
5 [AC_REQUIRE([AM_PATH_PYTHON])
6 py_mod_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'`
7 AC_MSG_CHECKING(for ifelse([$2],[],,[$2 in ])python module $1)
8 AC_CACHE_VAL(py_cv_mod_$py_mod_var, [
9 ifelse([$2],[], [prog="
10 import sys
11 try:
12         import $1
13 except ImportError:
14         sys.exit(1)
15 except:
16         sys.exit(0)
17 sys.exit(0)"], [prog="
18 import $1
19 $1.$2"])
20 if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC
21   then
22     eval "py_cv_mod_$py_mod_var=yes"
23   else
24     eval "py_cv_mod_$py_mod_var=no"
25   fi
26 ])
27 py_val=`eval "echo \`echo '$py_cv_mod_'$py_mod_var\`"`
28 if test "x$py_val" != xno; then
29   AC_MSG_RESULT(yes)
30   ifelse([$3], [],, [$3
31 ])dnl
32 else
33   AC_MSG_RESULT(no)
34   ifelse([$4], [],, [$4
35 ])dnl
36 fi
37 ])
38
39 dnl a macro to check for ability to create python extensions
40 dnl  AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
41 dnl function also defines PYTHON_INCLUDES
42 AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
43 [AC_REQUIRE([AM_PATH_PYTHON])
44 AC_MSG_CHECKING(for headers required to compile python extensions)
45 dnl deduce PYTHON_INCLUDES
46 py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
47 py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
48 PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
49 if test "$py_prefix" != "$py_exec_prefix"; then
50   PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
51 fi
52 AC_SUBST(PYTHON_INCLUDES)
53 dnl check if the headers exist:
54 save_CPPFLAGS="$CPPFLAGS"
55 CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
56 AC_TRY_CPP([#include <Python.h>],dnl
57 [AC_MSG_RESULT(found)
58 $1],dnl
59 [AC_MSG_RESULT(not found)
60 $2])
61 CPPFLAGS="$save_CPPFLAGS"
62 ])
63
64
65 # Macro to add for using GNU gettext.
66 # Ulrich Drepper <drepper@cygnus.com>, 1995, 1996
67 #
68 # Modified to never use included libintl.
69 # Owen Taylor <otaylor@redhat.com>, 12/15/1998
70 #
71 # Modified to never check for C header files.
72 # Arjan Molenaar <arjanmol@users.sourceforge.net>, 09-02-2002
73 #
74 # This file can be copied and used freely without restrictions.  It can
75 # be used in projects which are not available under the GNU Public License
76 # but which still want to provide support for the GNU gettext functionality.
77 # Please note that the actual code is *not* freely available.
78 #
79 #
80 # If you make changes to this file, you MUST update the copy in
81 # acinclude.m4. [ aclocal dies on duplicate macros, so if
82 # we run 'aclocal -I macros/' then we'll run into problems
83 # once we've installed glib-gettext.m4 :-( ]
84 #
85
86 dnl AM_GAPHOR_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
87 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
88 AC_DEFUN([AM_GAPHOR_PATH_PROG_WITH_TEST],
89 [# Extract the first word of "$2", so it can be a program name with args.
90 set dummy $2; ac_word=[$]2
91 AC_MSG_CHECKING([for $ac_word])
92 AC_CACHE_VAL(ac_cv_path_$1,
93 [case "[$]$1" in
94   /*)
95   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
96   ;;
97   *)
98   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
99   for ac_dir in ifelse([$5], , $PATH, [$5]); do
100     test -z "$ac_dir" && ac_dir=.
101     if test -f $ac_dir/$ac_word; then
102       if [$3]; then
103         ac_cv_path_$1="$ac_dir/$ac_word"
104         break
105       fi
106     fi
107   done
108   IFS="$ac_save_ifs"
109 dnl If no 4th arg is given, leave the cache variable unset,
110 dnl so AC_PATH_PROGS will keep looking.
111 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
112 ])dnl
113   ;;
114 esac])dnl
115 $1="$ac_cv_path_$1"
116 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
117   AC_MSG_RESULT([$]$1)
118 else
119   AC_MSG_RESULT(no)
120 fi
121 AC_SUBST($1)dnl
122 ])
123
124 # serial 5
125
126 AC_DEFUN(AM_GAPHOR_WITH_NLS,
127   dnl NLS is obligatory
128   [USE_NLS=yes
129     AC_SUBST(USE_NLS)
130
131     dnl Figure out what method
132     nls_cv_force_use_gnu_gettext="no"
133
134     nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
135     if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
136       dnl User does not insist on using GNU NLS library.  Figure out what
137       dnl to use.  If gettext or catgets are available (in this order) we
138       dnl use this.  Else we have to fall back to GNU NLS library.
139       dnl catgets is only used if permitted by option --with-catgets.
140       nls_cv_header_intl=
141       nls_cv_header_libgt=
142       CATOBJEXT=NONE
143       XGETTEXT=:
144
145       if test "$CATOBJEXT" = "NONE"; then
146         dnl Neither gettext nor catgets in included in the C library.
147         dnl Fall back on GNU gettext library.
148         nls_cv_use_gnu_gettext=yes
149       fi
150     fi
151
152     if test "$nls_cv_use_gnu_gettext" != "yes"; then
153       :
154     else
155       dnl Unset this variable since we use the non-zero value as a flag.
156       CATOBJEXT=
157     fi
158
159     # We need to process the po/ directory.
160     POSUB=po
161
162     AC_OUTPUT_COMMANDS(
163       [case "$CONFIG_FILES" in *po/Makefile.in*)
164         sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
165       esac])
166
167     dnl These rules are solely for the distribution goal.  While doing this
168     dnl we only have to keep exactly one list of the available catalogs
169     dnl in configure.in.
170     for lang in $ALL_LINGUAS; do
171       GMOFILES="$GMOFILES $lang.gmo"
172       POFILES="$POFILES $lang.po"
173     done
174
175     dnl Make all variables we use known to autoconf.
176     AC_SUBST(CATALOGS)
177     AC_SUBST(CATOBJEXT)
178     AC_SUBST(DATADIRNAME)
179     AC_SUBST(GMOFILES)
180     AC_SUBST(INSTOBJEXT)
181     AC_SUBST(INTLDEPS)
182     AC_SUBST(INTLLIBS)
183     AC_SUBST(INTLOBJS)
184     AC_SUBST(POFILES)
185     AC_SUBST(POSUB)
186   ])
187
188 AC_DEFUN(AM_GAPHOR_GNU_GETTEXT,
189   [AM_GAPHOR_WITH_NLS
190
191    if test "x$CATOBJEXT" != "x"; then
192      if test "x$ALL_LINGUAS" = "x"; then
193        LINGUAS=
194      else
195        AC_MSG_CHECKING(for catalogs to be installed)
196        NEW_LINGUAS=
197        for lang in ${LINGUAS=$ALL_LINGUAS}; do
198          case "$ALL_LINGUAS" in
199           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
200          esac
201        done
202        LINGUAS=$NEW_LINGUAS
203        AC_MSG_RESULT($LINGUAS)
204      fi
205
206      dnl Construct list of names of catalog files to be constructed.
207      if test -n "$LINGUAS"; then
208        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
209      fi
210    fi
211
212    dnl Determine which catalog format we have (if any is needed)
213    dnl For now we know about two different formats:
214    dnl   Linux libc-5 and the normal X/Open format
215    test -d po || mkdir po
216    if test "$CATOBJEXT" = ".cat"; then
217      dnl Transform the SED scripts while copying because some dumb SEDs
218      dnl cannot handle comments.
219      sed -e '/^#/d' $srcdir/po/$msgformat-msg.sed > po/po2msg.sed
220    fi
221
222    dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
223    dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
224    dnl Try to locate is.
225    MKINSTALLDIRS=
226    if test -n "$ac_aux_dir"; then
227      MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
228    fi
229    if test -z "$MKINSTALLDIRS"; then
230      MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
231    fi
232    AC_SUBST(MKINSTALLDIRS)
233
234    dnl Generate list of files to be processed by xgettext which will
235    dnl be included in po/Makefile.
236    test -d po || mkdir po
237    if test "x$srcdir" != "x."; then
238      if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
239        posrcprefix="$srcdir/"
240      else
241        posrcprefix="../$srcdir/"
242      fi
243    else
244      posrcprefix="../"
245    fi
246    rm -f po/POTFILES
247    sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
248         < $srcdir/po/POTFILES.in > po/POTFILES
249   ])
250
Note: See TracBrowser for help on using the browser.