Fixed the odd rendering problem that was reported when you have missing
[geda-gaf/peter-b.git] / gnetlist / configure.ac
blob2c0dd9d8d60a39ca7fcd4ea6f7e7deeee04e4fbc
1 # Process this file with autoconf to produce a configure script.
2 AC_INIT
3 AC_CONFIG_SRCDIR([src/gnetlist.c])
4 AC_PREREQ(2.54)
6 PACKAGE=geda-gnetlist
7 VERSION=20041228
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 # Force a specific version of gtk+
25 AC_ARG_WITH(gtk12, [  --with-gtk12            Force the use of gtk+ 1.2.x], [opt_gtkver=1.2])
27
28 # Command line flags end
29 #########################################################################
31 # Checks for programs.
32 AC_PROG_CC
33 AC_PROG_CPP
34 AC_PROG_MAKE_SET
35 AC_PATH_PROGS(AWK, nawk gawk mawk awk, )
37 #########################################################################
38
39 # Misc win32 / mingw checks and variables start
40 AC_CANONICAL_HOST
42 # Figure out if we are building on win32 and what environment.
43 case $host_os in
44   *cygwin*  ) AC_MSG_ERROR([Building gEDA/gaf under cygwin is not supported]) ;;
45   *mingw32* ) echo "Configuring for mingw"; MINGW=yes ;;
46 esac
48 if ! test "$MINGW" = "no" -o "$MINGW"x = x; then
49    MINGW="yes"
50    PATHSEP=\\\\
51    OTHERPATHSEP=/
52 else
53    # Unix host
54    MINGW="no"
55    PATHSEP=/
56    OTHERPATHSEP=\\\\
59
60 # Misc win32 / mingw checks and variables end
61 #########################################################################
63 ############################################################################
64 # Check for mics things start
65
66 # Checking for rint in math library
67 AC_CHECK_LIB(m, rint, AC_DEFINE(HAS_RINT, 1, [If your math library has rint in it, define this]), no_RINT="yes")
69 # Checking for dynamic lib
70 AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", DL_LIB="")
72 # Check for mics things start
73 ############################################################################
75 ############################################################################
76 # Check for gtk+ 1.2 and 2.2 start
77
79 # Check for pkg-config
80 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
81 if test $PKG_CONFIG = no; then
82    AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
85 # Search for gtk+ 2.2.x first (only if we are not forcing the gtk+ to 1.2)
86 if test "$opt_gtkver" != "1.2"
87 then
88    PKG_CHECK_MODULES(GTK22, gtk+-2.0 >= 2.2.0, GTK22="yes", no_GTK22="yes")
91 # This next bit of code figures out what gtk we need to use.
92 if test "$GTK22" = "yes" -a "$opt_gtkver" != "1.2"
93 then
95    AC_DEFINE(HAS_GTK22, 1, [If gtk+ 2.2.x has been installed, define this])
96    GTK_CFLAGS=$GTK22_CFLAGS
97    GTK_LIBS=$GTK22_LIBS
98    GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
100    # Search for glib
101    PKG_CHECK_MODULES(GLIB22, glib-2.0 >= 2.2.0, GLIB22="yes", no_GLIB22="yes")
102    if test "$GLIB22" != "yes"
103    then
104        AC_MSG_ERROR([Cannot find glib 2.2.x, install it and rerun ./configure.])
105    fi
106    GLIB_CFLAGS=$GLIB22_CFLAGS
107    GLIB_LIBS=$GLIB22_LIBS
108    GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
110 else
112    # Search for gtk+ 1.2 now 
113    PKG_CHECK_MODULES(GTK12, gtk+ >= 1.2.3, GTK12="yes", no_GTK12="yes")
115    AC_DEFINE(HAS_GTK12, 1, [If gtk+ 1.2.x has been installed, define this])
116    GTK_CFLAGS=$GTK12_CFLAGS
117    GTK_LIBS=$GTK12_LIBS
118    GTK_VERSION=`$PKG_CONFIG gtk+ --modversion`
120    # Search for glib
121    PKG_CHECK_MODULES(GLIB12, glib >= 1.2.3, GLIB12="yes", no_GLIB12="yes")
122    if test "$GLIB12" != "yes"
123    then
124        AC_MSG_ERROR([Cannot find glib >= 1.2.3, install it and rerun ./configure.])
125    fi
126    GLIB_CFLAGS=$GLIB12_CFLAGS
127    GLIB_LIBS=$GLIB12_LIBS
128    GLIB_VERSION=`$PKG_CONFIG glib --modversion`
131 if test "$GTK_VERSION" = ""
132 then
133    AC_MSG_ERROR([Cannot find gtk+ 2.2.x or gtk+ 1.2.x, install one of them.])
137 # Check for gtk+ 1.2 and 2.2 end
138 ############################################################################
140 ############################################################################
141 # Check for libgeda start
143 PKG_CHECK_MODULES(LIBGEDA, libgeda >= $VERSION, LIBGEDA="yes", 
144                   no_LIBGEDA="yes")
146 if test "$LIBGEDA" = "yes" 
147 then
148    LIBGEDA_VERSION=`$PKG_CONFIG libgeda --modversion`
149 else
150    AC_MSG_ERROR([Cannot find libgeda (or libgeda.pc), please install libgeda])
154 # Check for libgeda end
155 ############################################################################
157 #########################################################################
158 # Checks for header files start
160 AC_HEADER_STDC
161 AC_HEADER_SYS_WAIT
162 AC_HEADER_DIRENT
163 AC_CHECK_HEADERS(unistd.h string.h stdlib.h \
164                  stdarg.h assert.h fcntl.h errno.h)
166 # Checks for typedefs, structures, and compiler characteristics.
167 AC_C_CONST
169 # Checks for library functions.
170 AC_TYPE_SIGNAL
171 AC_CHECK_FUNCS(getcwd strstr vsnprintf snprintf)
173 AC_MSG_CHECKING([for optarg in unistd.h])
174 AC_TRY_COMPILE(
175 [#include <unistd.h>],
176 [ char *string = optarg; int i = optind; ],
177 optarg_found=yes,
178 optarg_found=no)
179 AC_MSG_RESULT($optarg_found)
181 if test $optarg_found = yes; then
182     AC_DEFINE(OPTARG_IN_UNISTD, 1, [Define if you have optarg in unistd.h])
186 # Checks for header files start
187 #########################################################################
189 #########################################################################
190 # Check for groff start
193 # search for groff
194 AC_PATH_PROG(GROFF, groff, no, ${PATH})
195 if test $GROFF = "no"; then
196         echo "Cannot find groff, some documentation will not be created."
200 # Check for groff end
201 #########################################################################
203 #########################################################################
204 # gEDA/gaf specify setup start
207 DATADIR=gEDA
208 GEDADATADIR=$datadir/$DATADIR
210 if eval "test x$opt_rcdir = x"; then
211         # path not was specified with --with-rcdir
212         AC_DEFINE_UNQUOTED(GEDARCDIR, "none", [gEDA/gaf's rc directory])
213         GEDARCDIR=$GEDADATADIR
214 else
215         # path WAS specified with --with-rcdir
216         AC_DEFINE_UNQUOTED(GEDARCDIR, "$opt_rcdir", [gEDA/gaf's rc directory])
217         GEDARCDIR="$opt_rcdir"
220 # Expand the prefix variable
221 # I don't like the way this is done, but it works (I hope).
222 if eval "test x$prefix = xNONE"; then
223  dprefix=$ac_default_prefix
224 else
225  dprefix=$prefix
228 gedatopdir=$dprefix/share/$DATADIR
229 expandgedadatadir=`echo $gedatopdir`
231 gedadocdir=$dprefix/share/doc/geda-doc
232 # --with-docdir : tells where to store documentation if not default
233 AC_ARG_WITH(docdir,
234     [  --with-docdir      Where to store documentation if not default.],
235         gedadocdir=$withval)
236 expandgedadocdir=`echo $gedadocdir`
237 GEDADOCDIR=$expandgedadocdir
238 AC_SUBST(GEDADOCDIR)
240 # this has to be expanded ( no ${prefix} ) --
241 AC_DEFINE_UNQUOTED(GEDADATADIR, "$gedatopdir", [gEDA/gaf's data directory])
242 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Currently running version of gEDA/gaf])
245 # gEDA/gaf specify things which need to setup
246 #########################################################################
248 # Finally create the final CFLAGS and LDFLAGS for use in the makefiles
249 GNETLIST_CFLAGS="$LIBGEDA_CFLAGS"
250 GNETLIST_LDFLAGS="$LIBGEDA_LIBS"  
252 # Makefile.in variable substitution
253 AC_SUBST(GNETLIST_CFLAGS)
254 AC_SUBST(GNETLIST_LDFLAGS)
255 AC_SUBST(GEDARCDIR)
256 AC_SUBST(GEDADATADIR)
257 AC_SUBST(PATHSEP)
258 AC_SUBST(OTHERPATHSEP)
260 # Create all the necessary derived files
261 AC_CONFIG_FILES([Makefile 
262                  src/Makefile 
263                  include/Makefile 
264                  scheme/Makefile 
265                  examples/Makefile 
266                  tests/Makefile 
267                  tests/hierarchy/Makefile 
268                  docs/Makefile 
269                  docs/vams/Makefile 
270                  examples/vams/Makefile 
271                  examples/vams/sch/Makefile 
272                  examples/vams/sym/Makefile 
273                  examples/vams/vhdl/Makefile 
274                  examples/vams/vhdl/basic-vhdl/Makefile 
275                  examples/vams/vhdl/new-vhdl/Makefile 
276                  examples/switcap/Makefile 
277                  lib/Makefile 
278                  utils/Makefile 
279                  scripts/Makefile
280                  scripts/sw2asc 
281                  lib/system-gnetlistrc ])
282 AC_CONFIG_COMMANDS([sw2asc-chmod],[[chmod +x scripts/sw2asc]],[[]])
284 AC_OUTPUT
286 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
287 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
288 expandedGEDADOCDIR=`eval "echo $GEDADOCDIR"`
290 AC_MSG_RESULT([
291 ** Configuration summary for $PACKAGE $VERSION:
293    GTK+ library version:             $GTK_VERSION
294    libgeda library version:          $LIBGEDA_VERSION
295    mingw build:                      $MINGW
296    data directory:                   $expandedGEDADATADIR
297    rc directory:                     $expandedGEDARCDIR
298    documentation directory:          $expandedGEDADOCDIR