use autoconf to generate Makefile

pull/1/head
Heiko Hund 2009-01-07 12:51:01 +00:00
parent bed501165b
commit b2500ebf47
6 changed files with 219 additions and 44 deletions

View File

@ -1,44 +0,0 @@
# This makefile builds OpenVPN-GUI using the mingw environment.
OPENSSL = /c/OpenSSL
RES_LANG = en
GUI_VERSION = 1.0.3
EXE = openvpn-gui-$(GUI_VERSION)-$(RES_LANG).exe
HEADERS = main.h openvpn.h openvpn_monitor_process.h tray.h viewlog.h \
service.h options.h passphrase.h openvpn-gui-res.h proxy.h \
ieproxy.h registry.h openvpn_config.h chartable.h scripts.h
OBJS = main.o tray.o openvpn.o openvpn_monitor_process.o viewlog.o \
service.o options.o passphrase.o proxy.o ieproxy.o registry.o \
openvpn_config.o scripts.o openvpn-gui-$(RES_LANG).res
INCLUDE_DIRS = -I. -I${OPENSSL}/include
LIB_DIRS = -L${OPENSSL}/lib/MinGW
WARNS = -W -Wall -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast \
-Wcast-align -Wwrite-strings -Wconversion -Wsign-compare \
-Waggregate-return -Wmissing-noreturn -Wmissing-format-attribute \
-Wredundant-decls -Winline -Wdisabled-optimization \
-Wno-unused-function -Wno-unused-variable
CC = gcc
CFLAGS = -g -O2 ${WARNS} -mno-cygwin
LDFLAGS = -mwindows -s
#LDFLAGS = -mwindows
WINDRES = windres.exe
all : ${OBJS}
${CC} -o ${EXE} ${OBJS} ${LIB_DIRS} -leay32 -lWinInet ${LDFLAGS}
# ${CC} -o ${EXE} ${OBJS} ${LIB_DIRS} -lWinInet ${LDFLAGS}
clean :
rm -f *.o *.exe *.res
%.o : %.c ${HEADERS}
${CC} ${CFLAGS} ${INCLUDE_DIRS} -c $< -o $@
openvpn-gui-$(RES_LANG).res : openvpn-gui-$(RES_LANG).rc openvpn-gui-res.h
$(WINDRES) -i openvpn-gui-$(RES_LANG).rc -I rc -o openvpn-gui-$(RES_LANG).res -O coff

58
Makefile.in Normal file
View File

@ -0,0 +1,58 @@
GUI_VERSION = 1.0.3
RES_LANG = en
BASENAME = openvpn-gui-$(GUI_VERSION)-$(RES_LANG)
EXE = $(BASENAME).exe
CC = @CC@
WINDRES = @WINDRES@
ZIP = @ZIP@
CFLAGS = @CRYPTO_CPPFLAGS@ @CFLAGS@ @CPPFLAGS@
LDFLAGS = @CRYPTO_LDFLAGS@ @LDFLAGS@
LIBS = @CRYPTO_LIBS@ @LIBS@
CFLAGS += -W -Wall -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast \
-Wcast-align -Wwrite-strings -Wconversion -Wsign-compare \
-Waggregate-return -Wmissing-noreturn -Wmissing-format-attribute \
-Wredundant-decls -Winline -Wdisabled-optimization \
-Wno-unused-function -Wno-unused-variable
OBJS = main.o tray.o openvpn.o openvpn_monitor_process.o viewlog.o \
service.o options.o passphrase.o proxy.o ieproxy.o registry.o \
openvpn_config.o scripts.o
SOURCES = main.c main.h openvpn.c openvpn.h \
openvpn_monitor_process.c openvpn_monitor_process.h \
tray.c tray.h viewlog.c viewlog.h service.c service.h \
options.c options.h passphrase.c passphrase.h proxy.c proxy.h \
ieproxy.c ieproxy.h registry.c registry.h scripts.c scripts.h \
openvpn_config.c openvpn_config.h \
chartable.h openvpn-gui-res.h openvpn-gui-$(RES_LANG).rc
EXTRA = connected.ico connecting.ico disconnected.ico reconnecting.ico openvpn-gui.ico \
acinclude.m4 Makefile.in aclocal.m4 config.h.in configure configure.ac \
OpenVPN\ GUI\ ReadMe.txt changes.txt COPYING COPYRIGHT.GPL
all : ${OBJS} openvpn-gui-$(RES_LANG).res
${CC} $(CFLAGS) $(LDFLAGS) -o ${EXE} ${OBJS} ${LIBS}
%.o : %.c %.h
$(CC) $(CFLAGS) -c $<
openvpn-gui-$(RES_LANG).res : openvpn-gui-$(RES_LANG).rc openvpn-gui-res.h
$(WINDRES) -i openvpn-gui-$(RES_LANG).rc -I rc -o openvpn-gui-$(RES_LANG).res -O coff
dist:
@test -x "$(ZIP)" || { \
echo "zip(1) was not found on your system"; \
echo "please install and run configure again"; \
exit 1; \
}
rm -rf $(BASENAME)
mkdir $(BASENAME)
cp $(SOURCES) $(EXTRA) $(BASENAME)
$(ZIP) -qr $(BASENAME).zip $(BASENAME)
rm -rf $(BASENAME)
clean :
rm -f *.o *.exe *.res

