autogen.sh
author J. Ali Harlow <ali@juiblex.co.uk>
Sat Oct 04 18:12:58 2014 +0100 (2014-10-04)
changeset 454 56ff755c268c
parent 323 3b24a0bd41ee
permissions -rwxr-xr-x
Only export symbols starting with razor_ in dynamic library.

Apart from being good practice to avoid clashes with higher-level
libraries and the application, this also fixes an obscure bug: The
gnulib library is used both by librazor (the dynamic library) and
by razor (the executable). In doing so, we want to have two separate
copies of the library despite the code duplication this involves.
Without the explicit limit to export only razor_ symbols, the razor
executable under mingw64 was picking up the getopt_long function
from librazor and the optind variable from libgnu which meant that
it did not see optind changing. Hiding librazor's copy of getopt
causes the linker to find libgnu's copy and everything works.

Note that under mingw librazor-#.dll still contains undocumented
(private) razor_ symbols but these will do no harm as long as nobody
tries to use them.
     1 #!/bin/sh
     2 # Run this to generate all the initial makefiles, etc.
     3 
     4 srcdir=`dirname $0`
     5 test -z "$srcdir" && srcdir=.
     6 
     7 DIE=0
     8 
     9 (test -f $srcdir/configure.ac) || {
    10     echo -n "**Error**: Directory $srcdir does not look like the"
    11     echo " top-level package directory"
    12     exit 1
    13 }
    14 
    15 (autoconf --version) < /dev/null > /dev/null 2>&1 || {
    16   echo
    17   echo "**Error**: You must have autoconf installed."
    18   echo "Download the appropriate package for your distribution,"
    19   echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
    20   DIE=1
    21 }
    22 
    23 (grep "^LT_INIT\|^A[MC]_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && {
    24   (libtool --version) < /dev/null > /dev/null 2>&1 || {
    25     echo
    26     echo "**Error**: You must have libtool installed."
    27     echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
    28     DIE=1
    29   }
    30 }
    31 
    32 (automake --version) < /dev/null > /dev/null 2>&1 || {
    33   echo
    34   echo "**Error**: You must have automake installed."
    35   echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
    36   DIE=1
    37   NO_AUTOMAKE=yes
    38 }
    39 
    40 
    41 # if no automake, don't bother testing for aclocal
    42 test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
    43   echo
    44   echo "**Error**: Missing aclocal.  The version of automake"
    45   echo "installed doesn't appear recent enough."
    46   echo "You can get automake from ftp://ftp.gnu.org/pub/gnu/"
    47   DIE=1
    48 }
    49 
    50 if [ -z "$GNULIB_TOOL" ]; then
    51   GNULIB_TOOL=`which gnulib-tool`
    52   if [ -z "$GNULIB_TOOL" ]; then
    53     echo
    54     echo "**Error**: Missing gnulib-tool.  Set GNULIB_TOOL to point"
    55     echo "to a copy of gnulib-tool which is not in your PATH."
    56     echo "You can get gnulib from http://www.gnu.org/software/gnulib/"
    57     DIE=1
    58   fi
    59 fi
    60 
    61 if test "$DIE" -eq 1; then
    62   exit 1
    63 fi
    64 
    65 if test -z "$*"; then
    66   echo "**Warning**: I am going to run configure with no arguments."
    67   echo "If you wish to pass any to it, please specify them on the"
    68   echo $0 " command line."
    69   echo
    70 fi
    71 
    72 case $CC in
    73 xlc )
    74   am_opt=--include-deps;;
    75 esac
    76 
    77       aclocalinclude="-I gl/m4 $ACLOCAL_FLAGS"
    78 
    79       if grep "^LT_INIT\|^A[MC]_PROG_LIBTOOL" configure.ac >/dev/null; then
    80 	if test -z "$NO_LIBTOOLIZE" ; then 
    81 	  echo "Running libtoolize..."
    82 	  libtoolize --force --copy
    83 	fi
    84       fi
    85       echo "Running aclocal $aclocalinclude ..."
    86       aclocal $aclocalinclude
    87       if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then
    88 	echo "Running autoheader..."
    89 	autoheader
    90       fi
    91       echo "Running automake --gnu -Wno-portability $am_opt ..."
    92       automake --add-missing --gnu -Wno-portability $am_opt
    93       echo "Running autoconf ..."
    94       autoconf
    95 
    96 intltoolize --copy --force --automake                  || exit 1
    97 
    98 gtkdocize --copy --flavour no-tmpl
    99 
   100 echo "Running $GNULIB_TOOL --update ..."
   101 $GNULIB_TOOL --update
   102 
   103 conf_flags="--enable-maintainer-mode"
   104 
   105 if test x$NOCONFIGURE = x; then
   106   echo "Running $srcdir/configure $conf_flags $@ ..."
   107   $srcdir/configure $conf_flags "$@" \
   108   && echo "Now type make to compile." || exit 1
   109 else
   110   echo "Skipping configure process."
   111 fi