2 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(src/gcm_input/message.h)
4 AM_INIT_AUTOMAKE(GnuCoMo, 0.0.9)
7 dnl Checks for programs.
18 AC_PATH_PROG(XML_CONFIG,xml2-config,no)
20 if test $XML_CONFIG = "no"
22 echo "XML library not found (see http://xmlsoft.org/)."
27 dnl Checks for libraries.
30 XML_CFLAGS=`$XML_CONFIG --cflags`
31 XML_LFLAGS=`$XML_CONFIG --libs`
33 LIBS="$LIBS $X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS"
34 LIBS="$LIBS -L/usr/local/lib $XML_LFLAGS"
35 CFLAGS="$CFLAGS $X_CFLAGS $XML_CFLAGS "
36 CXXFLAGS="$CXXFLAGS -Wno-deprecated $X_CFLAGS $XML_CFLAGS"
38 AC_CHECK_LIB(AXE, main, , AC_MSG_ERROR(AXE Library is not installed))
39 #AC_CHECK_LIB(X11, XOpenDisplay)
40 #AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData)
41 #AC_CHECK_LIB(pthread, pthread_create)
42 AC_CHECK_LIB(xml2, xmlParseFile)
44 # Where are the postgres includes...
45 postgres_include_default=
46 for usual_suspect in \
47 /usr/local/include/postgresql \
48 /usr/local/include/pgsql \
49 /usr/local/pgsql/include \
51 /usr/include/postgresql \
54 /opt/postgresql/include \
56 /usr/freeware/include \
58 AC_CHECK_FILE([$usual_suspect/libpq-fe.h],
59 [postgres_include_default=$usual_suspect],
61 if test -n "$postgres_include_default" ; then
66 AC_ARG_WITH(postgres-include,
67 --with-postgres-include PostgreSQL headers directory
69 , test "$withval" = no || with_postgres_include=$withval
70 , with_postgres_include=$postgres_include_default
75 for usual_suspect in \
76 /usr/local/lib/postgresql \
77 /usr/local/lib/pgsql \
78 /usr/local/pgsql/lib \
87 for library_extension in so a sa ; do
88 AC_CHECK_FILE([$usual_suspect/libpq.$library_extension],
89 [postgres_lib_default=$usual_suspect],
92 if test -n "$postgres_lib_default" ; then
97 AC_ARG_WITH(postgres-lib,
98 --with-postgres-lib PostgreSQL library directory containing libpq
99 , test "$withval" = no || with_postgres_lib=$withval
100 , with_postgres_lib=$postgres_lib_default
103 # provide one way to specify both include and lib
104 AC_ARG_WITH(postgres,
105 --with-postgres PostgreSQL common directory. Use this to specify libs & includes rooted at one place
106 , test "$withval" = no || with_postgres=$withval
107 with_postgres_lib=${with_postgres}/lib
108 with_postgres_include=${with_postgres}/include
112 AC_SUBST(with_postgres_lib)
113 AC_SUBST(with_postgres_include)
114 POSTGRES_LIB="-L${with_postgres_lib} -R${with_postgres_lib} -lpq"
115 AC_SUBST(POSTGRES_LIB)
116 POSTGRES_INCLUDE="-I${with_postgres_include}"
117 AC_SUBST(POSTGRES_INCLUDE)
119 # Checks for libraries.
120 AC_CHECK_LIB([pq], [PQexec], [], [AC_MSG_ERROR([Failed to find a suitable libpq.
122 PostgreSQL's libpq needs to be installed.
123 Perhaps you need to specify --with-postgres-lib?
124 ])], -L${with_postgres_lib})
126 # Checks for header files.
128 AC_CHECK_HEADER([${with_postgres_include}/libpq-fe.h],,AC_MSG_ERROR(
129 [Can't find libpq-fe.h in ${with_postgres_include}.
130 Please specify the location of the PostgreSQL include files with
131 --with-postgres-include=... or --with-postgres=...]
134 AC_CHECK_HEADER([${with_postgres_include}/libpq/libpq-fs.h],,AC_MSG_ERROR(
135 [Can't find libpq-fs.h in ${with_postgres_include}/libpq.
136 Please locate it and report your findings so this script can be corrected.]
139 CXXFLAGS="$CXXFLAGS $POSTGRES_INCLUDE"
140 LIBS="$LIBS $POSTGRES_LIB"
143 # There is no convenient way to detect libpqxx, so we'll
144 # use fixed paths for the time being.
146 CXXFLAGS="$CXXFLAGS -I/usr/local/pqxx/include"
147 LIBS="$LIBS -L/usr/local/pqxx/lib -lpqxx"
149 dnl Checks for header files.
152 AC_CHECK_HEADERS(unistd.h)
154 dnl Checks for typedefs, structures, and compiler characteristics.
157 dnl Checks for library functions.
158 AC_CHECK_FUNCS(strtod strtol strtoul)
160 dnl Edit this to be your web server's document root
162 DocumentRoot=/var/www/html
164 #AC_OUTPUT(Makefile src/Makefile src/lib/Makefile src/gcm_input/Makefile src/web/Makefile)
165 AC_OUTPUT(Makefile src/Makefile src/lib/Makefile src/gcm_input/Makefile)