tools/elf4rom/libs/libelf-0.8.10/aclocal.m4
changeset 34 92d87f2e53c2
equal deleted inserted replaced
33:1af5c1be89f8 34:92d87f2e53c2
       
     1 # aclocal.m4 - Local additions to Autoconf macros.
       
     2 # Copyright (C) 1995 - 2006 Michael Riepe
       
     3 #
       
     4 # This library is free software; you can redistribute it and/or
       
     5 # modify it under the terms of the GNU Library General Public
       
     6 # License as published by the Free Software Foundation; either
       
     7 # version 2 of the License, or (at your option) any later version.
       
     8 #
       
     9 # This library is distributed in the hope that it will be useful,
       
    10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    12 # Library General Public License for more details.
       
    13 #
       
    14 # You should have received a copy of the GNU Library General Public
       
    15 # License along with this library; if not, write to the Free Software
       
    16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
       
    17 
       
    18 # @(#) $Id: aclocal.m4,v 1.27 2007/09/07 12:07:59 michael Exp $
       
    19 
       
    20 AC_PREREQ(2.13)
       
    21 
       
    22 dnl mr_PACKAGE(package-name)
       
    23 AC_DEFUN(mr_PACKAGE, [changequote(<<, >>)dnl
       
    24   changequote([, ])dnl
       
    25   PACKAGE=$1
       
    26   VERSION=`cat $srcdir/VERSION`
       
    27   AC_SUBST(PACKAGE)
       
    28   AC_SUBST(VERSION)
       
    29   AC_ARG_ENABLE(maintainer-mode,
       
    30     [  --enable-maintainer-mode
       
    31                           enable maintainer-specific make rules (default: auto)],
       
    32     [mr_enable_maintainer_mode="$enableval"],
       
    33     [case :${I_AM_THE_MAINTAINER_OF}: in
       
    34       *:$1:*) mr_enable_maintainer_mode=yes;;
       
    35       *) mr_enable_maintainer_mode=no;;
       
    36     esac])
       
    37   if test x"$mr_enable_maintainer_mode" = x"yes"; then
       
    38     MAINT=
       
    39   else
       
    40     MAINT='maintainer-only-'
       
    41   fi
       
    42   AC_SUBST(MAINT)
       
    43 ])
       
    44 
       
    45 AC_DEFUN(mr_ENABLE_NLS, [
       
    46   AC_PROVIDE([$0])
       
    47 
       
    48   # Needed for `make dist' even if NLS is disabled.
       
    49   GMOFILES=
       
    50   MSGFILES=
       
    51   POFILES=
       
    52   for mr_lang in $ALL_LINGUAS; do
       
    53     GMOFILES="$GMOFILES $mr_lang.gmo"
       
    54     MSGFILES="$MSGFILES $mr_lang.msg"
       
    55     POFILES="$POFILES $mr_lang.po"
       
    56   done
       
    57   AC_SUBST(GMOFILES)
       
    58   AC_SUBST(MSGFILES)
       
    59   AC_SUBST(POFILES)
       
    60 
       
    61   AC_MSG_CHECKING([whether NLS is requested])
       
    62   AC_ARG_ENABLE(nls,
       
    63     [  --enable-nls            use Native Language Support (default: yes)],
       
    64     [mr_enable_nls="$enableval"],
       
    65     [mr_enable_nls=yes])
       
    66   AC_MSG_RESULT($mr_enable_nls)
       
    67 
       
    68   CATOBJEXT=
       
    69   INSTOBJEXT=
       
    70   localedir=
       
    71   if test "$mr_enable_nls" = yes; then
       
    72     mr_PATH=`echo ":$PATH" | sed -e 's,:[^:]*openwin[^:]*,,g' -e 's,^:,,'`
       
    73     AC_CACHE_CHECK([for dgettext],
       
    74       mr_cv_func_dgettext, [
       
    75 	AC_TRY_LINK([#include <libintl.h>],
       
    76 	  [char *s = dgettext("", ""); return 0],
       
    77 	  [mr_cv_func_dgettext=yes],
       
    78 	  [mr_cv_func_dgettext=no])
       
    79     ])
       
    80     if test "$mr_cv_func_dgettext" = yes; then
       
    81       AC_PATH_PROG(MSGFMT, msgfmt, no, $mr_PATH)
       
    82       if test "$MSGFMT" != no; then
       
    83 	AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT, $mr_PATH)
       
    84 	AC_PATH_PROG(XGETTEXT, xgettext, xgettext, $mr_PATH)
       
    85 	AC_PATH_PROG(MSGMERGE, msgmerge, msgmerge, $mr_PATH)
       
    86 	AC_CACHE_CHECK([for GNU gettext],
       
    87 	  mr_cv_gnu_gettext, [
       
    88 	    AC_TRY_LINK([],
       
    89 	      [extern int _nl_msg_cat_cntr; return _nl_msg_cat_cntr],
       
    90 	      [mr_cv_gnu_gettext=yes],
       
    91 	      [mr_cv_gnu_gettext=no])
       
    92 	])
       
    93 	if test "$mr_cv_gnu_gettext" = yes; then
       
    94 	  AC_CACHE_CHECK([for losing catgets-based GNU gettext],
       
    95 	    mr_cv_catgets_based_gettext, [
       
    96 	      AC_TRY_LINK([],
       
    97 		[extern int _msg_tbl_length; return _msg_tbl_length],
       
    98 		[mr_cv_catgets_based_gettext=yes],
       
    99 		[mr_cv_catgets_based_gettext=no])
       
   100 	  ])
       
   101 	  if test "$mr_cv_catgets_based_gettext" = yes; then
       
   102 	    # This loses completely. Turn it off and use catgets.
       
   103 	    LIBS=`echo $LIBS | sed 's,-lintl,,g'`
       
   104 	    mr_cv_func_dgettext=no
       
   105 	  else
       
   106 	    # Is there a better test for this case?
       
   107 	    AC_CACHE_CHECK([for pure GNU gettext],
       
   108 	      mr_cv_pure_gnu_gettext, [
       
   109 		AC_TRY_LINK([],
       
   110 		  [extern int gettext(); return gettext()],
       
   111 		  [mr_cv_pure_gnu_gettext=yes],
       
   112 		  [mr_cv_pure_gnu_gettext=no])
       
   113 	    ])
       
   114 	    if test "$mr_cv_pure_gnu_gettext" = yes; then
       
   115 	      CATOBJEXT=.gmo
       
   116 	      localedir='$(prefix)/share/locale'
       
   117 	    else
       
   118 	      CATOBJEXT=.mo
       
   119 	      localedir='$(prefix)/lib/locale'
       
   120 	    fi
       
   121 	    INSTOBJEXT=.mo
       
   122 	  fi
       
   123 	else
       
   124 	  # System provided gettext
       
   125 	  CATOBJEXT=.mo
       
   126 	  INSTOBJEXT=.mo
       
   127 	  localedir='$(prefix)/lib/locale'
       
   128 	fi
       
   129       else
       
   130 	# Gettext but no msgfmt. Try catgets.
       
   131 	mr_cv_func_dgettext=no
       
   132       fi
       
   133     fi
       
   134     if test "$mr_cv_func_dgettext" = yes; then
       
   135       AC_DEFINE(HAVE_DGETTEXT)
       
   136     else
       
   137       AC_CACHE_CHECK([for catgets], mr_cv_func_catgets, [
       
   138 	AC_TRY_LINK([#include <nl_types.h>],
       
   139 	  [catgets(catopen("",0),0,0,"");return 0;],
       
   140 	  [mr_cv_func_catgets=yes],
       
   141 	  [mr_cv_func_catgets=no])
       
   142       ])
       
   143       if test "$mr_cv_func_catgets" = yes; then
       
   144 	AC_PATH_PROG(GENCAT, gencat, no, $mr_PATH)
       
   145 	if test "$GENCAT" != no; then
       
   146 	  AC_DEFINE(HAVE_CATGETS)
       
   147 	  AC_PATH_PROG(GMSGFMT, [gmsgfmt msgfmt], msgfmt, $mr_PATH)
       
   148 	  AC_PATH_PROG(XGETTEXT, xgettext, xgettext, $mr_PATH)
       
   149 	  CATOBJEXT=.cat
       
   150 	  INSTOBJEXT=.cat
       
   151 	  localedir='$(prefix)/lib/locale'
       
   152 	fi
       
   153       else
       
   154 	AC_MSG_WARN([no NLS support, disabled])
       
   155 	mr_enable_nls=no
       
   156       fi
       
   157     fi
       
   158   fi
       
   159   AC_SUBST(CATOBJEXT)
       
   160   AC_SUBST(INSTOBJEXT)
       
   161   AC_SUBST(localedir)
       
   162 
       
   163   POSUB=
       
   164   CATALOGS=
       
   165   if test "$mr_enable_nls" = yes; then
       
   166     AC_MSG_CHECKING([for catalogs to be installed])
       
   167     mr_linguas=
       
   168     for mr_lang in ${LINGUAS=$ALL_LINGUAS}; do
       
   169       case " $ALL_LINGUAS " in
       
   170 	*" $mr_lang "*)
       
   171 	  mr_linguas="$mr_linguas$mr_lang "
       
   172 	  CATALOGS="$CATALOGS $mr_lang$CATOBJEXT"
       
   173 	  ;;
       
   174       esac
       
   175     done
       
   176     AC_MSG_RESULT($mr_linguas)
       
   177     POSUB=po
       
   178   fi
       
   179   AC_SUBST(CATALOGS)
       
   180   AC_SUBST(POSUB)
       
   181 ])
       
   182 
       
   183 AC_DEFUN(mr_TARGET_ELF, [
       
   184   AC_PROVIDE([$0])
       
   185   AC_CACHE_CHECK([for native ELF system],
       
   186     mr_cv_target_elf,
       
   187     [AC_TRY_RUN(changequote(<<, >>)dnl
       
   188 <<#include <stdio.h>
       
   189 int
       
   190 main(int argc, char **argv) {
       
   191   char buf[BUFSIZ];
       
   192   FILE *fp;
       
   193   int n;
       
   194 
       
   195   if ((fp = fopen(*argv, "r")) == NULL) {
       
   196     exit(1);
       
   197   }
       
   198   n = fread(buf, 1, sizeof(buf), fp);
       
   199   if (n >= 52
       
   200    && buf[0] == '\177'
       
   201    && buf[1] == 'E'
       
   202    && buf[2] == 'L'
       
   203    && buf[3] == 'F') {
       
   204     exit(0);
       
   205   }
       
   206   exit(1);
       
   207 }>>, changequote([, ])dnl
       
   208       mr_cv_target_elf=yes,
       
   209       mr_cv_target_elf=no,
       
   210       mr_cv_target_elf=no)])])
       
   211 
       
   212 AC_DEFUN(mr_ENABLE_SHARED, [
       
   213   AC_PROVIDE([$0])
       
   214   PICFLAGS=
       
   215   SHLIB_SFX=
       
   216   SHLINK_SFX=
       
   217   SONAME_SFX=
       
   218   LINK_SHLIB=
       
   219   INSTALL_SHLIB=
       
   220   DEPSHLIBS=
       
   221   AC_MSG_CHECKING([whether to build a shared library])
       
   222   AC_ARG_ENABLE(shared,
       
   223     [  --enable-shared         build shared library (default: yes)],
       
   224     [mr_enable_shared="$enableval"],
       
   225     [mr_enable_shared=yes])
       
   226   AC_MSG_RESULT($mr_enable_shared)
       
   227   if test "$mr_enable_shared" = yes; then
       
   228     AC_MSG_CHECKING([whether GNU naming conventions are requested])
       
   229     AC_ARG_ENABLE(gnu-names,
       
   230       [  --enable-gnu-names      use GNU library naming conventions (default: no)],
       
   231       [mr_enable_gnu_names="$enableval"],
       
   232       [mr_enable_gnu_names=no])
       
   233     AC_MSG_RESULT($mr_enable_gnu_names)
       
   234     AC_REQUIRE([AC_CANONICAL_HOST])
       
   235     AC_REQUIRE([AC_PROG_CC])
       
   236     AC_PATH_PROG(LD, ld, ld)
       
   237     case "$host" in
       
   238       *-linux*|*-gnu*)
       
   239 	if test "$GCC" = yes; then
       
   240 	  mr_TARGET_ELF
       
   241 	  if test "$mr_cv_target_elf" = yes; then
       
   242 	    PICFLAGS='-fPIC -DPIC'
       
   243 	    if test "$mr_enable_gnu_names" = yes
       
   244 	    then SHLIB_SFX='-$(VERSION).so'
       
   245 	    else SHLIB_SFX='.so.$(VERSION)'
       
   246 	    fi
       
   247 	    SHLINK_SFX='.so'
       
   248 	    SONAME_SFX='.so.$(MAJOR)'
       
   249 	    LINK_SHLIB='$(CC) -shared -Wl,-soname,$(SONAME)'
       
   250 	    INSTALL_SHLIB='$(INSTALL_PROGRAM)'
       
   251 	    DEPSHLIBS='-lc'
       
   252 	  else
       
   253 	    AC_MSG_WARN([shared libraries not supported for $host])
       
   254 	    mr_enable_shared=no
       
   255 	  fi
       
   256 	elif ${CC} -V 2>&1 | grep 'Intel(R) C++ Compiler' >/dev/null 2>&1; then
       
   257 	  AC_MSG_WARN([Use --disable-shared if $CC fails to build the shared library])
       
   258 	  PICFLAGS='-fPIC -DPIC'
       
   259 	  if test "$mr_enable_gnu_names" = yes
       
   260 	  then SHLIB_SFX='-$(VERSION).so'
       
   261 	  else SHLIB_SFX='.so.$(VERSION)'
       
   262 	  fi
       
   263 	  SHLINK_SFX='.so'
       
   264 	  SONAME_SFX='.so.$(MAJOR)'
       
   265 	  LINK_SHLIB='$(CC) -shared -Wl,-soname,$(SONAME)'
       
   266 	  INSTALL_SHLIB='$(INSTALL_PROGRAM)'
       
   267 	  DEPSHLIBS='-lc'
       
   268 	else
       
   269 	  AC_MSG_WARN([GNU CC required for building shared libraries])
       
   270 	  mr_enable_shared=no
       
   271 	fi
       
   272 	;;
       
   273       i386-pc-nto-qnx*)
       
   274 	mr_TARGET_ELF
       
   275 	if test "$mr_cv_target_elf" = yes; then
       
   276 	  PICFLAGS='-fPIC -DPIC'
       
   277 	  if test "$mr_enable_gnu_names" = yes
       
   278 	  then SHLIB_SFX='-$(VERSION).so'
       
   279 	  else SHLIB_SFX='.so.$(VERSION)'
       
   280 	  fi
       
   281 	  SHLINK_SFX='.so'
       
   282 	  SONAME_SFX='.so.$(MAJOR)'
       
   283 	  LINK_SHLIB='$(CC) -shared -Wl,-soname,$(SONAME)'
       
   284 	  INSTALL_SHLIB='$(INSTALL_PROGRAM)'
       
   285 	  DEPSHLIBS='-lc'
       
   286 	else
       
   287 	  AC_MSG_WARN([shared libraries not supported for $host])
       
   288 	  mr_enable_shared=no
       
   289 	fi
       
   290 	;;
       
   291       sparc-sun-solaris2*)
       
   292 	if test "$GCC" = yes; then
       
   293 	  PICFLAGS='-fPIC -DPIC'
       
   294 	else
       
   295 	  PICFLAGS='-K PIC -DPIC'
       
   296 	fi
       
   297 	if test "$mr_enable_gnu_names" = yes
       
   298 	then SHLIB_SFX='-$(MAJOR).so'
       
   299 	else SHLIB_SFX='.so.$(MAJOR)'
       
   300 	fi
       
   301 	SONAME_SFX='.so.$(MAJOR)'
       
   302 	SHLINK_SFX='.so'
       
   303 	LINK_SHLIB='$(LD) -G -z text -h $(SONAME)'
       
   304 	INSTALL_SHLIB='$(INSTALL_PROGRAM)'
       
   305 	;;
       
   306       *)
       
   307 	AC_MSG_WARN([shared libraries not supported for $host])
       
   308 	mr_enable_shared=no
       
   309 	;;
       
   310     esac
       
   311   else
       
   312     mr_enable_shared=no
       
   313   fi
       
   314   AC_SUBST(PICFLAGS)
       
   315   AC_SUBST(SHLIB_SFX)
       
   316   AC_SUBST(SHLINK_SFX)
       
   317   AC_SUBST(SONAME_SFX)
       
   318   AC_SUBST(LINK_SHLIB)
       
   319   AC_SUBST(INSTALL_SHLIB)
       
   320   AC_SUBST(DEPSHLIBS)
       
   321   DO_SHLIB="$mr_enable_shared"
       
   322   AC_SUBST(DO_SHLIB)
       
   323 ])
       
   324 
       
   325 AC_DEFUN(mr_ENABLE_DEBUG, [
       
   326   AC_PROVIDE([$0])
       
   327   AC_ARG_ENABLE(debug,
       
   328     [  --enable-debug          include extra debugging code (default: no)],
       
   329     [mr_enable_debug="$enableval"],
       
   330     [mr_enable_debug=no])
       
   331   if test "$mr_enable_debug" = yes; then
       
   332     AC_DEFINE(ENABLE_DEBUG)
       
   333   fi
       
   334 ])
       
   335 
       
   336 # vi: set ts=8 sw=2 :