86
acinclude.m4 Normal file
View File

@ -0,0 +1,86 @@
AC_DEFUN([AX_ASSERT_LIB], [
AC_CHECK_HEADER([$2], , [AC_MSG_FAILURE([$1 library headers could not be found.])])
AC_MSG_CHECKING([if $1 library is available])
LIBS="-l$1 $LIBS"
AC_TRY_LINK(
[#include <$2>], [$3], [AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no]); AC_MSG_FAILURE([$4])]
)
])
AC_DEFUN([AX_SEARCH_LIB], [
_ldflags="$LDFLAGS"
_cppflags="$CPPFLAGS"
_libs="$LIBS"
AC_ARG_WITH(m4_translit([$1], [_], [-]),
[AS_HELP_STRING([--with-]m4_translit([$1], [_], [-])[=DIR],
[search for $1 files in DIR/lib and DIR/include])],
[dnl
if test -d $withval
then
LDFLAGS="-L$withval/lib $_ldflags"
CPPFLAGS="-I$withval/include $_cppflags"
AC_SUBST(m4_translit([$1], [a-z-], [A-Z_])[_LDFLAGS], [-L$withval/lib])
AC_SUBST(m4_translit([$1], [a-z-], [A-Z_])[_CPPFLAGS], [-I$withval/include])
else
AC_MSG_ERROR([$withval: No such directory])
fi
]
)
AC_ARG_WITH(m4_translit([$1], [_], [-])[-lib],
[AS_HELP_STRING([--with-]m4_translit([$1], [_], [-])[-lib=DIR],
[search for $1 library in DIR])],
[dnl
if test -d $withval
then
LDFLAGS="-L$withval $_ldflags"
AC_SUBST(m4_translit([$1], [a-z-], [A-Z_])[_LDFLAGS], [-L$withval])
else
AC_MSG_ERROR([$withval: No such directory])
fi
]
)
AC_ARG_WITH(m4_translit([$1], [_], [-])[-includes],
[AS_HELP_STRING([--with-]m4_translit([$1], [_], [-])[-includes=DIR],
[search for $1 library header files in DIR])],
[dnl
if test -d $withval
then
CPPFLAGS="-I$withval $_cppflags"
AC_SUBST(m4_translit([$1], [a-z-], [A-Z_])[_CPPFLAGS], [-I$withval])
else
AC_MSG_ERROR([$withval: No such directory])
fi
]
)
AC_CHECK_HEADER([$4], , [AC_MSG_FAILURE([$1 library headers could not be found. You may want to specify a search path using `--with-]m4_translit([$1], [_], [-])[-includes'.])])
_result=no
for lib in $1 $2; do
AC_MSG_CHECKING([if $lib library is available])
LIBS="-l$lib $3 $_libs"
AC_TRY_LINK([#include <$4>], [$5], [
AC_SUBST(m4_translit([$1], [a-z-], [A-Z_])[_LIBS], [-l$lib])
AC_MSG_RESULT([yes])
_result=yes
break
], [AC_MSG_RESULT([no])])
done
if test "$_result" = "no"; then
AC_MSG_FAILURE([$1 library could not be found. You may want to specify a search path using `--with-]m4_translit([$1], [_], [-])[[[-lib]]'.])
fi
CPPFLAGS="$_cppflags"
LDFLAGS="$_ldflags"
LIBS="$_libs"
_result=
_cppflags=
_ldflags=
_libs=
])

2
bootstrap Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
autoreconf

46
config.h.in Normal file
View File

@ -0,0 +1,46 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS

27
configure.ac Normal file
View File

@ -0,0 +1,27 @@
AC_PREREQ([2.53])
AC_INIT([openvpn-gui], [1.0.3], [openvpn-devel@lists.sourceforge.net])
AC_CONFIG_SRCDIR([chartable.h])
AC_CONFIG_HEADERS([config.h])
AC_PROG_CC_C99
# Build Win32 native binaries
CFLAGS="$CFLAGS -mno-cygwin"
CPPFLAGS="$CPPFLAGS -mno-cygwin"
LDFLAGS="$LDFLAGS -mno-cygwin"
AC_PATH_PROG([WINDRES], [windres])
AC_PATH_PROG([ZIP], [zip])
AC_CHECK_HEADER([windows.h], ,
[AC_MSG_FAILURE([Target system must be Win32])])
AX_ASSERT_LIB([wininet], [wininet.h],
[DWORD s; InternetQueryOption(NULL, INTERNET_OPTION_PROXY, NULL, &s)],
[Make sure you have a recent w32api installed.])
AX_SEARCH_LIB([crypto], [cryptoeay32 eay32], [-lgdi32],
[openssl/pkcs12.h], [EVP_PKEY *k = EVP_PKEY_new()])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT