ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/vendor/libpeak-0.1.2/acinclude.m4
Revision: 3251
Committed: Wed Apr 2 16:58:30 2014 UTC (9 years, 11 months ago) by michael
File size: 41197 byte(s)
Log Message:
- Imported libpeak-0.1.2

File Contents

# Content
1 dnl ACX_STRUCT_TZHEAD
2 dnl Written by Stephane Thiell <mbuna@bugged.org>
3 dnl
4 AC_DEFUN([ACX_STRUCT_TZHEAD],
5 [AC_CHECK_HEADERS([tzfile.h])
6 AC_MSG_CHECKING([whether struct tzhead is defined in tzfile.h])
7 AC_CACHE_VAL(acx_cv_struct_tzhead,
8 cat > conftest.$ac_ext <<EOF
9 [
10 #include "confdefs.h"
11 #ifdef HAVE_TZFILE_H
12 #include <tzfile.h>
13 #endif
14
15 int main()
16 {
17 int size = sizeof(struct tzhead);
18 exit(0);
19 }]
20 EOF
21 if AC_TRY_EVAL(ac_compile); then
22 acx_cv_struct_tzhead=yes
23 else
24 acx_cv_struct_tzhead=no
25 fi
26 rm -fr conftest*)
27 AC_MSG_RESULT([$acx_cv_struct_tzhead])
28 if test x$acx_cv_struct_tzhead = xyes; then
29 AC_DEFINE(HAVE_STRUCT_TZHEAD, 1, [struct tzhead is defined in tzfile.h])
30 fi])dnl ACX_STRUCT_TZHEAD
31
32
33 dnl ACX_FD_SETSIZE
34 dnl Written by Stephane Thiell <mbuna@bugged.org>
35 dnl
36 AC_DEFUN([ACX_FD_SETSIZE],
37 [AC_CHECK_FUNCS(select)
38 AC_MSG_CHECKING(whether we can redefine FD_SETSIZE)
39 AC_CACHE_VAL(acx_cv_fd_setsize,
40 ss_status=0
41 cat > conftest.$ac_ext <<EOF
42 [
43 #define FD_SETSIZE 1234
44 #include "confdefs.h"
45 #include <stdlib.h>
46 #include <sys/types.h>
47 #include <sys/time.h>
48 #include <sys/select.h>
49 #include <unistd.h>
50
51 int main()
52 {
53 int status = 0;
54 int val = FD_SETSIZE;
55
56 if (val == 1234) status = 1;
57 else status = 2;
58
59 exit(status);
60 }]
61 EOF
62 if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
63 (./conftest; exit; ) 2>/dev/null
64 ss_status=$?
65 if test x$ss_status = x1; then
66 acx_cv_fd_setsize=yes
67 else
68 acx_cv_fd_setsize=no
69 fi
70 else
71 acx_cv_fd_setsize=no
72 fi
73 rm -fr conftest*)
74 AC_MSG_RESULT([$acx_cv_fd_setsize])
75 if test x$acx_cv_fd_setsize = xyes; then
76 AC_DEFINE(PEAK_FD_SETSIZE_REDEFINABLE, 1, [The system accepts to redefine FD_SETSIZE])
77 fi])dnl ACX_FD_SETSIZE
78
79
80 dnl ACX_PTHREAD
81 dnl Written by Steven G. Johnson <stevenj@alum.mit.edu>
82 dnl Alejandro Forero Cuervo <bachue@bachue.com>
83 dnl
84 AC_DEFUN([ACX_PTHREAD], [
85 AC_REQUIRE([AC_CANONICAL_HOST])
86 AC_LANG_SAVE
87 AC_LANG_C
88 acx_pthread_ok=no
89
90 # We used to check for pthread.h first, but this fails if pthread.h
91 # requires special compiler flags (e.g. on True64 or Sequent).
92 # It gets checked for in the link test anyway.
93
94 # First of all, check if the user has set any of the PTHREAD_LIBS,
95 # etcetera environment variables, and if threads linking works using
96 # them:
97 if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
98 save_CFLAGS="$CFLAGS"
99 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
100 save_LIBS="$LIBS"
101 LIBS="$PTHREAD_LIBS $LIBS"
102 AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
103 AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
104 AC_MSG_RESULT($acx_pthread_ok)
105 if test x"$acx_pthread_ok" = xno; then
106 PTHREAD_LIBS=""
107 PTHREAD_CFLAGS=""
108 fi
109 LIBS="$save_LIBS"
110 CFLAGS="$save_CFLAGS"
111 fi
112
113 # We must check for the threads library under a number of different
114 # names; the ordering is very important because some systems
115 # (e.g. DEC) have both -lpthread and -lpthreads, where one of the
116 # libraries is broken (non-POSIX).
117
118 # Create a list of thread flags to try. Items starting with a "-" are
119 # C compiler flags, and other items are library names, except for "none"
120 # which indicates that we try without any flags at all.
121
122 acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt"
123
124 # The ordering *is* (sometimes) important. Some notes on the
125 # individual items follow:
126
127 # pthreads: AIX (must check this before -lpthread)
128 # none: in case threads are in libc; should be tried before -Kthread and
129 # other compiler flags to prevent continual compiler warnings
130 # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
131 # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
132 # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
133 # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
134 # -pthreads: Solaris/gcc
135 # -mthreads: Mingw32/gcc, Lynx/gcc
136 # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
137 # doesn't hurt to check since this sometimes defines pthreads too;
138 # also defines -D_REENTRANT)
139 # pthread: Linux, etcetera
140 # --thread-safe: KAI C++
141
142 case "${host_cpu}-${host_os}" in
143 *solaris*)
144
145 # On Solaris (at least, for some versions), libc contains stubbed
146 # (non-functional) versions of the pthreads routines, so link-based
147 # tests will erroneously succeed. (We need to link with -pthread or
148 # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
149 # a function called by this macro, so we could check for that, but
150 # who knows whether they'll stub that too in a future libc.) So,
151 # we'll just look for -pthreads and -lpthread first:
152
153 acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
154 ;;
155 esac
156
157 if test x"$acx_pthread_ok" = xno; then
158 for flag in $acx_pthread_flags; do
159
160 case $flag in
161 none)
162 AC_MSG_CHECKING([whether pthreads work without any flags])
163 ;;
164
165 -*)
166 AC_MSG_CHECKING([whether pthreads work with $flag])
167 PTHREAD_CFLAGS="$flag"
168 ;;
169
170 *)
171 AC_MSG_CHECKING([for the pthreads library -l$flag])
172 PTHREAD_LIBS="-l$flag"
173 ;;
174 esac
175
176 save_LIBS="$LIBS"
177 save_CFLAGS="$CFLAGS"
178 LIBS="$PTHREAD_LIBS $LIBS"
179 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
180
181 # Check for various functions. We must include pthread.h,
182 # since some functions may be macros. (On the Sequent, we
183 # need a special flag -Kthread to make this header compile.)
184 # We check for pthread_join because it is in -lpthread on IRIX
185 # while pthread_create is in libc. We check for pthread_attr_init
186 # due to DEC craziness with -lpthreads. We check for
187 # pthread_cleanup_push because it is one of the few pthread
188 # functions on Solaris that doesn't have a non-functional libc stub.
189 # We try pthread_create on general principles.
190 AC_TRY_LINK([#include <pthread.h>],
191 [pthread_t th; pthread_join(th, 0);
192 pthread_attr_init(0); pthread_cleanup_push(0, 0);
193 pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
194 [acx_pthread_ok=yes])
195
196 LIBS="$save_LIBS"
197 CFLAGS="$save_CFLAGS"
198
199 AC_MSG_RESULT($acx_pthread_ok)
200 if test "x$acx_pthread_ok" = xyes; then
201 break;
202 fi
203
204 PTHREAD_LIBS=""
205 PTHREAD_CFLAGS=""
206 done
207 fi
208
209 # Various other checks:
210 if test "x$acx_pthread_ok" = xyes; then
211 save_LIBS="$LIBS"
212 LIBS="$PTHREAD_LIBS $LIBS"
213 save_CFLAGS="$CFLAGS"
214 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
215
216 # Detect AIX lossage: threads are created detached by default
217 # and the JOINABLE attribute has a nonstandard name (UNDETACHED).
218 AC_MSG_CHECKING([for joinable pthread attribute])
219 AC_TRY_LINK([#include <pthread.h>],
220 [int attr=PTHREAD_CREATE_JOINABLE;],
221 ok=PTHREAD_CREATE_JOINABLE, ok=unknown)
222 if test x"$ok" = xunknown; then
223 AC_TRY_LINK([#include <pthread.h>],
224 [int attr=PTHREAD_CREATE_UNDETACHED;],
225 ok=PTHREAD_CREATE_UNDETACHED, ok=unknown)
226 fi
227 if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then
228 AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok,
229 [Define to the necessary symbol if this constant
230 uses a non-standard name on your system.])
231 fi
232 AC_MSG_RESULT(${ok})
233 if test x"$ok" = xunknown; then
234 AC_MSG_WARN([we do not know how to create joinable pthreads])
235 fi
236
237 AC_MSG_CHECKING([if more special flags are required for pthreads])
238 flag=no
239 case "${host_cpu}-${host_os}" in
240 *-aix* | *-freebsd*) flag="-D_THREAD_SAFE";;
241 *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
242 esac
243 AC_MSG_RESULT(${flag})
244 if test "x$flag" != xno; then
245 PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
246 fi
247
248 LIBS="$save_LIBS"
249 CFLAGS="$save_CFLAGS"
250 fi
251 dnl Removed AIX cc_r check as we already perform it in configure.ac --mbuna
252 PTHREAD_CC="$CC"
253
254 AC_SUBST(PTHREAD_LIBS)
255 AC_SUBST(PTHREAD_CFLAGS)
256 AC_SUBST(PTHREAD_CC)
257
258 # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
259 if test x"$acx_pthread_ok" = xyes; then
260 ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
261 :
262 else
263 acx_pthread_ok=no
264 $2
265 fi
266 AC_LANG_RESTORE
267 ])dnl ACX_PTHREAD
268
269
270
271 dnl AC_COMPILE_CHECK_SIZEOF
272 dnl Written by Kaveh Ghazi <ghazi@caip.rutgers.edu>
273 dnl
274 AC_DEFUN([AC_COMPILE_CHECK_SIZEOF],
275 [changequote(<<, >>)dnl
276 dnl The name to #define.
277 define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
278 dnl The cache variable name.
279 define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
280 changequote([, ])dnl
281 AC_MSG_CHECKING(size of $1)
282 AC_CACHE_VAL(AC_CV_NAME,
283 [for ac_size in 4 8 1 2 16 $2 ; do # List sizes in rough order of prevalence.
284 AC_TRY_COMPILE([#include "confdefs.h"
285 #include <sys/types.h>
286 $2
287 ], [switch (0) case 0: case (sizeof ($1) == $ac_size):;], AC_CV_NAME=$ac_size)
288 if test x$AC_CV_NAME != x ; then break; fi
289 done
290 ])
291 if test x$AC_CV_NAME = x ; then
292 AC_MSG_ERROR([cannot determine a size for $1])
293 fi
294 AC_MSG_RESULT($AC_CV_NAME)
295 AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The number of bytes in type $1])
296 undefine([AC_TYPE_NAME])dnl
297 undefine([AC_CV_NAME])dnl
298 ])
299
300
301
302 dnl Written by Guido Draheim <guidod@gmx.de>
303 dnl
304 AC_DEFUN([AC_CREATE_STDINT_H],
305 [# ------ AC CREATE STDINT H -------------------------------------
306 AC_MSG_CHECKING([for stdint-types....])
307 ac_stdint_h=`echo ifelse($1, , _stdint.h, $1)`
308 if test "$ac_stdint_h" = "stdint.h" ; then
309 AC_MSG_RESULT("(are you sure you want them in ./stdint.h?)")
310 elif test "$ac_stdint_h" = "inttypes.h" ; then
311 AC_MSG_RESULT("(are you sure you want them in ./inttypes.h?)")
312 else
313 AC_MSG_RESULT("(putting them into $ac_stdint_h)")
314 fi
315
316 inttype_headers=`echo inttypes.h sys/inttypes.h sys/inttypes.h $2 \
317 | sed -e 's/,/ /g'`
318
319 ac_cv_header_stdint_x="no-file"
320 ac_cv_header_stdint_o="no-file"
321 ac_cv_header_stdint_u="no-file"
322 for i in stdint.h $inttype_headers ; do
323 unset ac_cv_type_uintptr_t
324 unset ac_cv_type_uint64_t
325 _AC_CHECK_TYPE_NEW(uintptr_t,[ac_cv_header_stdint_x=$i],dnl
326 continue,[#include <$i>])
327 AC_CHECK_TYPE(uint64_t,[and64="(uint64_t too)"],[and64=""],[#include<$i>])
328 AC_MSG_RESULT(... seen our uintptr_t in $i $and64)
329 break;
330 done
331 if test "$ac_cv_header_stdint_x" = "no-file" ; then
332 for i in stdint.h $inttype_headers ; do
333 unset ac_cv_type_uint32_t
334 unset ac_cv_type_uint64_t
335 AC_CHECK_TYPE(uint32_t,[ac_cv_header_stdint_o=$i],dnl
336 continue,[#include <$i>])
337 AC_CHECK_TYPE(uint64_t,[and64="(uint64_t too)"],[and64=""],[#include<$i>])
338 AC_MSG_RESULT(... seen our uint32_t in $i $and64)
339 break;
340 done
341 if test "$ac_cv_header_stdint_o" = "no-file" ; then
342 for i in sys/types.h $inttype_headers ; do
343 unset ac_cv_type_u_int32_t
344 unset ac_cv_type_u_int64_t
345 AC_CHECK_TYPE(u_int32_t,[ac_cv_header_stdint_u=$i],dnl
346 continue,[#include <$i>])
347 AC_CHECK_TYPE(uint64_t,[and64="(u_int64_t too)"],[and64=""],[#include<$i>])
348 AC_MSG_RESULT(... seen our u_int32_t in $i $and64)
349 break;
350 done
351 fi
352 fi
353
354 # ----------------- DONE inttypes.h checks MAYBE C basic types --------
355
356 if test "$ac_cv_header_stdint_x" = "no-file" ; then
357 AC_COMPILE_CHECK_SIZEOF(char)
358 AC_COMPILE_CHECK_SIZEOF(short)
359 AC_COMPILE_CHECK_SIZEOF(int)
360 AC_COMPILE_CHECK_SIZEOF(long)
361 AC_COMPILE_CHECK_SIZEOF(void*)
362 ac_cv_header_stdint_test="yes"
363 else
364 ac_cv_header_stdint_test="no"
365 fi
366
367 # ----------------- DONE inttypes.h checks START header -------------
368 _ac_stdint_h=AS_TR_CPP(_$ac_stdint_h)
369 AC_MSG_RESULT(creating $ac_stdint_h : $_ac_stdint_h)
370 echo "#ifndef" $_ac_stdint_h >$ac_stdint_h
371 echo "#define" $_ac_stdint_h "1" >>$ac_stdint_h
372 echo "#ifndef" _GENERATED_STDINT_H >>$ac_stdint_h
373 echo "#define" _GENERATED_STDINT_H '"'$PACKAGE $VERSION'"' >>$ac_stdint_h
374 if test "$GCC" = "yes" ; then
375 echo "/* generated using a gnu compiler version" `$CC --version` "*/" \
376 >>$ac_stdint_h
377 else
378 echo "/* generated using $CC */" >>$ac_stdint_h
379 fi
380 echo "" >>$ac_stdint_h
381
382 if test "$ac_cv_header_stdint_x" != "no-file" ; then
383 ac_cv_header_stdint="$ac_cv_header_stdint_x"
384 elif test "$ac_cv_header_stdint_o" != "no-file" ; then
385 ac_cv_header_stdint="$ac_cv_header_stdint_o"
386 elif test "$ac_cv_header_stdint_u" != "no-file" ; then
387 ac_cv_header_stdint="$ac_cv_header_stdint_u"
388 else
389 ac_cv_header_stdint="stddef.h"
390 fi
391
392 # ----------------- See if int_least and int_fast types are present
393 unset ac_cv_type_int_least32_t
394 unset ac_cv_type_int_fast32_t
395 AC_CHECK_TYPE(int_least32_t,,,[#include <$ac_cv_header_stdint>])
396 AC_CHECK_TYPE(int_fast32_t,,,[#include<$ac_cv_header_stdint>])
397
398 if test "$ac_cv_header_stdint" != "stddef.h" ; then
399 if test "$ac_cv_header_stdint" != "stdint.h" ; then
400 AC_MSG_RESULT(..adding include stddef.h)
401 echo "#include <stddef.h>" >>$ac_stdint_h
402 fi ; fi
403 AC_MSG_RESULT(..adding include $ac_cv_header_stdint)
404 echo "#include <$ac_cv_header_stdint>" >>$ac_stdint_h
405 echo "" >>$ac_stdint_h
406
407 # ----------------- DONE header START basic int types -------------
408 if test "$ac_cv_header_stdint_x" = "no-file" ; then
409 AC_MSG_RESULT(... need to look at C basic types)
410 dnl ac_cv_header_stdint_test="yes" # moved up before creating the file
411 else
412 AC_MSG_RESULT(... seen good stdint.h inttypes)
413 dnl ac_cv_header_stdint_test="no" # moved up before creating the file
414 fi
415
416 if test "$ac_cv_header_stdint_u" != "no-file" ; then
417 AC_MSG_RESULT(... seen bsd/sysv typedefs)
418 cat >>$ac_stdint_h <<EOF
419
420 /* int8_t int16_t int32_t defined by inet code, redeclare the u_intXX types */
421 typedef u_int8_t uint8_t;
422 typedef u_int16_t uint16_t;
423 typedef u_int32_t uint32_t;
424 EOF
425 cat >>$ac_stdint_h <<EOF
426
427 /* glibc compatibility */
428 #ifndef __int8_t_defined
429 #define __int8_t_defined
430 #endif
431 EOF
432 fi
433
434 ac_cv_sizeof_x="$ac_cv_sizeof_char:$ac_cv_sizeof_short"
435 ac_cv_sizeof_X="$ac_cv_sizeof_x:$ac_cv_sizeof_int"
436 ac_cv_sizeof_X="$ac_cv_sizeof_X:$ac_cv_sizeof_voidp:$ac_cv_sizeof_long"
437 if test "$ac_cv_header_stdint" = "stddef.h" ; then
438 # we must guess all the basic types. Apart from byte-adressable system,
439 # there a few 32-bit-only dsp-systems. nibble-addressable systems are way off.
440 cat >>$ac_stdint_h <<EOF
441 /* ------------ BITSPECIFIC INTTYPES SECTION --------------- */
442 EOF
443 t="typedefs for a"
444 case "$ac_cv_sizeof_X" in
445 1:2:2:2:4) AC_MSG_RESULT(..adding $t normal 16-bit system)
446 cat >>$ac_stdint_h <<EOF
447 /* a normal 16-bit system */
448 typedef unsigned char uint8_t;
449 typedef unsigned short uint16_t;
450 typedef unsigned long uint32_t;
451 #ifndef __int8_t_defined
452 #define __int8_t_defined
453 typedef char int8_t;
454 typedef short int16_t;
455 typedef long int32_t;
456 #endif
457 EOF
458 ;;
459 1:2:2:4:4) AC_MSG_RESULT(..adding $t 32-bit system derived from a 16-bit)
460 cat >>$ac_stdint_h <<EOF
461 /* a 32-bit system derived from a 16-bit */
462 typedef unsigned char uint8_t;
463 typedef unsigned short uint16_t;
464 typedef unsigned int uint32_t;
465 #ifndef __int8_t_defined
466 #define __int8_t_defined
467 typedef char int8_t;
468 typedef short int16_t;
469 typedef int int32_t;
470 #endif
471 EOF
472 ;;
473 1:2:4:4:4) AC_MSG_RESULT(..adding $t normal 32-bit system)
474 cat >>$ac_stdint_h <<EOF
475 /* a normal 32-bit system */
476 typedef unsigned char uint8_t;
477 typedef unsigned short uint16_t;
478 typedef unsigned int uint32_t;
479 #ifndef __int8_t_defined
480 #define __int8_t_defined
481 typedef char int8_t;
482 typedef short int16_t;
483 typedef int int32_t;
484 #endif
485 EOF
486 ;;
487 1:2:4:4:8) AC_MSG_RESULT(..adding $t 32-bit system prepared for 64-bit)
488 cat >>$ac_stdint_h <<EOF
489
490 /* a 32-bit system prepared for 64-bit */
491 typedef unsigned char uint8_t;
492 typedef unsigned short uint16_t;
493 typedef unsigned int uint32_t;
494 #ifndef __int8_t_defined
495 #define __int8_t_defined
496 typedef char int8_t;
497 typedef short int16_t;
498 typedef int int32_t;
499 #endif
500 EOF
501 ;;
502 1:2:4:8:8) AC_MSG_RESULT(..adding $t normal 64-bit system)
503 cat >>$ac_stdint_h <<EOF
504
505 /* a normal 64-bit system */
506 typedef unsigned char uint8_t;
507 typedef unsigned short uint16_t;
508 typedef unsigned int uint32_t;
509 #ifndef __int8_t_defined
510 #define __int8_t_defined
511 typedef char int8_t;
512 typedef short int16_t;
513 typedef int int32_t;
514 #endif
515 EOF
516 ;;
517 1:2:4:8:4) AC_MSG_RESULT(..adding $t 64-bit system derived from a 32-bit)
518 cat >>$ac_stdint_h <<EOF
519
520 /* a 64-bit system derived from a 32-bit system */
521 typedef unsigned char uint8_t;
522 typedef unsigned short uint16_t;
523 typedef unsigned int uint32_t;
524 #ifndef __int8_t_defined
525 #define __int8_t_defined
526 typedef char int8_t;
527 typedef short int16_t;
528 typedef int int32_t;
529 #endif
530 EOF
531 ;;
532 *)
533 AC_MSG_ERROR([ $ac_cv_sizeof_X dnl
534 what is that a system? contact the author, quick! http://ac-archive.sf.net])
535 exit 1
536 ;;
537 esac
538 fi
539
540 # ------------- DONE basic int types START int64_t types ------------
541 if test "$ac_cv_type_uint64_t" = "yes"
542 then AC_MSG_RESULT(... seen good uint64_t)
543 cat >>$ac_stdint_h <<EOF
544
545 /* system headers have good uint64_t */
546 #ifndef _HAVE_UINT64_T
547 #define _HAVE_UINT64_T
548 #endif
549 EOF
550
551 elif test "$ac_cv_type_u_int64_t" = "yes"
552 then AC_MSG_RESULT(..adding typedef u_int64_t uint64_t)
553 cat >>$ac_stdint_h <<EOF
554
555 /* system headers have an u_int64_t */
556 #ifndef _HAVE_UINT64_T
557 #define _HAVE_UINT64_T
558 typedef u_int64_t uint64_t;
559 #endif
560 EOF
561 else AC_MSG_RESULT(..adding generic uint64_t runtime checks)
562 cat >>$ac_stdint_h <<EOF
563
564 /* -------------------- 64 BIT GENERIC SECTION -------------------- */
565 /* here are some common heuristics using compiler runtime specifics */
566 #if defined __STDC_VERSION__ && defined __STDC_VERSION__ > 199901L
567
568 #ifndef _HAVE_UINT64_T
569 #define _HAVE_UINT64_T
570 typedef long long int64_t;
571 typedef unsigned long long uint64_t;
572 #endif
573
574 #elif !defined __STRICT_ANSI__
575 #if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__
576
577 #ifndef _HAVE_UINT64_T
578 #define _HAVE_UINT64_T
579 typedef __int64 int64_t;
580 typedef unsigned __int64 uint64_t;
581 #endif
582
583 #elif defined __GNUC__ || defined __MWERKS__ || defined __ELF__
584 dnl /* note: all ELF-systems seem to have loff-support which needs 64-bit */
585
586 #if !defined _NO_LONGLONG
587 #ifndef _HAVE_UINT64_T
588 #define _HAVE_UINT64_T
589 typedef long long int64_t;
590 typedef unsigned long long uint64_t;
591 #endif
592 #endif
593
594 #elif defined __alpha || (defined __mips && defined _ABIN32)
595
596 #if !defined _NO_LONGLONG
597 #ifndef _HAVE_UINT64_T
598 #define _HAVE_UINT64_T
599 typedef long int64_t;
600 typedef unsigned long uint64_t;
601 #endif
602 #endif
603 /* compiler/cpu type ... or just ISO C99 */
604 #endif
605 #endif
606 EOF
607
608 # plus a default 64-bit for systems that are likely to be 64-bit ready
609 case "$ac_cv_sizeof_x:$ac_cv_sizeof_voidp:$ac_cv_sizeof_long" in
610 1:2:8:8) AC_MSG_RESULT(..adding uint64_t default, normal 64-bit system)
611 cat >>$ac_stdint_h <<EOF
612 /* DEFAULT: */
613 /* seen normal 64-bit system, CC has sizeof(long and void*) == 8 bytes */
614 #ifndef _HAVE_UINT64_T
615 #define _HAVE_UINT64_T
616 typedef long int64_t;
617 typedef unsigned long uint64_t;
618 #endif
619 EOF
620 ;;
621 1:2:4:8) AC_MSG_RESULT(..adding uint64_t default, typedef to long)
622 cat >>$ac_stdint_h <<EOF
623 /* DEFAULT: */
624 /* seen 32-bit system prepared for 64-bit, CC has sizeof(long) == 8 bytes */
625 #ifndef _HAVE_UINT64_T
626 #define _HAVE_UINT64_T
627 typedef long int64_t;
628 typedef unsigned long uint64_t;
629 #endif
630 EOF
631 ;;
632 1:2:8:4) AC_MSG_RESULT(..adding uint64_t default, typedef long long)
633 cat >>$ac_stdint_h <<EOF
634 /* DEFAULT: */
635 /* seen 64-bit derived from a 32-bit, CC has sizeof(long) == 4 bytes */
636 #ifndef _HAVE_UINT64_T
637 #define _HAVE_UINT64_T
638 typedef long long int64_t;
639 typedef unsigned long long uint64_t;
640 #endif
641 EOF
642 ;;
643 *)
644 cat >>$ac_stdint_h <<EOF
645 /* NOTE: */
646 /* the configure-checks for the basic types did not make us believe */
647 /* that we could add a fallback to a 'long long' typedef to int64_t */
648 EOF
649 esac
650 fi
651
652 # ------------- DONE int64_t types START intptr types ------------
653 if test "$ac_cv_header_stdint_x" = "no-file" ; then
654 cat >>$ac_stdint_h <<EOF
655
656 /* -------------------------- INPTR SECTION --------------------------- */
657 EOF
658 case "$ac_cv_sizeof_x:$ac_cv_sizeof_voidp" in
659 1:2:2)
660 a="int16_t" ; cat >>$ac_stdint_h <<EOF
661 /* we tested sizeof(void*) to be of 2 chars, hence we declare it 16-bit */
662
663 typedef uint16_t uintptr_t;
664 typedef int16_t intptr_t;
665 EOF
666 ;;
667 1:2:4)
668 a="int32_t" ; cat >>$ac_stdint_h <<EOF
669 /* we tested sizeof(void*) to be of 4 chars, hence we declare it 32-bit */
670
671 typedef uint32_t uintptr_t;
672 typedef int32_t intptr_t;
673 EOF
674 ;;
675 1:2:8)
676 a="int64_t" ; cat >>$ac_stdint_h <<EOF
677 /* we tested sizeof(void*) to be of 8 chars, hence we declare it 64-bit */
678
679 typedef uint64_t uintptr_t;
680 typedef int64_t intptr_t;
681 EOF
682 ;;
683 *)
684 a="long" ; cat >>$ac_stdint_h <<EOF
685 /* we tested sizeof(void*) but got no guess, hence we declare it as if long */
686
687 typedef unsigned long uintptr_t;
688 typedef long intptr_t;
689 EOF
690 ;;
691 esac
692 AC_MSG_RESULT(..adding typedef $a intptr_t)
693 fi
694
695 # ------------- DONE intptr types START int_least types ------------
696 if test "$ac_cv_type_int_least32_t" = "no"; then
697 AC_MSG_RESULT(..adding generic int_least-types)
698 cat >>$ac_stdint_h <<EOF
699
700 /* --------------GENERIC INT_LEAST ------------------ */
701
702 typedef int8_t int_least8_t;
703 typedef int16_t int_least16_t;
704 typedef int32_t int_least32_t;
705 #ifdef _HAVE_UINT64_T
706 typedef int64_t int_least64_t;
707 #endif
708
709 typedef uint8_t uint_least8_t;
710 typedef uint16_t uint_least16_t;
711 typedef uint32_t uint_least32_t;
712 #ifdef _HAVE_UINT64_T
713 typedef uint64_t uint_least64_t;
714 #endif
715 EOF
716 fi
717
718 # ------------- DONE intptr types START int_least types ------------
719 if test "$ac_cv_type_int_fast32_t" = "no"; then
720 AC_MSG_RESULT(..adding generic int_fast-types)
721 cat >>$ac_stdint_h <<EOF
722
723 /* --------------GENERIC INT_FAST ------------------ */
724
725 typedef int8_t int_fast8_t;
726 typedef int32_t int_fast16_t;
727 typedef int32_t int_fast32_t;
728 #ifdef _HAVE_UINT64_T
729 typedef int64_t int_fast64_t;
730 #endif
731
732 typedef uint8_t uint_fast8_t;
733 typedef uint32_t uint_fast16_t;
734 typedef uint32_t uint_fast32_t;
735 #ifdef _HAVE_UINT64_T
736 typedef uint64_t uint_fast64_t;
737 #endif
738 EOF
739 fi
740
741 if test "$ac_cv_header_stdint_x" = "no-file" ; then
742 cat >>$ac_stdint_h <<EOF
743
744 #ifdef _HAVE_UINT64_T
745 typedef int64_t intmax_t;
746 typedef uint64_t uintmax_t;
747 #else
748 typedef long int intmax_t;
749 typedef unsigned long uintmax_t;
750 #endif
751 EOF
752 fi
753
754 AC_MSG_RESULT(... DONE $ac_stdint_h)
755 cat >>$ac_stdint_h <<EOF
756
757 /* once */
758 #endif
759 #endif
760 EOF
761 ])
762
763 dnl quote from SunOS-5.8 sys/inttypes.h:
764 dnl Use at your own risk. As of February 1996, the committee is squarely
765 dnl behind the fixed sized types; the "least" and "fast" types are still being
766 dnl discussed. The probability that the "fast" types may be removed before
767 dnl the standard is finalized is high enough that they are not currently
768 dnl implemented.
769
770
771
772 dnl AC_LIBRARY_NET
773 dnl Written by John Hawkinson <jhawk@mit.edu>. This code is in the Public
774 dnl Domain.
775 dnl
776 dnl This test is for network applications that need socket() and
777 dnl gethostbyname() -ish functions. Under Solaris, those applications need to
778 dnl link with "-lsocket -lnsl". Under IRIX, they should *not* link with
779 dnl "-lsocket" because libsocket.a breaks a number of things (for instance:
780 dnl gethostbyname() under IRIX 5.2, and snoop sockets under most versions of
781 dnl IRIX).
782 dnl
783 dnl Unfortunately, many application developers are not aware of this, and
784 dnl mistakenly write tests that cause -lsocket to be used under IRIX. It is
785 dnl also easy to write tests that cause -lnsl to be used under operating
786 dnl systems where neither are necessary (or useful), such as SunOS 4.1.4, which
787 dnl uses -lnsl for TLI.
788 dnl
789 dnl This test exists so that every application developer does not test this in
790 dnl a different, and subtly broken fashion.
791 dnl
792 dnl It has been argued that this test should be broken up into two seperate
793 dnl tests, one for the resolver libraries, and one for the libraries necessary
794 dnl for using Sockets API. Unfortunately, the two are carefully intertwined and
795 dnl allowing the autoconf user to use them independantly potentially results in
796 dnl unfortunate ordering dependancies -- as such, such component macros would
797 dnl have to carefully use indirection and be aware if the other components were
798 dnl executed. Since other autoconf macros do not go to this trouble, and almost
799 dnl no applications use sockets without the resolver, this complexity has not
800 dnl been implemented.
801 dnl
802 dnl The check for libresolv is in case you are attempting to link statically
803 dnl and happen to have a libresolv.a lying around (and no libnsl.a).
804 dnl
805 AC_DEFUN(AC_LIBRARY_NET, [
806 # Most operating systems have gethostbyname() in the default searched
807 # libraries (i.e. libc):
808 AC_CHECK_FUNC(gethostbyname, ,
809 # Some OSes (eg. Solaris) place it in libnsl:
810 AC_CHECK_LIB(nsl, gethostbyname, ,
811 # Some strange OSes (SINIX) have it in libsocket:
812 AC_CHECK_LIB(socket, gethostbyname, ,
813 # Unfortunately libsocket sometimes depends on libnsl.
814 # AC_CHECK_LIB's API is essentially broken so the following
815 # ugliness is necessary:
816 AC_CHECK_LIB(socket, gethostbyname,
817 LIBS="-lsocket -lnsl $LIBS",
818 AC_CHECK_LIB(resolv, gethostbyname),
819 -lnsl)
820 )
821 )
822 )
823 AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket, ,
824 AC_CHECK_LIB(socket, socket, LIBS="-lsocket -lnsl $LIBS", , -lnsl)))
825 ])
826
827
828 dnl +little fix for solaris sh --mbuna
829 dnl
830 dnl ______ /usr/share/aclocal/rleigh/ac_config_libconfig_in.m4 ______
831 dnl @synopsis AC_CONFIG_LIBCONFIG_IN [(LIBRARY [, DESTINATION [, MODULES]])]
832 dnl
833 dnl Creates a custom LIBRARY-config script. The script supports
834 dnl --cflags, --libs and --version options, as well as all of the
835 dnl standard configure variables e.g. --libdir and --sysconfdir.
836 dnl --prefix and --exec-prefix may be specified to override the
837 dnl defaults. --help gives a complete list of available options.
838 dnl Modules allow multiple sets of --libs, --cflags and --version
839 dnl options to be used, and combined together.
840 dnl
841 dnl This macro saves you all the typing for a library-config.in script;
842 dnl you don't even need to distribute one along. Place this macro
843 dnl in your configure.ac, et voila, you got one that you want to install.
844 dnl
845 dnl The options:
846 dnl
847 dnl $1 = LIBRARY e.g. gtk, ncurses
848 dnl $2 = DESTINATION Directory path, e.g. src/scripts
849 dnl $3 = MODULES Additional library modules, not including the
850 dnl default ($1).
851 dnl
852 dnl It is suggested that the following CFLAGS and LIBS variables are
853 dnl used in your configure.in. library_libs is *essential*.
854 dnl library_cflags is important, but not always needed. If they do not
855 dnl exist, defaults will be taken from LIBRARY_CFLAGS, LIBRARY_LIBS
856 dnl (should be -llibrary *only*) and LIBRARY_LIBDEPS (-l options for
857 dnl libraries your library depends upon.
858 dnl LIBLIBRARY_LIBS is simply $LIBRARY_LIBS $LIBRARY_LIBDEPS.
859 dnl NB. LIBRARY and library are the name of your library, in upper and
860 dnl lower case repectively e.g. GTK, gtk.
861 dnl
862 dnl LIBRARY_CFLAGS: cflags for compiling libraries and example progs
863 dnl LIBRARY_LIBS: libraries for linking programs
864 dnl LIBRARY_LIBDEPS*: libraries for linking libraries against (needed
865 dnl to link -static
866 dnl library_cflags*: cflags to store in library-config
867 dnl library_libs*: libs to store in library-config
868 dnl LIBLIBRARY_LIBS: libs to link programs IN THIS PACKAGE ONLY against
869 dnl LIBRARY_VERSION*: the version of your library (x.y.z recommended)
870 dnl *=required if you want sensible output, otherwise they will be
871 dnl *guessed* (DWIM)
872 dnl
873 dnl Support for pkg-config is available by default. libs, cflags and
874 dnl version information will be obtained from the pkg-config metadata
875 dnl file library.pc if it exists in the pkgconfig data directory.
876 dnl The above information still needs to be specified, as it will still
877 dnl be used if pkg-config is not found on the host system at configure
878 dnl time.
879 dnl
880 dnl -I and -L flags will be obtained from *both* pkgconfig and the script.
881 dnl AC_CONFIG_LIBCONFIG_IN_PKGCONFIG enables pkg-config support (default)
882 dnl AC_CONFIG_LIBCONFIG_IN_STATIC disables pkg-config support
883 dnl
884 dnl There is also an AC_SUBST(LIBRARY_CONFIG) that will be set to
885 dnl the name of the file that we output in this macro. Use as:
886 dnl
887 dnl install-exec-local: install-config
888 dnl install-config:
889 dnl $(mkinstalldirs) $(DESTDIR)$(bindir)
890 dnl $(INSTALL_EXEC) @LIBRARY_CONFIG@ $(DESTDIR)$(bindir)
891 dnl
892 dnl Or, if using automake:
893 dnl
894 dnl bin_SCRIPTS = @LIBRARY_CONFIG@
895 dnl
896 dnl Based upon AC_CREATE_GENERIC_CONFIG (ac_create_generic_config.m4)
897 dnl by Guido Draheim <guidod@gmx.de> and gtk-config by Owen Taylor.
898 dnl
899 dnl @version %Id: ac_config_libconfig_in.m4,v 1.4 2002/09/12 22:11:52 guidod Exp %
900 dnl @author Roger Leigh <roger@whinlatter.uklinux.net>
901 dnl
902 # AC_CONFIG_LIBCONFIG_IN(LIBRARY, DESTINATION, MODULES)
903 # -----------------------------------------------------
904 # Generate a custom LIBRARY-config script. Create the script in the
905 # DESTINATION directory, including support for MODULES.
906 AC_DEFUN([AC_CONFIG_LIBCONFIG_IN],
907 [# create a custom library-config file ($1-config)
908 m4_if(AC_CONFIG_LIBCONFIG_IN_USEPKGCONFIG, [true],
909 [AC_PATH_PROG(PKG_CONFIG, pkg-config)])
910 pushdef([LIBCONFIG_DIR], [m4_if([$2], , , [$2/])])
911 LIBCONFIG_FILE="LIBCONFIG_DIR[]$1-config.in"
912 AC_SUBST(target)dnl
913 AC_SUBST(host)dnl
914 AC_SUBST(build)dnl
915 dnl create directory if it does not preexist
916 m4_if([$2], , , [AS_MKDIR_P([$2])])
917 AC_MSG_NOTICE([creating $LIBCONFIG_FILE])
918 echo '#! /bin/sh' >$LIBCONFIG_FILE
919 echo "# $1-config library configuration script" >>$LIBCONFIG_FILE
920 echo '# generated by ac_config_libconfig_in.m4' >>$LIBCONFIG_FILE
921 echo ' ' >>$LIBCONFIG_FILE
922 echo 'template_version="1.0.0"' >>$LIBCONFIG_FILE
923 echo ' ' >>$LIBCONFIG_FILE
924 echo 'package="@PACKAGE@"' >>$LIBCONFIG_FILE
925 echo ' ' >>$LIBCONFIG_FILE
926 echo '# usage instructions if no options given' >>$LIBCONFIG_FILE
927 echo 'if test "'"\$""#"'" -eq 0; then' >>$LIBCONFIG_FILE
928 echo ' cat <<EOF' >>$LIBCONFIG_FILE
929 m4_if($3, ,
930 [echo 'Usage: $1-config [[OPTIONS]]' >>$LIBCONFIG_FILE],
931 [echo 'Usage: $1-config [[OPTIONS]] [[LIBRARIES]]' >>$LIBCONFIG_FILE])
932 echo 'Options:' >>$LIBCONFIG_FILE
933 echo ' [[--prefix[=DIR]]]' >>$LIBCONFIG_FILE
934 echo ' [[--exec-prefix[=DIR]]]' >>$LIBCONFIG_FILE
935 echo ' [[--package]]' >>$LIBCONFIG_FILE
936 echo ' [[--version]]' >>$LIBCONFIG_FILE
937 echo ' [[--cflags]]' >>$LIBCONFIG_FILE
938 echo ' [[--libs]]' >>$LIBCONFIG_FILE
939 echo ' [[--help]]' >>$LIBCONFIG_FILE
940 m4_if($3, , ,
941 [echo 'Libraries:' >>$LIBCONFIG_FILE
942 for module in $1 $3 ; do
943 echo " $module" >>$LIBCONFIG_FILE ;
944 done])
945 echo 'EOF' >>$LIBCONFIG_FILE
946 echo 'fi' >>$LIBCONFIG_FILE
947 echo ' ' >>$LIBCONFIG_FILE
948 echo '# parse options' >>$LIBCONFIG_FILE
949 echo 'o=""' >>$LIBCONFIG_FILE
950 echo 'h=""' >>$LIBCONFIG_FILE
951 echo 'for i in $''*; do' >>$LIBCONFIG_FILE
952 echo ' case $i in' >>$LIBCONFIG_FILE
953 options="prefix exec-prefix eprefix package version cflags libs bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir infodir mandir target host build pkgdatadir pkglibdir pkgincludedir template-version help"
954 echo ' --prefix=*) prefix=`echo $i | sed -e "s/--prefix=//"` ;;' >>$LIBCONFIG_FILE
955 echo ' --exec-prefix=*) exec_prefix=`echo $i | sed -e "s/--exec-prefix=//"` ;;' >>$LIBCONFIG_FILE
956 echo ' --eprefix=*) exec_prefix=`echo $i | sed -e "s/--eprefix=//"` ;;' >>$LIBCONFIG_FILE
957 for option in $options ; do
958 case $option in
959 exec-prefix) echo " --$option) echo_exec_prefix=\"yes\" ;;" >>$LIBCONFIG_FILE ;;
960 template-version) echo " --$option) echo_template_version=\"yes\" ;;" >>$LIBCONFIG_FILE ;;
961 *) echo " --$option) echo_$option=\"yes\" ;;" >>$LIBCONFIG_FILE ;;
962 esac
963 done
964 m4_if($3, , ,
965 [for module in $1 $3 ; do
966 echo " $module) echo_module_$module=\"yes\" ;" >>$LIBCONFIG_FILE ;
967 echo ' echo_module="yes" ;;' >>$LIBCONFIG_FILE ;
968 done])
969 echo ' //*|/*//*|./*//*) echo_extra="yes" ;;' >>$LIBCONFIG_FILE
970 echo ' *) eval "echo Unknown option: $i" ; exit 1 ;;' >>$LIBCONFIG_FILE
971 echo ' esac' >>$LIBCONFIG_FILE
972 echo 'done' >>$LIBCONFIG_FILE
973 echo ' ' >>$LIBCONFIG_FILE
974 # in the order of occurence a standard automake Makefile
975 echo '# defaults from configure; set only if not set previously' >>$LIBCONFIG_FILE
976 vars="prefix exec_prefix bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir infodir mandir includedir target host build"
977 for var in $vars ; do
978 echo "if test -z \"\$$var\" ; then" >>$LIBCONFIG_FILE
979 echo " $var=\"@$var@\"" >>$LIBCONFIG_FILE
980 echo 'fi' >>$LIBCONFIG_FILE
981 done
982 echo ' ' >>$LIBCONFIG_FILE
983 echo '# generate output' >>$LIBCONFIG_FILE
984 echo 'if test x$echo_module != xyes ; then' >>$LIBCONFIG_FILE
985 echo ' echo_module_$1="yes"' >>$LIBCONFIG_FILE
986 echo 'fi' >>$LIBCONFIG_FILE
987 AC_CONFIG_LIBCONFIG_IN_MODULES(m4_if([$3], , [$1], [m4_translit([$1 $3], [ ], [,])]))dnl
988 for option in $options extra; do
989 case $option in
990 exec-prefix) echo "if test x\$echo_exec_prefix = xyes ; then" >>$LIBCONFIG_FILE ;;
991 template-version) echo "if test x\$echo_template_version = xyes ; then" >>$LIBCONFIG_FILE ;;
992 *) echo "if test x\$echo_$option = xyes ; then" >>$LIBCONFIG_FILE ;;
993 esac
994 case $option in
995 exec-prefix | eprefix) echo ' o="$o $exec_prefix"' >>$LIBCONFIG_FILE ;;
996 template-version) echo ' o="$o $template_version"' >>$LIBCONFIG_FILE ;;
997 cflags)
998 echo ' i=`eval echo "$includedir"`' >>$LIBCONFIG_FILE ;
999 echo ' i=`eval echo "$i"`' >>$LIBCONFIG_FILE ;
1000 echo ' if test "_$i" != "_/usr/include" ; then' >>$LIBCONFIG_FILE ;
1001 echo ' o="$o -I$includedir"' >>$LIBCONFIG_FILE ;
1002 echo ' fi' >>$LIBCONFIG_FILE ;
1003 echo ' o="$o $cflags"' >>$LIBCONFIG_FILE ;;
1004 libs) echo ' o="$o -L$libdir $libs"' >>$LIBCONFIG_FILE ;;
1005 help) echo ' h="1"' >>$LIBCONFIG_FILE ;;
1006 pkgdatadir) echo " o=\"$o \${datadir}/\${package}\"" >>$LIBCONFIG_FILE ;;
1007 pkglibdir) echo " o=\"$o \${libdir}/\${package}\"" >>$LIBCONFIG_FILE ;;
1008 pkgincludedir) echo " o=\"$o \${includedir}/\${package}\"" >>$LIBCONFIG_FILE ;;
1009 extra)
1010 echo ' v=`echo $i | sed -e s://:\$:g`' >>$LIBCONFIG_FILE ;
1011 echo ' v=`eval "echo $v"`' >>$LIBCONFIG_FILE ;
1012 echo ' o="$o $v"' >>$LIBCONFIG_FILE ;;
1013 *) echo " o=\"$o \$$option\"" >>$LIBCONFIG_FILE
1014 esac
1015 echo 'fi' >>$LIBCONFIG_FILE
1016 done
1017 echo ' ' >>$LIBCONFIG_FILE
1018 echo '# output data' >>$LIBCONFIG_FILE
1019 echo 'o=`eval "echo $o"`' >>$LIBCONFIG_FILE
1020 echo 'o=`eval "echo $o"`' >>$LIBCONFIG_FILE
1021 echo 'if test -n "$o" ; then ' >>$LIBCONFIG_FILE
1022 echo ' eval "echo $o"' >>$LIBCONFIG_FILE
1023 echo 'fi' >>$LIBCONFIG_FILE
1024 echo ' ' >>$LIBCONFIG_FILE
1025 echo '# help text' >>$LIBCONFIG_FILE
1026 echo 'if test ! -z "$h" ; then ' >>$LIBCONFIG_FILE
1027 echo ' cat <<EOF' >>$LIBCONFIG_FILE
1028 echo 'All available options:' >>$LIBCONFIG_FILE
1029 echo ' --prefix=DIR and change \$prefix and \$exec-prefix' >>$LIBCONFIG_FILE
1030 echo ' --exec-prefix=DIR (affects all other options)' >>$LIBCONFIG_FILE
1031 echo ' --prefix \$prefix $prefix' >>$LIBCONFIG_FILE
1032 echo ' --exec_prefix or... ' >>$LIBCONFIG_FILE
1033 echo ' --eprefix \$exec_prefix $exec_prefix' >>$LIBCONFIG_FILE
1034 echo ' --version \$version $version' >>$LIBCONFIG_FILE
1035 echo ' --cflags -I\$includedir unless it is /usr/include' >>$LIBCONFIG_FILE
1036 echo ' --libs -L\$libdir \$LIBS $libs' >>$LIBCONFIG_FILE
1037 echo ' --package \$package $package' >>$LIBCONFIG_FILE
1038 echo ' --bindir \$bindir $bindir' >>$LIBCONFIG_FILE
1039 echo ' --sbindir \$sbindir $sbindir' >>$LIBCONFIG_FILE
1040 echo ' --libexecdir \$libexecdir $libexecdir' >>$LIBCONFIG_FILE
1041 echo ' --datadir \$datadir $datadir' >>$LIBCONFIG_FILE
1042 echo ' --sysconfdir \$sysconfdir $sysconfdir' >>$LIBCONFIG_FILE
1043 echo ' --sharedstatedir \$sharedstatedir$sharedstatedir' >>$LIBCONFIG_FILE
1044 echo ' --localstatedir \$localstatedir $localstatedir' >>$LIBCONFIG_FILE
1045 echo ' --libdir \$libdir $libdir' >>$LIBCONFIG_FILE
1046 echo ' --infodir \$infodir $infodir' >>$LIBCONFIG_FILE
1047 echo ' --mandir \$mandir $mandir' >>$LIBCONFIG_FILE
1048 echo ' --target \$target $target' >>$LIBCONFIG_FILE
1049 echo ' --host \$host $host' >>$LIBCONFIG_FILE
1050 echo ' --build \$build $build' >>$LIBCONFIG_FILE
1051 echo ' --pkgdatadir \$datadir/\$package ${datadir}/${package}' >>$LIBCONFIG_FILE
1052 echo ' --pkglibdir \$libdir/\$package ${libdir}/${package}' >>$LIBCONFIG_FILE
1053 echo ' --pkgincludedir \$includedir/\$package ${includedir}/${package}' >>$LIBCONFIG_FILE
1054 echo ' --template-version \$template_version $template_version' >>$LIBCONFIG_FILE
1055 echo ' --help' >>$LIBCONFIG_FILE
1056 echo 'EOF' >>$LIBCONFIG_FILE
1057 echo 'fi' >>$LIBCONFIG_FILE
1058 m4_pushdef([LIBCONFIG_UP], [m4_translit([$1], [a-z], [A-Z])])dnl
1059 LIBCONFIG_UP[]_CONFIG="LIBCONFIG_DIR[]$1-config"
1060 AC_SUBST(LIBCONFIG_UP[]_CONFIG)
1061 dnl AC_CONFIG_FILES(LIBCONFIG_DIR[]$1[-config], [chmod +x ]LIBCONFIG_DIR[]$1[-config])
1062 m4_popdef([LIBCONFIG_DIR])
1063 m4_popdef([LIBCONFIG_UP])
1064 ])
1065
1066
1067 # AC_CONFIG_LIBCONFIG_IN_MODULES [(MODULE1 [, MODULE2 [, ...]])]
1068 # --------------------------------------------------------------
1069 #Output shell script using custom module variables.
1070 AC_DEFUN([AC_CONFIG_LIBCONFIG_IN_MODULES],
1071 [m4_if([$1], , ,
1072 [# create module definition for $1
1073 dnl we're going to need uppercase, lowercase and user-friendly versions of the
1074 dnl string `MODULE'
1075 m4_pushdef([MODULE_UP], m4_translit([$1], [a-z], [A-Z]))dnl
1076 m4_pushdef([MODULE_DOWN], m4_translit([$1], [A-Z], [a-z]))dnl
1077 if test -z "$MODULE_DOWN[]_cflags" ; then
1078 if test -n "$MODULE_UP[]_CFLAGS" ; then
1079 MODULE_DOWN[]_cflags="$MODULE_UP[]_CFLAGS"
1080 else
1081 dnl AC_MSG_WARN([variable `MODULE_DOWN[]_cflags' undefined])
1082 MODULE_DOWN[]_cflags=''
1083 fi
1084 fi
1085 AC_SUBST(MODULE_DOWN[]_cflags)dnl
1086 if test -z "$MODULE_DOWN[]_libs" ; then
1087 if test -n "$MODULE_UP[]_LIBS" ; then
1088 MODULE_DOWN[]_libs="$MODULE_UP[]_LIBS"
1089 else
1090 AC_MSG_WARN([variable `MODULE_DOWN[]_libs' and `MODULE_UP[]_LIBS' undefined])
1091 MODULE_DOWN[]_libs='-l$1'
1092 fi
1093 if test -n "$MODULE_UP[]_LIBDEPS" ; then
1094 MODULE_DOWN[]_libs="$MODULE_DOWN[]_libs $MODULE_UP[]_LIBDEPS"
1095 fi
1096 fi
1097 AC_SUBST(MODULE_DOWN[]_libs)dnl
1098 if test -z "$MODULE_UP[]_VERSION" ; then
1099 AC_MSG_WARN([variable `MODULE_UP[]_VERSION' undefined])
1100 MODULE_UP[]_VERSION="$VERSION"
1101 fi
1102 AC_SUBST(MODULE_UP[]_VERSION)dnl
1103 echo 'if test x$echo_module_$1 = xyes ; then' >>$LIBCONFIG_FILE
1104 AC_CONFIG_LIBCONFIG_IN_MODULES_VARS([cflags], [MODULE_DOWN[]_cflags], [cflags])
1105 AC_CONFIG_LIBCONFIG_IN_MODULES_VARS([libs], [MODULE_DOWN[]_libs], [libs])
1106 AC_CONFIG_LIBCONFIG_IN_MODULES_VARS([version], [MODULE_UP[]_VERSION], [modversion])
1107 echo 'fi' >>$LIBCONFIG_FILE
1108 m4_popdef([MODULE_UP])dnl
1109 m4_popdef([MODULE_DOWN])dnl
1110 AC_CONFIG_LIBCONFIG_IN_MODULES(m4_shift($@))])dnl
1111 ])
1112
1113
1114 # AC_CONFIG_LIBCONFIG_IN_MODULES_VARS [(VAR, SUBSTITUTION,
1115 # PKGCONFIG_ARGS)]
1116 # --------------------------------------------------------
1117 # Output AC_CONFIG_LIBCONFIG_IN_MODULES variables.
1118 # VAR = variable to set
1119 # SUBSTITUTION = set if pkg-config is not available
1120 # PKGCONFIG_ARGS = args for pkg-config
1121 AC_DEFUN([AC_CONFIG_LIBCONFIG_IN_MODULES_VARS],
1122 [m4_if(AC_CONFIG_LIBCONFIG_IN_USEPKGCONFIG, [true],
1123 [
1124 echo 'if test -x "`which pkg-config`" ; then' >>$LIBCONFIG_FILE
1125 echo ' if pkg-config --atleast-pkgconfig-version=0.7 --exists "MODULE_DOWN"; then' >>$LIBCONFIG_FILE
1126 echo ' $1="@S|@$1 `pkg-config --$3 MODULE_DOWN`"' >>$LIBCONFIG_FILE
1127 echo ' fi' >>$LIBCONFIG_FILE
1128 echo 'else' >>$LIBCONFIG_FILE
1129 echo ' $1="@S|@$1 @$2@"' >>$LIBCONFIG_FILE
1130 echo 'fi' >>$LIBCONFIG_FILE
1131 ],
1132 [echo ' $1="@S|@$1 @$2@"' >>$LIBCONFIG_FILE
1133 ])])
1134
1135
1136 # AC_CONFIG_LIBCONFIG_IN_PKGCONFIG
1137 # --------------------------------
1138 # Enable pkgconfig support in libconfig script (default)
1139 AC_DEFUN([AC_CONFIG_LIBCONFIG_IN_PKGCONFIG],
1140 [m4_define([AC_CONFIG_LIBCONFIG_IN_USEPKGCONFIG], [true])
1141 ])dnl
1142
1143
1144 # AC_CONFIG_LIBCONFIG_IN_STATIC
1145 # -----------------------------
1146 # Disable pkgconfig support in libconfig script
1147 AC_DEFUN([AC_CONFIG_LIBCONFIG_IN_STATIC],
1148 [m4_define([AC_CONFIG_LIBCONFIG_IN_USEPKGCONFIG], [false])
1149 ])dnl