bfin: remove inline keyword
[xenomai-head.git] / config / acinclude.m4
blob952161395934593b90c440c3e175fc380616c8e7
1 dnl AC_PATH_XREQUIRED() requires X libs. This frag has been
2 dnl lifted nearly "as is" from Postgresql's configure.in script.
4 AC_DEFUN([AC_PATH_XREQUIRED],
6         save_LIBS="$LIBS"
7         save_CFLAGS="$CFLAGS"
8         save_CPPFLAGS="$CPPFLAGS"
9         save_LDFLAGS="$LDFLAGS"
11         AC_PATH_X
12         AC_PATH_XTRA
14         LIBS="$LIBS $X_EXTRA_LIBS"
15         CFLAGS="$CFLAGS $X_CFLAGS"
16         CPPFLAGS="$CPPFLAGS $X_CFLAGS"
17         LDFLAGS="$LDFLAGS $X_LIBS"
19         dnl Check for X library
21         X11_LIBS=""
22         AC_CHECK_LIB(X11, XOpenDisplay, X11_LIBS="-lX11",,${X_PRE_LIBS})
23         if test "$X11_LIBS" = ""; then
24                 dnl Not having X is bad news, period. Let the user fix this.
25                 AC_MSG_ERROR([The X11 library '-lX11' could not be found,
26  so I won't go further. Please use the configure
27  options '--x-includes=DIR' and '--x-libraries=DIR'
28  to specify the X location. See the file 'config.log'
29  for further diagnostics.])
30         fi
31         AC_SUBST(X_LIBS)
32         AC_SUBST(X11_LIBS)
33         AC_SUBST(X_PRE_LIBS)
35         LIBS="$save_LIBS"
36         CFLAGS="$save_CFLAGS"
37         CPPFLAGS="$save_CPPFLAGS"
38         LDFLAGS="$save_LDFLAGS"
41 dnl AC_POSIX_SIGHANDLER() determines whether
42 dnl signal handlers are posix compliant. This frag
43 dnl has been adapted from readline's aclocal.m4.
45 AC_DEFUN([AC_POSIX_SIGHANDLER],
46 [AC_MSG_CHECKING([if signal handlers are posix compliant])
47 AC_CACHE_VAL(ac_cv_posix_sighandler,
48 [AC_TRY_COMPILE([#include <sys/types.h>
49 #include <signal.h>
50 #ifdef signal
51 #undef signal
52 #endif
53 #ifdef __cplusplus
54 extern "C"
55 #endif
56 void (*signal(void))(void);],
57 [int i;], ac_cv_posix_sighandler=no, ac_cv_posix_sighandler=yes)])dnl
58 AC_MSG_RESULT($ac_cv_posix_sighandler)
59 if test $ac_cv_posix_sighandler = yes; then
60 AC_DEFINE(HAVE_POSIX_SIGHANDLER,1,[Kconfig])
64 #------------------------------------------------------------------------
65 # SC_PATH_TCLCONFIG --
67 #       Locate the tclConfig.sh file and perform a sanity check on
68 #       the Tcl compile flags
70 # Arguments:
71 #       none
73 # Results:
75 #       Adds the following arguments to configure:
76 #               --with-tcl=...
78 #       Defines the following vars:
79 #               TCL_BIN_DIR     Full path to the directory containing
80 #                               the tclConfig.sh file
81 #------------------------------------------------------------------------
83 AC_DEFUN([SC_PATH_TCLCONFIG], [
84     #
85     # Ok, lets find the tcl configuration
86     # First, look for one uninstalled.
87     # the alternative search directory is invoked by --with-tcl
88     #
90     if test x"${no_tcl}" = x ; then
91         # we reset no_tcl in case something fails here
92         no_tcl=true
93         AC_ARG_WITH(tcl, [  --with-tcl              directory containing tcl configuration (tclConfig.sh)], with_tclconfig=${withval})
94         AC_MSG_CHECKING([for Tcl configuration])
95         AC_CACHE_VAL(ac_cv_c_tclconfig,[
97             # First check to see if --with-tcl was specified.
98             if test x"${with_tclconfig}" != x ; then
99                 if test -f "${with_tclconfig}/tclConfig.sh" ; then
100                     ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
101                 else
102                     AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
103                 fi
104             fi
106             # then check for a private Tcl installation
107             if test x"${ac_cv_c_tclconfig}" = x ; then
108                 for i in \
109                         ../tcl \
110                         `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
111                         ../../tcl \
112                         `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
113                         ../../../tcl \
114                         `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
115                     if test -f "$i/unix/tclConfig.sh" ; then
116                         ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
117                         break
118                     fi
119                 done
120             fi
122             # check in a few common install locations
123             if test x"${ac_cv_c_tclconfig}" = x ; then
124                 for i in ${prefix}/lib /usr/local/lib /usr/pkg/lib /usr/lib \
125                         `ls -dr /usr/lib/tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
126                     if test -f "$i/tclConfig.sh" ; then
127                         ac_cv_c_tclconfig=`(cd $i; pwd)`
128                         break
129                     fi
130                 done
131             fi
133             # check in a few other private locations
134             if test x"${ac_cv_c_tclconfig}" = x ; then
135                 for i in \
136                         ${srcdir}/../tcl \
137                         `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
138                     if test -f "$i/unix/tclConfig.sh" ; then
139                     ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
140                     break
141                 fi
142                 done
143             fi
144         ])
146         if test x"${ac_cv_c_tclconfig}" = x ; then
147             TCL_BIN_DIR="# no Tcl configs found"
148             AC_MSG_WARN(Can't find Tcl configuration definitions)
149             exit 1
150         else
151             no_tcl=
152             TCL_BIN_DIR=${ac_cv_c_tclconfig}
153             AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh)
154         fi
155     fi
158 #------------------------------------------------------------------------
159 # SC_PATH_TKCONFIG --
161 #       Locate the tkConfig.sh file
163 # Arguments:
164 #       none
166 # Results:
168 #       Adds the following arguments to configure:
169 #               --with-tk=...
171 #       Defines the following vars:
172 #               TK_BIN_DIR      Full path to the directory containing
173 #                               the tkConfig.sh file
174 #------------------------------------------------------------------------
176 AC_DEFUN([SC_PATH_TKCONFIG], [
177     #
178     # Ok, lets find the tk configuration
179     # First, look for one uninstalled.
180     # the alternative search directory is invoked by --with-tk
181     #
183     if test x"${no_tk}" = x ; then
184         # we reset no_tk in case something fails here
185         no_tk=true
186         AC_ARG_WITH(tk, [  --with-tk               directory containing tk configuration (tkConfig.sh)], with_tkconfig=${withval})
187         AC_MSG_CHECKING([for Tk configuration])
188         AC_CACHE_VAL(ac_cv_c_tkconfig,[
190             # First check to see if --with-tkconfig was specified.
191             if test x"${with_tkconfig}" != x ; then
192                 if test -f "${with_tkconfig}/tkConfig.sh" ; then
193                     ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
194                 else
195                     AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
196                 fi
197             fi
199             # then check for a private Tk library
200             if test x"${ac_cv_c_tkconfig}" = x ; then
201                 for i in \
202                         ../tk \
203                         `ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \
204                         ../../tk \
205                         `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \
206                         ../../../tk \
207                         `ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
208                     if test -f "$i/unix/tkConfig.sh" ; then
209                         ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
210                         break
211                     fi
212                 done
213             fi
214             # check in a few common install locations
215             if test x"${ac_cv_c_tkconfig}" = x ; then
216                 for i in ${prefix}/lib /usr/local/lib /usr/pkg/lib /usr/lib \
217                         `ls -dr /usr/lib/tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
218                     if test -f "$i/tkConfig.sh" ; then
219                         ac_cv_c_tkconfig=`(cd $i; pwd)`
220                         break
221                     fi
222                 done
223             fi
224             # check in a few other private locations
225             if test x"${ac_cv_c_tkconfig}" = x ; then
226                 for i in \
227                         ${srcdir}/../tk \
228                         `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
229                     if test -f "$i/unix/tkConfig.sh" ; then
230                         ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
231                         break
232                     fi
233                 done
234             fi
235         ])
236         if test x"${ac_cv_c_tkconfig}" = x ; then
237             TK_BIN_DIR="# no Tk configs found"
238             AC_MSG_WARN(Can't find Tk configuration definitions)
239             exit 1
240         else
241             no_tk=
242             TK_BIN_DIR=${ac_cv_c_tkconfig}
243             AC_MSG_RESULT(found $TK_BIN_DIR/tkConfig.sh)
244         fi
245     fi
249 #------------------------------------------------------------------------
250 # SC_LOAD_TCLCONFIG --
252 #       Load the tclConfig.sh file
254 # Arguments:
255 #       
256 #       Requires the following vars to be set:
257 #               TCL_BIN_DIR
259 # Results:
261 #       Subst the following vars:
262 #               TCL_BIN_DIR
263 #               TCL_SRC_DIR
264 #               TCL_LIB_FILE
266 #------------------------------------------------------------------------
268 AC_DEFUN([SC_LOAD_TCLCONFIG], [
269     AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
271     if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
272         AC_MSG_RESULT([loading])
273         . $TCL_BIN_DIR/tclConfig.sh
274     else
275         AC_MSG_ERROR([not found])
276     fi
278     AC_PATH_PROG(TCL_SCRIPT, tclsh${TCL_VERSION}, tclsh)
280     AC_SUBST(TCL_BIN_DIR)
281     AC_SUBST(TCL_SRC_DIR)
282     AC_SUBST(TCL_LIB_FILE)
283     AC_SUBST(TCL_LIBS)
284     AC_SUBST(TCL_DEFS)
285     AC_SUBST(TCL_SHLIB_LD_LIBS)
286     AC_SUBST(TCL_EXTRA_CFLAGS)
287     AC_SUBST(TCL_LD_FLAGS)
288     AC_SUBST(TCL_LIB_FILE)
289     AC_SUBST(TCL_STUB_LIB_FILE)
290     AC_SUBST(TCL_LIB_SPEC)
291     AC_SUBST(TCL_BUILD_LIB_SPEC)
292     AC_SUBST(TCL_STUB_LIB_SPEC)
293     AC_SUBST(TCL_BUILD_STUB_LIB_SPEC)
294     AC_SUBST(TCL_DBGX)
297 #------------------------------------------------------------------------
298 # SC_LOAD_TKCONFIG --
300 #       Load the tkConfig.sh file
302 # Arguments:
303 #       
304 #       Requires the following vars to be set:
305 #               TK_BIN_DIR
307 # Results:
309 #       Sets the following vars that should be in tkConfig.sh:
310 #               TK_BIN_DIR
311 #------------------------------------------------------------------------
313 AC_DEFUN([SC_LOAD_TKCONFIG], [
314     AC_MSG_CHECKING([for existence of $TK_BIN_DIR/tkConfig.sh])
316     if test -f "$TK_BIN_DIR/tkConfig.sh" ; then
317         AC_MSG_RESULT([loading])
318         . $TK_BIN_DIR/tkConfig.sh
319     else
320         AC_MSG_ERROR([not found])
321     fi
323     AC_SUBST(TK_BIN_DIR)
324     AC_SUBST(TK_SRC_DIR)
325     AC_SUBST(TK_LIB_FILE)
326     AC_SUBST(TK_LIB_FLAG)
327     AC_SUBST(TK_LIB_SPEC)
328     AC_SUBST(TK_DBGX)
331 #------------------------------------------------------------------------
332 # SC_PATH_TIX --
334 #       Locate the Tix installation.
336 # Arguments:
337 #       None.
339 # Results:
341 #       Substs the following vars:
342 #               TIX_TCL_LIB
343 #               TIX_LIB_SPEC
344 #------------------------------------------------------------------------
346 AC_DEFUN([SC_PATH_TIX], [
347     AC_MSG_CHECKING(for Tix's Tcl library)
349     AC_ARG_WITH(tixlibrary, [  --with-tixlibrary      directory containing the Tix library files.], with_tixlibrary=${withval})
351     if test x"${with_tixlibrary}" != x ; then
352         if test -f "${with_tixlibrary}/Init.tcl" ; then
353             ac_cv_tix_libdir=${with_tixlibrary}
354         else
355             AC_MSG_ERROR([${with_tixlibrary} directory does not contain Tix's init file Init.tcl])
356         fi
357     else
358         AC_CACHE_VAL(ac_cv_tix_libdir, [
359             for d in \
360             `ls -dr /usr/local/lib/tix[[0-9]]* 2>/dev/null ` \
361             `ls -dr /usr/local/share/tix[[0-9]]* 2>/dev/null ` \
362             `ls -dr /usr/pkg/lib/tix[[0-9]]* 2>/dev/null ` \
363             `ls -dr /usr/lib/tix[[0-9]]* 2>/dev/null ` \
364             `ls -dr /usr/share/tix[[0-9]]* 2>/dev/null ` ; do
365                 if test -f "$d/Init.tcl" ; then
366                 ac_cv_tix_libdir=$d
367                 break
368                 fi
369             done
370         ])
371     fi
373     AC_MSG_RESULT($ac_cv_tix_libdir)
374     TIX_TCL_LIB=$ac_cv_tix_libdir
375     AC_SUBST(TIX_TCL_LIB)
377     SC_LIB_SPEC(tix)
378     TIX_LIB_SPEC=$tix_LIB_SPEC
379     AC_SUBST(TIX_LIB_SPEC)
382 #------------------------------------------------------------------------
383 # SC_LIB_SPEC --
385 #       Compute the name of an existing object library located in libdir
386 #       from the given base name and produce the appropriate linker flags.
388 # Arguments:
389 #       basename        The base name of the library without version
390 #                       numbers, extensions, or "lib" prefixes.
392 #       Requires:
394 # Results:
396 #       Defines the following vars:
397 #               ${basename}_LIB_NAME    The computed library name.
398 #               ${basename}_LIB_SPEC    The computed linker flags.
399 #------------------------------------------------------------------------
401 AC_DEFUN([SC_LIB_SPEC], [
402     AC_MSG_CHECKING(for $1 library)
403     eval "sc_lib_name_dir=${libdir}"
404     for i in \
405             `ls -dr ${sc_lib_name_dir}/$1[[0-9]]*.lib 2>/dev/null ` \
406             `ls -dr ${sc_lib_name_dir}/lib$1.* 2>/dev/null ` \
407             `ls -dr ${sc_lib_name_dir}/lib$1[[0-9]]* 2>/dev/null ` \
408             `ls -dr /usr/pkg/*/lib$1.so 2>/dev/null ` \
409             `ls -dr /usr/pkg/*/lib$1[[0-9]]* 2>/dev/null ` \
410             `ls -dr /usr/pkg/lib/lib$1.so 2>/dev/null ` \
411             `ls -dr /usr/pkg/lib/lib$1[[0-9]]* 2>/dev/null ` \
412             `ls -dr /usr/lib/$1[[0-9]]*.lib 2>/dev/null ` \
413             `ls -dr /usr/lib/lib$1.so 2>/dev/null ` \
414             `ls -dr /usr/lib/lib$1[[0-9]]* 2>/dev/null ` \
415             `ls -dr /usr/local/lib/$1[[0-9]]*.lib 2>/dev/null ` \
416             `ls -dr /usr/local/lib/lib$1.so 2>/dev/null ` \
417             `ls -dr /usr/local/lib/lib$1[[0-9]]* 2>/dev/null ` ; do
418         if test -f "$i" ; then
419             sc_lib_name_dir=`dirname $i`
420             $1_LIB_NAME=`basename $i`
421             break
422         fi
423     done
425     case "`uname -s`" in
426         *win32* | *WIN32* | *CYGWIN_NT*)
427             $1_LIB_SPEC=${$1_LIB_NAME}
428             ;;
429         *)
430             # Strip off the leading "lib" and trailing ".a" or ".so"
431             sc_lib_name_lib=`echo ${$1_LIB_NAME}|sed -e 's/^lib//' -e 's/\.so.*$//' -e 's/\.a$//'`
432             $1_LIB_SPEC="-L${sc_lib_name_dir} -l${sc_lib_name_lib}"
433             ;;
434     esac
435     if test "x${sc_lib_name_lib}" = x ; then
436         AC_MSG_ERROR(not found)
437     else
438         AC_MSG_RESULT(${$1_LIB_SPEC})
439     fi
442 #------------------------------------------------------------------------
443 # SC_PUBLIC_TCL_HEADERS --
445 #       Locate the installed public Tcl header files
447 # Arguments:
448 #       None.
450 # Requires:
452 # Results:
454 #       Adds a --with-tclinclude switch to configure.
455 #       Result is cached.
457 #       Substs the following vars:
458 #               TCL_INCLUDES
459 #------------------------------------------------------------------------
461 AC_DEFUN([SC_PUBLIC_TCL_HEADERS], [
462     AC_MSG_CHECKING(for Tcl public headers)
464     AC_ARG_WITH(tclinclude, [  --with-tclinclude      directory containing the public Tcl header files.], with_tclinclude=${withval})
466     if test x"${with_tclinclude}" != x ; then
467         if test -f "${with_tclinclude}/tcl.h" ; then
468             ac_cv_c_tclh=${with_tclinclude}
469         else
470             AC_MSG_ERROR([${with_tclinclude} directory does not contain Tcl public header file tcl.h])
471         fi
472     else
473         AC_CACHE_VAL(ac_cv_c_tclh, [
474             # Use the value from --with-tclinclude, if it was given
476             if test x"${with_tclinclude}" != x ; then
477                 ac_cv_c_tclh=${with_tclinclude}
478             else
479                 # Check in the includedir, if --prefix was specified
481                 eval "temp_includedir=${includedir}"
482                 for i in \
483                         ${temp_includedir} /usr/local/include /usr/include /usr/pkg/include \
484                         `ls -dr /usr/include/tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
485                     if test -f "$i/tcl.h" ; then
486                         ac_cv_c_tclh=$i
487                         break
488                     fi
489                 done
490             fi
491         ])
492     fi
494     # Print a message based on how we determined the include path
496     if test x"${ac_cv_c_tclh}" = x ; then
497         AC_MSG_ERROR(tcl.h not found.  Please specify its location with --with-tclinclude)
498     else
499         AC_MSG_RESULT(${ac_cv_c_tclh})
500     fi
502     # Convert to a native path and substitute into the output files.
504     INCLUDE_DIR_NATIVE=`echo ${ac_cv_c_tclh}`
506     TCL_INCLUDES="-I${INCLUDE_DIR_NATIVE}"
508     AC_SUBST(TCL_INCLUDES)
511 #------------------------------------------------------------------------
512 # SC_PUBLIC_TK_HEADERS --
514 #       Locate the installed public Tk header files
516 # Arguments:
517 #       None.
519 # Requires:
521 # Results:
523 #       Adds a --with-tkinclude switch to configure.
524 #       Result is cached.
526 #       Substs the following vars:
527 #               TK_INCLUDES
528 #------------------------------------------------------------------------
530 AC_DEFUN([SC_PUBLIC_TK_HEADERS], [
531     AC_MSG_CHECKING(for Tk public headers)
533     AC_ARG_WITH(tkinclude, [  --with-tkinclude      directory containing the public Tk header files.], with_tkinclude=${withval})
535     if test x"${with_tkinclude}" != x ; then
536         if test -f "${with_tkinclude}/tk.h" ; then
537             ac_cv_c_tkh=${with_tkinclude}
538         else
539             AC_MSG_ERROR([${with_tkinclude} directory does not contain Tk public header file tk.h])
540         fi
541     else
542         AC_CACHE_VAL(ac_cv_c_tkh, [
543             # Use the value from --with-tkinclude, if it was given
545             if test x"${with_tkinclude}" != x ; then
546                 ac_cv_c_tkh=${with_tkinclude}
547             else
548                 # Check in the includedir, if --prefix was specified
550                 eval "temp_includedir=${includedir}"
551                 for i in \
552                         ${temp_includedir} /usr/local/include /usr/include /usr/pkg/include \
553                         `ls -dr /usr/include/tk[[8-9]].[[0-9]]* 2>/dev/null` \
554                         `ls -dr /usr/include/tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
555                     if test -f "$i/tk.h" ; then
556                         ac_cv_c_tkh=$i
557                         break
558                     fi
559                 done
560             fi
561         ])
562     fi
564     # Print a message based on how we determined the include path
566     if test x"${ac_cv_c_tkh}" = x ; then
567         AC_MSG_ERROR(tk.h not found.  Please specify its location with --with-tkinclude)
568     else
569         AC_MSG_RESULT(${ac_cv_c_tkh})
570     fi
572     # Convert to a native path and substitute into the output files.
574     INCLUDE_DIR_NATIVE=`echo ${ac_cv_c_tkh}`
576     TK_INCLUDES="-I${INCLUDE_DIR_NATIVE}"
578     AC_SUBST(TK_INCLUDES)