Bumped package version to 20061020
[geda-gaf/peter-b.git] / gsymcheck / configure.ac
blobb93360cd5ccab03581dce1b53e97a40784b18e72
1 # Process this file with autoconf to produce a configure script.
2 AC_INIT
3 AC_CONFIG_SRCDIR([src/gsymcheck.c])
4 AC_PREREQ(2.54)
6 PACKAGE=geda-gsymcheck
7 VERSION=20061020
8 echo Configuring $PACKAGE version $VERSION
10 # Initialize automake 
11 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
12 AM_CONFIG_HEADER([config.h])
14 # Initialize maintainer mode
15 AM_MAINTAINER_MODE
18 #########################################################################
19 # Command line flags start
20
21 # Change default location for rc files
22 AC_ARG_WITH(rcdir, [  --with-rcdir=path       Change where the system-*rc files are installed], [opt_rcdir=$withval])
24
25 # Command line flags end
26 #########################################################################
28 # Checks for programs.
29 AC_PROG_CC
30 AM_CONDITIONAL(CCISGCC, test "$GCC" = "yes")    
31 AC_PROG_CPP
32 AC_PROG_MAKE_SET
34 #########################################################################
35
36 # Misc win32 / mingw checks and variables start
37 AC_CANONICAL_HOST
39 # Figure out if we are building on win32 and what environment.
40 case $host_os in
41   *mingw32* ) echo "Configuring for mingw"; MINGW=yes ;;
42 esac
44 if ! test "$MINGW" = "no" -o "$MINGW"x = x; then
45    MINGW="yes"
46    PATHSEP=\\\\
47    OTHERPATHSEP=/
48 else
49    # Unix host
50    MINGW="no"
51    PATHSEP=/
52    OTHERPATHSEP=\\\\
55
56 # Misc win32 / mingw checks and variables end
57 #########################################################################
59 ############################################################################
60 # Check for mics things start
61
62 # Checking for rint in math library
63 AC_CHECK_LIB(m, rint, AC_DEFINE(HAS_RINT, 1, [If your math library has rint in it, define this]), no_RINT="yes")
65 # Checking for dynamic lib
66 AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", DL_LIB="")
68 # Check for mics things start
69 ############################################################################
72 ############################################################################
73 # Check for gtk+ 2.4 start
74
76 # Check for pkg-config
77 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
78 if test $PKG_CONFIG = no; then
79    AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
82 PKG_CHECK_MODULES(GTK24, gtk+-2.0 >= 2.4.0, GTK24="yes", no_GTK24="yes")
84 # This next bit of code figures out what gtk we need to use.
85 if test "$GTK24" = "yes" 
86 then
88    AC_DEFINE(HAS_GTK24, 1, [If gtk+ 2.4.x has been installed, define this])
89    GTK_CFLAGS=$GTK24_CFLAGS
90    GTK_LIBS=$GTK24_LIBS
91    GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
93    # Search for glib
94    PKG_CHECK_MODULES(GLIB24, glib-2.0 >= 2.4.0, GLIB24="yes", no_GLIB24="yes")
95    if test "$GLIB24" != "yes"
96    then
97        AC_MSG_ERROR([Cannot find glib 2.4.x, install it and rerun ./configure.])
98    fi
99    GLIB_CFLAGS=$GLIB24_CFLAGS
100    GLIB_LIBS=$GLIB24_LIBS
101    GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
103 else
104    GTK_VERSION=""
107 if test "$GTK_VERSION" = ""
108 then
109    AC_MSG_ERROR([Cannot find gtk+ 2.4.x or later, please install gtk+.])
113 # Check for gtk+ 2.4 end
114 ############################################################################
116 ############################################################################
117 # Check for libgeda start
119 PKG_CHECK_MODULES(LIBGEDA, libgeda >= $VERSION, LIBGEDA="yes", 
120                   no_LIBGEDA="yes")
122 if test "$LIBGEDA" = "yes" 
123 then
124    LIBGEDA_VERSION=`$PKG_CONFIG libgeda --modversion`
125 else
126    AC_MSG_ERROR([Cannot find libgeda (or libgeda.pc), please install libgeda])
130 # Check for libgeda end
131 ############################################################################
133 #########################################################################
134 # Checks for header files start
136 AC_HEADER_STDC
137 AC_HEADER_SYS_WAIT
138 AC_HEADER_DIRENT
139 AC_CHECK_HEADERS(unistd.h string.h stdlib.h \
140                  stdarg.h assert.h fcntl.h errno.h)
142 # Checks for typedefs, structures, and compiler characteristics.
143 AC_C_CONST
145 # Checks for library functions.
146 AC_TYPE_SIGNAL
147 AC_CHECK_FUNCS(getcwd strstr vsnprintf snprintf)
149 AC_MSG_CHECKING([for optarg in unistd.h])
150 AC_TRY_COMPILE(
151 [#include <unistd.h>],
152 [ char *string = optarg; int i = optind; ],
153 optarg_found=yes,
154 optarg_found=no)
155 AC_MSG_RESULT($optarg_found)
157 if test $optarg_found = yes; then
158     AC_DEFINE(OPTARG_IN_UNISTD, 1, [Define if you have optarg in unistd.h])
162 # Checks for header files start
163 #########################################################################
165 #########################################################################
166 # Check for groff start
169 # search for groff
170 AC_PATH_PROG(GROFF, groff, no, ${PATH})
171 if test $GROFF = "no"; then
172         echo "Cannot find groff, some documentation will not be created."
176 # Check for groff end
177 #########################################################################
179 #########################################################################
180 # gEDA/gaf specify setup start
183 DATADIR=gEDA
184 GEDADATADIR=$datadir/$DATADIR
186 if eval "test x$opt_rcdir = x"; then
187         # path not was specified with --with-rcdir
188         AC_DEFINE_UNQUOTED(GEDARCDIR, "none", [gEDA/gaf's rc directory])
189         GEDARCDIR=$GEDADATADIR
190 else
191         # path WAS specified with --with-rcdir
192         AC_DEFINE_UNQUOTED(GEDARCDIR, "$opt_rcdir", [gEDA/gaf's rc directory])
193         GEDARCDIR="$opt_rcdir"
196 # Expand the prefix variable
197 # I don't like the way this is done, but it works (I hope).
198 if eval "test x$prefix = xNONE"; then
199  dprefix=$ac_default_prefix
200 else
201  dprefix=$prefix
204 gedatopdir=$dprefix/share/$DATADIR
205 expandgedadatadir=`echo $gedatopdir`
207 gedadocdir=$dprefix/share/doc/geda-doc
208 # --with-docdir : tells where to store documentation if not default
209 AC_ARG_WITH(docdir,
210     [  --with-docdir      Where to store documentation if not default.],
211         gedadocdir=$withval)
212 expandgedadocdir=`echo $gedadocdir`
213 GEDADOCDIR=$expandgedadocdir
214 AC_SUBST(GEDADOCDIR)
216 # this has to be expanded ( no ${prefix} ) --
217 AC_DEFINE_UNQUOTED(GEDADATADIR, "$gedatopdir", [gEDA/gaf's data directory])
218 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Currently running version of gEDA/gaf])
221 # gEDA/gaf specify things which need to setup
222 #########################################################################
224 # Finally create the final CFLAGS and LDFLAGS for use in the makefiles
225 GSYMCHECK_CFLAGS="$LIBGEDA_CFLAGS"
226 GSYMCHECK_LDFLAGS="$LIBGEDA_LIBS"  
228 # Makefile.in variable substitution
229 AC_SUBST(GSYMCHECK_CFLAGS)
230 AC_SUBST(GSYMCHECK_LDFLAGS)
231 AC_SUBST(GEDARCDIR)
232 AC_SUBST(GEDADATADIR)
233 AC_SUBST(PATHSEP)
234 AC_SUBST(OTHERPATHSEP)
236 # Create all the necessary derived files
237 AC_CONFIG_FILES([Makefile 
238                  src/Makefile 
239                  include/Makefile 
240                  scheme/Makefile 
241                  examples/Makefile 
242                  lib/Makefile 
243                  utils/Makefile
244                  docs/Makefile
245                  tests/Makefile
246                  lib/system-gsymcheckrc ])
248 AC_OUTPUT
250 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
251 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
252 expandedGEDADOCDIR=`eval "echo $GEDADOCDIR"`
254 AC_MSG_RESULT([
255 ** Configuration summary for $PACKAGE $VERSION:
257    GTK+ library version:             $GTK_VERSION
258    libgeda library version:          $LIBGEDA_VERSION
259    mingw build:                      $MINGW
260    data directory:                   $expandedGEDADATADIR
261    rc directory:                     $expandedGEDARCDIR
262    documentation directory:          $expandedGEDADOCDIR