3000
|
1 dnl Autoconf support for Klibtool. |
4286
|
2 dnl $Id: acklibtool.m4,v 1.6 2003-01-04 19:30:09 jwe Exp $ |
3000
|
3 dnl |
|
4 dnl |
|
5 dnl Find the script, check for subprogs, etc. |
|
6 AC_DEFUN(kb_AC_PROG_LIBTOOL, |
|
7 [AC_REQUIRE([AC_PROG_RANLIB]) |
|
8 AC_REQUIRE([AC_CANONICAL_HOST]) |
|
9 # |
|
10 AC_MSG_CHECKING([for libtool object types]) |
|
11 # |
|
12 ## Check that the klibtool script is in ac_aux_dir. Don't bother to |
|
13 # scan PATH. For one thing, if we found it somewhere there, we couldn't |
|
14 # use that directory to put the config file ... and that's what we need |
|
15 # to do, to avoid having to configure in every subdirectory. |
|
16 LIBTOOL=$ac_aux_dir/klibtool |
|
17 AC_SUBST(LIBTOOL) |
|
18 if test ! -r $LIBTOOL; then |
|
19 AC_MSG_ERROR([klibtool not in $ac_aux_dir, goodbye]) |
|
20 exit 1 |
|
21 fi |
|
22 # |
|
23 ## Argument parsing: we support --enable-shared and --enable-static. |
4286
|
24 AC_ARG_ENABLE(shared, |
|
25 [ --enable-shared build shared libraries [default=no]],, |
|
26 [if test "$enableval" = no; then enable_shared=no; |
|
27 else enable_shared=yes; fi], |
|
28 enable_shared=no) |
|
29 # |
|
30 AC_ARG_ENABLE(static, |
|
31 [ --enable-static build static libraries [default=yes]],, |
|
32 [if test "$enableval" = no; then enable_static=no; |
|
33 else enable_static=yes; fi], |
|
34 enable_static=yes) |
3000
|
35 # |
|
36 # If they explicitly --enable-static, make that the link type. |
|
37 # More commonly, they will just --enable-shared; make that the link type. |
3172
|
38 # If they --disable-static, implicitly --enable-shared. |
|
39 # In any case, prepend to any existing LIBTOOL_OBJTYPES. |
3000
|
40 # If they really want to build both and link statically, |
|
41 # then they set LIBTOOL_OBJTYPES to SHARED and --enable-static. |
|
42 test "$enable_static" = yes && LIBTOOL_OBJTYPES=STATIC:$LIBTOOL_OBJTYPES |
3172
|
43 (test "$enable_shared" = yes \ |
|
44 || test "$enable_static" = no) \ |
|
45 && LIBTOOL_OBJTYPES=SHARED:$LIBTOOL_OBJTYPES |
3000
|
46 # Don't bother to remove the trailing :, it'll be ignored. |
|
47 # |
|
48 ## Finally: Run the klibtool configure command. |
|
49 LIBTOOL_OBJTYPES=$LIBTOOL_OBJTYPES RANLIB=$RANLIB \ |
3174
|
50 $LIBTOOL --source-dir $ac_aux_dir --config-dir . configure "$host" |
3000
|
51 AC_MSG_RESULT($LIBTOOL_OBJTYPES) |
|
52 ])dnl |
|
53 dnl |
|
54 dnl |
|
55 dnl Like AC_REPLACE_FUNCS, but add to LTLIBOBJS instead of LIBOBJS. |
|
56 AC_DEFUN(kb_AC_KLIBTOOL_REPLACE_FUNCS, |
|
57 [ dnl cannot require this function, since it doesn't have a provide call. |
|
58 AC_CHECK_FUNCS($1,, LTLIBOBJS="$LTLIBOBJS $ac_func.lo") |
|
59 AC_SUBST(LTLIBOBJS)dnl |
|
60 ])dnl |