1dnl Process this file with autoconf to produce a configure script.
2AC_INIT(Chemtool,1.6.13,martin@ruby.chemie.uni-freiburg.de,chemtool)
3AC_CONFIG_SRCDIR(main.c)
4AM_INIT_AUTOMAKE(chemtool, 1.6.13)
5
6AC_CONFIG_HEADER(config.h)
7AM_GNU_GETTEXT([external])
8AM_GNU_GETTEXT_VERSION(0.14.1)
9dnl Checks for programs.
10AC_PROG_CC
11AC_PROG_MAKE_SET
12AC_PROG_INSTALL
13AC_PROG_LN_S
14AC_PATH_PROG(CP,cp)
15AC_PATH_PROG(RM,rm)
16
17dnl Checks for libraries.
18dnl Replace `main' with a function in -libs:
19AC_CHECK_LIB(ibs, main)
20dnl Replace `main' with a function in -lm:
21AC_CHECK_LIB(m, acos)
22
23
24AC_DEFINE([LIBUNDO],1,[Define if you want to use the built-in undo functionality])
25
26AC_DEFINE([MENU],1,[Define if you want to use pull-down menus instead of button bars])
27
28AC_ARG_ENABLE(enable_gtk1,
29[  --enable-gtk1           Use GTK+-1.x even if GTK+-2.x is available [no]],enable_gtk1=no)
30
31AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
32
33AC_MSG_CHECKING([for GTK version and compile options ])
34
35if test x$PKG_CONFIG = xno -o x$enable_gtk1 = xyes ; then
36AM_PATH_GTK(1.0.2, , exit 1)
37else
38if $PKG_CONFIG gtk+-2.0 --cflags ; then
39       GTK_CFLAGS="-DGTK2 `$PKG_CONFIG gtk+-2.0 --cflags` "
40       GTK_LIBS=`$PKG_CONFIG gtk+-2.0 --libs`
41dnl    use_gtk2=yes
42       AC_DEFINE([GTK2], [1], [the GTK2 library])
43       enable_stockgtk=yes
44else
45if $PKG_CONFIG --cflags gtk+ ; then
46	GTK_CFLAGS=`$PKG_CONFIG gtk+ --cflags`
47	GTK_LIBS=`$PKG_CONFIG gtk+ --libs`
48dnl    use_gtk2=no
49fi
50fi
51fi
52
53dnl AC_MSG_RESULT using GTK2 : $use_gtk2
54
55dnl Checks for header files.
56AC_PATH_XTRA
57AC_HEADER_DIRENT
58AC_HEADER_STDC
59
60LDFLAGS="$X_LIBS"
61AC_CHECK_LIB([X11],[XOpenDisplay])
62dnl just an ugly hack to work around the more aggressive header checks
63dnl in recent autoconf. Not sure if we should really rely on include
64dnl paths being provided in CPPFLAGS, not CFLAGS, or if a nested set
65dnl of tests encompassing all dependent headers would be in order.
66dnl
67dnl saved_CPPFLAGS=$CPPFLAGS
68dnl CPPFLAGS="$CFLAGS $CPPFLAGS"
69
70AC_CHECK_HEADERS(strings.h unistd.h libintl.h)
71
72dnl CPPFLAGS=$saved_CPPFLAGS
73
74dnl Checks for typedefs, structures, and compiler characteristics.
75AC_C_CONST
76AC_TYPE_SIZE_T
77AC_STRUCT_TM
78
79dnl Checks for library functions.
80AC_FUNC_FNMATCH
81AC_FUNC_MEMCMP
82AC_FUNC_MMAP
83AC_CHECK_FUNCS(getcwd getwd mkdir strtod strtol)
84
85dnl Optional stuff
86AC_ARG_WITH(localedir,
87[  --with-localedir=DIR	  Set locale directory=DIR [DATADIR/locale]],
88localedir=$withval,
89[localedir=$datadir/locale])
90dnl AC_DEFINE_UNQUOTED(LOCALEDIR=$withval),
91dnl [AC_DEFINE_UNQUOTED(LOCALEDIR="\"\$datadir/locale"\")])
92dnl "
93
94dnl Optional stuff
95AC_ARG_WITH(kdedir,
96[  --with-kdedir=DIR	  Set KDE directory=DIR [/opt/kde3,/opt/kde2,/opt/kde]],
97kdedir=$withval,
98[kdedir="/opt/kde3 /opt/kde2 /opt/kde"])
99AC_MSG_CHECKING([for KDE ])
100for the_kdedir in $kdedir; do
101if test -d $the_kdedir/share/mimelnk ; then
102	kdemimedir=$the_kdedir
103	AC_MSG_RESULT([apparently in $kdemimedir])
104	break;
105else
106	KDEMIMEDIR=$KDEDIR
107	if test -d $KDEMIMEDIR/share/mimelnk; then
108	AC_MSG_RESULT([apparently in $KDEMIMEDIR])
109	kdemimedir=$KDEMIMEDIR
110	fi
111fi
112done
113if test "x$kdemimedir" = "x" ; then
114	AC_MSG_RESULT([no])
115fi
116dnl AC_DEFINE_UNQUOTED(KDEDIR=$withval),
117dnl [AC_DEFINE_UNQUOTED(KDEDIR="\"\/opt/kde"\")])
118dnl "
119
120dnl Optional stuff
121AC_ARG_WITH(gnomedir,
122[  --with-gnomedir=DIR	  Set GNOME directory=DIR [/usr]],
123gnomedir=$withval,
124[gnomedir=/usr])
125AC_MSG_CHECKING([for GNOME ])
126if test -d $gnomedir/share/mime-info ; then
127	gnomemimedir=$gnomedir
128	AC_MSG_RESULT([apparently in $gnomemimedir])
129else
130	GNOMEMIMEDIR=$GNOMEDIR
131	if test -d $GNOMEMIMEDIR/share/mime-info; then
132	AC_MSG_RESULT([apparently in $GNOMEMIMEDIR])
133	gnomemimedir=$GNOMEMIMEDIR
134	fi
135fi
136if test "x$GNOMEMIMEDIR" = "x" ; then
137	AC_MSG_RESULT([no])
138fi
139dnl AC_DEFINE_UNQUOTED(GNOMEMIMEDIR=$withval),
140dnl [AC_DEFINE_UNQUOTED(GNOMEMIMEDIR="\"\/usr"\")])
141dnl "
142
143dnl AC_MSG_CHECKING(whether to enable locales)
144dnl AC_ARG_ENABLE(locales,
145dnl [  --enable-locales        Support localised messages [yes]],,enable_locales=yes)
146dnl if test x$enable_locales = xyes; then
147dnl if test "$ac_cv_header_libintl_h" = "yes"
148dnl then
149dnl	AC_MSG_RESULT(yes)
150dnl        AC_DEFINE_UNQUOTED([LOCALEDIR=\"\$datadir/locale\"],[],[])
151dnl else
152dnl	AC_MSG_RESULT(no)
153dnl	AC_DEFINE([DISABLE_NLS],[1],[])
154dnl fi
155dnl else
156dnl	AC_MSG_RESULT(no)
157dnl	AC_DEFINE([DISABLE_NLS],[1],[])
158dnl fi
159
160AC_MSG_CHECKING(whether to enable libundo)
161AC_ARG_ENABLE(undo,
162[  --enable-undo           Build with libundo [yes]],,enable_undo=yes)
163if test x$enable_undo = xyes; then
164	AC_MSG_RESULT(yes)
165	AC_DEFINE([LIBUNDO],[1],[the undo library is available])
166else
167	AC_MSG_RESULT(no)
168fi
169
170AC_MSG_CHECKING(whether to use pull-down menus)
171AC_ARG_ENABLE(menu,
172[  --enable-menu           Enable new style pull-down-menu [yes]],,enable_menu=yes)
173if test x$enable_menu = xyes; then
174	AC_MSG_RESULT(yes)
175	AC_DEFINE([MENU],[1],[])
176else
177	AC_MSG_RESULT(no)
178fi
179
180AC_MSG_CHECKING(whether to enable emf output)
181AC_ARG_ENABLE(emf,
182[  --enable-emf            Enable enhanced metafile output via libEMF [no]],,enable_emf=no)
183if test x$enable_emf = xyes; then
184	AC_MSG_RESULT(yes)
185	AC_DEFINE([EMF], [1], [use optional libEMF instead of fig2dev for EMF output])
186	EMFLIBS="-lEMF -lstdc++"
187else
188	AC_MSG_RESULT(no)
189	EMFLIBS=""
190fi
191
192
193AC_MSG_CHECKING(whether standard GTK dialogs should be used instead of our own)
194AC_ARG_ENABLE(stockgtk,
195[  --enable-stockgtk	  use standard GTK menu and fileselection widgets [no]],,enable_stockgtk=no)
196
197if test x$enable_stockgtk = xyes; then
198	AC_MSG_RESULT(yes)
199	MYGTKSRCS=""
200	MYGTKOBJS=""
201else
202	AC_MSG_RESULT(no)
203	ac_sys_system=`uname -s`
204	if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "CYGWIN"; then
205	AC_MSG_RESULT([         sorry, overriding library functions is impossible on your system, enforcing "yes"])
206	MYGTKSRCS=""
207	MYGTKOBJS=""
208	else
209	MYGTKSRCS="gtkmenu.c gtkfilesel.c"
210	MYGTKOBJS="gtkmenu.o gtkfilesel.o"
211		if test "$ac_sys_system" = "Darwin" ; then
212		LDFLAGS="-force_flat_namespace ${LDFLAGS}"
213		fi
214	fi
215fi
216
217dnl X_LIBS="$X_PRE_LIBS $X_LIBS $XLIB"
218
219AC_SUBST(localedir)
220AC_SUBST(localedir)
221AC_SUBST(kdemimedir)
222AC_SUBST(gnomemimedir)
223AC_SUBST(EMFLIBS)
224AC_SUBST(MYGTKSRCS)
225AC_SUBST(MYGTKOBJS)
226AC_SUBST(GTK_CFLAGS)
227AC_SUBST(GTK_LIBS)
228dnl AC_SUBST(X_LIBS)
229
230AC_OUTPUT(Makefile src-cht/Makefile m4/Makefile po/Makefile.in po/Makefile )
231